MCPcopy Index your code
hub / github.com/linuxkit/linuxkit / CacheProvider

Interface CacheProvider

src/cmd/linuxkit/spec/cache.go:13–53  ·  view source on GitHub ↗

CacheProvider interface for a provide of a cache.

Source from the content-addressed store, hash-verified

11
12// CacheProvider interface for a provide of a cache.
13type CacheProvider interface {
14 // FindDescriptor find the descriptor pointed to by the reference in the cache.
15 // ref is a valid reference, such as docker.io/library/alpine:3.15 or alpine@sha256:4edbd2beb5f78b1014028f4fbb99f3237d9561100b6881aabbf5acce2c4f9454
16 // If both tag and digest are provided, will use digest exclusively.
17 // Will expand to full names, so "alpine" becomes "docker.io/library/alpine:latest".
18 // If none is found, returns nil Descriptor and no error.
19 FindDescriptor(ref *reference.Spec) (*v1.Descriptor, error)
20 // ImagePull takes an image name and pulls it from a registry to the cache. It should be
21 // efficient and only write missing blobs, based on their content hash. If the ref already
22 // exists in the cache, it should not pull anything, unless alwaysPull is set to true.
23 ImagePull(ref *reference.Spec, platform []imagespec.Platform, alwaysPull bool) error
24 // ImageInCache takes an image name and checks if it exists in the cache, including checking that the given
25 // architecture is complete. Like ImagePull, it should be efficient and only write missing blobs, based on
26 // their content hash.
27 ImageInCache(ref *reference.Spec, trustedRef, architecture string) (bool, error)
28 // ImageInRegistry takes an image name and checks if it exists in the registry.
29 ImageInRegistry(ref *reference.Spec, trustedRef, architecture string) (bool, error)
30 // IndexWrite takes an image name and creates an index for the descriptors to which it points.
31 // Cache implementation determines whether it should pull missing blobs from a remote registry.
32 // If the provided reference already exists and it is an index, updates the manifests in the
33 // existing index.
34 IndexWrite(ref *reference.Spec, descriptors ...v1.Descriptor) error
35 // ImageLoad takes an OCI format image tar stream in the io.Reader and writes it to the cache. It should be
36 // efficient and only write missing blobs, based on their content hash.
37 ImageLoad(r io.Reader) ([]v1.Descriptor, error)
38 // DescriptorWrite writes a descriptor to the cache index; it validates that it has a name
39 // and replaces any existing one
40 DescriptorWrite(image string, descriptors v1.Descriptor) error
41 // Push an image along with a multi-arch index from local cache to remote registry.
42 // name is the name as referenced in the local cache, remoteName is the name to give it remotely.
43 // If remoteName is empty, it is the same as name.
44 // if withManifest defined will push a multi-arch manifest
45 Push(name, remoteName string, withManifest, override bool) error
46 // NewSource return an ImageSource for a specific ref and architecture in the cache.
47 NewSource(ref *reference.Spec, platform *imagespec.Platform, descriptor *v1.Descriptor) ImageSource
48 // GetContent returns an io.Reader to the provided content as is, given a specific digest. It is
49 // up to the caller to validate it.
50 GetContent(hash v1.Hash) (io.ReadCloser, error)
51 // Store get content.Store referencing the cache
52 Store() (content.Store, error)
53}

Callers 17

BuildMethod · 0.65
BuildMethod · 0.65
buildArchMethod · 0.65
BuildMethod · 0.65
BuildMethod · 0.65
buildArchMethod · 0.65
BuildMethod · 0.65
BuildMethod · 0.65
BuildMethod · 0.65
buildArchMethod · 0.65
BuildMethod · 0.65
PushMethod · 0.65

Implementers 2

Providersrc/cmd/linuxkit/cache/provider.go
cacheMockersrc/cmd/linuxkit/pkglib/build_test.go

Calls

no outgoing calls

Tested by

no test coverage detected