local

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPathMustBeAbsolute is returned if the given path to New was not absolute.
	ErrPathMustBeAbsolute = errors.New("path must be absolute")

	// ErrPathMustExist is returned if the given path to New did not exist.
	ErrPathMustExist = errors.New("path must exist")

	// ErrPathMustBeADirectory is returned if the given path to New is not a directory.
	ErrPathMustBeADirectory = errors.New("path must be a directory")

	// ErrPathMustBeWritable is returned if the given path to New is not writable.
	ErrPathMustBeWritable = errors.New("path must be writable")
)

Functions

This section is empty.

Types

type Store

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

Store represents a local store and implements storage.Store.

func New

func New(ctx context.Context, path string) (*Store, error)

func (*Store) DeleteNar

func (s *Store) DeleteNar(ctx context.Context, narURL nar.URL) error

DeleteNar deletes the nar from the store.

func (*Store) DeleteNarInfo

func (s *Store) DeleteNarInfo(ctx context.Context, hash string) error

DeleteNarInfo deletes the narinfo from the store.

func (*Store) DeleteSecretKey

func (s *Store) DeleteSecretKey(ctx context.Context) error

DeleteSecretKey deletes the secret key in the store.

func (*Store) GetNar

func (s *Store) GetNar(ctx context.Context, narURL nar.URL) (int64, io.ReadCloser, error)

GetNar returns nar from the store. NOTE: The caller must close the returned io.ReadCloser!

func (*Store) GetNarInfo

func (s *Store) GetNarInfo(ctx context.Context, hash string) (*narinfo.NarInfo, error)

GetNarInfo returns narinfo from the store.

func (*Store) GetSecretKey

func (s *Store) GetSecretKey(ctx context.Context) (signature.SecretKey, error)

GetSecretKey returns secret key from the store.

func (*Store) HasNar

func (s *Store) HasNar(ctx context.Context, narURL nar.URL) bool

HasNar returns true if the store has the nar.

func (*Store) HasNarInfo

func (s *Store) HasNarInfo(ctx context.Context, hash string) bool

HasNarInfo returns true if the store has the narinfo.

func (*Store) PutNar

func (s *Store) PutNar(ctx context.Context, narURL nar.URL, body io.Reader) (int64, error)

PutNar puts the nar in the store.

func (*Store) PutNarInfo

func (s *Store) PutNarInfo(ctx context.Context, hash string, narInfo *narinfo.NarInfo) error

PutNarInfo puts the narinfo in the store.

func (*Store) PutSecretKey

func (s *Store) PutSecretKey(ctx context.Context, sk signature.SecretKey) error

PutSecretKey stores the secret key in the store.

Jump to

Keyboard shortcuts

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