Documentation ¶
Overview ¶
Package db is a generated GoMock package.
Index ¶
- Variables
- type BoltDB
- func (b *BoltDB) BucketExists(namespace string) bool
- func (b *BoltDB) Delete(namespace string, key []byte) (err error)
- func (b *BoltDB) Filter(namespace string, cond Condition, minKey, maxKey []byte) ([][]byte, [][]byte, error)
- func (b *BoltDB) Get(namespace string, key []byte) ([]byte, error)
- func (b *BoltDB) GetBucketByPrefix(namespace []byte) ([][]byte, error)
- func (b *BoltDB) GetKeyByPrefix(namespace, prefix []byte) ([][]byte, error)
- func (b *BoltDB) Insert(name []byte, key uint64, value []byte) error
- func (b *BoltDB) Purge(name []byte, key uint64) error
- func (b *BoltDB) Put(namespace string, key, value []byte) (err error)
- func (b *BoltDB) Range(namespace string, key []byte, count uint64) ([][]byte, error)
- func (b *BoltDB) Remove(name []byte, key uint64) error
- func (b *BoltDB) SeekNext(name []byte, key uint64) ([]byte, error)
- func (b *BoltDB) SeekPrev(name []byte, key uint64) ([]byte, error)
- func (b *BoltDB) Start(_ context.Context) error
- func (b *BoltDB) Stop(_ context.Context) error
- func (b *BoltDB) WriteBatch(kvsb batch.KVStoreBatch) (err error)
- type Condition
- type Config
- type CountingIndex
- type KVStore
- type KVStoreBasic
- type KVStoreFlusher
- type KVStoreFlusherOption
- type KVStoreForRangeIndex
- type KVStoreWithBuffer
- type KVStoreWithRange
- type MockKVStore
- func (m *MockKVStore) Delete(arg0 string, arg1 []byte) error
- func (m *MockKVStore) EXPECT() *MockKVStoreMockRecorder
- func (m *MockKVStore) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)
- func (m *MockKVStore) Get(arg0 string, arg1 []byte) ([]byte, error)
- func (m *MockKVStore) Put(arg0 string, arg1, arg2 []byte) error
- func (m *MockKVStore) Start(arg0 context.Context) error
- func (m *MockKVStore) Stop(arg0 context.Context) error
- func (m *MockKVStore) WriteBatch(arg0 batch.KVStoreBatch) error
- type MockKVStoreBasic
- func (m *MockKVStoreBasic) Delete(arg0 string, arg1 []byte) error
- func (m *MockKVStoreBasic) EXPECT() *MockKVStoreBasicMockRecorder
- func (m *MockKVStoreBasic) Get(arg0 string, arg1 []byte) ([]byte, error)
- func (m *MockKVStoreBasic) Put(arg0 string, arg1, arg2 []byte) error
- func (m *MockKVStoreBasic) Start(arg0 context.Context) error
- func (m *MockKVStoreBasic) Stop(arg0 context.Context) error
- type MockKVStoreBasicMockRecorder
- func (mr *MockKVStoreBasicMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreBasicMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreBasicMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockKVStoreBasicMockRecorder) Start(arg0 interface{}) *gomock.Call
- func (mr *MockKVStoreBasicMockRecorder) Stop(arg0 interface{}) *gomock.Call
- type MockKVStoreForRangeIndex
- func (m *MockKVStoreForRangeIndex) Delete(arg0 string, arg1 []byte) error
- func (m *MockKVStoreForRangeIndex) EXPECT() *MockKVStoreForRangeIndexMockRecorder
- func (m *MockKVStoreForRangeIndex) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)
- func (m *MockKVStoreForRangeIndex) Get(arg0 string, arg1 []byte) ([]byte, error)
- func (m *MockKVStoreForRangeIndex) GetBucketByPrefix(arg0 []byte) ([][]byte, error)
- func (m *MockKVStoreForRangeIndex) GetKeyByPrefix(namespace, prefix []byte) ([][]byte, error)
- func (m *MockKVStoreForRangeIndex) Insert(arg0 []byte, arg1 uint64, arg2 []byte) error
- func (m *MockKVStoreForRangeIndex) Purge(arg0 []byte, arg1 uint64) error
- func (m *MockKVStoreForRangeIndex) Put(arg0 string, arg1, arg2 []byte) error
- func (m *MockKVStoreForRangeIndex) Remove(arg0 []byte, arg1 uint64) error
- func (m *MockKVStoreForRangeIndex) SeekNext(arg0 []byte, arg1 uint64) ([]byte, error)
- func (m *MockKVStoreForRangeIndex) SeekPrev(arg0 []byte, arg1 uint64) ([]byte, error)
- func (m *MockKVStoreForRangeIndex) Start(arg0 context.Context) error
- func (m *MockKVStoreForRangeIndex) Stop(arg0 context.Context) error
- func (m *MockKVStoreForRangeIndex) WriteBatch(arg0 batch.KVStoreBatch) error
- type MockKVStoreForRangeIndexMockRecorder
- func (mr *MockKVStoreForRangeIndexMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) GetBucketByPrefix(arg0 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) GetKeyByPrefix(namespace, prefix interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) Insert(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) Purge(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) Remove(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) SeekNext(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) SeekPrev(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) Start(arg0 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) Stop(arg0 interface{}) *gomock.Call
- func (mr *MockKVStoreForRangeIndexMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call
- type MockKVStoreMockRecorder
- func (mr *MockKVStoreMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockKVStoreMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockKVStoreMockRecorder) Start(arg0 interface{}) *gomock.Call
- func (mr *MockKVStoreMockRecorder) Stop(arg0 interface{}) *gomock.Call
- func (mr *MockKVStoreMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call
- type MockKVStoreWithRange
- func (m *MockKVStoreWithRange) Delete(arg0 string, arg1 []byte) error
- func (m *MockKVStoreWithRange) EXPECT() *MockKVStoreWithRangeMockRecorder
- func (m *MockKVStoreWithRange) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)
- func (m *MockKVStoreWithRange) Get(arg0 string, arg1 []byte) ([]byte, error)
- func (m *MockKVStoreWithRange) Put(arg0 string, arg1, arg2 []byte) error
- func (m *MockKVStoreWithRange) Range(arg0 string, arg1 []byte, arg2 uint64) ([][]byte, error)
- func (m *MockKVStoreWithRange) Start(arg0 context.Context) error
- func (m *MockKVStoreWithRange) Stop(arg0 context.Context) error
- func (m *MockKVStoreWithRange) WriteBatch(arg0 batch.KVStoreBatch) error
- type MockKVStoreWithRangeMockRecorder
- func (mr *MockKVStoreWithRangeMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreWithRangeMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockKVStoreWithRangeMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockKVStoreWithRangeMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockKVStoreWithRangeMockRecorder) Range(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockKVStoreWithRangeMockRecorder) Start(arg0 interface{}) *gomock.Call
- func (mr *MockKVStoreWithRangeMockRecorder) Stop(arg0 interface{}) *gomock.Call
- func (mr *MockKVStoreWithRangeMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call
- type RangeIndex
Constants ¶
This section is empty.
Variables ¶
var ( // CountKey is the special key to store the size of index, it satisfies bytes.Compare(CountKey, MinUint64) = -1 CountKey = []byte{0, 0, 0, 0, 0, 0, 0} // ZeroIndex is 8-byte of 0 ZeroIndex = byteutil.Uint64ToBytesBigEndian(0) // ErrInvalid indicates an invalid input ErrInvalid = errors.New("invalid input") )
var ( // ErrBucketNotExist indicates certain bucket does not exist in db ErrBucketNotExist = errors.New("bucket not exist in DB") // ErrNotExist indicates certain item does not exist in Blockchain database ErrNotExist = errors.New("not exist in DB") // ErrIO indicates the generic error of DB I/O operation ErrIO = errors.New("DB I/O operation error") // ErrNotSupported indicates that api is not supported ErrNotSupported = errors.New("not supported") )
var ( // MaxKey is the special key such that bytes.Compare(MaxUint64, MaxKey) = -1 MaxKey = []byte{255, 255, 255, 255, 255, 255, 255, 255, 0} // NotExist is the empty byte slice to indicate a key does not exist (as a result of calling Purge()) NotExist = []byte{} )
var DefaultConfig = Config{ NumRetries: 3, MaxCacheSize: 64, BlockStoreBatchSize: 16, V2BlocksToSplitDB: 1000000, Compressor: "Snappy", CompressLegacy: false, SplitDBSizeMB: 0, SplitDBHeight: 900000, HistoryStateRetention: 2000, }
DefaultConfig returns the default config
var ( // ErrDBNotStarted represents the error when a db has not started ErrDBNotStarted = errors.New("db has not started") )
Functions ¶
This section is empty.
Types ¶
type BoltDB ¶ added in v1.1.2
BoltDB is KVStore implementation based bolt DB
func (*BoltDB) BucketExists ¶ added in v1.1.2
BucketExists returns true if bucket exists
func (*BoltDB) Delete ¶ added in v1.1.2
Delete deletes a record,if key is nil,this will delete the whole bucket
func (*BoltDB) Filter ¶ added in v1.1.2
func (b *BoltDB) Filter(namespace string, cond Condition, minKey, maxKey []byte) ([][]byte, [][]byte, error)
Filter returns <k, v> pair in a bucket that meet the condition
func (*BoltDB) GetBucketByPrefix ¶ added in v1.1.2
GetBucketByPrefix retrieves all bucket those with const namespace prefix
func (*BoltDB) GetKeyByPrefix ¶ added in v1.1.2
GetKeyByPrefix retrieves all keys those with const prefix
func (*BoltDB) SeekNext ¶ added in v1.6.3
SeekNext returns value by the key (if key not exist, use next key)
func (*BoltDB) SeekPrev ¶ added in v1.6.3
SeekPrev returns value by the key (if key not exist, use previous key)
func (*BoltDB) Start ¶ added in v1.1.2
Start opens the BoltDB (creates new file if not existing yet)
func (*BoltDB) WriteBatch ¶ added in v1.1.2
func (b *BoltDB) WriteBatch(kvsb batch.KVStoreBatch) (err error)
WriteBatch commits a batch
type Config ¶ added in v1.2.1
type Config struct { DbPath string `yaml:"dbPath"` // NumRetries is the number of retries NumRetries uint8 `yaml:"numRetries"` // MaxCacheSize is the max number of blocks that will be put into an LRU cache. 0 means disabled MaxCacheSize int `yaml:"maxCacheSize"` // BlockStoreBatchSize is the number of blocks to be stored together as a unit (to get better compression) BlockStoreBatchSize int `yaml:"blockStoreBatchSize"` // V2BlocksToSplitDB is the accumulated number of blocks to split a new file after v1.1.2 V2BlocksToSplitDB uint64 `yaml:"v2BlocksToSplitDB"` // Compressor is the compression used on block data, used by new DB file after v1.1.2 Compressor string `yaml:"compressor"` // CompressLegacy enables gzip compression on block data, used by legacy DB file before v1.1.2 CompressLegacy bool `yaml:"compressLegacy"` // SplitDBSize is the config for DB's split file size SplitDBSizeMB uint64 `yaml:"splitDBSizeMB"` // SplitDBHeight is the config for DB's split start height SplitDBHeight uint64 `yaml:"splitDBHeight"` // HistoryStateRetention is the number of blocks account/contract state will be retained HistoryStateRetention uint64 `yaml:"historyStateRetention"` }
Config is the config for database
func (Config) SplitDBSize ¶ added in v1.2.1
SplitDBSize returns the configured SplitDBSizeMB
type CountingIndex ¶ added in v0.9.0
type CountingIndex interface { // Size returns the total number of keys so far Size() uint64 // Add inserts a value into the index Add([]byte, bool) error // Get return value of key[slot] Get(uint64) ([]byte, error) // Range return value of keys [start, start+count) Range(uint64, uint64) ([][]byte, error) // Revert removes entries from end Revert(uint64) error // Close makes the index not usable Close() // Commit commits the batch Commit() error // UseBatch UseBatch(batch.KVStoreBatch) error // Finalize Finalize() error }
CountingIndex is a bucket of <k, v> where k consists of 8-byte whose value increments (0, 1, 2 ... n) upon each insertion the special key CountKey stores the total number of items in bucket so far
func GetCountingIndex ¶ added in v0.11.0
func GetCountingIndex(kv KVStore, name []byte) (CountingIndex, error)
GetCountingIndex return an existing counting index
func NewCountingIndexNX ¶ added in v0.11.0
func NewCountingIndexNX(kv KVStore, name []byte) (CountingIndex, error)
NewCountingIndexNX creates a new counting index if it does not exist, otherwise return existing index
type KVStore ¶
type KVStore interface { KVStoreBasic // WriteBatch commits a batch WriteBatch(batch.KVStoreBatch) error // Filter returns <k, v> pair in a bucket that meet the condition Filter(string, Condition, []byte, []byte) ([][]byte, [][]byte, error) }
KVStore is a KVStore with WriteBatch API
func NewKvStoreWithCache ¶ added in v1.1.2
NewKvStoreWithCache wraps kvstore with stateCaches
type KVStoreBasic ¶ added in v0.11.0
type KVStoreBasic interface { lifecycle.StartStopper // Put insert or update a record identified by (namespace, key) Put(string, []byte, []byte) error // Get gets a record by (namespace, key) Get(string, []byte) ([]byte, error) // Delete deletes a record by (namespace, key) Delete(string, []byte) error }
KVStoreBasic is the interface of basic KV store.
type KVStoreFlusher ¶ added in v0.11.0
type KVStoreFlusher interface { SerializeQueue() []byte Flush() error KVStoreWithBuffer() KVStoreWithBuffer BaseKVStore() KVStore }
KVStoreFlusher is a wrapper of KVStoreWithBuffer, which has flush api
func NewKVStoreFlusher ¶ added in v0.11.0
func NewKVStoreFlusher(store KVStore, buffer batch.CachedBatch, opts ...KVStoreFlusherOption) (KVStoreFlusher, error)
NewKVStoreFlusher returns kv store flusher
type KVStoreFlusherOption ¶ added in v0.11.0
type KVStoreFlusherOption func(*flusher) error
KVStoreFlusherOption sets option for KVStoreFlusher
func FlushTranslateOption ¶ added in v0.11.0
func FlushTranslateOption(wit batch.WriteInfoTranslate) KVStoreFlusherOption
FlushTranslateOption sets the translate for flush
func SerializeFilterOption ¶ added in v0.11.0
func SerializeFilterOption(filter batch.WriteInfoFilter) KVStoreFlusherOption
SerializeFilterOption sets the filter for serialize write queue
func SerializeOption ¶ added in v0.11.0
func SerializeOption(wis batch.WriteInfoSerialize) KVStoreFlusherOption
SerializeOption sets the serialize function for write queue
type KVStoreForRangeIndex ¶ added in v0.11.0
type KVStoreForRangeIndex interface { KVStore // Insert inserts a value into the index Insert([]byte, uint64, []byte) error // SeekNext returns value by the key (if key not exist, use next key) SeekNext([]byte, uint64) ([]byte, error) // Remove removes an existing key Remove([]byte, uint64) error // Purge deletes an existing key and all keys before it Purge([]byte, uint64) error // GetBucketByPrefix retrieves all bucket those with const namespace prefix GetBucketByPrefix([]byte) ([][]byte, error) // GetKeyByPrefix retrieves all keys those with const prefix GetKeyByPrefix(namespace, prefix []byte) ([][]byte, error) // SeekPrev returns value by the key (if key not exist, use previous key) SeekPrev([]byte, uint64) ([]byte, error) }
KVStoreForRangeIndex is KVStore for range index
func NewMemKVStore ¶
func NewMemKVStore() KVStoreForRangeIndex
NewMemKVStore instantiates an in-memory KV store
type KVStoreWithBuffer ¶ added in v0.11.0
type KVStoreWithBuffer interface { KVStore // contains filtered or unexported methods }
KVStoreWithBuffer defines a KVStore with a buffer, which enables snapshot, revert, and transaction with multiple writes
type KVStoreWithRange ¶ added in v0.11.0
type KVStoreWithRange interface { KVStore // Range gets a range of records by (namespace, key, count) Range(string, []byte, uint64) ([][]byte, error) }
KVStoreWithRange is KVStore with Range() API
type MockKVStore ¶ added in v0.11.0
type MockKVStore struct {
// contains filtered or unexported fields
}
MockKVStore is a mock of KVStore interface.
func NewMockKVStore ¶ added in v0.11.0
func NewMockKVStore(ctrl *gomock.Controller) *MockKVStore
NewMockKVStore creates a new mock instance.
func (*MockKVStore) Delete ¶ added in v0.11.0
func (m *MockKVStore) Delete(arg0 string, arg1 []byte) error
Delete mocks base method.
func (*MockKVStore) EXPECT ¶ added in v0.11.0
func (m *MockKVStore) EXPECT() *MockKVStoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockKVStore) Filter ¶ added in v0.11.0
func (m *MockKVStore) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)
Filter mocks base method.
func (*MockKVStore) Get ¶ added in v0.11.0
func (m *MockKVStore) Get(arg0 string, arg1 []byte) ([]byte, error)
Get mocks base method.
func (*MockKVStore) Put ¶ added in v0.11.0
func (m *MockKVStore) Put(arg0 string, arg1, arg2 []byte) error
Put mocks base method.
func (*MockKVStore) Start ¶ added in v0.11.0
func (m *MockKVStore) Start(arg0 context.Context) error
Start mocks base method.
func (*MockKVStore) Stop ¶ added in v0.11.0
func (m *MockKVStore) Stop(arg0 context.Context) error
Stop mocks base method.
func (*MockKVStore) WriteBatch ¶ added in v0.11.0
func (m *MockKVStore) WriteBatch(arg0 batch.KVStoreBatch) error
WriteBatch mocks base method.
type MockKVStoreBasic ¶ added in v0.11.0
type MockKVStoreBasic struct {
// contains filtered or unexported fields
}
MockKVStoreBasic is a mock of KVStoreBasic interface.
func NewMockKVStoreBasic ¶ added in v0.11.0
func NewMockKVStoreBasic(ctrl *gomock.Controller) *MockKVStoreBasic
NewMockKVStoreBasic creates a new mock instance.
func (*MockKVStoreBasic) Delete ¶ added in v0.11.0
func (m *MockKVStoreBasic) Delete(arg0 string, arg1 []byte) error
Delete mocks base method.
func (*MockKVStoreBasic) EXPECT ¶ added in v0.11.0
func (m *MockKVStoreBasic) EXPECT() *MockKVStoreBasicMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockKVStoreBasic) Get ¶ added in v0.11.0
func (m *MockKVStoreBasic) Get(arg0 string, arg1 []byte) ([]byte, error)
Get mocks base method.
func (*MockKVStoreBasic) Put ¶ added in v0.11.0
func (m *MockKVStoreBasic) Put(arg0 string, arg1, arg2 []byte) error
Put mocks base method.
type MockKVStoreBasicMockRecorder ¶ added in v0.11.0
type MockKVStoreBasicMockRecorder struct {
// contains filtered or unexported fields
}
MockKVStoreBasicMockRecorder is the mock recorder for MockKVStoreBasic.
func (*MockKVStoreBasicMockRecorder) Delete ¶ added in v0.11.0
func (mr *MockKVStoreBasicMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockKVStoreBasicMockRecorder) Get ¶ added in v0.11.0
func (mr *MockKVStoreBasicMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
Get indicates an expected call of Get.
func (*MockKVStoreBasicMockRecorder) Put ¶ added in v0.11.0
func (mr *MockKVStoreBasicMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call
Put indicates an expected call of Put.
func (*MockKVStoreBasicMockRecorder) Start ¶ added in v0.11.0
func (mr *MockKVStoreBasicMockRecorder) Start(arg0 interface{}) *gomock.Call
Start indicates an expected call of Start.
func (*MockKVStoreBasicMockRecorder) Stop ¶ added in v0.11.0
func (mr *MockKVStoreBasicMockRecorder) Stop(arg0 interface{}) *gomock.Call
Stop indicates an expected call of Stop.
type MockKVStoreForRangeIndex ¶ added in v0.11.0
type MockKVStoreForRangeIndex struct {
// contains filtered or unexported fields
}
MockKVStoreForRangeIndex is a mock of KVStoreForRangeIndex interface.
func NewMockKVStoreForRangeIndex ¶ added in v0.11.0
func NewMockKVStoreForRangeIndex(ctrl *gomock.Controller) *MockKVStoreForRangeIndex
NewMockKVStoreForRangeIndex creates a new mock instance.
func (*MockKVStoreForRangeIndex) Delete ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) Delete(arg0 string, arg1 []byte) error
Delete mocks base method.
func (*MockKVStoreForRangeIndex) EXPECT ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) EXPECT() *MockKVStoreForRangeIndexMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockKVStoreForRangeIndex) Filter ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)
Filter mocks base method.
func (*MockKVStoreForRangeIndex) Get ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) Get(arg0 string, arg1 []byte) ([]byte, error)
Get mocks base method.
func (*MockKVStoreForRangeIndex) GetBucketByPrefix ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) GetBucketByPrefix(arg0 []byte) ([][]byte, error)
GetBucketByPrefix mocks base method.
func (*MockKVStoreForRangeIndex) GetKeyByPrefix ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) GetKeyByPrefix(namespace, prefix []byte) ([][]byte, error)
GetKeyByPrefix mocks base method.
func (*MockKVStoreForRangeIndex) Insert ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) Insert(arg0 []byte, arg1 uint64, arg2 []byte) error
Insert mocks base method.
func (*MockKVStoreForRangeIndex) Purge ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) Purge(arg0 []byte, arg1 uint64) error
Purge mocks base method.
func (*MockKVStoreForRangeIndex) Put ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) Put(arg0 string, arg1, arg2 []byte) error
Put mocks base method.
func (*MockKVStoreForRangeIndex) Remove ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) Remove(arg0 []byte, arg1 uint64) error
Remove mocks base method.
func (*MockKVStoreForRangeIndex) SeekNext ¶ added in v1.6.3
func (m *MockKVStoreForRangeIndex) SeekNext(arg0 []byte, arg1 uint64) ([]byte, error)
SeekNext mocks base method.
func (*MockKVStoreForRangeIndex) SeekPrev ¶ added in v1.6.3
func (m *MockKVStoreForRangeIndex) SeekPrev(arg0 []byte, arg1 uint64) ([]byte, error)
SeekPrev mocks base method.
func (*MockKVStoreForRangeIndex) Start ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) Start(arg0 context.Context) error
Start mocks base method.
func (*MockKVStoreForRangeIndex) Stop ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) Stop(arg0 context.Context) error
Stop mocks base method.
func (*MockKVStoreForRangeIndex) WriteBatch ¶ added in v0.11.0
func (m *MockKVStoreForRangeIndex) WriteBatch(arg0 batch.KVStoreBatch) error
WriteBatch mocks base method.
type MockKVStoreForRangeIndexMockRecorder ¶ added in v0.11.0
type MockKVStoreForRangeIndexMockRecorder struct {
// contains filtered or unexported fields
}
MockKVStoreForRangeIndexMockRecorder is the mock recorder for MockKVStoreForRangeIndex.
func (*MockKVStoreForRangeIndexMockRecorder) Delete ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockKVStoreForRangeIndexMockRecorder) Filter ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
Filter indicates an expected call of Filter.
func (*MockKVStoreForRangeIndexMockRecorder) Get ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
Get indicates an expected call of Get.
func (*MockKVStoreForRangeIndexMockRecorder) GetBucketByPrefix ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) GetBucketByPrefix(arg0 interface{}) *gomock.Call
GetBucketByPrefix indicates an expected call of GetBucketByPrefix.
func (*MockKVStoreForRangeIndexMockRecorder) GetKeyByPrefix ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) GetKeyByPrefix(namespace, prefix interface{}) *gomock.Call
GetKeyByPrefix indicates an expected call of GetKeyByPrefix.
func (*MockKVStoreForRangeIndexMockRecorder) Insert ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) Insert(arg0, arg1, arg2 interface{}) *gomock.Call
Insert indicates an expected call of Insert.
func (*MockKVStoreForRangeIndexMockRecorder) Purge ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) Purge(arg0, arg1 interface{}) *gomock.Call
Purge indicates an expected call of Purge.
func (*MockKVStoreForRangeIndexMockRecorder) Put ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call
Put indicates an expected call of Put.
func (*MockKVStoreForRangeIndexMockRecorder) Remove ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) Remove(arg0, arg1 interface{}) *gomock.Call
Remove indicates an expected call of Remove.
func (*MockKVStoreForRangeIndexMockRecorder) SeekNext ¶ added in v1.6.3
func (mr *MockKVStoreForRangeIndexMockRecorder) SeekNext(arg0, arg1 interface{}) *gomock.Call
SeekNext indicates an expected call of SeekNext.
func (*MockKVStoreForRangeIndexMockRecorder) SeekPrev ¶ added in v1.6.3
func (mr *MockKVStoreForRangeIndexMockRecorder) SeekPrev(arg0, arg1 interface{}) *gomock.Call
SeekPrev indicates an expected call of SeekPrev.
func (*MockKVStoreForRangeIndexMockRecorder) Start ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) Start(arg0 interface{}) *gomock.Call
Start indicates an expected call of Start.
func (*MockKVStoreForRangeIndexMockRecorder) Stop ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) Stop(arg0 interface{}) *gomock.Call
Stop indicates an expected call of Stop.
func (*MockKVStoreForRangeIndexMockRecorder) WriteBatch ¶ added in v0.11.0
func (mr *MockKVStoreForRangeIndexMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call
WriteBatch indicates an expected call of WriteBatch.
type MockKVStoreMockRecorder ¶ added in v0.11.0
type MockKVStoreMockRecorder struct {
// contains filtered or unexported fields
}
MockKVStoreMockRecorder is the mock recorder for MockKVStore.
func (*MockKVStoreMockRecorder) Delete ¶ added in v0.11.0
func (mr *MockKVStoreMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockKVStoreMockRecorder) Filter ¶ added in v0.11.0
func (mr *MockKVStoreMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
Filter indicates an expected call of Filter.
func (*MockKVStoreMockRecorder) Get ¶ added in v0.11.0
func (mr *MockKVStoreMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
Get indicates an expected call of Get.
func (*MockKVStoreMockRecorder) Put ¶ added in v0.11.0
func (mr *MockKVStoreMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call
Put indicates an expected call of Put.
func (*MockKVStoreMockRecorder) Start ¶ added in v0.11.0
func (mr *MockKVStoreMockRecorder) Start(arg0 interface{}) *gomock.Call
Start indicates an expected call of Start.
func (*MockKVStoreMockRecorder) Stop ¶ added in v0.11.0
func (mr *MockKVStoreMockRecorder) Stop(arg0 interface{}) *gomock.Call
Stop indicates an expected call of Stop.
func (*MockKVStoreMockRecorder) WriteBatch ¶ added in v0.11.0
func (mr *MockKVStoreMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call
WriteBatch indicates an expected call of WriteBatch.
type MockKVStoreWithRange ¶ added in v0.11.0
type MockKVStoreWithRange struct {
// contains filtered or unexported fields
}
MockKVStoreWithRange is a mock of KVStoreWithRange interface.
func NewMockKVStoreWithRange ¶ added in v0.11.0
func NewMockKVStoreWithRange(ctrl *gomock.Controller) *MockKVStoreWithRange
NewMockKVStoreWithRange creates a new mock instance.
func (*MockKVStoreWithRange) Delete ¶ added in v0.11.0
func (m *MockKVStoreWithRange) Delete(arg0 string, arg1 []byte) error
Delete mocks base method.
func (*MockKVStoreWithRange) EXPECT ¶ added in v0.11.0
func (m *MockKVStoreWithRange) EXPECT() *MockKVStoreWithRangeMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockKVStoreWithRange) Filter ¶ added in v0.11.0
func (m *MockKVStoreWithRange) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)
Filter mocks base method.
func (*MockKVStoreWithRange) Get ¶ added in v0.11.0
func (m *MockKVStoreWithRange) Get(arg0 string, arg1 []byte) ([]byte, error)
Get mocks base method.
func (*MockKVStoreWithRange) Put ¶ added in v0.11.0
func (m *MockKVStoreWithRange) Put(arg0 string, arg1, arg2 []byte) error
Put mocks base method.
func (*MockKVStoreWithRange) Start ¶ added in v0.11.0
func (m *MockKVStoreWithRange) Start(arg0 context.Context) error
Start mocks base method.
func (*MockKVStoreWithRange) Stop ¶ added in v0.11.0
func (m *MockKVStoreWithRange) Stop(arg0 context.Context) error
Stop mocks base method.
func (*MockKVStoreWithRange) WriteBatch ¶ added in v0.11.0
func (m *MockKVStoreWithRange) WriteBatch(arg0 batch.KVStoreBatch) error
WriteBatch mocks base method.
type MockKVStoreWithRangeMockRecorder ¶ added in v0.11.0
type MockKVStoreWithRangeMockRecorder struct {
// contains filtered or unexported fields
}
MockKVStoreWithRangeMockRecorder is the mock recorder for MockKVStoreWithRange.
func (*MockKVStoreWithRangeMockRecorder) Delete ¶ added in v0.11.0
func (mr *MockKVStoreWithRangeMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockKVStoreWithRangeMockRecorder) Filter ¶ added in v0.11.0
func (mr *MockKVStoreWithRangeMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
Filter indicates an expected call of Filter.
func (*MockKVStoreWithRangeMockRecorder) Get ¶ added in v0.11.0
func (mr *MockKVStoreWithRangeMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
Get indicates an expected call of Get.
func (*MockKVStoreWithRangeMockRecorder) Put ¶ added in v0.11.0
func (mr *MockKVStoreWithRangeMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call
Put indicates an expected call of Put.
func (*MockKVStoreWithRangeMockRecorder) Range ¶ added in v0.11.0
func (mr *MockKVStoreWithRangeMockRecorder) Range(arg0, arg1, arg2 interface{}) *gomock.Call
Range indicates an expected call of Range.
func (*MockKVStoreWithRangeMockRecorder) Start ¶ added in v0.11.0
func (mr *MockKVStoreWithRangeMockRecorder) Start(arg0 interface{}) *gomock.Call
Start indicates an expected call of Start.
func (*MockKVStoreWithRangeMockRecorder) Stop ¶ added in v0.11.0
func (mr *MockKVStoreWithRangeMockRecorder) Stop(arg0 interface{}) *gomock.Call
Stop indicates an expected call of Stop.
func (*MockKVStoreWithRangeMockRecorder) WriteBatch ¶ added in v0.11.0
func (mr *MockKVStoreWithRangeMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call
WriteBatch indicates an expected call of WriteBatch.
type RangeIndex ¶ added in v0.11.0
type RangeIndex interface { // Insert inserts a value into the index Insert(uint64, []byte) error // Get returns value by the key Get(uint64) ([]byte, error) // Delete deletes an existing key Delete(uint64) error // Purge deletes an existing key and all keys before it Purge(uint64) error // Close makes the index not usable Close() }
RangeIndex is a bucket of sparse <k, v> pair, where k consists of 8-byte value and all keys that falls in 2 consecutive k have the same v for example, given 3 entries in the bucket:
k = 0x0000000000000004 ==> v1 k = 0x0000000000000123 ==> v2 k = 0x0000000000005678 ==> v3
we have: for all key 0x0 <= k < 0x4, value[k] = initial value for all key 0x4 <= k < 0x123, value[k] = v1 for all key 0x123 <= k < 0x5678, value[k] = v2 for all key k >= 0x5678, value[k] = v3
func NewRangeIndex ¶ added in v0.11.0
func NewRangeIndex(kv KVStore, name, init []byte) (RangeIndex, error)
NewRangeIndex creates a new instance of rangeIndex