fs

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package fs implements a key-value store that stores keys as file names and values as file content.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store added in v0.7.0

type Store struct {
	// Dir is the directory where key-value entries
	// are located. The store will read / write
	// values from / to files in this directory.
	Dir string

	// ErrorLog specifies an optional logger for errors
	// when files cannot be opened, deleted or contain
	// invalid content.
	// If nil, logging is done via the log package's
	// standard logger.
	ErrorLog *log.Logger
}

Store is a file system key-value store that stores keys as file names in a directory.

func (*Store) Create added in v0.7.0

func (s *Store) Create(_ context.Context, name string, key key.Key) error

Create stores the key in a new file in the KeyStore directory if and only if no file with the given name does not exists.

If such a file already exists it returns kes.ErrKeyExists.

func (*Store) Delete added in v0.7.0

func (s *Store) Delete(_ context.Context, name string) error

Delete removes the file with the given name in the KeyStore directory, if it exists. It does not return an error if the file does not exist.

func (*Store) Get added in v0.7.0

func (s *Store) Get(_ context.Context, name string) (key.Key, error)

Get returns the key associated with the given name. If no entry for name exists, Get returns kes.ErrKeyNotFound. In particular, Get reads the key from the associated file in KeyStore directory.

func (*Store) List added in v0.13.0

func (s *Store) List(ctx context.Context) (key.Iterator, error)

List returns a new iterator over the metadata of all stored keys.

func (*Store) Status added in v0.17.3

func (s *Store) Status(_ context.Context) (key.StoreState, error)

Status returns the current state of the FS key store.

Jump to

Keyboard shortcuts

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