fs

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 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.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 fileystem.

func NewStore added in v0.23.0

func NewStore(dir string) (*Store, error)

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) Close added in v0.23.0

func (s *Store) Close() error

Close closes the Store.

func (*Store) Create added in v0.23.0

func (s *Store) Create(_ context.Context, name string, value []byte) error

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

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

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

func (s *Store) Get(_ context.Context, name string) ([]byte, error)

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

func (s *Store) List(ctx context.Context, prefix string, n int) ([]string, string, error)

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

func (*Store) Status added in v0.23.0

func (s *Store) Status(context.Context) (kes.KeyStoreState, error)

Status returns the current state of the Conn.

In particular, it reports whether the underlying filesystem is accessible.

func (*Store) String added in v0.23.0

func (s *Store) String() string

Jump to

Keyboard shortcuts

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