Documentation
¶
Index ¶
Constants ¶
const ( ConnectTimeout = 10 * time.Second ReadTimeout = 10 * time.Second WriteTimeout = 10 * time.Second )
Constants for timeouts.
Variables ¶
var ( // ErrorLayerNotFound is the error returned by Lookup when the layer // requested was not found in the registry. ErrorLayerNotFound = errors.Errorf("layer not found in cache") )
Functions ¶
This section is empty.
Types ¶
type KVStore ¶
KVStore is the interface that the CacheManager relies on to make the mapping between cacheID and image name. The Get function returns an empty string and no error if the key was not found in the store. Cleanup closes potential connections to the store.
func NewFSStore ¶
NewFSStore returns a KVStore backed by the local filesystem. Each key stored will correspond to a file on disk and its value is the contents of that key.
func NewRedisStore ¶
NewRedisStore returns a new instance of KVStore backed by a redis server. In this constructor we try to open a connection to redis. If that attempt fails we return an error. If it succeeds we just close that connection.
type Manager ¶
type Manager interface { PullCache(cacheID string) (*image.DigestPair, error) PushCache(cacheID string, digestPair *image.DigestPair) error WaitForPush() error }
Manager is the interface through which we interact with the cacheID -> image layer mapping.
func New ¶
New returns a new cache manager that interacts with the registry passed in as well as the local filesystem through the image store. By default the registry field is left blank.
func NewNoopCacheManager ¶
func NewNoopCacheManager() Manager
NewNoopCacheManager returns a Manager that does nothing.
type MemKVStore ¶
MemKVStore implements the KVStore interface. It stores the key-value mappings in memory.
func (MemKVStore) Cleanup ¶
func (m MemKVStore) Cleanup() error
Cleanup does nothing, but is implemented to comply with the KVStore interface.
func (MemKVStore) Get ¶
func (m MemKVStore) Get(key string) (string, error)
Get returns the value of a key previously set in memory.
func (MemKVStore) Put ¶
func (m MemKVStore) Put(key, value string) error
Put stores a key and its value in memory.