cache

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event any

Event contains change information about the cache.

type Local

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

Local stores and retrieves xpkg.ParsedPackages in a filesystem-backed cache in a thread-safe manner.

func NewLocal

func NewLocal(root string, opts ...Option) (*Local, error)

NewLocal creates a new LocalCache.

func (*Local) Clean

func (c *Local) Clean() error

Clean removes all entries from the cache. Returns nil if the directory DNE.

func (*Local) Close

func (c *Local) Close()

Close closes the subscription channels for the cache.

func (*Local) Get

Get retrieves an image from the LocalCache.

func (*Local) Store

func (c *Local) Store(k v1beta1.Dependency, v *xpkg.ParsedPackage) error

Store saves an image to the LocalCache. If a file currently exists at that location, we overwrite the current file.

func (*Local) Versions

func (c *Local) Versions(k v1beta1.Dependency) ([]string, error)

Versions returns a slice of versions that exist in the cache for the given package.

func (*Local) Watch

func (c *Local) Watch() <-chan Event

Watch returns a channel that can be used to subscribe to events from the cache.

type Option

type Option func(*Local)

Option represents an option that can be applied to Local.

func WithFS

func WithFS(fs afero.Fs) Option

WithFS defines the filesystem that is configured for Local.

func WithLogger

func WithLogger(logger logging.Logger) Option

WithLogger defines the logger that is configured for Local.

func WithWatchInterval

func WithWatchInterval(i *time.Duration) Option

WithWatchInterval overrides the default watchInterval for Local.

type XpkgMarshaler

type XpkgMarshaler interface {
	FromDir(afero.Fs, string) (*xpkg.ParsedPackage, error)
}

XpkgMarshaler defines the API contract for working marshaling xpkg.ParsedPackage's from a directory.

Jump to

Keyboard shortcuts

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