oci

package
v0.0.102 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRegistry is the default registry to use
	DefaultRegistry = "index.docker.io"
	// IndexStoreContextKey is the context key for the index store
	IndexStoreContextKey contextKeyType = "indexStore"
	// BlobStoreContextKey is the context key for the blob store
	BlobStoreContextKey contextKeyType = "blobStore"
	// KeyStoreContextKey is the context key for the blob store
	KeyStoreContextKey contextKeyType = "keyStore"
	// 2dfs media type
	TwoDfsMediaType = "application/vnd.oci.image.layer.v1.2dfs.field"
	// image name annotation
	ImageNameAnnotation = "2dfs.image.name"
)

Variables

View Source
var PullPushProtocol = "https"

Functions

func DeleteToken

func DeleteToken()

func DownloadBlob

func DownloadBlob(ctx context.Context, image OciImageLink, digest digest.Digest, mediaType string) (io.ReadCloser, error)

func DownloadIndex

func DownloadIndex(image OciImageLink) (v1.Index, error)

func DownloadManifest

func DownloadManifest(image OciImageLink, digest string) (io.ReadCloser, error)

func GetFileSha

func GetFileSha(keys CacheKeys, dst []string) (string, string, error)

Given the file destination, and the CacheKeys, looks if any of the keys match the destination and returns the key and the sha of the file. Error otherwise.

func ReadConfig

func ReadConfig(configReader io.ReadCloser) (v1.Image, error)

func ReadIndex

func ReadIndex(indexReader io.ReadCloser) (v1.Index, error)

func ReadManifest

func ReadManifest(manifestReader io.ReadCloser) (v1.Manifest, int64, string, error)

ReadManifest returns manifest struct, manifest size, manifest digest

func UploadBlob

func UploadBlob(link OciImageLink, blobReader io.ReadCloser, contentLength int, token string) (string, error)

func UploadManifest

func UploadManifest(link OciImageLink, indexBytes []byte, mediaType string, token string) (string, error)

Types

type Base64Reader

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

func NewBase64Reader

func NewBase64Reader(reader io.ReadCloser) *Base64Reader

func (*Base64Reader) Close

func (r *Base64Reader) Close() error

func (*Base64Reader) Read

func (r *Base64Reader) Read(p []byte) (int, error)

type CacheKeys

type CacheKeys struct {
	Keys []FileCacheKey `json:"keys"`
}

func ParseCacheKey

func ParseCacheKey(reader io.Reader) (CacheKeys, error)

type FieldExporter

type FieldExporter interface {
	ExportAsTar(dst string) error
	Upload() error
}

type FileCacheKey

type FileCacheKey struct {
	Destination   string `json:"destination"`
	DiffID        string `json:"diffID"`
	CompressedSha string `json:"compressedSha"`
}

type Image

type Image interface {
	AddField(manifest filesystem.TwoDFsManifest, targetImage string) error
	GetIndex() []byte
	GetExporter(args ...string) (FieldExporter, error)
}

func GetLocalImage

func GetLocalImage(ctx context.Context, reference string) (Image, error)

func NewImage

func NewImage(ctx context.Context, url string, forcepull bool, platforms []string) (Image, error)

Get an image online or from cache. forcepull: force image pull even if local cache entry found platforms: array of supported platforms. The resulting image will only include support of those is the original image has it.

type ManifestMediaType

type ManifestMediaType string
type OciImageLink struct {
	Registry string

	Repository string
	Reference  string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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