Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrIO indicates the generic error of DB I/O operation ErrIO = errors.New("DB I/O operation error") // ErrNotExist defines an error that the query has no return value in db ErrNotExist = errors.New("key does not exist") // NextHeightKey defines the constant key of next height NextHeightKey = []byte("next-height") )
Functions ¶
This section is empty.
Types ¶
type KVStore ¶
type KVStore interface { Start(context.Context) error Stop(context.Context) error Get([]byte) ([]byte, error) Put([]byte, []byte) error }
KVStore defines the db interface using in committee
func NewInMemKVStore ¶
func NewInMemKVStore() KVStore
NewInMemKVStore creates a new in memory kv store
func NewKVStoreWithNamespaceWrapper ¶
func NewKVStoreWithNamespaceWrapper(namespace string, store KVStoreWithNamespace) KVStore
NewKVStoreWithNamespaceWrapper create a kvstore with specified namespace and a KVStoreWithNamespace
type KVStoreWithNamespace ¶
type KVStoreWithNamespace interface { Start(context.Context) error Stop(context.Context) error Get(string, []byte) ([]byte, error) Put(string, []byte, []byte) error }
KVStoreWithNamespace defines the db interface with namesapce
func NewBoltDB ¶
func NewBoltDB(dbPath string, numOfRetries uint8) KVStoreWithNamespace
NewBoltDB creates a new boltDB
func NewInMemStoreWithNamespace ¶ added in v0.2.0
func NewInMemStoreWithNamespace(_ Config) KVStoreWithNamespace
NewInMemStoreWithNamespace defines a wrapper to convert memStore to KVStoreWithNamespace
type KVStoreWithNamespaceWrapper ¶
type KVStoreWithNamespaceWrapper struct {
// contains filtered or unexported fields
}
KVStoreWithNamespaceWrapper defines a wrapper to convert KVStoreWithNamespace to KVStore
func (*KVStoreWithNamespaceWrapper) Get ¶
func (w *KVStoreWithNamespaceWrapper) Get(key []byte) ([]byte, error)
Get gets the value by key from kv store
func (*KVStoreWithNamespaceWrapper) Put ¶
func (w *KVStoreWithNamespaceWrapper) Put(key []byte, value []byte) error
Put puts key-value pair into kv store
Click to show internal directories.
Click to hide internal directories.