Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDataNotFound = errors.New("data not found")
ErrDataNotFound is returned when data not found
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider interface { // OpenStore opens a store with given name space and returns the handle OpenStore(name string) (Store, error) // CloseStore closes store of given name space CloseStore(name string) error // Close closes all stores created under this store provider Close() error }
Provider storage provider interface
type Store ¶
type Store interface { // Put stores the key and the record Put(k string, v []byte) error // Get fetches the record based on key Get(k string) ([]byte, error) // Iterator returns an iterator for the latest snapshot of the // underlying store // // Args: // // start: Start of the key range, include in the range. // limit: Limit of the key range, not include in the range. // // Returns: // // StoreIterator: iterator for result range Iterator(start, limit string) StoreIterator // Delete will delete a record with k key Delete(k string) error }
Store is the storage interface
type StoreIterator ¶
type StoreIterator interface { // Next moves the iterator to the next key/value pair. // It returns false if the iterator is exhausted. Next() bool // Release releases associated resources. Release should always success // and can be called multiple times without causing error. Release() // Error returns any accumulated error. Exhausting all the key/value pairs // is not considered to be an error. Error() error // Key returns the key of the current key/value pair, or nil if done. // The caller should not modify the contents of the returned slice, and // its contents may change on the next call to any 'seeks method'. Key() []byte // Value returns the value of the current key/value pair, or nil if done. // The caller should not modify the contents of the returned slice, and // its contents may change on the next call to any 'seeks method'. Value() []byte }
StoreIterator is the iterator for the latest snapshot of the underlying store.
Click to show internal directories.
Click to hide internal directories.