registry

package
v0.0.0-...-c9b8f36 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultUserAgent = "model-distribution"
)

Variables

View Source
var (
	ErrInvalidReference     = errors.New("invalid model reference")
	ErrModelNotFound        = errors.New("model not found")
	ErrUnauthorized         = errors.New("unauthorized access to model")
	ErrUnsupportedMediaType = errors.New(fmt.Sprintf(
		"client supports only models of type %q and older - try upgrading",
		types.MediaTypeModelConfigV01,
	))
)
View Source
var (
	DefaultTransport = remote.DefaultTransport
)

Functions

func NewReferenceError

func NewReferenceError(reference string, err error) error

NewReferenceError creates a new ReferenceError

func NewRegistryError

func NewRegistryError(reference, code, message string, err error) error

NewRegistryError creates a new Error

Types

type Client

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

func NewClient

func NewClient(opts ...ClientOption) *Client

func (*Client) BearerToken

func (c *Client) BearerToken(ctx context.Context, reference string) (string, error)

func (*Client) BlobURL

func (c *Client) BlobURL(reference string, digest v1.Hash) (string, error)

func (*Client) Model

func (c *Client) Model(ctx context.Context, reference string) (types.ModelArtifact, error)

func (*Client) NewTarget

func (c *Client) NewTarget(tag string) (*Target, error)

type ClientOption

type ClientOption func(*Client)

func WithAuthConfig

func WithAuthConfig(username, password string) ClientOption

func WithTransport

func WithTransport(transport http.RoundTripper) ClientOption

func WithUserAgent

func WithUserAgent(userAgent string) ClientOption

type Error

type Error struct {
	Reference string
	// Code should be one of error codes defined in the distribution spec
	// (see https://github.com/opencontainers/distribution-spec/blob/583e014d15418d839d67f68152bc2c83821770e0/spec.md#error-codes)
	Code    string
	Message string
	Err     error
}

Error represents an error returned by an OCI registry

func (Error) Error

func (e Error) Error() string

func (Error) Is

func (e Error) Is(target error) bool

Is implements error matching for Error

func (Error) Unwrap

func (e Error) Unwrap() error

type ReferenceError

type ReferenceError struct {
	Reference string
	Err       error
}

ReferenceError represents an error related to an invalid model reference

func (*ReferenceError) Error

func (e *ReferenceError) Error() string

func (*ReferenceError) Is

func (e *ReferenceError) Is(target error) bool

Is implements error matching for ReferenceError

func (*ReferenceError) Unwrap

func (e *ReferenceError) Unwrap() error

type Target

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

func (*Target) Write

func (t *Target) Write(ctx context.Context, model types.ModelArtifact, progressWriter io.Writer) error

Jump to

Keyboard shortcuts

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