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) GetContent(hash v1.Hash) (io.ReadCloser, 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(r io.Reader) ([]v1.Descriptor, 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) Pull(name string, withArchReferences bool) error
- func (p *Provider) Push(name, remoteName string, withArchSpecificTags, override 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) SBoMs ¶
func (c ImageSource) SBoMs() ([]io.ReadCloser, error)
SBoM return the sbom for 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) GetContent ¶
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 ¶
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. Returns any descriptors that are in the tar stream's index.json as manifests. Does not try to resolve lower levels. Most such tar streams will have a single manifest in the index.json's manifests list, but it is possible to have more.
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. 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. However, do note that it *always* reaches out to the remote registry to check the content. If you just want to check the status of a local ref, use ValidateImage. Note that ImagePull does try ValidateImage first, so if the image is already in the cache, it will not do any network activity at all.
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) Pull ¶
Pull pull a reference, whether it points to an arch-specific image or to an index. If an index, optionally, try to pull its individual named references as well.
func (*Provider) Push ¶
Push push an image along with a multi-arch index. name is the name as referenced in the local cache, remoteName is the name to give it remotely. If remoteName is empty, it is the same as name. If withArchSpecificTags is true, it will push all arch-specific images in the index, each as their own tag with the same name as the index, but with the architecture appended, e.g. image:foo will have image:foo-amd64, image:foo-arm64, etc.
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, it will *not* pull down missing content. This function is network-free. If you wish to validate and fill in missing content, use PullImage. If the reference is to an index, it will check the index for a manifest for the given architecture, and any manifests that have no architecture at all. It will ignore manifests for other architectures. If no architecture is provided, it will validate all manifests. It also calculates the hash of each component.