badgerdbprovider

package module
v0.0.0-...-2cc8c9a Latest Latest
Warning

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

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

README

store-badgerdb

介绍

hercules 链badgerdb账本存储模块

软件架构

软件架构说明

安装教程
  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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerDBHandle

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

BadgerDBHandle encapsulated handle to badgerDB

func NewBadgerDBHandle

func NewBadgerDBHandle(input *NewBadgerDBOptions) *BadgerDBHandle

func (*BadgerDBHandle) Close

func (h *BadgerDBHandle) Close() error

Close closes the badgerdb

func (*BadgerDBHandle) CompactRange

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

CompactRange compacts the underlying DB for the given key range.

func (*BadgerDBHandle) Delete

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

Delete deletes the given key

func (*BadgerDBHandle) Get

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

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

func (*BadgerDBHandle) GetDbType

func (h *BadgerDBHandle) GetDbType() string

GetDbType returns db type

func (*BadgerDBHandle) GetWriteBatchSize

func (h *BadgerDBHandle) GetWriteBatchSize() uint64

GetWriteBatchSize returns write batch size

func (*BadgerDBHandle) Has

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

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

func (*BadgerDBHandle) NewIteratorWithPrefix

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

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

func (*BadgerDBHandle) NewIteratorWithRange

func (h *BadgerDBHandle) 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 (*BadgerDBHandle) Put

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

Put saves the key-values

func (*BadgerDBHandle) WriteBatch

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

WriteBatch writes a batch in an atomic operation

type BadgerDbConfig

type BadgerDbConfig struct {
	StorePath      string `mapstructure:"store_path"`
	Compression    uint8  `mapstructure:"compression"`
	ValueThreshold int64  `mapstructure:"value_threshold"`
	WriteBatchSize uint64 `mapstructure:"write_batch_size"`
}

type Iterator

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

func NewIterator

func NewIterator(db *badger.DB, opts badger.IteratorOptions, start []byte, end []byte) *Iterator

func (*Iterator) Error

func (iter *Iterator) Error() error

func (*Iterator) First

func (iter *Iterator) First() bool

func (*Iterator) Key

func (iter *Iterator) Key() []byte

func (*Iterator) Next

func (iter *Iterator) Next() bool

func (*Iterator) Release

func (iter *Iterator) Release()

func (*Iterator) Value

func (iter *Iterator) Value() []byte

type NewBadgerDBOptions

type NewBadgerDBOptions struct {
	Config    *BadgerDbConfig
	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