db

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 13 Imported by: 16

Documentation

Overview

Package db is a generated GoMock package.

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Condition added in v0.11.0

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

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

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
}

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 NewMemKVStore

func NewMemKVStore() KVStore

NewMemKVStore instantiates an in-memory KV store

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
}

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
	// 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 added in v0.11.0

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

func NewBoltDB(cfg config.DB) KVStoreWithBucketFillPercent

NewBoltDB instantiates an BoltDB with implements KVStore

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

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

func (*MockKVStoreBasic) Start added in v0.11.0

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

Start mocks base method

func (*MockKVStoreBasic) Stop added in v0.11.0

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

Stop 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

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) Seek added in v0.11.0

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

Seek mocks base method

func (*MockKVStoreForRangeIndex) Start added in v0.11.0

Start mocks base method

func (*MockKVStoreForRangeIndex) Stop added in v0.11.0

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) Seek added in v0.11.0

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

Seek indicates an expected call of Seek

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 MockKVStoreWithBucketFillPercent added in v0.11.0

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

MockKVStoreWithBucketFillPercent is a mock of KVStoreWithBucketFillPercent interface

func NewMockKVStoreWithBucketFillPercent added in v0.11.0

func NewMockKVStoreWithBucketFillPercent(ctrl *gomock.Controller) *MockKVStoreWithBucketFillPercent

NewMockKVStoreWithBucketFillPercent creates a new mock instance

func (*MockKVStoreWithBucketFillPercent) Delete added in v0.11.0

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

Delete mocks base method

func (*MockKVStoreWithBucketFillPercent) EXPECT added in v0.11.0

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

func (*MockKVStoreWithBucketFillPercent) Filter added in v0.11.0

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

Filter mocks base method

func (*MockKVStoreWithBucketFillPercent) Get added in v0.11.0

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

Get mocks base method

func (*MockKVStoreWithBucketFillPercent) Put added in v0.11.0

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

Put mocks base method

func (*MockKVStoreWithBucketFillPercent) SetBucketFillPercent added in v0.11.0

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

SetBucketFillPercent mocks base method

func (*MockKVStoreWithBucketFillPercent) Start added in v0.11.0

Start mocks base method

func (*MockKVStoreWithBucketFillPercent) Stop added in v0.11.0

Stop mocks base method

func (*MockKVStoreWithBucketFillPercent) WriteBatch added in v0.11.0

WriteBatch mocks base method

type MockKVStoreWithBucketFillPercentMockRecorder added in v0.11.0

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

MockKVStoreWithBucketFillPercentMockRecorder is the mock recorder for MockKVStoreWithBucketFillPercent

func (*MockKVStoreWithBucketFillPercentMockRecorder) Delete added in v0.11.0

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

Delete indicates an expected call of Delete

func (*MockKVStoreWithBucketFillPercentMockRecorder) Filter added in v0.11.0

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

Filter indicates an expected call of Filter

func (*MockKVStoreWithBucketFillPercentMockRecorder) Get added in v0.11.0

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

Get indicates an expected call of Get

func (*MockKVStoreWithBucketFillPercentMockRecorder) Put added in v0.11.0

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

Put indicates an expected call of Put

func (*MockKVStoreWithBucketFillPercentMockRecorder) SetBucketFillPercent added in v0.11.0

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

SetBucketFillPercent indicates an expected call of SetBucketFillPercent

func (*MockKVStoreWithBucketFillPercentMockRecorder) Start added in v0.11.0

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

Start indicates an expected call of Start

func (*MockKVStoreWithBucketFillPercentMockRecorder) Stop added in v0.11.0

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

Stop indicates an expected call of Stop

func (*MockKVStoreWithBucketFillPercentMockRecorder) WriteBatch added in v0.11.0

func (mr *MockKVStoreWithBucketFillPercentMockRecorder) 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

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) Range added in v0.11.0

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

Range 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

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

func NewRangeIndex added in v0.11.0

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

NewRangeIndex creates a new instance of rangeIndex

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL