backend

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Login logs into a registry.
	Login(ctx context.Context, registry, username, password string, cfg *config.Login) error

	// Logout logs out from a registry.
	Logout(ctx context.Context, registry string) error

	// Attach attaches user materials into the model artifact which follows the Model Spec.
	Attach(ctx context.Context, filepath string, cfg *config.Attach) error

	// Upload uploads the file to a model artifact repository in advance, but will not push config and manifest.
	Upload(ctx context.Context, filepath string, cfg *config.Upload) error

	// Build builds the user materials into the model artifact which follows the Model Spec.
	Build(ctx context.Context, modelfilePath, workDir, target string, cfg *config.Build) error

	// Pull pulls an artifact from a registry.
	Pull(ctx context.Context, target string, cfg *config.Pull) error

	// Fetch fetches partial files to the output.
	Fetch(ctx context.Context, target string, cfg *config.Fetch) error

	// Push pushes the image to the registry.
	Push(ctx context.Context, target string, cfg *config.Push) error

	// List lists all the model artifacts.
	List(ctx context.Context) ([]*ModelArtifact, error)

	// Remove deletes the model artifact.
	Remove(ctx context.Context, target string) (string, error)

	// Prune prunes the unused blobs and clean up the storage.
	Prune(ctx context.Context, dryRun, removeUntagged bool) error

	// Inspect inspects the model artifact.
	Inspect(ctx context.Context, target string, cfg *config.Inspect) (any, error)

	// Extract extracts the model artifact.
	Extract(ctx context.Context, target string, cfg *config.Extract) error

	// Tag creates a new tag that refers to the source model artifact.
	Tag(ctx context.Context, source, target string) error

	// Nydusify converts the model artifact to nydus format.
	Nydusify(ctx context.Context, target string) (string, error)
}

Backend is the interface to represent the backend.

func New

func New(storageDir string) (Backend, error)

New creates a new backend.

type InspectedModelArtifact

type InspectedModelArtifact struct {
	// ID is the image id of the model artifact.
	ID string `json:"Id"`
	// Digest is the digest of the model artifact.
	Digest string `json:"Digest"`
	// Architecture is the architecture of the model.
	Architecture string `json:"Architecture"`
	// CreatedAt is the creation time of the model artifact.
	CreatedAt string `json:"CreatedAt"`
	// Family is the family of the model.
	Family string `json:"Family"`
	// Format is the format of the model.
	Format string `json:"Format"`
	// Name is the name of the model.
	Name string `json:"Name"`
	// ParamSize is the param size of the model.
	ParamSize string `json:"ParamSize"`
	// Precision is the precision of the model.
	Precision string `json:"Precision"`
	// Quantization is the quantization of the model.
	Quantization string `json:"Quantization"`
	// Layers is the layers of the model artifact.
	Layers []InspectedModelArtifactLayer `json:"Layers"`
}

InspectedModelArtifact is the data structure for model artifact that has been inspected.

type InspectedModelArtifactLayer

type InspectedModelArtifactLayer struct {
	// MediaType is the media type of the model artifact layer.
	MediaType string `json:"MediaType"`
	// Digest is the digest of the model artifact layer.
	Digest string `json:"Digest"`
	// Size is the size of the model artifact layer.
	Size int64 `json:"Size"`
	// Filepath is the filepath of the model artifact layer.
	Filepath string `json:"Filepath"`
}

InspectedModelArtifactLayer is the data structure for model artifact layer that has been inspected.

type ModelArtifact

type ModelArtifact struct {
	// Repository is the repository of the model artifact.
	Repository string
	// Tag is the tag of the model artifact.
	Tag string
	// Digest is the digest of the model artifact.
	Digest string
	// Size is the size of the model artifact.
	Size int64
	// CreatedAt is the creation time of the model artifact.
	CreatedAt time.Time
}

ModelArtifact is the data model to represent the model artifact.

type Referencer

type Referencer interface {
	// Repository returns the repository of the reference.
	Repository() string
	// Tag returns the tag of the reference.
	Tag() string
	// Digest returns the digest of the reference.
	Digest() string
	// Domain returns the domain of the reference.
	Domain() string
}

Referencer is the interface for the reference.

func ParseReference

func ParseReference(ref string) (Referencer, error)

ParseReference parses the reference.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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