Documentation ¶
Index ¶
- func Get(cache string) (layout.Path, error)
- func ListImages(dir string) (map[string]string, error)
- type ImageSource
- type Provider
- func (p *Provider) DescriptorWrite(ref *reference.Spec, desc v1.Descriptor) (lktspec.ImageSource, error)
- func (p *Provider) FindDescriptor(ref *reference.Spec) (*v1.Descriptor, error)
- func (p *Provider) FindRoot(imageName string) (ResolvableDescriptor, error)
- func (p *Provider) ImageInCache(ref *reference.Spec, trustedRef, architecture string) (bool, error)
- func (p *Provider) ImageInRegistry(ref *reference.Spec, trustedRef, architecture string) (bool, error)
- func (p *Provider) ImageLoad(ref *reference.Spec, architecture string, r io.Reader) (lktspec.ImageSource, error)
- func (p *Provider) ImagePull(ref *reference.Spec, trustedRef, architecture string, alwaysPull bool) (lktspec.ImageSource, error)
- func (p *Provider) IndexWrite(ref *reference.Spec, descriptors ...v1.Descriptor) (lktspec.ImageSource, error)
- func (p *Provider) List() (map[string]string, error)
- func (p *Provider) NewSource(ref *reference.Spec, architecture string, descriptor *v1.Descriptor) lktspec.ImageSource
- func (p *Provider) Push(name string, withManifest bool) error
- func (p *Provider) Remove(name string) error
- func (p *Provider) Store() (content.Store, error)
- func (p *Provider) ValidateImage(ref *reference.Spec, architecture string) (lktspec.ImageSource, error)
- type ResolvableDescriptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ImageSource ¶
type ImageSource struct {
// contains filtered or unexported fields
}
ImageSource a source for an image in the OCI distribution cache. Implements a spec.ImageSource.
func (ImageSource) Config ¶
func (c ImageSource) Config() (imagespec.ImageConfig, error)
Config return the imagespec.ImageConfig for the given source. Resolves to the architecture, if necessary.
func (ImageSource) Descriptor ¶
func (c ImageSource) Descriptor() *v1.Descriptor
Descriptor return the descriptor of the image.
func (ImageSource) TarReader ¶
func (c ImageSource) TarReader() (io.ReadCloser, error)
TarReader return an io.ReadCloser to read the filesystem contents of the image, as resolved to the provided architecture.
func (ImageSource) V1TarReader ¶
func (c ImageSource) V1TarReader(overrideName string) (io.ReadCloser, error)
V1TarReader return an io.ReadCloser to read the image as a v1 tarball
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider cache implementation of cacheProvider
func NewProvider ¶
NewProvider create a new CacheProvider based in the provided directory
func (*Provider) DescriptorWrite ¶
func (p *Provider) DescriptorWrite(ref *reference.Spec, desc v1.Descriptor) (lktspec.ImageSource, error)
DescriptorWrite writes a descriptor to the cache index; it validates that it has a name and replaces any existing one
func (*Provider) FindDescriptor ¶
FindDescriptor get the first descriptor pointed to by the image reference, whether tagged or digested
func (*Provider) FindRoot ¶
func (p *Provider) FindRoot(imageName string) (ResolvableDescriptor, error)
FindRoot find the root ResolvableDescriptor, representing an Image or Index, for a given imageName.
func (*Provider) ImageInCache ¶
func (*Provider) ImageInRegistry ¶
func (p *Provider) ImageInRegistry(ref *reference.Spec, trustedRef, architecture string) (bool, error)
ImageInRegistry takes an image name and checks that the image manifest or index to which it refers exists in the registry.
func (*Provider) ImageLoad ¶
func (p *Provider) ImageLoad(ref *reference.Spec, architecture string, r io.Reader) (lktspec.ImageSource, error)
ImageLoad takes an OCI format image tar stream and writes it locally. It should be efficient and only write missing blobs, based on their content hash.
func (*Provider) ImagePull ¶
func (p *Provider) ImagePull(ref *reference.Spec, trustedRef, architecture string, alwaysPull bool) (lktspec.ImageSource, error)
ImagePull takes an image name and ensures that the image manifest or index to which it refers exists in local cache and, if not, pulls it from the registry and writes it locally. It should be efficient and only write missing blobs, based on their content hash. It will only pull the actual blobs, config and manifest for the requested architectures, even if ref points to an index with multiple architectures. If the ref and all of the content for the requested architectures already exist in the cache, it will not pull anything, unless alwaysPull is set to true. If you call it multiple times, even with different architectures, the ref will continue to point to the same index. Only the underlying content will be added.
func (*Provider) IndexWrite ¶
func (p *Provider) IndexWrite(ref *reference.Spec, descriptors ...v1.Descriptor) (lktspec.ImageSource, error)
IndexWrite takes an image name and creates an index for the targets to which it points. does not pull down any images; entirely assumes that the subjects of the manifests are present. If a reference to the provided already exists and it is an index, updates the manifests in the existing index.
func (*Provider) NewSource ¶
func (p *Provider) NewSource(ref *reference.Spec, architecture string, descriptor *v1.Descriptor) lktspec.ImageSource
NewSource return an ImageSource for a specific ref and architecture in the given cache directory.
func (*Provider) Remove ¶
Remove removes all references pointed to by the provided reference, whether it is an image or an index. If it is not found, it is a no-op. This should be viewed as "Ensure this reference is not in the cache", rather than "Remove this reference from the cache".
func (*Provider) ValidateImage ¶
func (p *Provider) ValidateImage(ref *reference.Spec, architecture string) (lktspec.ImageSource, error)
ValidateImage given a reference, validate that it is complete. If not, pull down missing components as necessary. It also calculates the hash of each component.