Documentation ¶
Overview ¶
This package implements an image metadata cache given a backing k-v store.
The interface `Client` stands in for the k-v store (e.g., memcached, in the subpackage); `Cache` implements registry.Registry given a `Client`.
The `Warmer` is for continually refreshing the cache by fetching new metadata from the original image registries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotCached = &fluxerr.Error{ Type: fluxerr.Missing, Err: errors.New("item not in cache"), Help: `Image not yet cached It takes time to initially cache all the images. Please wait. If you have waited for a long time, check the Flux logs. Potential reasons for the error are: no internet, no cache, error with the remote repository. `, } )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
Cache is a local cache of image metadata.
func (*Cache) GetImageRepositoryMetadata ¶
GetImageRepositoryMetadata returns the metadata from an image repository (e.g,. at "docker.io/fluxcd/flux")
type Client ¶
func InstrumentClient ¶
type Decorator ¶
type Decorator interface {
// contains filtered or unexported methods
}
Decorator is for decorating an ImageRepository before it is returned.
type ImageRepository ¶
type ImageRepository struct { image.RepositoryMetadata LastError string LastUpdate time.Time }
ImageRepository holds the last good information on an image repository.
Whenever we successfully fetch a set (partial or full) of image metadata, `LastUpdate`, `Tags` and `Images` shall each be assigned a value, and `LastError` will be cleared.
If we cannot for any reason obtain the set of image metadata, `LastError` shall be assigned a value, and the other fields left alone.
It's possible to have all fields populated: this means at some point it was successfully fetched, but since then, there's been an error. It's then up to the caller to decide what to do with the value (show the images, but also indicate there's a problem, for example).
type Keyer ¶
type Keyer interface {
Key() string
}
An interface to provide the key under which to store the data Use the full path to image for the memcache key because there might be duplicates from other registries
func NewManifestKey ¶
func NewManifestKey(image image.CanonicalRef) Keyer
func NewRepositoryKey ¶
func NewRepositoryKey(repo image.CanonicalName) Keyer
type StringSet ¶
type StringSet map[string]struct{}
StringSet is a set of strings.
func NewStringSet ¶
NewStringSet returns a StringSet containing exactly the strings given as arguments.
type TimestampLabelWhitelist ¶
type TimestampLabelWhitelist []string
TimestampLabelWhitelist contains a string slice of glob patterns. Any canonical image reference that matches one of the glob patterns will prefer creation timestamps from labels over the one it received from the registry.
type Warmer ¶
type Warmer struct { Trace bool Priority chan image.Name Notify func() // contains filtered or unexported fields }
Warmer refreshes the information kept in the cache from remote registries.