Documentation ¶
Overview ¶
Package fskv provides simple file system based key-value storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLocked = errors.New("Locked")
ErrLocked returned in case is key locked for modifications
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket represents a collection of key/value pairs inside the storage.
func (*Bucket) Get ¶
Get retrieves the value for a key in the bucket. Returns an error value if the key does not exist.
func (*Bucket) GetBucket ¶
GetBucket creates a new bucket if it doesn't already exist and returns a reference to it. Returns an error if the bucket name is invalid.
func (*Bucket) Remove ¶
Remove removes a key from the bucket. If the key does not exist then nothing is done. If no keys provided whole bucket will be removed.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents a collection of buckets and key-value pairs that persist on disk.
func Open ¶
Open creates and opens a database at the given path. If the directory does not exist then it will be created automatically.
func OpenWithFactory ¶
OpenWithFactory creates and opens a database with the given function. Function should return afero.Fs
func (*DB) Get ¶
Get retrieves the value for a key. Returns an error value if the key does not exist.
func (*DB) GetBucket ¶
GetBucket creates a new bucket if it doesn't already exist and returns a reference to it. Returns an error if the bucket name is invalid.
func (*DB) Remove ¶
Remove removes a key. If the key does not exist then nothing is done. If no keys provided whole content of the storage wil be removed.