leveldbprovider

package module
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0 Imports: 15 Imported by: 8

Documentation

Index

Constants

View Source
const (
	//StoreBlockDBDir blockdb folder name
	StoreBlockDBDir = "store_block"
	//StoreStateDBDir statedb folder name
	StoreStateDBDir = "store_state"
	//StoreHistoryDBDir historydb folder name
	StoreHistoryDBDir = "store_history"
	//StoreResultDBDir resultdb folder name
	StoreResultDBDir = "store_result"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptedIterator

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

EncryptedIterator 具有数据解密的迭代器

func NewEncryptedIterator

func NewEncryptedIterator(it iterator.Iterator, encryptor crypto.SymmetricKey) *EncryptedIterator

func (*EncryptedIterator) Error

func (e *EncryptedIterator) Error() error

func (*EncryptedIterator) First

func (e *EncryptedIterator) First() bool

func (*EncryptedIterator) Key

func (e *EncryptedIterator) Key() []byte

func (*EncryptedIterator) Next

func (e *EncryptedIterator) Next() bool

func (*EncryptedIterator) Release

func (e *EncryptedIterator) Release()

func (*EncryptedIterator) Value

func (e *EncryptedIterator) Value() []byte

type LevelDBHandle

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

LevelDBHandle encapsulated handle to leveldb

func NewLevelDBHandle

func NewLevelDBHandle(options *NewLevelDBOptions) *LevelDBHandle

func (*LevelDBHandle) Close

func (h *LevelDBHandle) Close() error

Close closes the leveldb

func (*LevelDBHandle) CompactRange

func (h *LevelDBHandle) CompactRange(start, limit []byte) error

CompactRange compacts the underlying DB for the given key range.

func (*LevelDBHandle) Delete

func (h *LevelDBHandle) Delete(key []byte) error

Delete deletes the given key

func (*LevelDBHandle) Get

func (h *LevelDBHandle) Get(key []byte) ([]byte, error)

Get returns the value for the given key, or returns nil if none exists

func (*LevelDBHandle) GetWriteBatchSize

func (h *LevelDBHandle) GetWriteBatchSize() uint64

func (*LevelDBHandle) Has

func (h *LevelDBHandle) Has(key []byte) (bool, error)

Has return true if the given key exist, or return false if none exists

func (*LevelDBHandle) NewIteratorWithPrefix

func (h *LevelDBHandle) NewIteratorWithPrefix(prefix []byte) (protocol.Iterator, error)

NewIteratorWithPrefix returns an iterator that contains all the key-values with given prefix

func (*LevelDBHandle) NewIteratorWithRange

func (h *LevelDBHandle) NewIteratorWithRange(startKey []byte, limitKey []byte) (protocol.Iterator, error)

NewIteratorWithRange returns an iterator that contains all the key-values between given key ranges start is included in the results and limit is excluded.

func (*LevelDBHandle) Put

func (h *LevelDBHandle) Put(key []byte, value []byte) error

Put saves the key-values

func (*LevelDBHandle) WriteBatch

func (h *LevelDBHandle) WriteBatch(batch protocol.StoreBatcher, sync bool) error

WriteBatch writes a batch in an atomic operation

type LevelDbConfig

type LevelDbConfig struct {
	StorePath            string `mapstructure:"store_path"`
	WriteBufferSize      int    `mapstructure:"write_buffer_size"`
	BloomFilterBits      int    `mapstructure:"bloom_filter_bits"`
	BlockWriteBufferSize int    `mapstructure:"block_write_buffer_size"`
	WriteBatchSize       uint64 `mapstructure:"write_batch_size"`
}

type MemdbHandle

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

func NewMemdbHandle

func NewMemdbHandle() *MemdbHandle

func (*MemdbHandle) Close

func (db *MemdbHandle) Close() error

func (*MemdbHandle) CompactRange

func (db *MemdbHandle) CompactRange(start []byte, limit []byte) error

func (*MemdbHandle) Delete

func (db *MemdbHandle) Delete(key []byte) error

Delete deletes the given key

func (*MemdbHandle) Get

func (db *MemdbHandle) Get(key []byte) ([]byte, error)

func (*MemdbHandle) GetWriteBatchSize

func (db *MemdbHandle) GetWriteBatchSize() uint64

func (*MemdbHandle) Has

func (db *MemdbHandle) Has(key []byte) (bool, error)

Has return true if the given key exist, or return false if none exists

func (*MemdbHandle) NewIteratorWithPrefix

func (db *MemdbHandle) NewIteratorWithPrefix(prefix []byte) (protocol.Iterator, error)

NewIteratorWithPrefix returns an iterator that contains all the key-values with given prefix

func (*MemdbHandle) NewIteratorWithRange

func (db *MemdbHandle) NewIteratorWithRange(start []byte, limit []byte) (protocol.Iterator, error)

NewIteratorWithRange returns an iterator that contains all the key-values between given key ranges start is included in the results and limit is excluded.

func (*MemdbHandle) Put

func (db *MemdbHandle) Put(key []byte, value []byte) error

Put saves the key-values

func (*MemdbHandle) WriteBatch

func (db *MemdbHandle) WriteBatch(batch protocol.StoreBatcher, sync bool) error

WriteBatch writes a batch in an atomic operation

type NewLevelDBOptions

type NewLevelDBOptions struct {
	Config    *LevelDbConfig
	Logger    protocol.Logger
	Encryptor crypto.SymmetricKey
	ChainId   string
	DbFolder  string
}

Jump to

Keyboard shortcuts

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