store

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CurrentVersion is the current version of the store layout
	CurrentVersion = "1.0.0"
)

Variables

View Source
var ErrModelNotFound = errors.New("model not found")

Functions

This section is empty.

Types

type Index

type Index struct {
	Models []IndexEntry `json:"models"`
}

Index represents the index of all models in the store

func (Index) Add

func (i Index) Add(entry IndexEntry) Index

func (Index) Find

func (i Index) Find(ref string) (IndexEntry, int, bool)

func (Index) Remove

func (i Index) Remove(ref string) Index

func (Index) Tag

func (i Index) Tag(ref string, tag string) (Index, error)

func (Index) UnTag

func (i Index) UnTag(tag string) (*reference.Tag, Index, error)

type IndexEntry

type IndexEntry struct {
	// ID is the globally unique model identifier.
	ID string `json:"id"`
	// Tags are the list of tags associated with the model.
	Tags []string `json:"tags"`
	// Files are the files associated with the model.
	Files []string `json:"files"`
}

IndexEntry represents a model with its metadata and tags

func (IndexEntry) HasTag

func (e IndexEntry) HasTag(tag string) bool

func (IndexEntry) MatchesReference

func (e IndexEntry) MatchesReference(ref string) bool

func (IndexEntry) Tag

func (e IndexEntry) Tag(tag *reference.Tag) IndexEntry

func (IndexEntry) UnTag

func (e IndexEntry) UnTag(tag *reference.Tag) IndexEntry

type Layout

type Layout struct {
	Version string `json:"version"`
}

Layout represents the layout information of the store

type LocalStore

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

LocalStore implements the Store interface for local storage

func New

func New(opts Options) (*LocalStore, error)

New creates a new LocalStore

func (*LocalStore) AddTags

func (s *LocalStore) AddTags(ref string, newTags []string) error

AddTags adds tags to an existing model

func (*LocalStore) BundleForModel

func (s *LocalStore) BundleForModel(ref string) (types.ModelBundle, error)

BundleForModel returns a runtime bundle for the given model

func (*LocalStore) CleanupStaleIncompleteFiles added in v1.0.4

func (s *LocalStore) CleanupStaleIncompleteFiles(maxAge time.Duration) error

CleanupStaleIncompleteFiles removes incomplete download files that haven't been modified for more than the specified duration. This prevents disk space leaks from abandoned downloads.

func (*LocalStore) Delete

func (s *LocalStore) Delete(ref string) (string, []string, error)

Delete deletes a model by reference

func (*LocalStore) GetIncompleteSize added in v1.0.4

func (s *LocalStore) GetIncompleteSize(hash oci.Hash) (int64, error)

GetIncompleteSize returns the size of an incomplete blob if it exists, or 0 if it doesn't.

func (*LocalStore) List

func (s *LocalStore) List() ([]IndexEntry, error)

List lists all models in the store

func (*LocalStore) Read

func (s *LocalStore) Read(reference string) (*Model, error)

Read reads a model from the store by reference (either tag or ID)

func (*LocalStore) RemoveTags

func (s *LocalStore) RemoveTags(tags []string) ([]string, error)

RemoveTags removes tags from models

func (*LocalStore) Reset

func (s *LocalStore) Reset() error

Reset clears all contents of the store directory and reinitializes the store. It removes all files and subdirectories within the store's root path, but preserves the root directory itself. This allows the method to work correctly when the store directory is a mounted volume (e.g., in Docker Engine).

func (*LocalStore) RootPath

func (s *LocalStore) RootPath() string

RootPath returns the root path of the store

func (*LocalStore) Version

func (s *LocalStore) Version() string

Version returns the store version

func (*LocalStore) Write

func (s *LocalStore) Write(mdl oci.Image, tags []string, w io.Writer, opts ...WriteOption) (err error)

Write writes a model to the store

func (*LocalStore) WriteBlob

func (s *LocalStore) WriteBlob(diffID oci.Hash, r io.Reader) error

WriteBlob writes the blob to the store. For backwards compatibility, this version does not support resume detection. Use WriteBlobWithResume for resume support.

func (*LocalStore) WriteBlobWithResume added in v1.0.11

func (s *LocalStore) WriteBlobWithResume(diffID oci.Hash, r io.Reader, digestStr string, rangeSuccess *remote.RangeSuccess) error

WriteBlobWithResume writes the blob to the store with optional resume support. If digestStr and rangeSuccess are provided, and rangeSuccess indicates a successful Range request for this digest, WriteBlob will append to the incomplete file instead of starting fresh.

func (*LocalStore) WriteLightweight

func (s *LocalStore) WriteLightweight(mdl oci.Image, tags []string) (err error)

WriteLightweight writes only the manifest and config for a model, assuming layers already exist in the store. This is used for config-only modifications where the layer data hasn't changed.

func (*LocalStore) WriteManifest

func (s *LocalStore) WriteManifest(hash oci.Hash, raw []byte) error

WriteManifest writes the model's manifest to the store

type Model

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

func (*Model) ChatTemplatePath

func (m *Model) ChatTemplatePath() (string, error)

func (*Model) Config

func (m *Model) Config() (mdtypes.ModelConfig, error)

func (*Model) ConfigArchivePath

func (m *Model) ConfigArchivePath() (string, error)

func (*Model) ConfigFile

func (m *Model) ConfigFile() (*oci.ConfigFile, error)

func (*Model) ConfigName

func (m *Model) ConfigName() (oci.Hash, error)

func (*Model) Descriptor

func (m *Model) Descriptor() (mdtypes.Descriptor, error)

func (*Model) Digest

func (m *Model) Digest() (oci.Hash, error)

func (*Model) GGUFPaths

func (m *Model) GGUFPaths() ([]string, error)

func (*Model) ID

func (m *Model) ID() (string, error)

func (*Model) LayerByDiffID

func (m *Model) LayerByDiffID(hash oci.Hash) (oci.Layer, error)

func (*Model) LayerByDigest

func (m *Model) LayerByDigest(hash oci.Hash) (oci.Layer, error)

func (*Model) Layers

func (m *Model) Layers() ([]oci.Layer, error)

func (*Model) MMPROJPath

func (m *Model) MMPROJPath() (string, error)

func (*Model) Manifest

func (m *Model) Manifest() (*oci.Manifest, error)

func (*Model) MediaType

func (m *Model) MediaType() (oci.MediaType, error)

func (*Model) RawConfigFile

func (m *Model) RawConfigFile() ([]byte, error)

func (*Model) RawManifest

func (m *Model) RawManifest() ([]byte, error)

func (*Model) SafetensorsPaths

func (m *Model) SafetensorsPaths() ([]string, error)

func (*Model) Size

func (m *Model) Size() (int64, error)

func (*Model) Tags

func (m *Model) Tags() []string

type Options

type Options struct {
	RootPath string
}

Options represents options for creating a store

type WriteOption added in v1.0.11

type WriteOption func(*writeOptions)

WriteOption configures Write behavior.

func WithRangeSuccess added in v1.0.11

func WithRangeSuccess(rs *remote.RangeSuccess) WriteOption

WithRangeSuccess passes a RangeSuccess tracker for resume detection.

Jump to

Keyboard shortcuts

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