Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMutationDel ¶
func NewMutationSet ¶
Types ¶
type BufferedKVStore ¶
type BufferedKVStore interface { kv.KVStore // the uncommitted mutations Mutations() MutationSequence ClearMutations() Clone() BufferedKVStore // only for testing! DangerouslyDumpToDict() dict.Dict // only for testing! DangerouslyDumpToString() string }
BufferedKVStore represents a KVStore backed by a database. Writes are cached in-memory as a MutationSequence; reads are delegated to the backing database when not cached.
func NewBufferedKVStore ¶
func NewBufferedKVStore(db kvstore.KVStore) BufferedKVStore
type DBError ¶
type DBError struct {
// contains filtered or unexported fields
}
Any failed access to the DB will return an instance of DBError
type Mutation ¶
type Mutation interface { Read(io.Reader) error Write(io.Writer) error String() string ApplyTo(w kv.KVStoreWriter) // Key returns the key that is mutated Key() kv.Key // Value returns the value after the mutation (nil if deleted) Value() []byte // contains filtered or unexported methods }
Mutation represents a single "set" or "del" operation over a KVStore
type MutationSequence ¶
type MutationSequence interface { Read(io.Reader) error Write(io.Writer) error String() string Clone() MutationSequence Len() int // Iterate over all mutations in order, even ones affecting the same key repeatedly Iterate(func(mut Mutation) bool) // Iterate over the latest mutation recorded for each key IterateLatest(func(key kv.Key, mut Mutation) bool) // Iterate over the latest value recorded for each non-deleted key IterateValues(prefix kv.Key, f func(key kv.Key, value []byte) bool) (map[kv.Key]bool, bool) Latest(key kv.Key) Mutation Add(mut Mutation) ApplyTo(w kv.KVStoreWriter) }
func NewMutationSequence ¶
func NewMutationSequence() MutationSequence
Click to show internal directories.
Click to hide internal directories.