sources

package
v0.39.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 11 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) 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) 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) 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) error

func (*MemSource) URI

func (s *MemSource) URI() string

type Source

type Source interface {
	// Sync synchronises these sources from the possibly remote origin
	Sync(p *ui.UI, force 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) (*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) 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. A Sources set can only be synchronised once. Following calls will not have any effect.

Jump to

Keyboard shortcuts

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