layout

package
v0.0.0-...-bef4977 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

View Source
const ImageRefNameKey = "org.opencontainers.image.ref.name"

Variables

This section is empty.

Functions

func FromBaseImageInstance

func FromBaseImageInstance(image v1.Image) func(*imgutil.ImageOptions)

FromBaseImageInstance loads the provided image as the manifest, config, and layers for the working image. If the image is not found, it does nothing.

func FromBaseImagePath

func FromBaseImagePath(name string) func(*imgutil.ImageOptions)

FromBaseImagePath loads the image at the provided path as the manifest, config, and layers for the working image. If the image is not found, it does nothing.

func ImageRefAnnotation

func ImageRefAnnotation(imageRefName string) map[string]string

ImageRefAnnotation creates a map containing the key 'org.opencontainers.image.ref.name' with the provided value.

func ParseRefToPath

func ParseRefToPath(imageRef string) (string, error)

ParseRefToPath parse the given image reference to local path directory following the rules: An image reference refers to either a tag reference or digest reference.

  • A tag reference refers to an identifier of form <registry>/<repo>/<image>:<tag>
  • A digest reference refers to a content addressable identifier of form <registry>/<repo>/<image>@<algorithm>:<digest>

WHEN the image reference points to a tag reference returns <registry>/<repo>/<image>/<tag> WHEN the image reference points to a digest reference returns <registry>/<repo>/<image>/<algorithm>/<digest>

func WithConfig

func WithConfig(c *v1.Config) func(*imgutil.ImageOptions)

func WithCreatedAt

func WithCreatedAt(t time.Time) func(*imgutil.ImageOptions)

func WithDefaultPlatform

func WithDefaultPlatform(p imgutil.Platform) func(*imgutil.ImageOptions)

func WithHistory

func WithHistory() func(*imgutil.ImageOptions)

func WithMediaTypes

func WithMediaTypes(m imgutil.MediaTypes) func(*imgutil.ImageOptions)

func WithPreviousImage

func WithPreviousImage(name string) func(*imgutil.ImageOptions)

func WithoutLayersWhenSaved

func WithoutLayersWhenSaved() func(*imgutil.ImageOptions)

WithoutLayersWhenSaved (layout only) if provided will cause the image to be written without layers in the `blobs` directory.

Types

type AppendOption

type AppendOption func(*appendOptions)

func WithAnnotations

func WithAnnotations(annotations map[string]string) AppendOption

func WithoutLayers

func WithoutLayers() AppendOption

type Identifier

type Identifier struct {
	Digest string
	Path   string
}

func ParseIdentifier

func ParseIdentifier(identifier string) (Identifier, error)

ParseIdentifier parse the given identifier string into a layout.Identifier. WHEN image.Identifier() method is called, it returns the layout identifier with the format path@[digest] this method reconstruct a string reference in that format into a layout.Identifier

func (Identifier) String

func (i Identifier) String() string

type Image

type Image struct {
	*imgutil.CNBImageCore
	// contains filtered or unexported fields
}

func NewImage

func NewImage(path string, ops ...imgutil.ImageOption) (*Image, error)

func (*Image) Delete

func (i *Image) Delete() error

func (*Image) Found

func (i *Image) Found() bool

Found reports if image exists in the image store with `Name()`.

func (*Image) Identifier

func (i *Image) Identifier() (imgutil.Identifier, error)

Identifier Each image's ID is given by the SHA256 hash of its configuration JSON. It is represented as a hexadecimal encoding of 256 bits, e.g., sha256:a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9.

func (*Image) Kind

func (i *Image) Kind() string

func (*Image) Name

func (i *Image) Name() string

func (*Image) Rename

func (i *Image) Rename(name string)

func (*Image) Save

func (i *Image) Save(additionalNames ...string) error

func (*Image) SaveAs

func (i *Image) SaveAs(name string, additionalNames ...string) error

SaveAs ignores the image `Name()` method and saves the image according to name & additional names provided to this method

func (*Image) SaveFile

func (i *Image) SaveFile() (string, error)

func (*Image) Valid

func (i *Image) Valid() bool

type Path

type Path struct {
	ggcr.Path
}

func FromPath

func FromPath(path string) (Path, error)

func Write

func Write(path string, ii v1.ImageIndex) (Path, error)

func (Path) AppendImage

func (l Path) AppendImage(img v1.Image, ops ...AppendOption) error

AppendImage mimics GGCR's AppendImage in that it appends an image to a `layout.Path`, but the image appended does not include any layers in the `blobs` directory. The returned image will return layers when Layers(), LayerByDiffID(), or LayerByDigest() are called, but the returned layer will error when DiffID(), Compressed(), or Uncompressed() are called. This is useful when we need to satisfy the v1.Image interface but do not need to access any layers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL