remote

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 24 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedStatusCode      = errors.New("unexpected status code")
	ErrFailedToRetrieveLayerSize = errors.New("failed to retrieve layer size from remote")
	ErrInvalidHost               = errors.New("invalid host destination")
	ErrFailedToRedirect          = errors.New("failed to redirect")
	ErrUnableToCreateFetcher     = errors.New("unable to create remote fetcher")
	ErrNoRegion                  = errors.New("no regions to fetch")
	ErrCannotParseContentLength  = errors.New("failed to parse Content-Length header")
	ErrCannotParseContentRange   = errors.New("failed to parse Content-Range header")
	ErrCannotParseContentType    = errors.New("failed to parse Content-Type header")
	ErrFailedToRefreshURL        = errors.New("failed to refresh URL")
	ErrRequestFailed             = errors.New("request to registry failed")
)

Functions

This section is empty.

Types

type Blob

type Blob interface {
	Check() error
	Size() int64
	FetchedSize() int64
	ReadAt(p []byte, offset int64, opts ...Option) (int, error)
	Refresh(ctx context.Context, hosts []docker.RegistryHost, refspec reference.Spec, desc ocispec.Descriptor) error
	Close() error
}

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context, off int64, size int64) (io.ReadCloser, error)
	Check() error
	GenID(off int64, size int64) string
}

type Handler

type Handler interface {
	Handle(ctx context.Context, desc ocispec.Descriptor) (fetcher Fetcher, size int64, err error)
}

type Option

type Option func(*options)

func WithCacheOpts

func WithCacheOpts(cacheOpts ...cache.Option) Option

func WithContext

func WithContext(ctx context.Context) Option

type Resolver

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

func NewResolver

func NewResolver(cfg config.BlobConfig, handlers map[string]Handler) *Resolver

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, hosts []docker.RegistryHost, refspec reference.Spec, desc ocispec.Descriptor, blobCache cache.BlobCache) (Blob, error)

Jump to

Keyboard shortcuts

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