ocistore

package
v1.1.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: EPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package ocistore is the shared on-disk store for OCI model artifacts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

Index is the DMR-compatible models.json document.

type IndexEntry

type IndexEntry struct {
	ID    string   `json:"id"`
	Tags  []string `json:"tags"`
	Files []string `json:"files"`
}

IndexEntry records one stored artifact and its tags.

type Layout

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

Layout is the DMR-compatible store marker.

type ModelRef

type ModelRef struct {
	Digest string   `json:"digest,omitempty"`
	Blobs  []string `json:"blobs"`
}

ModelRef records which blobs and manifest a local model name claims.

type Store

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

Store is a local content-addressed model artifact store.

func Open

func Open(root string) (*Store, error)

Open initializes (or opens) a store at root.

func (*Store) AppendBlob

func (s *Store) AppendBlob(digest string, r io.Reader, expectedSize int64) error

AppendBlob appends to an existing incomplete download.

func (*Store) CleanupStaleIncomplete

func (s *Store) CleanupStaleIncomplete(now time.Time) (int, error)

CleanupStaleIncomplete removes partial blob downloads older than seven days.

func (*Store) CollectUnused

func (s *Store) CollectUnused() (int, error)

CollectUnused deletes blobs and manifests that no remaining model claims.

func (*Store) HasBlob

func (s *Store) HasBlob(digest string) (bool, error)

HasBlob reports whether a complete blob is present.

func (*Store) IncompleteSize

func (s *Store) IncompleteSize(digest string) (int64, error)

IncompleteSize returns the size of a partial blob download, or 0.

func (*Store) Open

func (s *Store) Open(digest string) (io.ReadCloser, error)

Open opens a complete blob for reading.

func (*Store) ReadBlob

func (s *Store) ReadBlob(digest string) ([]byte, error)

ReadBlob returns the complete blob bytes.

func (*Store) ReadIndex

func (s *Store) ReadIndex() (Index, error)

ReadIndex returns the models.json index.

func (*Store) ReadLayout

func (s *Store) ReadLayout() (Layout, error)

ReadLayout returns the store layout document.

func (*Store) Release

func (s *Store) Release(modelName string) error

Release drops modelName's blob claims. Blobs still claimed by another model are kept.

func (*Store) RemoveIncomplete

func (s *Store) RemoveIncomplete(digest string) error

RemoveIncomplete deletes a partial blob download.

func (*Store) Root

func (s *Store) Root() string

Root returns the store directory.

func (*Store) Track

func (s *Store) Track(modelName, digest string, blobs []string) error

Track records that modelName claims digest and blobs. Replaces any previous claim.

func (*Store) WriteBlob

func (s *Store) WriteBlob(digest string, r io.Reader, expectedSize int64) error

WriteBlob writes a blob from offset 0 (or replaces an incomplete file). expectedSize, when > 0, is the full blob size used to detect a partial download.

func (*Store) WriteManifest

func (s *Store) WriteManifest(digest string, raw []byte, tags []string, files []string) error

WriteManifest stores the raw OCI manifest and updates models.json.

Jump to

Keyboard shortcuts

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