kvmvccmavl

package
v0.0.0-...-5c7291a Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: ISC Imports: 17 Imported by: 0

Documentation

Overview

Package kvmvccmavl kvmvcc+mavl接口

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrStateHashLost ...
	ErrStateHashLost = errors.New("ErrStateHashLost")
)

Functions

func DelMavl

func DelMavl(db dbm.DB)

DelMavl 数据库中mavl数据清除 达到kvmvccMavlFork + 100000 后触发清除

func DisableLog

func DisableLog()

DisableLog disable log output

func EnablePrune

func EnablePrune(enable bool)

EnablePrune 使能裁剪

func New

func New(cfg *types.Store, sub []byte) queue.Module

New construct KVMVCCStore module

func SetLogLevel

func SetLogLevel(level string)

SetLogLevel set log level

func SetPruneHeight

func SetPruneHeight(height int)

SetPruneHeight 设置每次裁剪高度

Types

type KVMVCCStore

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

KVMVCCStore provide kvmvcc store interface implementation

func NewKVMVCC

func NewKVMVCC(sub *subKVMVCCConfig, db dbm.DB) *KVMVCCStore

NewKVMVCC construct KVMVCCStore module

func (*KVMVCCStore) Close

func (mvccs *KVMVCCStore) Close()

Close the KVMVCCStore module

func (*KVMVCCStore) Commit

func (mvccs *KVMVCCStore) Commit(req *types.ReqHash) ([]byte, error)

Commit kvs in the mem of KVMVCCStore module to state db and return the StateHash

func (*KVMVCCStore) CommitUpgrade

func (mvccs *KVMVCCStore) CommitUpgrade(req *types.ReqHash) ([]byte, error)

CommitUpgrade kvs in the mem of KVMVCCStore module to state db and re

func (*KVMVCCStore) Del

func (mvccs *KVMVCCStore) Del(req *types.StoreDel) ([]byte, error)

Del set kvs to nil with StateHash

func (*KVMVCCStore) Get

func (mvccs *KVMVCCStore) Get(datas *types.StoreGet) [][]byte

Get kvs with statehash from KVMVCCStore

func (*KVMVCCStore) GetMaxVersion

func (mvccs *KVMVCCStore) GetMaxVersion() (int64, error)

GetMaxVersion 获取当前最大高度

func (*KVMVCCStore) IterateRangeByStateHash

func (mvccs *KVMVCCStore) IterateRangeByStateHash(statehash []byte, start []byte, end []byte, ascending bool, fn func(key, value []byte) bool)

IterateRangeByStateHash travel with Prefix by StateHash to get the latest version kvs.

func (*KVMVCCStore) MemSet

func (mvccs *KVMVCCStore) MemSet(datas *types.StoreSet, hash []byte, sync bool) ([]byte, error)

MemSet set kvs to the mem of KVMVCCStore module and return the StateHash

func (*KVMVCCStore) ProcEvent

func (mvccs *KVMVCCStore) ProcEvent(msg queue.Message)

ProcEvent handles supported events

func (*KVMVCCStore) Rollback

func (mvccs *KVMVCCStore) Rollback(req *types.ReqHash) ([]byte, error)

Rollback kvs in the mem of KVMVCCStore module and return the StateHash

func (*KVMVCCStore) Set

func (mvccs *KVMVCCStore) Set(datas *types.StoreSet, hash []byte, sync bool) ([]byte, error)

Set kvs with statehash to KVMVCCStore

type KVmMavlStore

type KVmMavlStore struct {
	*drivers.BaseStore
	*KVMVCCStore
	*MavlStore
	// contains filtered or unexported fields
}

KVmMavlStore provide kvmvcc and mavl store interface implementation

func (*KVmMavlStore) Close

func (kvmMavls *KVmMavlStore) Close()

Close the KVmMavlStore module

func (*KVmMavlStore) Commit

func (kvmMavls *KVmMavlStore) Commit(req *types.ReqHash) ([]byte, error)

Commit kvs in the mem of KVmMavlStore module to state db and return the StateHash

func (*KVmMavlStore) CommitUpgrade

func (kvmMavls *KVmMavlStore) CommitUpgrade(req *types.ReqHash) ([]byte, error)

CommitUpgrade kvs in the mem of KVmMavlStore module to state db and return the StateHash

func (*KVmMavlStore) Del

func (kvmMavls *KVmMavlStore) Del(req *types.StoreDel) ([]byte, error)

Del set kvs to nil with StateHash

func (*KVmMavlStore) Get

func (kvmMavls *KVmMavlStore) Get(datas *types.StoreGet) [][]byte

Get kvs with statehash from KVmMavlStore

func (*KVmMavlStore) IterateRangeByStateHash

func (kvmMavls *KVmMavlStore) IterateRangeByStateHash(statehash []byte, start []byte, end []byte, ascending bool, fn func(key, value []byte) bool)

IterateRangeByStateHash travel with Prefix by StateHash to get the latest version kvs.

func (*KVmMavlStore) MemSet

func (kvmMavls *KVmMavlStore) MemSet(datas *types.StoreSet, sync bool) ([]byte, error)

MemSet set kvs to the mem of KVmMavlStore module and return the StateHash

func (*KVmMavlStore) MemSetUpgrade

func (kvmMavls *KVmMavlStore) MemSetUpgrade(datas *types.StoreSet, sync bool) ([]byte, error)

MemSetUpgrade set kvs to the mem of KVmMavlStore module not cache the tree and return the StateHash

func (*KVmMavlStore) ProcEvent

func (kvmMavls *KVmMavlStore) ProcEvent(msg *queue.Message)

ProcEvent handles supported events

func (*KVmMavlStore) Rollback

func (kvmMavls *KVmMavlStore) Rollback(req *types.ReqHash) ([]byte, error)

Rollback kvs in the mem of KVmMavlStore module and return the StateHash

func (*KVmMavlStore) Set

func (kvmMavls *KVmMavlStore) Set(datas *types.StoreSet, sync bool) ([]byte, error)

Set kvs with statehash to KVmMavlStore

type MavlStore

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

MavlStore mavl store struct

func NewMavl

func NewMavl(sub *subMavlConfig, db dbm.DB) *MavlStore

NewMavl new mavl store module

func (*MavlStore) Close

func (mavls *MavlStore) Close()

Close close mavl store

func (*MavlStore) Commit

func (mavls *MavlStore) Commit(req *types.ReqHash) ([]byte, error)

Commit convert memcory mavl to storage db

func (*MavlStore) Del

func (mavls *MavlStore) Del(req *types.StoreDel) ([]byte, error)

Del ...

func (*MavlStore) Get

func (mavls *MavlStore) Get(datas *types.StoreGet) [][]byte

Get get values by keys

func (*MavlStore) IterateRangeByStateHash

func (mavls *MavlStore) IterateRangeByStateHash(statehash []byte, start []byte, end []byte, ascending bool, fn func(key, value []byte) bool)

IterateRangeByStateHash 迭代实现功能; statehash:当前状态hash, start:开始查找的key, end: 结束的key, ascending:升序,降序, fn 迭代回调函数

func (*MavlStore) MemSet

func (mavls *MavlStore) MemSet(datas *types.StoreSet, sync bool) ([]byte, error)

MemSet set keys values to memcory mavl, return root hash and error

func (*MavlStore) MemSetUpgrade

func (mavls *MavlStore) MemSetUpgrade(datas *types.StoreSet, sync bool) ([]byte, error)

MemSetUpgrade 计算hash之后不在内存中存储树

func (*MavlStore) ProcEvent

func (mavls *MavlStore) ProcEvent(msg queue.Message)

ProcEvent not support message

func (*MavlStore) Rollback

func (mavls *MavlStore) Rollback(req *types.ReqHash) ([]byte, error)

Rollback 回退将缓存的mavl树删除掉

func (*MavlStore) Set

func (mavls *MavlStore) Set(datas *types.StoreSet, sync bool) ([]byte, error)

Set set k v to mavl store db; sync is true represent write sync

Jump to

Keyboard shortcuts

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