oci

package
v0.0.99 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConvertImagesToEstargz = false
View Source
var File_internal_artifacts_oci_types_proto protoreflect.FileDescriptor
View Source
var MergeOptimizer func(images []NamedImage) compute.Computable[Image]
View Source
var (
	UsePercentageInTracking = false
)

Functions

func CacheLayer

func CacheLayer(ctx context.Context, c cache.Cache, layer v1.Layer) (schema.Digest, error)

func ComputeLayerCacheData

func ComputeLayerCacheData(layer v1.Layer) ([]byte, schema.Digest, error)

func ImageP

func ImageP(ref string, platform *specs.Platform, opts ResolveOpts) compute.Computable[Image]

Returns a Computable which constraints on platform if one is specified.

func LoadCachedLayer

func LoadCachedLayer(ctx context.Context, c cache.Cache, h schema.Digest) (v1.Layer, schema.Digest, error)

func MakeImageIndex

func MakeImageIndex(images ...ImageWithPlatform) compute.Computable[ResolvableImage]

func MergeImageLayers

func MergeImageLayers(images ...NamedImage) compute.Computable[Image]

func ParseRef

func ParseRef(imageRef string, insecure bool) (name.Reference, error)

func ParseRefAndKeychain

func ParseRefAndKeychain(ctx context.Context, imageRef string, opts ResolveOpts) (name.Reference, []remote.Option, error)

func ParseTag

func ParseTag(tag TargetRepository, digest v1.Hash) (name.Tag, error)

func Prebuilt added in v0.0.94

func Prebuilt(imgid ImageID, opts ResolveOpts) compute.Computable[ResolvableImage]

func ReadFileFromImage

func ReadFileFromImage(ctx context.Context, img v1.Image, path string) ([]byte, error)

func ReadFiles

func ReadFiles(image NamedImage, paths ...string) compute.Computable[fs.FS]

func ReadFilesFromImage

func ReadFilesFromImage(img v1.Image, paths ...string) (*memfs.FS, error)

func RegisterDomainKeychain

func RegisterDomainKeychain(suffix string, keychain Keychain, purpose KeychainWhen)

func RegisterImageCacheable

func RegisterImageCacheable()

func VisitFilesFromImage

func VisitFilesFromImage(img v1.Image, visitor func(layer, path string, typ byte, contents []byte) error) error

func WriteRemoteOptsWithAuth

func WriteRemoteOptsWithAuth(ctx context.Context, keychain Keychain) []remote.Option

Types

type AllocatedRepository

type AllocatedRepository struct {
	Parent interface{}
	TargetRepository
}

func (AllocatedRepository) ComputeDigest

func (t AllocatedRepository) ComputeDigest(context.Context) (schema.Digest, error)

type HasToLayer

type HasToLayer interface {
	AsLayer() (v1.Layer, error)
}

type Image

type Image v1.Image

func Canonical

func Canonical(ctx context.Context, original Image) (Image, error)

func IngestFromFS

func IngestFromFS(ctx context.Context, fsys fs.FS, path string, compressed bool) (Image, error)

func WithCanonicalManifest

func WithCanonicalManifest(ctx context.Context, img Image) (Image, error)

type ImageID

type ImageID struct {
	Repository string `json:"repository"`
	Tag        string `json:"tag"`
	Digest     string `json:"digest"`
}

func ParseImageID

func ParseImageID(ref string) (ImageID, error)

func (ImageID) ComputeDigest

func (i ImageID) ComputeDigest(ctx context.Context) (schema.Digest, error)

func (ImageID) ImageRef

func (i ImageID) ImageRef() string

func (ImageID) RepoAndDigest

func (i ImageID) RepoAndDigest() string

func (ImageID) String

func (i ImageID) String() string

func (ImageID) WithDigest

func (i ImageID) WithDigest(d fmt.Stringer) ImageID

type ImageIndex

type ImageIndex v1.ImageIndex

type ImageSource added in v0.0.89

type ImageSource interface {
	GetSourceLabel() string
	GetSourcePackageRef() *schema.PackageRef
}

type ImageWithPlatform

type ImageWithPlatform struct {
	Image    NamedImage
	Platform specs.Platform
}

type Keychain

type Keychain interface {
	Resolve(context.Context, authn.Resource) (authn.Authenticator, error)
}

type KeychainWhen

type KeychainWhen int
const (
	Keychain_UseAlways KeychainWhen = iota
	Keychain_UseOnWrites
)

type Layer

type Layer v1.Layer

func LayerFromFS

func LayerFromFS(ctx context.Context, vfs fs.FS) (Layer, error)

type NamedImage

type NamedImage interface {
	ResourceDescription[Image]
	Image() compute.Computable[Image]
}

func LocalCopy

func LocalCopy(input NamedImage) NamedImage

func MakeImage

func MakeImage(description string, base NamedImage, layers ...NamedLayer) NamedImage

func MakeImageFromScratch

func MakeImageFromScratch(description string, layers ...NamedLayer) NamedImage

func MakeNamedImage

func MakeNamedImage(description string, image compute.Computable[Image]) NamedImage

func ResolveImage

func ResolveImage(ref string, platform specs.Platform) NamedImage

func Scratch

func Scratch() NamedImage

type NamedImageID

type NamedImageID interface {
	ResourceDescription[ImageID]
	ImageID() compute.Computable[ImageID]
}

func MakeNamedImageID

func MakeNamedImageID(description string, imageID compute.Computable[ImageID]) NamedImageID

func ResolveDigest

func ResolveDigest(ref string, opts ResolveOpts) NamedImageID

Resolves the image tag into a digest. If one is already specified, this is a no-op.

type NamedLayer

type NamedLayer interface {
	ResourceDescription[Layer]
	Layer() compute.Computable[Layer]
}

func LayerFromFile

func LayerFromFile(description string, vfs fs.FS, path string) NamedLayer

func MakeLayer

func MakeLayer(name string, vfs compute.Computable[fs.FS]) NamedLayer

func MakeNamedLayer

func MakeNamedLayer(description string, layer compute.Computable[Layer]) NamedLayer

type RawDescriptor

type RawDescriptor struct {
	Repository  string `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"`
	MediaType   string `protobuf:"bytes,2,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"`
	RawManifest []byte `protobuf:"bytes,3,opt,name=raw_manifest,json=rawManifest,proto3" json:"raw_manifest,omitempty"`
	RawConfig   []byte `protobuf:"bytes,4,opt,name=raw_config,json=rawConfig,proto3" json:"raw_config,omitempty"` // Only available when the descriptor points at an image.
	// contains filtered or unexported fields
}

func (*RawDescriptor) Descriptor deprecated

func (*RawDescriptor) Descriptor() ([]byte, []int)

Deprecated: Use RawDescriptor.ProtoReflect.Descriptor instead.

func (*RawDescriptor) GetMediaType

func (x *RawDescriptor) GetMediaType() string

func (*RawDescriptor) GetRawConfig

func (x *RawDescriptor) GetRawConfig() []byte

func (*RawDescriptor) GetRawManifest

func (x *RawDescriptor) GetRawManifest() []byte

func (*RawDescriptor) GetRepository

func (x *RawDescriptor) GetRepository() string

func (*RawDescriptor) ProtoMessage

func (*RawDescriptor) ProtoMessage()

func (*RawDescriptor) ProtoReflect

func (x *RawDescriptor) ProtoReflect() protoreflect.Message

func (*RawDescriptor) Reset

func (x *RawDescriptor) Reset()

func (*RawDescriptor) String

func (x *RawDescriptor) String() string

type RemoteProgress

type RemoteProgress struct {
	// contains filtered or unexported fields
}

func (*RemoteProgress) FormatProgress

func (rp *RemoteProgress) FormatProgress() string

func (*RemoteProgress) Track

func (rp *RemoteProgress) Track() remote.Option

type ResolvableImage

type ResolvableImage interface {
	Digest() (schema.Digest, error)
	Image() (Image, error)
	ImageForPlatform(specs.Platform) (Image, error)
	ImageIndex() (ImageIndex, error)
	Push(context.Context, TargetRepository, bool) (v1.Hash, error)
	// contains filtered or unexported methods
}

func RawAsResolvable

func RawAsResolvable(img Image) ResolvableImage

type ResolveOpts

type ResolveOpts struct {
	InsecureRegistry bool
	PublicImage      bool
	Keychain         Keychain
}

type ResourceDescription

type ResourceDescription[V any] interface {
	Description() string
}

type TargetRepository

type TargetRepository struct {
	InsecureRegistry bool
	Keychain         Keychain
	ImageID
}

type TargetRewritter

type TargetRewritter interface {
	CheckRewriteLocalUse(TargetRepository) *TargetRepository
}

Jump to

Keyboard shortcuts

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