depot

package
v0.0.0-...-66c7a0d Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ConservativeGC = "conservative"
	AggressiveGC   = "aggressive"
	DisabledGC     = "disabled"
)

Variables

This section is empty.

Functions

func IsErrNotFound

func IsErrNotFound(e error) bool

Types

type Client

type Client interface {
	// TDepsForPackage fetches all the dependencies for the given package
	// If the given package is A, and A -> B -> C, this function will return
	// B and C
	TDepsForPackage(habpkg.VersionedPackage) ([]habpkg.HabPkg, error)
	// DownloadPackage downloads the hartifact for the given package
	DownloadPackage(habpkg.VersionedPackage, io.Writer) (*HartHeader, error)
	// DownloadOriginKey downloads the public origin key
	DownloadOriginKey(OriginKeyName, io.Writer) error
}

Client can fetch things from the hab depot

func NewClient

func NewClient(opts ...ClientOpt) Client

NewClient returns a client that can talk to the depot

type ClientOpt

type ClientOpt func(c *client)

ClientOpt are functional client options

type GarbageCollector

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

func NewGarbageCollector

func NewGarbageCollector(cache HabCache) *GarbageCollector

func (*GarbageCollector) AggressiveCollect

func (gc *GarbageCollector) AggressiveCollect(roots []habpkg.HabPkg) error

AggressiveCollect deletes all habitat packages except those that are listed in the roots list or are transitive dependencies of those packages. This can result in deletion of packages that have been intentionally installed by the user, as there is no way to differentiate packages installed by the deployment service but are no longer used from those installed by the user.

func (*GarbageCollector) Collect

func (gc *GarbageCollector) Collect(roots []habpkg.HabPkg, cleanupMode string) error

func (*GarbageCollector) ConservativeCollect

func (gc *GarbageCollector) ConservativeCollect(rootPackages []habpkg.HabPkg) error

ConservativeCollect deletes old versions of the rootPackages. Transitive dependencies and packages not managed by deployment service are not deleted. This is a safe compromise that will not delete any packages installed by the user, at the cost of leaving multiple versions of Automate's transitive dependencies on-disk. Automate packages update much more frequently than dependencies so this should give most of the benefits of package cleanup.

type HabCache

type HabCache interface {
	TDepsForPackage(habpkg.VersionedPackage) ([]habpkg.HabPkg, error)
	ListAllPackages() ([]habpkg.HabPkg, error)
	Delete(habpkg.HabPkg) error
}

TODO(jaym): I'm not sure what to call this thing

type HartHeader

type HartHeader struct {
	FormatVersion string
	KeyName       OriginKeyName
}

HartHeader is the header of the hart

type LocalCache

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

func FromLocalCache

func FromLocalCache(opts ...LocalCacheOpt) *LocalCache

func (*LocalCache) Delete

func (local *LocalCache) Delete(pkg habpkg.HabPkg) error

func (*LocalCache) DownloadOriginKey

func (local *LocalCache) DownloadOriginKey(keyName OriginKeyName, w io.Writer) error

DownloadOriginKey downloads the public origin key

func (*LocalCache) DownloadPackage

func (local *LocalCache) DownloadPackage(pkg habpkg.VersionedPackage, w io.Writer) (*HartHeader, error)

DownloadPackage downloads the hartifact for the given package

func (*LocalCache) ListAllPackages

func (local *LocalCache) ListAllPackages() ([]habpkg.HabPkg, error)

ListAllPackages lists all locally installed habitat packages

func (*LocalCache) TDepsForPackage

func (local *LocalCache) TDepsForPackage(pkg habpkg.VersionedPackage) ([]habpkg.HabPkg, error)

type LocalCacheOpt

type LocalCacheOpt func(*LocalCache)

func WithLocalHabRoot

func WithLocalHabRoot(root string) LocalCacheOpt

type OriginKeyName

type OriginKeyName string

OriginKeyName is the key name, for example core-20180119235000

Jump to

Keyboard shortcuts

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