db

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// used to compute the size of bloom filter bits array, too small will lead to
	// high false positive rate.
	BITSPERKEY     = 10
	DBConfigSuffix = ".config"
)

Variables

This section is empty.

Functions

func BlockhashKey

func BlockhashKey(height uint32) []byte

func CurrentBlockHashKey

func CurrentBlockHashKey() []byte

func CurrentFastSyncRoot

func CurrentFastSyncRoot() []byte

func CurrentStateTrie

func CurrentStateTrie() []byte

func DonationKey

func DonationKey(height uint32) []byte

func HeaderKey

func HeaderKey(blockHash common.Uint256) []byte

func PrepaidKey

func PrepaidKey(programHash common.Uint160) []byte

func TransactionKey

func TransactionKey(txHash common.Uint256) []byte

func TrieCompactHeightKey

func TrieCompactHeightKey() []byte

func TrieFastSyncRootHeightKey

func TrieFastSyncRootHeightKey() []byte

func TrieFastSyncStatusKey

func TrieFastSyncStatusKey() []byte

func TrieNodeKey

func TrieNodeKey(key []byte) []byte

func TriePrunedHeightKey

func TriePrunedHeightKey() []byte

func TrieRefCountHeightKey

func TrieRefCountHeightKey() []byte

func TrieRefCountKey

func TrieRefCountKey(key []byte) []byte

func TrieRefCountNeedResetKey

func TrieRefCountNeedResetKey() []byte

func VersionKey

func VersionKey() []byte

Types

type DataEntryPrefix

type DataEntryPrefix byte
const (
	// DATA
	DATA_BlockHash   DataEntryPrefix = 0x00
	DATA_Header      DataEntryPrefix = 0x01
	DATA_Transaction DataEntryPrefix = 0x02

	ST_Prepaid   DataEntryPrefix = 0xc7
	ST_StateTrie DataEntryPrefix = 0xc8

	//SYSTEM
	SYS_CurrentBlock DataEntryPrefix = 0x40
	SYS_Donations    DataEntryPrefix = 0x42

	//CONFIG
	CFG_Version DataEntryPrefix = 0xf0

	//TRIE
	TRIE_Node               DataEntryPrefix = 0xa0
	TRIE_RefCount           DataEntryPrefix = 0xa1
	TRIE_RefCountHeight     DataEntryPrefix = 0xa2
	TRIE_PrunedHeight       DataEntryPrefix = 0xa3
	TRIE_CompactHeight      DataEntryPrefix = 0xa4
	TRIE_FastSyncStatus     DataEntryPrefix = 0xa5
	TRIE_FastSyncRoot       DataEntryPrefix = 0xa6
	TRIE_FastSyncRootHeight DataEntryPrefix = 0xa7
	TRIE_RefCountNeedReset  DataEntryPrefix = 0xa8
)

type IIterator

type IIterator interface {
	Next() bool
	Prev() bool
	First() bool
	Last() bool
	Seek(key []byte) bool
	Key() []byte
	Value() []byte
	Release()
}

type IStore

type IStore interface {
	Put(key []byte, value []byte) error
	Get(key []byte) ([]byte, error)
	Has(key []byte) (bool, error)
	Delete(key []byte) error
	NewBatch() error
	BatchPut(key []byte, value []byte) error
	BatchDelete(key []byte) error
	BatchCommit() error
	Compact() error
	Close() error
	NewIterator(prefix []byte) IIterator
}

type Iterator

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

func (*Iterator) First

func (it *Iterator) First() bool

func (*Iterator) Key

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

func (*Iterator) Last

func (it *Iterator) Last() bool

func (*Iterator) Next

func (it *Iterator) Next() bool

func (*Iterator) Prev

func (it *Iterator) Prev() bool

func (*Iterator) Release

func (it *Iterator) Release()

func (*Iterator) Seek

func (it *Iterator) Seek(key []byte) bool

func (*Iterator) Value

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

type LevelDBConfig

type LevelDBConfig struct {
	CompactionL0Trigger    int
	WriteL0SlowdownTrigger int
	WriteL0PauseTrigger    int
	CompactionTableSize    int
	WriteBuffer            int
	BlockCacheCapacity     int
	DisableSeeksCompaction bool
}

func NewLevelDBConfig

func NewLevelDBConfig(file string) *LevelDBConfig

type LevelDBStore

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

func NewLevelDBStore

func NewLevelDBStore(file string) (*LevelDBStore, error)

func (*LevelDBStore) BatchCommit

func (self *LevelDBStore) BatchCommit() error

func (*LevelDBStore) BatchDelete

func (self *LevelDBStore) BatchDelete(key []byte) error

func (*LevelDBStore) BatchPut

func (self *LevelDBStore) BatchPut(key []byte, value []byte) error

func (*LevelDBStore) Close

func (self *LevelDBStore) Close() error

func (*LevelDBStore) Compact

func (self *LevelDBStore) Compact() error

func (*LevelDBStore) Delete

func (self *LevelDBStore) Delete(key []byte) error

func (*LevelDBStore) Get

func (self *LevelDBStore) Get(key []byte) ([]byte, error)

func (*LevelDBStore) Has

func (self *LevelDBStore) Has(key []byte) (bool, error)

func (*LevelDBStore) NewBatch

func (self *LevelDBStore) NewBatch() error

func (*LevelDBStore) NewIterator

func (self *LevelDBStore) NewIterator(prefix []byte) IIterator

func (*LevelDBStore) Put

func (self *LevelDBStore) Put(key []byte, value []byte) error

Jump to

Keyboard shortcuts

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