storage

package
v0.0.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option is the option wrapper for modifying the storage options.

func WithRootDir

func WithRootDir(rootDir string) Option

WithRootDir sets the root directory of the storage.

type Options

type Options struct {
	// RootDir is the root directory of the storage.
	RootDir string
}

Options is the options for the storage.

type Storage

type Storage interface {
	// PullManifest pulls the manifest from the storage.
	PullManifest(ctx context.Context, repo, reference string) ([]byte, string, error)
	// PushManifest pushes the manifest to the storage.
	PushManifest(ctx context.Context, repo, reference string, body []byte) (string, error)
	// DeleteManifest deletes the manifest from the storage.
	DeleteManifest(ctx context.Context, repo, reference string) error
	// PullBlob pulls the blob from the storage.
	PullBlob(ctx context.Context, repo, digest string) (io.ReadCloser, error)
	// PushBlob pushes the blob to the storage.
	PushBlob(ctx context.Context, repo string, body io.Reader) (string, int64, error)
	// StatBlob stats the blob in the storage.
	StatBlob(ctx context.Context, repo, digest string) (bool, error)
	// ListRepositories lists all the repositories in the storage.
	ListRepositories(ctx context.Context) ([]string, error)
	// ListTags lists all the tags in the repository.
	ListTags(ctx context.Context, repo string) ([]string, error)
	// PerformGC performs the garbage collection in the storage to free up the space.
	PerformGC(ctx context.Context, dryRun, removeUntagged bool) error
}

Storage is an interface for storage which wraps the storage operations.

func New

func New(storageType Type, storageDir string, opts ...Option) (Storage, error)

New gets the storage by the type.

type Type

type Type = string

Type is the type of storage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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