sources

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const SyncFrequency = time.Hour * 24

SyncFrequency determines how frequently sources will be synced.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuiltInSource

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

BuiltInSource is a source for built in packages

func NewBuiltInSource

func NewBuiltInSource(dir fs.FS) *BuiltInSource

NewBuiltInSource returns a new MemSource

func (*BuiltInSource) Bundle

func (s *BuiltInSource) Bundle() fs.FS

func (*BuiltInSource) Sync

func (s *BuiltInSource) Sync(_ *ui.UI, _ bool) (bool, error)

func (*BuiltInSource) URI

func (s *BuiltInSource) URI() string

type GitSource

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

GitSource is a new Source based on a git repo

func NewGitSource

func NewGitSource(uri, sourceDir string, runner util.CommandRunner) *GitSource

NewGitSource returns a new GitSource

func (*GitSource) Bundle

func (s *GitSource) Bundle() fs.FS

func (*GitSource) Sync

func (s *GitSource) Sync(p *ui.UI, force bool) (bool, error)

func (*GitSource) URI

func (s *GitSource) URI() string

type LocalSource

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

LocalSource is a new Source based on a local filesystem

func NewLocalSource

func NewLocalSource(uri string, f fs.FS) *LocalSource

NewLocalSource returns a new LocalSource

func (*LocalSource) Bundle

func (s *LocalSource) Bundle() fs.FS

func (*LocalSource) Sync

func (s *LocalSource) Sync(_ *ui.UI, _ bool) (bool, error)

func (*LocalSource) URI

func (s *LocalSource) URI() string

type MemSource

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

MemSource is a new Source based on a name and content kept in memory

func NewMemSource

func NewMemSource(name, content string) *MemSource

NewMemSource returns a new MemSource

func (*MemSource) Bundle

func (s *MemSource) Bundle() fs.FS

func (*MemSource) Sync

func (s *MemSource) Sync(_ *ui.UI, _ bool) (bool, error)

func (*MemSource) URI

func (s *MemSource) URI() string

type Source

type Source interface {
	// Sync synchronises these sources from the possibly remote origin.
	// Returns true if the source was actually updated.
	Sync(p *ui.UI, force bool) (bool, error)
	// URI returns a URI for the source
	URI() string
	// Bundle returns a fs.FS for the manifests from this source
	Bundle() fs.FS
}

Source is a single source for manifest files

type Sources

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

Sources knows how to sync manifests from various sources such as git repositories.

func ForURIs

func ForURIs(b *ui.UI, dir, env string, uris []string, rewriters ...URLRewriter) (*Sources, error)

ForURIs returns Source instances for given uri strings

func New

func New(stateDir string, sources []Source) *Sources

New returns a new set of sources

func (*Sources) Add

func (s *Sources) Add(source Source)

Add a new source

func (*Sources) Bundles

func (s *Sources) Bundles() []fs.FS

Bundles returns all the package manifests bundles

func (*Sources) LocalDirs added in v0.45.0

func (s *Sources) LocalDirs() []string

func (*Sources) Prepend

func (s *Sources) Prepend(source Source)

Prepend a new source

func (*Sources) Sources

func (s *Sources) Sources() []string

Sources returns the source URIs

func (*Sources) Sync

func (s *Sources) Sync(p *ui.UI, force bool) error

Sync synchronises manifests from remote repos. Will be synced at most every SyncFrequency unless "force" is true. Sources will only be synchronised once per invocation. Following calls will not have any effect.

type URLRewriter added in v0.44.4

type URLRewriter func(uri string) (string, error)

URLRewriter is a function that can transform a source URI

Jump to

Keyboard shortcuts

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