storage

package
v1.4.2-beta1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeyNotFound = errors.New("key not found")

Functions

func GetKeyOfParts

func GetKeyOfParts(t KeyPrefix, partList ...interface{}) ([]byte, error)

Types

type ActionType

type ActionType byte
const (
	Dump ActionType = iota
	GC
	Backup
	Restore
	Size
)

type Batch

type Batch interface {
	Put(k []byte, v interface{}) error
	Delete(k []byte) error
	Get([]byte) (interface{}, error)
	Iterator(prefix []byte, end []byte, f func(k, v []byte) error) error
	Drop(prefix []byte) error
	Discard()
}

type Cache

type Cache interface {
	Get(key []byte) (interface{}, error)
	Put(key []byte, value interface{}) error
	Delete(key []byte) error
	Len() int64
}

type KeyPrefix

type KeyPrefix byte
const (
	KeyPrefixBlock KeyPrefix = iota
	KeyPrefixSmartContractBlock
	KeyPrefixUncheckedBlockPrevious
	KeyPrefixUncheckedBlockLink
	KeyPrefixAccount
	//KeyPrefixToken
	KeyPrefixFrontier
	KeyPrefixPending
	KeyPrefixRepresentation
	KeyPrefixPerformance
	KeyPrefixChild
	KeyPrefixVersion //10
	KeyPrefixStorage
	KeyPrefixToken    //discard
	KeyPrefixSender   //discard
	KeyPrefixReceiver //discard
	KeyPrefixMessage  //discard
	KeyPrefixMessageInfo
	KeyPrefixOnlineReps
	KeyPrefixPovHeader   // prefix + height + hash => header
	KeyPrefixPovBody     // prefix + height + hash => body
	KeyPrefixPovHeight   // prefix + hash => height (uint64) 20
	KeyPrefixPovTxLookup // prefix + txHash => TxLookup
	KeyPrefixPovBestHash // prefix + height => hash
	KeyPrefixPovTD       // prefix + height + hash => total difficulty (big int)
	KeyPrefixLink
	KeyPrefixBlockCache //block store this table before consensus complete
	KeyPrefixRepresentationCache
	KeyPrefixUncheckedTokenInfo
	KeyPrefixBlockCacheAccount
	KeyPrefixPovMinerStat    // prefix + day index => miners of best blocks per day
	KeyPrefixUnconfirmedSync //30
	KeyPrefixUncheckedSync
	KeyPrefixSyncCacheBlock
	KeyPrefixUncheckedPovHeight
	KeyPrefixPovLatestHeight  // prefix => height
	KeyPrefixPovTxlScanCursor // prefix => height
	KeyPrefixVoteHistory
	KeyPrefixPovDiffStat // prefix + dayIndex => average diff statistics per day
	KeyPrefixPeerInfo    //prefix+peerID => peerInfo
	KeyPrefixGapPublish
	KeyPrefixDPoS
	KeyPrefixAccountBlockHash
	KeyPrefixAccountPovHeight
	KeyPrefixPrivatePayload
	KeyPrefixGapDoDSettleState
	KeyPrefixGapPovHeight

	// Trie key space should be different
	KeyPrefixTrieVMStorage = 100 // Deprecated vm_store.go, idPrefixStorage
	KeyPrefixTrie          = 101 // 101 is used for trie intermediate node, trie.go, idPrefixTrie
	KeyPrefixTriePovState  = 102
	KeyPrefixContractValue = 103 // idPrefixContractValue ledger.go
	KeyPrefixVmLogs        = 104 // vm_store.go
	KeyPrefixVMStorage     = 105 // vm_store.go
	KeyPrefixTrieClean     = 106
	KeyPrefixTrieTemp      = 107
	KeyPrefixPendingBackup = 253
	KeyPrefixGenericType   = 254
	KeyPrefixGenericTypeC  = 255
)

type Store

type Store interface {
	Delete(k []byte) error
	Get([]byte) ([]byte, error)
	Put(k, v []byte) error
	Has(k []byte) (bool, error)
	Batch(bool) Batch
	PutBatch(Batch) error
	BatchWrite(bool, func(batch Batch) error) error
	//BatchView(func(batch Batch) error) error
	Iterator(prefix []byte, end []byte, f func(k, v []byte) error) error
	Count(prefix []byte) (uint64, error)
	Purge() error
	Drop(prefix []byte) error
	Upgrade(version int) error
	Action(at ActionType) (interface{}, error)
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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