Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrValueUnset = errors.New("requested value not set")
ErrValueUnset is returned when a requested value is not set in the store.
Functions ¶
This section is empty.
Types ¶
type Iterator ¶
type Iterator interface {
// Returns the next element of the iterator
GetNext() (string, error)
// HasNext returns true if there is at least one more item after the current position
HasNext() bool
}
Iterator is an iterator for the store.
type Store ¶
type Store interface {
// BeginTransaction starts a new transaction.
BeginTransaction() (Transaction, error)
// Get returns a value from store by key.
Get(string) ([]byte, error)
// Put saves a value to store by key.
Put(string, []byte) error
// Iterator returns an Iterator for a given prefix.
Iterator(string) (Iterator, error)
// SetEncryptionKey sets the encryption key for the store.
SetEncryptionKey([]byte) error
// SetRecoveryData sets recovery data for the store.
SetRecoveryData([]byte)
// LoadState loads the sealed state of a store.
LoadState() ([]byte, error)
}
Store is the interface for persistence.
type Transaction ¶
type Transaction interface {
// Get returns a value from store by key
Get(string) ([]byte, error)
// Put saves a value to store by key
Put(string, []byte) error
// Delete removes a value from store by key
Delete(string) error
// Iterator returns an Iterator for a given prefix
Iterator(string) (Iterator, error)
// Commit ends a transaction and persists the changes
Commit() error
// Rollback aborts a transaction. Noop if already committed.
Rollback()
}
Transaction is a Store transaction.
Click to show internal directories.
Click to hide internal directories.