source

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectContentType

func DetectContentType(path string) string

DetectContentType makes a best-effort guess based on file extension.

Types

type Config

type Config struct {
	Kind       Kind              `json:"kind"`
	Filesystem *FilesystemConfig `json:"filesystem,omitempty"`
	GitHub     *GitHubConfig     `json:"github,omitempty"`
	HTTP       *HTTPConfig       `json:"http,omitempty"`
}

Config is the persisted, source-kind-specific configuration for a Resource.

type FetchRequest

type FetchRequest struct {
	Config Config
	// PinnedRevision, when set, asks the Fetcher to re-fetch a specific
	// historical revision rather than the current one. Unused in v0.1.
	PinnedRevision string
}

type FetchResult

type FetchResult struct {
	Content        []byte
	ContentType    string
	SourceRevision string
	Metadata       map[string]string
}

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context, req FetchRequest) (FetchResult, error)
}

Fetcher is the common abstraction every source adapter implements.

type FilesystemConfig

type FilesystemConfig struct {
	Path string `json:"path"`
}

type GitHubConfig

type GitHubConfig struct {
	Owner string `json:"owner"`
	Repo  string `json:"repo"`
	Path  string `json:"path"`
	Ref   string `json:"ref"`
}

type HTTPConfig

type HTTPConfig struct {
	URL     string            `json:"url"`
	Headers map[string]string `json:"headers,omitempty"`
}

type Kind

type Kind string

Kind identifies the type of physical origin a Resource is backed by.

const (
	KindFilesystem Kind = "filesystem"
	KindGitHub     Kind = "github"
	KindHTTP       Kind = "http"
)

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry dispatches a FetchRequest to the Fetcher registered for its Kind.

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Fetch

func (r *Registry) Fetch(ctx context.Context, req FetchRequest) (FetchResult, error)

func (*Registry) Register

func (r *Registry) Register(k Kind, f Fetcher)

Directories

Path Synopsis
Package http fetches content from a generic HTTP(S) endpoint.
Package http fetches content from a generic HTTP(S) endpoint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL