storage

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned if the nar or narinfo were not found.
	ErrNotFound = errors.New("not found")

	// ErrAlreadyExists is returned the store already has a file with the
	// same name.
	ErrAlreadyExists = errors.New("file already exists")
)

Functions

This section is empty.

Types

type ConfigStore

type ConfigStore interface {
	// GetSecretKey returns secret key from the store.
	GetSecretKey(ctx context.Context) (signature.SecretKey, error)

	// PutSecretKey stores the secret key in the store.
	PutSecretKey(ctx context.Context, sk signature.SecretKey) error

	// DeleteSecretKey deletes the secret key in the store.
	DeleteSecretKey(ctx context.Context) error
}

ConfigStore represents a store for the ncps to use for storing configurations.

type NarInfoStore

type NarInfoStore interface {
	// HasNarInfo returns true if the store has the narinfo.
	HasNarInfo(ctx context.Context, hash string) bool

	// GetNarInfo returns narinfo from the store.
	GetNarInfo(ctx context.Context, hash string) (*narinfo.NarInfo, error)

	// PutNarInfo puts the narinfo in the store.
	PutNarInfo(ctx context.Context, hash string, narInfo *narinfo.NarInfo) error

	// DeleteNarInfo deletes the narinfo from the store.
	DeleteNarInfo(ctx context.Context, hash string) error
}

NarInfoStore represents a store capable of storing narinfos.

type NarStore

type NarStore interface {
	// HasNar returns true if the store has the nar.
	HasNar(ctx context.Context, narURL nar.URL) bool

	// GetNar returns nar from the store.
	// NOTE: The caller must close the returned io.ReadCloser!
	GetNar(ctx context.Context, narURL nar.URL) (int64, io.ReadCloser, error)

	// PutNar puts the nar in the store.
	PutNar(ctx context.Context, narURL nar.URL, body io.Reader) (int64, error)

	// DeleteNar deletes the nar from the store.
	DeleteNar(ctx context.Context, narURL nar.URL) error
}

NarStore represents a store capable of storing nars.

type Store

type Store struct {
	ConfigStore
	NarInfoStore
	NarStore
}

Store represents a store capable of storing narinfos and nars.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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