Documentation ¶
Overview ¶
Package fsvault provides a simple crud abstraction over the filesystem as a datastore.
Data keys should use '/' as a separator, which keeps the implementation simple by mirroring the underlying filesystem.
Data is any []byte slice.
Encryption of the data, at rest, is enabled by providing a list of encryption key strings to the NewFSVault() method.
Index ¶
- func Delete(vaultRoot string, vaultKey string) error
- func DeleteMapValue[V any](vaultRoot string, vaultKey string, mapKey string)
- func Get(vaultRoot string, vaultKey string) ([]byte, error)
- func GetMap[V any](vaultRoot string, vaultKey string) map[string]V
- func GetMapValue[V any](vaultRoot string, vaultKey string, mapKey string) V
- func KeyExists(vaultRoot string, vaultKey string) (bool, error)
- func List(vaultRoot string, vaultKey string) []string
- func Put(vaultRoot string, vaultKey string, data []byte) error
- func PutMapValue[V any](vaultRoot string, vaultKey string, mapKey string, value V)
- type Unlocker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteMapValue ¶ added in v0.3.0
func Get ¶ added in v0.3.0
Get returns the data at key, or an error.
If encryption keys are present, and a non-primary encryption key successfully decrypted the data, then the data is re-stored using the primary encryption key. See the main documentation for more on encryption key rollover.
func GetMapValue ¶ added in v0.3.0
func KeyExists ¶ added in v0.3.0
KeyExists returns true if data exists at key, and is read/writeable.
func List ¶ added in v0.3.0
List returns an alphabetically sorted list of the object names found a key.
Types ¶
type Unlocker ¶ added in v0.3.0
type Unlocker interface {
Unlock()
}
Unlocker provides an Unlock method to release the lock.
func GetMapValueWithLock ¶ added in v0.3.0
GetMapValueWithLock returns the value and a lock on the map, the caller must release the lock.
func GetMapWithLock ¶ added in v0.3.0
GetMapWithLock returns the map with a lock the caller must unlock. If the map doesn't exist, the key lock is still returned.