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) Close() error
- func (s *Store) Create(_ context.Context, name string, value []byte) error
- func (s *Store) Delete(_ context.Context, name string) error
- func (s *Store) Get(_ context.Context, name string) ([]byte, error)
- func (s *Store) List(ctx context.Context, prefix string, n int) ([]string, string, error)
- func (s *Store) Status(context.Context) (kes.KeyStoreState, error)
- func (s *Store) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶ added in v0.23.0
type Store struct {
// contains filtered or unexported fields
}
Store is a connection to a directory on the filesystem.
It implements the kms.Store interface and acts as KMS abstraction over a filesystem.
func NewStore ¶ added in v0.23.0
NewStore returns a new Store that reads from and writes to the given directory.
If the directory or any parent directory does not exist, NewStore creates them all.
It returns an error if dir exists but is not a directory.
func (*Store) Create ¶ added in v0.23.0
Create creates a new file with the given name inside the Conn directory if and only if no such file exists.
It returns kes.ErrKeyExists if such a file already exists.
func (*Store) Delete ¶ added in v0.23.0
Delete deletes the named file within the Conn directory if and only if it exists. It returns kes.ErrKeyNotFound if no such file exists.
func (*Store) Get ¶ added in v0.23.0
Get reads the content of the named file within the Conn directory. It returns kes.ErrKeyNotFound if no such file exists.
func (*Store) List ¶ added in v0.23.0
List returns a new Iterator over the names of all stored keys. List returns the first n key names, that start with the given prefix, and the next prefix from which the listing should continue.
It returns all keys with the prefix if n < 0 and less than n names if n is greater than the number of keys with the prefix.
An empty prefix matches any key name. At the end of the listing or when there are no (more) keys starting with the prefix, the returned prefix is empty