store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package store is used to interface with different types of storage (memory, disk)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobCreator

type BlobCreator interface {
	// WriteCloser is used to push the blob content.
	io.WriteCloser
	// Cancel is used to stop an upload.
	Cancel()
	// Size reports the number of bytes pushed.
	Size() int64
	// Digest is used to get the current digest of the content.
	Digest() digest.Digest
	// Verify ensures a digest matches the content.
	Verify(digest.Digest) error
}

BlobCreator is used to upload new blobs.

type BlobOpt

type BlobOpt func(*blobConfig)

func BlobWithAlgorithm

func BlobWithAlgorithm(a digest.Algorithm) BlobOpt

func BlobWithDigest

func BlobWithDigest(d digest.Digest) BlobOpt

type Opts

type Opts func(*storeConf)

Opts includes options for the directory store.

func WithLog

func WithLog(log slog.Logger) Opts

WithLog includes a logger on the directory store.

type Repo

type Repo interface {
	// IndexGet returns the current top level index for a repo.
	IndexGet() (types.Index, error)
	// IndexInsert adds a new entry to the index and writes the change to index.json.
	IndexInsert(desc types.Descriptor, opts ...types.IndexOpt) error
	// IndexRemove deletes an entry from the index and writes the change to index.json.
	IndexRemove(desc types.Descriptor) error

	// BlobGet returns a reader to an entry from the CAS.
	BlobGet(d digest.Digest) (io.ReadSeekCloser, error)
	// BlobCreate is used to create a new blob.
	BlobCreate(opts ...BlobOpt) (BlobCreator, string, error)
	// BlobDelete removes an entry from the CAS.
	BlobDelete(d digest.Digest) error
	// BlobSession is used to retrieve an upload session
	BlobSession(sessionID string) (BlobCreator, error)

	// Done indicates the routine using this repo is finished.
	// This must be called exactly once for every instance of [Store.RepoGet].
	Done()
	// contains filtered or unexported methods
}

Repo interface is used to access a CAS and the index managing known manifests.

type Store

type Store interface {
	// RepoGet returns a repo from the store.
	// When finished, the method [Repo.Done] must be called.
	RepoGet(repoStr string) (Repo, error)

	// Close releases resources used by the store.
	// The store should not be used after being closed.
	Close() error
}

Store interface is used to abstract access to a backend storage system for repositories.

func NewDir

func NewDir(conf config.Config, opts ...Opts) Store

NewDir returns a directory store.

func NewMem

func NewMem(conf config.Config, opts ...Opts) Store

Jump to

Keyboard shortcuts

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