store_leveldb

package module
v0.0.0-...-5c6d30d Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

README

store-leveldb

介绍

perseus 链存储组件-leveldb

软件架构

软件架构说明

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

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

View Source
var DbType_Leveldb = "leveldb"

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) GetDbType

func (h *LevelDBHandle) GetDbType() string

GetDbType returns db type

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"`
	WriteBatchSize         uint64 `mapstructure:"write_batch_size"`
	WriteBufferSize        int    `mapstructure:"write_buffer_size"`
	BloomFilterBits        int    `mapstructure:"bloom_filter_bits"`
	NoSync                 bool   `mapstructure:"no_sync"`
	DisableBufferPool      bool   `mapstructure:"disable_buffer_pool"`
	Compression            uint   `mapstructure:"compression"`
	DisableBlockCache      bool   `mapstructure:"disable_block_cache"`
	BlockCacheCapacity     int    `mapstructure:"block_cache_capacity"`
	BlockSize              int    `mapstructure:"block_size"`
	CompactionTableSize    int    `mapstructure:"compaction_table_size"`
	CompactionTotalSize    int    `mapstructure:"compaction_total_size"`
	WriteL0PauseTrigger    int    `mapstructure:"write_l0_pause_trigger"`
	WriteL0SlowdownTrigger int    `mapstructure:"write_l0_slowdown_trigger"`
	CompactionL0Trigger    int    `mapstructure:"compaction_l0_trigger"`
}

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) GetDbType

func (db *MemdbHandle) GetDbType() string

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