archive

package
v0.0.0-...-45beecc Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package archive provides a Docker and OCI compatible importer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRefPrefix

func AddRefPrefix(image string) func(string) string

AddRefPrefix prepends the given image prefix to tag-only references, while leaving returning full references unmodified.

func DigestTranslator

func DigestTranslator(prefix string) func(digest.Digest) string

DigestTranslator creates a digest reference by adding the digest to an image name

func Export

func Export(ctx context.Context, store content.Provider, writer io.Writer, opts ...ExportOpt) error

Export implements Exporter.

func FilterRefPrefix

func FilterRefPrefix(image string) func(string) string

FilterRefPrefix restricts references to having the given image prefix. Tag-only references will have the prefix prepended.

func ImportIndex

func ImportIndex(ctx context.Context, store content.Store, reader io.Reader, opts ...ImportOpt) (ocispec.Descriptor, error)

ImportIndex imports an index from a tar archive image bundle

  • implements Docker v1.1, v1.2 and OCI v1.
  • prefers OCI v1 when provided
  • creates OCI index for Docker formats
  • normalizes Docker references and adds as OCI ref name e.g. alpine:latest -> docker.io/library/alpine:latest
  • existing OCI reference names are untouched

Types

type BlobFilter

type BlobFilter func(ocispec.Descriptor) bool

BlobFilter returns false if the blob should not be included in the archive.

type ExportOpt

type ExportOpt func(context.Context, *exportOptions) error

ExportOpt defines options for configuring exported descriptors

func WithAllPlatforms

func WithAllPlatforms() ExportOpt

WithAllPlatforms exports all manifests from a manifest list. Missing content will fail the export.

func WithBlobFilter

func WithBlobFilter(f BlobFilter) ExportOpt

WithBlobFilter specifies BlobFilter.

func WithImage

func WithImage(is images.Store, name string) ExportOpt

WithImage adds the provided images to the exported archive.

func WithManifest

func WithManifest(manifest ocispec.Descriptor, names ...string) ExportOpt

WithManifest adds a manifest to the exported archive. When names are given they will be set on the manifest in the exported archive, creating an index record for each name. When no names are provided, it is up to caller to put name annotation to on the manifest descriptor if needed.

func WithPlatform

func WithPlatform(p platforms.MatchComparer) ExportOpt

WithPlatform defines the platform to require manifest lists have not exporting all platforms. Additionally, platform is used to resolve image configs for Docker v1.1, v1.2 format compatibility.

func WithSkipDockerManifest

func WithSkipDockerManifest() ExportOpt

WithSkipDockerManifest skips creation of the Docker compatible manifest.json file.

func WithSkipNonDistributableBlobs

func WithSkipNonDistributableBlobs() ExportOpt

WithSkipNonDistributableBlobs excludes non-distributable blobs such as Windows base layers.

type ImportOpt

type ImportOpt func(*importOpts) error

ImportOpt is an option for importing an OCI index

func WithImportCompression

func WithImportCompression() ImportOpt

WithImportCompression compresses uncompressed layers on import. This is used for import formats which do not include the manifest.

Jump to

Keyboard shortcuts

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