onvakv

package module
v0.0.0-...-19f5321 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: BSD-2-Clause Imports: 14 Imported by: 0

README

ONVAKV: the Optimized Non-Volatile Authenticated Key-Value store

OnvaKV is yet another ADS (Authenticated Data Structure) for blockchains. Like Ethereum's MPT and Cosmos-SDK's IAVL, it is designed as a KV database to store all the state information under consensus. Its main advantage over MPT and IAVL is performance.

MPT and IAVL are built upon traditional KV databases, such as LevelDB or RocksDB. For one single read/write operation, they need to access the underlying KV database for several times. And each time a KV database is accessed, it may access the hard disk for serveral times. Thus, they are very slow.

OnvaKV does not rely on LevelDB or RocksDB during normal read/write/deletion operations. It uses carefully designed data structures in DRAM and hard disk such that reading a KV pair only need to access the hard disk only once. At the same time, it does use RocksDB to store meta information and historical information.

The general idea of OnvaKV is described here.

Documentation

Index

Constants

View Source
const (
	StartReapThres                  int64 = 10000 // 1000 * 1000
	KeptEntriesToActiveEntriesRatio       = 2
)
View Source
const (
	MinimumTasksInGoroutine = 10
	MaximumGoroutines       = 128
)

Variables

View Source
var Phase1n2Time, Phase1Time, Phase2Time, Phase3Time, Phase4Time, Phase0Time uint64

Functions

This section is empty.

Types

type BucketMap

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

func NewBucketMap

func NewBucketMap(size int) *BucketMap

func (*BucketMap) Load

func (bm *BucketMap) Load(key string) (value *HotEntry, ok bool)

func (*BucketMap) Store

func (bm *BucketMap) Store(key string, value *HotEntry)

type Entry

type Entry = types.Entry

type HotEntry

type HotEntry = types.HotEntry

type OnvaIterator

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

func (*OnvaIterator) Close

func (iter *OnvaIterator) Close()

func (*OnvaIterator) Domain

func (iter *OnvaIterator) Domain() (start []byte, end []byte)

func (*OnvaIterator) Key

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

func (*OnvaIterator) Next

func (iter *OnvaIterator) Next()

func (*OnvaIterator) Valid

func (iter *OnvaIterator) Valid() bool

func (*OnvaIterator) Value

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

type OnvaKV

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

func NewOnvaKV

func NewOnvaKV(dirName string, canQueryHistory bool, startEndKeys [][]byte) (*OnvaKV, error)

func NewOnvaKV4Mock

func NewOnvaKV4Mock(startEndKeys [][]byte) *OnvaKV

func (*OnvaKV) ActiveCount

func (okv *OnvaKV) ActiveCount() int

func (*OnvaKV) BeginWrite

func (okv *OnvaKV) BeginWrite(height int64)

func (*OnvaKV) CheckConsistency

func (okv *OnvaKV) CheckConsistency()

func (*OnvaKV) Close

func (okv *OnvaKV) Close()

func (*OnvaKV) DeactiviateEntry

func (okv *OnvaKV) DeactiviateEntry(sn int64)

func (*OnvaKV) Delete

func (okv *OnvaKV) Delete(key []byte)

func (*OnvaKV) EndWrite

func (okv *OnvaKV) EndWrite()

func (*OnvaKV) GetCurrHeight

func (okv *OnvaKV) GetCurrHeight() int64

func (*OnvaKV) GetEntry

func (okv *OnvaKV) GetEntry(k []byte) *Entry

func (*OnvaKV) GetRootHash

func (okv *OnvaKV) GetRootHash() []byte

func (*OnvaKV) InitGuards

func (okv *OnvaKV) InitGuards(startKey, endKey []byte)

func (*OnvaKV) Iterator

func (okv *OnvaKV) Iterator(start, end []byte) dbm.Iterator

func (*OnvaKV) PrepareForDeletion

func (okv *OnvaKV) PrepareForDeletion(k []byte) (findIt bool)

func (*OnvaKV) PrepareForUpdate

func (okv *OnvaKV) PrepareForUpdate(k []byte)

func (*OnvaKV) PrintMetaInfo

func (okv *OnvaKV) PrintMetaInfo()

func (*OnvaKV) PruneBeforeHeight

func (okv *OnvaKV) PruneBeforeHeight(height int64)

func (*OnvaKV) ReverseIterator

func (okv *OnvaKV) ReverseIterator(start, end []byte) dbm.Iterator

func (*OnvaKV) Set

func (okv *OnvaKV) Set(key, value []byte)

Jump to

Keyboard shortcuts

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