Documentation ¶
Index ¶
- Constants
- func IsErrNotFound(e error) bool
- type Client
- type ClientOpt
- type GarbageCollector
- type HabCache
- type HartHeader
- type LocalCache
- func (local *LocalCache) Delete(pkg habpkg.HabPkg) error
- func (local *LocalCache) DownloadOriginKey(keyName OriginKeyName, w io.Writer) error
- func (local *LocalCache) DownloadPackage(pkg habpkg.VersionedPackage, w io.Writer) (*HartHeader, error)
- func (local *LocalCache) ListAllPackages() ([]habpkg.HabPkg, error)
- func (local *LocalCache) TDepsForPackage(pkg habpkg.VersionedPackage) ([]habpkg.HabPkg, error)
- type LocalCacheOpt
- type OriginKeyName
Constants ¶
const ( ConservativeGC = "conservative" AggressiveGC = "aggressive" DisabledGC = "disabled" )
Variables ¶
This section is empty.
Functions ¶
func IsErrNotFound ¶
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
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) 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