Documentation
¶
Overview ¶
Package fs implements a key-value store that stores keys as file names and values as file content.
Index ¶
- type Conn
- func (c *Conn) Create(_ context.Context, name string, value []byte) error
- func (c *Conn) Delete(_ context.Context, name string) error
- func (c *Conn) Get(_ context.Context, name string) ([]byte, error)
- func (c *Conn) List(ctx context.Context) (kms.Iter, error)
- func (c *Conn) Status(context.Context) (kms.State, error)
- type Iter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶ added in v0.22.0
type Conn struct {
// contains filtered or unexported fields
}
Conn is a connection to a directory on the filesystem.
It implements the kms.Conn interface and acts as KMS abstraction over a fileystem.
func NewConn ¶ added in v0.22.0
NewConn returns a new Conn that reads from and writes to the given directory.
If the directory or any parent directory does not exist, NewConn creates them all.
It returns an error if dir exists but is not a directory.
func (*Conn) Create ¶ added in v0.22.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 (*Conn) Delete ¶ added in v0.22.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 (*Conn) Get ¶ added in v0.22.0
Get reads the content of the named file within the Conn directory. It returns kes.ErrKeyNotFound if no such file exists.
type Iter ¶ added in v0.22.0
type Iter struct {
// contains filtered or unexported fields
}
Iter is an iterator over all files within a directory. It must be closed to release any filesystem resources.
func NewIter ¶ added in v0.22.0
func NewIter(ctx context.Context, dir fs.ReadDirFile) *Iter
NewIter returns an Iter all files within the given directory. The Iter does not iterator recursively into subdirectories.
func (*Iter) Close ¶ added in v0.22.0
Close closes the Iter and releases and filesystem resources back to the OS.