...

Package layout

import "edge-infra.dev/pkg/f8n/warehouse/oci/layout"
Overview
Index

Overview ▾

Package layout defines utilities for working with a Pallet OCI Image Layout.

All artifacts written to the layout must have a name annotation representing the tag for that artifact, e.g., "shoot:latest".

func RefMatcher

func RefMatcher(ref name.Reference) match.Matcher

RefMatcher returns a matcher for looking up the OCI v1 annotation used to look up tagged artifacts

type Path

Path represents an OCI Image Layout on disk. It is used for storing and accessing packages locally.

type Path struct {
    layout.Path
}

func Clear

func Clear(path string) (*Path, error)

func FromFS

func FromFS(fsys fs.FS, dst string) (*Path, error)

FromFS reads an Image Layout from the root of fsys. If a layout exists at another location in the file system, fs.Sub can be used to create an appropriate FS:

f, err := fs.Sub(embeddedFSVar, "layout/root")
if err != nil { return err }
p, err := layout.FromFS(f)

func New

func New(path string) (*Path, error)

New creates a new Path at the specified filepath. If an Image Layout doesn't already exist at that path, a new one is created.

func (*Path) Append

func (p *Path) Append(ref name.Reference, a oci.Artifact) error

Append adds the artifact to the image layout with correct warehouse annotations for fetching based on the name and tag.

func (*Path) Get

func (p *Path) Get(ref name.Reference) (oci.Artifact, error)

Get retrieves an OCI artifact from the layout for the ref, based on what kind of ref it is. If the ref is a name.Tag, it is looked up using the OCI reference annotation defined in the OCI Image spec. If it is a name.Digest, the digest is searched for directly.

func (*Path) Prune

func (p *Path) Prune() ([]string, error)

func (*Path) Sort

func (p *Path) Sort() error

Sort improves the reproducibility of the layout's IndexManifest (index.json) by sorting the descriptors by digest. The initial index is read in as a GGCR v1.IndexManifest. Its descriptors are then sorted by digest. The modified index is written back to the same location.