Documentation ¶
Overview ¶
Package store provides a basic API for modules to interact with kv-stores independently of any implementation of that functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KVStore ¶
type KVStore interface { // Get returns nil iff key doesn't exist. Errors on nil key. Get(key []byte) ([]byte, error) // Has checks if a key exists. Errors on nil key. Has(key []byte) (bool, error) // Set sets the key. Errors on nil key or value. Set(key, value []byte) error // Delete deletes the key. Errors on nil key. Delete(key []byte) error // Iterator iterates over a domain of keys in ascending order. End is exclusive. // Start must be less than end, or the Iterator is invalid. // Iterator must be closed by caller. // To iterate over entire domain, use store.Iterator(nil, nil) // CONTRACT: No writes may happen within a domain while an iterator exists over it. // Exceptionally allowed for cachekv.Store, safe to write in the modules. Iterator(start, end []byte) (Iterator, error) // ReverseIterator iterates over a domain of keys in descending order. End is exclusive. // Start must be less than end, or the Iterator is invalid. // Iterator must be closed by caller. // CONTRACT: No writes may happen within a domain while an iterator exists over it. // Exceptionally allowed for cachekv.Store, safe to write in the modules. ReverseIterator(start, end []byte) (Iterator, error) }
KVStore describes the basic interface for interacting with key-value stores.
type KVStoreService ¶
type KVStoreService interface { // OpenKVStore retrieves the KVStore from the context. OpenKVStore(context.Context) KVStore }
KVStoreService represents a unique, non-forgeable handle to a regular merkle-tree backed KVStore. It should be provided as a module-scoped dependency by the runtime module being used to build the app.
type MemoryStoreService ¶
type MemoryStoreService interface { // OpenMemoryStore retrieves the memory store from the context. OpenMemoryStore(context.Context) KVStore }
MemoryStoreService represents a unique, non-forgeable handle to a memory-backed KVStore. It should be provided as a module-scoped dependency by the runtime module being used to build the app.
type TransientStoreService ¶
type TransientStoreService interface { // OpenTransientStore retrieves the transient store from the context. OpenTransientStore(context.Context) KVStore }
TransientStoreService represents a unique, non-forgeable handle to a memory-backed KVStore which is reset at the start of every block. It should be provided as a module-scoped dependency by the runtime module being used to build the app.