Documentation ¶
Index ¶
Constants ¶
View Source
const Delimiter = '/'
Delimiter separates nested paths in storage.
Variables ¶
View Source
var ( // ErrKeyNotFound used when something doesn't exist. ErrKeyNotFound = errs.Class("key not found") // ErrEmptyKey is returned when an empty key is used in Put or in CompareAndSwap. ErrEmptyKey = errs.Class("empty key") // ErrValueChanged is returned when the current value of the key does not match the old value in CompareAndSwap. ErrValueChanged = errs.Class("value changed") )
Functions ¶
Types ¶
type Items ¶
type Items []Item
Items keeps all Item.
type Key ¶
type Key []byte
Key is the type for the keys in a `Store`.
func (Key) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface for the Key type.
type Keys ¶
type Keys []Key
Keys is the type for a slice of keys in a `Store`.
func (Keys) ByteSlices ¶
ByteSlices converts a `Keys` struct to a slice of byte-slices (i.e. `[][]byte`).
type Store ¶
type Store interface { // Put adds a value to store. Put(context.Context, Key, Value) error // Get gets a value to store. Get(context.Context, Key) (Value, error) // Delete deletes key and the value. Delete(context.Context, Key) error // Range iterates over all items in unspecified order. // The Key and Value are valid only for the duration of callback. Range(ctx context.Context, fn func(context.Context, Key, Value) error) error // CompareAndSwap atomically compares and swaps oldValue with newValue. CompareAndSwap(ctx context.Context, key Key, oldValue, newValue Value) error // Close closes the store. Close() error }
Store describes key/value stores like redis and boltdb.
Click to show internal directories.
Click to hide internal directories.