blob

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Overview

Package blob is the underlying type for pushing and pulling blobs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blob

type Blob interface {
	Common
	RawBody() ([]byte, error)
}

Blob interface is used for returning blobs

type Common

type Common interface {
	GetDescriptor() types.Descriptor
	Response() *http.Response
	RawHeaders() http.Header

	// Deprecated: Digest should be replaced by GetDescriptor().Digest
	Digest() digest.Digest
	// Deprecated: Length should be replaced by GetDescriptor().Size
	Length() int64
	// Deprecated: MediaType should be replaced by GetDescriptor().MediaType
	MediaType() string
}

Common interface is provided by all Blob implementations

type OCIConfig

type OCIConfig interface {
	Blob
	GetConfig() v1.Image
	SetConfig(v1.Image)
}

OCIConfig wraps an OCI Config struct extracted from a Blob

func NewOCIConfig

func NewOCIConfig(opts ...Opts) OCIConfig

NewOCIConfig creates a new BlobOCIConfig from an OCI Image

type Opts

type Opts func(*blobConfig)

func WithDesc

func WithDesc(d types.Descriptor) Opts

WithDesc specifies the descriptor associated with the blob

func WithHeader

func WithHeader(header http.Header) Opts

WithHeader defines the headers received when pulling a blob

func WithImage

func WithImage(image v1.Image) Opts

WithImage provides the OCI Image config needed for config blobs

func WithRawBody

func WithRawBody(raw []byte) Opts

WithRawBody defines the raw blob contents for OCIConfig

func WithReader

func WithReader(rc io.Reader) Opts

WithReader defines the reader for a new blob

func WithRef

func WithRef(r ref.Ref) Opts

WithRef specifies the reference where the blob was pulled from

func WithResp

func WithResp(resp *http.Response) Opts

WithResp includes the http response, which is used to extract the headers and reader

type Reader

type Reader interface {
	Blob
	io.ReadCloser
	ToOCIConfig() (OCIConfig, error)
	ToTarReader() (TarReader, error)
}

Reader is an unprocessed Blob with an available ReadCloser for reading the Blob

func NewReader

func NewReader(opts ...Opts) Reader

NewReader creates a new reader

type TarReader added in v0.4.5

type TarReader interface {
	Blob
	io.Closer
	GetTarReader() (*tar.Reader, error)
	ReadFile(filename string) (*tar.Header, io.Reader, error)
}

TarReader reads or writes to a blob with tar contents and optional compression

func NewTarReader added in v0.4.5

func NewTarReader(opts ...Opts) TarReader

NewTarReader creates a TarReader

Jump to

Keyboard shortcuts

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