Documentation ¶
Overview ¶
Package fs implements a key-value store that stores keys as file names and values as file content.
Index ¶
- type Store
- func (s *Store) Create(_ context.Context, name string, key key.Key) error
- func (s *Store) Delete(_ context.Context, name string) error
- func (s *Store) Get(_ context.Context, name string) (key.Key, error)
- func (s *Store) List(ctx context.Context) (key.Iterator, error)
- func (s *Store) Status(_ context.Context) (key.StoreState, error)
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
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
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
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.