cache

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache allows us to keep state for repositories, rather than querying them every time.

Cache Structure: <cacheDir>/git/ * Caches bare git repositories in directories named based on the repository address. <cacheDir>/oci/ * Caches oci images with further hierarchy underneath * We Cache image layers in <cacheDir>/oci/layers/ (this might be obsolete with the flattened Cache) * We Cache flattened tar files in <cacheDir>/oci/ (so we don't need to pull to read resources) * We poll the repositories (every minute) and Cache the discovered images in memory.

func NewCache

func NewCache(cacheDir string, opts CacheOptions) *Cache

func (*Cache) CloseRepository

func (c *Cache) CloseRepository(repositorySpec *configapi.Repository) error

func (*Cache) ObjectCache added in v0.0.10

func (c *Cache) ObjectCache() ObjectCache

ObjectCache() is a cache of all our objects.

func (*Cache) OpenRepository

func (c *Cache) OpenRepository(ctx context.Context, repositorySpec *configapi.Repository) (*cachedRepository, error)

type CacheOptions

type CacheOptions struct {
	CredentialResolver repository.CredentialResolver
	UserInfoProvider   repository.UserInfoProvider
}

type ObjectCache added in v0.0.10

type ObjectCache interface {
	WatchPackageRevisions(ctx context.Context, filter repository.ListPackageRevisionFilter, callback ObjectWatcher) error
}

ObjectCache caches objects across repositories, and allows for watching.

type ObjectWatcher added in v0.0.10

type ObjectWatcher interface {
	OnPackageRevisionChange(eventType watch.EventType, obj repository.PackageRevision) bool
}

ObjectWatcher is the callback interface for watchers.

Jump to

Keyboard shortcuts

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