distribution

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0, Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidReference     = registry.ErrInvalidReference
	ErrModelNotFound        = store.ErrModelNotFound // model not found in store
	ErrUnsupportedMediaType = fmt.Errorf(
		"client supports only models of type %q and older - try upgrading",
		types.MediaTypeModelConfigV01,
	)
	ErrConflict = errors.New("resource conflict")
)

Functions

func GetSupportedFormats

func GetSupportedFormats() []types.Format

Types

type Client

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

Client provides model distribution functionality

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient creates a new distribution client

func (*Client) DeleteModel

func (c *Client) DeleteModel(reference string, force bool) (*DeleteModelResponse, error)

DeleteModel deletes a model

func (*Client) GetBundle

func (c *Client) GetBundle(ref string) (types.ModelBundle, error)

GetBundle returns a types.Bundle containing the model, creating one as necessary

func (*Client) GetModel

func (c *Client) GetModel(reference string) (types.Model, error)

GetModel returns a model by reference

func (*Client) GetStorePath

func (c *Client) GetStorePath() string

GetStorePath returns the root path where models are stored

func (*Client) IsModelInStore

func (c *Client) IsModelInStore(reference string) (bool, error)

IsModelInStore checks if a model with the given reference is in the local store

func (*Client) ListModels

func (c *Client) ListModels() ([]types.Model, error)

ListModels returns all available models

func (*Client) LoadModel

func (c *Client) LoadModel(r io.Reader, progressWriter io.Writer) (string, error)

LoadModel loads the model from the reader to the store

func (*Client) PullModel

func (c *Client) PullModel(ctx context.Context, reference string, progressWriter io.Writer, bearerToken ...string) error

PullModel pulls a model from a registry and returns the local file path

func (*Client) PushModel

func (c *Client) PushModel(ctx context.Context, tag string, progressWriter io.Writer) (err error)

PushModel pushes a tagged model from the content store to the registry.

func (*Client) ResetStore

func (c *Client) ResetStore() error

func (*Client) Tag

func (c *Client) Tag(source string, target string) error

Tag adds a tag to a model

func (*Client) WriteLightweightModel

func (c *Client) WriteLightweightModel(mdl types.ModelArtifact, tags []string) error

WriteLightweightModel writes a model to the store without transferring layer data. This is used for config-only modifications where the layer data hasn't changed. The layers must already exist in the store.

type DeleteModelAction

type DeleteModelAction struct {
	Untagged *string `json:"Untagged,omitempty"`
	Deleted  *string `json:"Deleted,omitempty"`
}

type DeleteModelResponse

type DeleteModelResponse []DeleteModelAction

type Option

type Option func(*options)

Option represents an option for creating a new Client

func WithLogger

func WithLogger(logger *logrus.Entry) Option

WithLogger sets the logger

func WithRegistryClient added in v1.0.12

func WithRegistryClient(client *registry.Client) Option

WithRegistryClient sets the registry client to use for pulling and pushing models.

func WithStoreRootPath

func WithStoreRootPath(path string) Option

WithStoreRootPath sets the store root path

Jump to

Keyboard shortcuts

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