iotex-core: github.com/iotexproject/iotex-core/db Index | Files | Directories

package db

import "github.com/iotexproject/iotex-core/db"

Package db is a generated GoMock package.

Index

Package Files

counting_index.go db_bolt.go kvstore.go kvstore_impl.go kvstorewithbuffer.go mock_kvstore.go range_index.go

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")
)
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{}
)

type Condition Uses

type Condition func(k, v []byte) bool

Condition spells the condition for <k, v> to be filtered out

type CountingIndex Uses

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
}

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 Uses

func GetCountingIndex(kv KVStore, name []byte) (CountingIndex, error)

GetCountingIndex return an existing counting index

func NewCountingIndexNX Uses

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 Uses

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 NewMemKVStore Uses

func NewMemKVStore() KVStore

NewMemKVStore instantiates an in-memory KV store

type KVStoreBasic Uses

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 Uses

type KVStoreFlusher interface {
    SerializeQueue() []byte
    Flush() error
    KVStoreWithBuffer() KVStoreWithBuffer
}

KVStoreFlusher is a wrapper of KVStoreWithBuffer, which has flush api

func NewKVStoreFlusher Uses

func NewKVStoreFlusher(store KVStore, buffer batch.CachedBatch, opts ...KVStoreFlusherOption) (KVStoreFlusher, error)

NewKVStoreFlusher returns kv store flusher

type KVStoreFlusherOption Uses

type KVStoreFlusherOption func(*flusher) error

KVStoreFlusherOption sets option for KVStoreFlusher

func FlushTranslateOption Uses

func FlushTranslateOption(wit batch.WriteInfoTranslate) KVStoreFlusherOption

FlushTranslateOption sets the translate for flush

func SerializeFilterOption Uses

func SerializeFilterOption(filter batch.WriteInfoFilter) KVStoreFlusherOption

SerializeFilterOption sets the filter for serialize write queue

func SerializeOption Uses

func SerializeOption(wis batch.WriteInfoSerialize) KVStoreFlusherOption

SerializeOption sets the serialize function for write queue

type KVStoreForRangeIndex Uses

type KVStoreForRangeIndex interface {
    KVStore
    // Insert inserts a value into the index
    Insert([]byte, uint64, []byte) error
    // Seek returns value by the key
    Seek([]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)
}

KVStoreForRangeIndex is KVStore for range index

type KVStoreWithBucketFillPercent Uses

type KVStoreWithBucketFillPercent interface {
    KVStore
    // SetBucketFillPercent sets specified fill percent for a bucket
    SetBucketFillPercent(string, float64) error
}

KVStoreWithBucketFillPercent is KVStore with option to set bucket fill percent

func NewBoltDB Uses

func NewBoltDB(cfg config.DB) KVStoreWithBucketFillPercent

NewBoltDB instantiates an BoltDB with implements KVStore

type KVStoreWithBuffer Uses

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 Uses

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 Uses

type MockKVStore struct {
    // contains filtered or unexported fields
}

MockKVStore is a mock of KVStore interface

func NewMockKVStore Uses

func NewMockKVStore(ctrl *gomock.Controller) *MockKVStore

NewMockKVStore creates a new mock instance

func (*MockKVStore) Delete Uses

func (m *MockKVStore) Delete(arg0 string, arg1 []byte) error

Delete mocks base method

func (*MockKVStore) EXPECT Uses

func (m *MockKVStore) EXPECT() *MockKVStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockKVStore) Filter Uses

func (m *MockKVStore) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)

Filter mocks base method

func (*MockKVStore) Get Uses

func (m *MockKVStore) Get(arg0 string, arg1 []byte) ([]byte, error)

Get mocks base method

func (*MockKVStore) Put Uses

func (m *MockKVStore) Put(arg0 string, arg1, arg2 []byte) error

Put mocks base method

func (*MockKVStore) Start Uses

func (m *MockKVStore) Start(arg0 context.Context) error

Start mocks base method

func (*MockKVStore) Stop Uses

func (m *MockKVStore) Stop(arg0 context.Context) error

Stop mocks base method

func (*MockKVStore) WriteBatch Uses

func (m *MockKVStore) WriteBatch(arg0 batch.KVStoreBatch) error

WriteBatch mocks base method

type MockKVStoreBasic Uses

type MockKVStoreBasic struct {
    // contains filtered or unexported fields
}

MockKVStoreBasic is a mock of KVStoreBasic interface

func NewMockKVStoreBasic Uses

func NewMockKVStoreBasic(ctrl *gomock.Controller) *MockKVStoreBasic

NewMockKVStoreBasic creates a new mock instance

func (*MockKVStoreBasic) Delete Uses

func (m *MockKVStoreBasic) Delete(arg0 string, arg1 []byte) error

Delete mocks base method

func (*MockKVStoreBasic) EXPECT Uses

func (m *MockKVStoreBasic) EXPECT() *MockKVStoreBasicMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockKVStoreBasic) Get Uses

func (m *MockKVStoreBasic) Get(arg0 string, arg1 []byte) ([]byte, error)

Get mocks base method

func (*MockKVStoreBasic) Put Uses

func (m *MockKVStoreBasic) Put(arg0 string, arg1, arg2 []byte) error

Put mocks base method

func (*MockKVStoreBasic) Start Uses

func (m *MockKVStoreBasic) Start(arg0 context.Context) error

Start mocks base method

func (*MockKVStoreBasic) Stop Uses

func (m *MockKVStoreBasic) Stop(arg0 context.Context) error

Stop mocks base method

type MockKVStoreBasicMockRecorder Uses

type MockKVStoreBasicMockRecorder struct {
    // contains filtered or unexported fields
}

MockKVStoreBasicMockRecorder is the mock recorder for MockKVStoreBasic

func (*MockKVStoreBasicMockRecorder) Delete Uses

func (mr *MockKVStoreBasicMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call

Delete indicates an expected call of Delete

func (*MockKVStoreBasicMockRecorder) Get Uses

func (mr *MockKVStoreBasicMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockKVStoreBasicMockRecorder) Put Uses

func (mr *MockKVStoreBasicMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call

Put indicates an expected call of Put

func (*MockKVStoreBasicMockRecorder) Start Uses

func (mr *MockKVStoreBasicMockRecorder) Start(arg0 interface{}) *gomock.Call

Start indicates an expected call of Start

func (*MockKVStoreBasicMockRecorder) Stop Uses

func (mr *MockKVStoreBasicMockRecorder) Stop(arg0 interface{}) *gomock.Call

Stop indicates an expected call of Stop

type MockKVStoreForRangeIndex Uses

type MockKVStoreForRangeIndex struct {
    // contains filtered or unexported fields
}

MockKVStoreForRangeIndex is a mock of KVStoreForRangeIndex interface

func NewMockKVStoreForRangeIndex Uses

func NewMockKVStoreForRangeIndex(ctrl *gomock.Controller) *MockKVStoreForRangeIndex

NewMockKVStoreForRangeIndex creates a new mock instance

func (*MockKVStoreForRangeIndex) Delete Uses

func (m *MockKVStoreForRangeIndex) Delete(arg0 string, arg1 []byte) error

Delete mocks base method

func (*MockKVStoreForRangeIndex) EXPECT Uses

func (m *MockKVStoreForRangeIndex) EXPECT() *MockKVStoreForRangeIndexMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockKVStoreForRangeIndex) Filter Uses

func (m *MockKVStoreForRangeIndex) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)

Filter mocks base method

func (*MockKVStoreForRangeIndex) Get Uses

func (m *MockKVStoreForRangeIndex) Get(arg0 string, arg1 []byte) ([]byte, error)

Get mocks base method

func (*MockKVStoreForRangeIndex) GetBucketByPrefix Uses

func (m *MockKVStoreForRangeIndex) GetBucketByPrefix(arg0 []byte) ([][]byte, error)

GetBucketByPrefix mocks base method

func (*MockKVStoreForRangeIndex) GetKeyByPrefix Uses

func (m *MockKVStoreForRangeIndex) GetKeyByPrefix(namespace, prefix []byte) ([][]byte, error)

GetKeyByPrefix mocks base method

func (*MockKVStoreForRangeIndex) Insert Uses

func (m *MockKVStoreForRangeIndex) Insert(arg0 []byte, arg1 uint64, arg2 []byte) error

Insert mocks base method

func (*MockKVStoreForRangeIndex) Purge Uses

func (m *MockKVStoreForRangeIndex) Purge(arg0 []byte, arg1 uint64) error

Purge mocks base method

func (*MockKVStoreForRangeIndex) Put Uses

func (m *MockKVStoreForRangeIndex) Put(arg0 string, arg1, arg2 []byte) error

Put mocks base method

func (*MockKVStoreForRangeIndex) Remove Uses

func (m *MockKVStoreForRangeIndex) Remove(arg0 []byte, arg1 uint64) error

Remove mocks base method

func (*MockKVStoreForRangeIndex) Seek Uses

func (m *MockKVStoreForRangeIndex) Seek(arg0 []byte, arg1 uint64) ([]byte, error)

Seek mocks base method

func (*MockKVStoreForRangeIndex) Start Uses

func (m *MockKVStoreForRangeIndex) Start(arg0 context.Context) error

Start mocks base method

func (*MockKVStoreForRangeIndex) Stop Uses

func (m *MockKVStoreForRangeIndex) Stop(arg0 context.Context) error

Stop mocks base method

func (*MockKVStoreForRangeIndex) WriteBatch Uses

func (m *MockKVStoreForRangeIndex) WriteBatch(arg0 batch.KVStoreBatch) error

WriteBatch mocks base method

type MockKVStoreForRangeIndexMockRecorder Uses

type MockKVStoreForRangeIndexMockRecorder struct {
    // contains filtered or unexported fields
}

MockKVStoreForRangeIndexMockRecorder is the mock recorder for MockKVStoreForRangeIndex

func (*MockKVStoreForRangeIndexMockRecorder) Delete Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call

Delete indicates an expected call of Delete

func (*MockKVStoreForRangeIndexMockRecorder) Filter Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

Filter indicates an expected call of Filter

func (*MockKVStoreForRangeIndexMockRecorder) Get Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockKVStoreForRangeIndexMockRecorder) GetBucketByPrefix Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) GetBucketByPrefix(arg0 interface{}) *gomock.Call

GetBucketByPrefix indicates an expected call of GetBucketByPrefix

func (*MockKVStoreForRangeIndexMockRecorder) GetKeyByPrefix Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) GetKeyByPrefix(namespace, prefix interface{}) *gomock.Call

GetKeyByPrefix indicates an expected call of GetKeyByPrefix

func (*MockKVStoreForRangeIndexMockRecorder) Insert Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Insert(arg0, arg1, arg2 interface{}) *gomock.Call

Insert indicates an expected call of Insert

func (*MockKVStoreForRangeIndexMockRecorder) Purge Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Purge(arg0, arg1 interface{}) *gomock.Call

Purge indicates an expected call of Purge

func (*MockKVStoreForRangeIndexMockRecorder) Put Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call

Put indicates an expected call of Put

func (*MockKVStoreForRangeIndexMockRecorder) Remove Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Remove(arg0, arg1 interface{}) *gomock.Call

Remove indicates an expected call of Remove

func (*MockKVStoreForRangeIndexMockRecorder) Seek Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Seek(arg0, arg1 interface{}) *gomock.Call

Seek indicates an expected call of Seek

func (*MockKVStoreForRangeIndexMockRecorder) Start Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Start(arg0 interface{}) *gomock.Call

Start indicates an expected call of Start

func (*MockKVStoreForRangeIndexMockRecorder) Stop Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) Stop(arg0 interface{}) *gomock.Call

Stop indicates an expected call of Stop

func (*MockKVStoreForRangeIndexMockRecorder) WriteBatch Uses

func (mr *MockKVStoreForRangeIndexMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call

WriteBatch indicates an expected call of WriteBatch

type MockKVStoreMockRecorder Uses

type MockKVStoreMockRecorder struct {
    // contains filtered or unexported fields
}

MockKVStoreMockRecorder is the mock recorder for MockKVStore

func (*MockKVStoreMockRecorder) Delete Uses

func (mr *MockKVStoreMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call

Delete indicates an expected call of Delete

func (*MockKVStoreMockRecorder) Filter Uses

func (mr *MockKVStoreMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

Filter indicates an expected call of Filter

func (*MockKVStoreMockRecorder) Get Uses

func (mr *MockKVStoreMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockKVStoreMockRecorder) Put Uses

func (mr *MockKVStoreMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call

Put indicates an expected call of Put

func (*MockKVStoreMockRecorder) Start Uses

func (mr *MockKVStoreMockRecorder) Start(arg0 interface{}) *gomock.Call

Start indicates an expected call of Start

func (*MockKVStoreMockRecorder) Stop Uses

func (mr *MockKVStoreMockRecorder) Stop(arg0 interface{}) *gomock.Call

Stop indicates an expected call of Stop

func (*MockKVStoreMockRecorder) WriteBatch Uses

func (mr *MockKVStoreMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call

WriteBatch indicates an expected call of WriteBatch

type MockKVStoreWithBucketFillPercent Uses

type MockKVStoreWithBucketFillPercent struct {
    // contains filtered or unexported fields
}

MockKVStoreWithBucketFillPercent is a mock of KVStoreWithBucketFillPercent interface

func NewMockKVStoreWithBucketFillPercent Uses

func NewMockKVStoreWithBucketFillPercent(ctrl *gomock.Controller) *MockKVStoreWithBucketFillPercent

NewMockKVStoreWithBucketFillPercent creates a new mock instance

func (*MockKVStoreWithBucketFillPercent) Delete Uses

func (m *MockKVStoreWithBucketFillPercent) Delete(arg0 string, arg1 []byte) error

Delete mocks base method

func (*MockKVStoreWithBucketFillPercent) EXPECT Uses

func (m *MockKVStoreWithBucketFillPercent) EXPECT() *MockKVStoreWithBucketFillPercentMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockKVStoreWithBucketFillPercent) Filter Uses

func (m *MockKVStoreWithBucketFillPercent) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)

Filter mocks base method

func (*MockKVStoreWithBucketFillPercent) Get Uses

func (m *MockKVStoreWithBucketFillPercent) Get(arg0 string, arg1 []byte) ([]byte, error)

Get mocks base method

func (*MockKVStoreWithBucketFillPercent) Put Uses

func (m *MockKVStoreWithBucketFillPercent) Put(arg0 string, arg1, arg2 []byte) error

Put mocks base method

func (*MockKVStoreWithBucketFillPercent) SetBucketFillPercent Uses

func (m *MockKVStoreWithBucketFillPercent) SetBucketFillPercent(arg0 string, arg1 float64) error

SetBucketFillPercent mocks base method

func (*MockKVStoreWithBucketFillPercent) Start Uses

func (m *MockKVStoreWithBucketFillPercent) Start(arg0 context.Context) error

Start mocks base method

func (*MockKVStoreWithBucketFillPercent) Stop Uses

func (m *MockKVStoreWithBucketFillPercent) Stop(arg0 context.Context) error

Stop mocks base method

func (*MockKVStoreWithBucketFillPercent) WriteBatch Uses

func (m *MockKVStoreWithBucketFillPercent) WriteBatch(arg0 batch.KVStoreBatch) error

WriteBatch mocks base method

type MockKVStoreWithBucketFillPercentMockRecorder Uses

type MockKVStoreWithBucketFillPercentMockRecorder struct {
    // contains filtered or unexported fields
}

MockKVStoreWithBucketFillPercentMockRecorder is the mock recorder for MockKVStoreWithBucketFillPercent

func (*MockKVStoreWithBucketFillPercentMockRecorder) Delete Uses

func (mr *MockKVStoreWithBucketFillPercentMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call

Delete indicates an expected call of Delete

func (*MockKVStoreWithBucketFillPercentMockRecorder) Filter Uses

func (mr *MockKVStoreWithBucketFillPercentMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

Filter indicates an expected call of Filter

func (*MockKVStoreWithBucketFillPercentMockRecorder) Get Uses

func (mr *MockKVStoreWithBucketFillPercentMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockKVStoreWithBucketFillPercentMockRecorder) Put Uses

func (mr *MockKVStoreWithBucketFillPercentMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call

Put indicates an expected call of Put

func (*MockKVStoreWithBucketFillPercentMockRecorder) SetBucketFillPercent Uses

func (mr *MockKVStoreWithBucketFillPercentMockRecorder) SetBucketFillPercent(arg0, arg1 interface{}) *gomock.Call

SetBucketFillPercent indicates an expected call of SetBucketFillPercent

func (*MockKVStoreWithBucketFillPercentMockRecorder) Start Uses

func (mr *MockKVStoreWithBucketFillPercentMockRecorder) Start(arg0 interface{}) *gomock.Call

Start indicates an expected call of Start

func (*MockKVStoreWithBucketFillPercentMockRecorder) Stop Uses

func (mr *MockKVStoreWithBucketFillPercentMockRecorder) Stop(arg0 interface{}) *gomock.Call

Stop indicates an expected call of Stop

func (*MockKVStoreWithBucketFillPercentMockRecorder) WriteBatch Uses

func (mr *MockKVStoreWithBucketFillPercentMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call

WriteBatch indicates an expected call of WriteBatch

type MockKVStoreWithRange Uses

type MockKVStoreWithRange struct {
    // contains filtered or unexported fields
}

MockKVStoreWithRange is a mock of KVStoreWithRange interface

func NewMockKVStoreWithRange Uses

func NewMockKVStoreWithRange(ctrl *gomock.Controller) *MockKVStoreWithRange

NewMockKVStoreWithRange creates a new mock instance

func (*MockKVStoreWithRange) Delete Uses

func (m *MockKVStoreWithRange) Delete(arg0 string, arg1 []byte) error

Delete mocks base method

func (*MockKVStoreWithRange) EXPECT Uses

func (m *MockKVStoreWithRange) EXPECT() *MockKVStoreWithRangeMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockKVStoreWithRange) Filter Uses

func (m *MockKVStoreWithRange) Filter(arg0 string, arg1 Condition, arg2, arg3 []byte) ([][]byte, [][]byte, error)

Filter mocks base method

func (*MockKVStoreWithRange) Get Uses

func (m *MockKVStoreWithRange) Get(arg0 string, arg1 []byte) ([]byte, error)

Get mocks base method

func (*MockKVStoreWithRange) Put Uses

func (m *MockKVStoreWithRange) Put(arg0 string, arg1, arg2 []byte) error

Put mocks base method

func (*MockKVStoreWithRange) Range Uses

func (m *MockKVStoreWithRange) Range(arg0 string, arg1 []byte, arg2 uint64) ([][]byte, error)

Range mocks base method

func (*MockKVStoreWithRange) Start Uses

func (m *MockKVStoreWithRange) Start(arg0 context.Context) error

Start mocks base method

func (*MockKVStoreWithRange) Stop Uses

func (m *MockKVStoreWithRange) Stop(arg0 context.Context) error

Stop mocks base method

func (*MockKVStoreWithRange) WriteBatch Uses

func (m *MockKVStoreWithRange) WriteBatch(arg0 batch.KVStoreBatch) error

WriteBatch mocks base method

type MockKVStoreWithRangeMockRecorder Uses

type MockKVStoreWithRangeMockRecorder struct {
    // contains filtered or unexported fields
}

MockKVStoreWithRangeMockRecorder is the mock recorder for MockKVStoreWithRange

func (*MockKVStoreWithRangeMockRecorder) Delete Uses

func (mr *MockKVStoreWithRangeMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call

Delete indicates an expected call of Delete

func (*MockKVStoreWithRangeMockRecorder) Filter Uses

func (mr *MockKVStoreWithRangeMockRecorder) Filter(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

Filter indicates an expected call of Filter

func (*MockKVStoreWithRangeMockRecorder) Get Uses

func (mr *MockKVStoreWithRangeMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockKVStoreWithRangeMockRecorder) Put Uses

func (mr *MockKVStoreWithRangeMockRecorder) Put(arg0, arg1, arg2 interface{}) *gomock.Call

Put indicates an expected call of Put

func (*MockKVStoreWithRangeMockRecorder) Range Uses

func (mr *MockKVStoreWithRangeMockRecorder) Range(arg0, arg1, arg2 interface{}) *gomock.Call

Range indicates an expected call of Range

func (*MockKVStoreWithRangeMockRecorder) Start Uses

func (mr *MockKVStoreWithRangeMockRecorder) Start(arg0 interface{}) *gomock.Call

Start indicates an expected call of Start

func (*MockKVStoreWithRangeMockRecorder) Stop Uses

func (mr *MockKVStoreWithRangeMockRecorder) Stop(arg0 interface{}) *gomock.Call

Stop indicates an expected call of Stop

func (*MockKVStoreWithRangeMockRecorder) WriteBatch Uses

func (mr *MockKVStoreWithRangeMockRecorder) WriteBatch(arg0 interface{}) *gomock.Call

WriteBatch indicates an expected call of WriteBatch

type RangeIndex Uses

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

position 0 (k = 0x0000000000000000) stores the value to return beyond the largest inserted key

func NewRangeIndex Uses

func NewRangeIndex(kv KVStore, name, init []byte) (RangeIndex, error)

NewRangeIndex creates a new instance of rangeIndex

Directories

PathSynopsis
batch
sql
trie
trie/triepb

Package db imports 12 packages (graph) and is imported by 13 packages. Updated 2020-04-06. Refresh now. Tools for package owners.