dbutils

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const NumberLength = 8

Variables

View Source
var ErrInvalidSize = errors.New("bit endian number has an invalid size")

Functions

func BlockBodyKey

func BlockBodyKey(number uint64, hash libcommon.Hash) []byte

BlockBodyKey = num (uint64 big endian) + hash

func BloomBitsKey

func BloomBitsKey(bit uint, section uint64, hash libcommon.Hash) []byte

bloomBitsKey = bloomBitsPrefix + bit (uint16 big endian) + section (uint64 big endian) + hash

func CompositeKeySuffix

func CompositeKeySuffix(key []byte, timestamp uint64) (composite, encodedTS []byte)

Key + blockNum

func CompositeKeyWithoutIncarnation

func CompositeKeyWithoutIncarnation(key []byte) []byte

func DecodeBlockNumber

func DecodeBlockNumber(number []byte) (uint64, error)

func EncodeBlockNumber

func EncodeBlockNumber(number uint64) []byte

EncodeBlockNumber encodes a block number as big endian uint64

func GenerateCompositeStorageKey

func GenerateCompositeStorageKey(addressHash libcommon.Hash, incarnation uint64, seckey libcommon.Hash) []byte

AddrHash + incarnation + KeyHash For contract storage

func GenerateCompositeStoragePrefix

func GenerateCompositeStoragePrefix(addressHash []byte, incarnation uint64, storageHashPrefix []byte) []byte

AddrHash + incarnation + StorageHashPrefix

func GenerateCompositeTrieKey

func GenerateCompositeTrieKey(addressHash libcommon.Hash, seckey libcommon.Hash) []byte

AddrHash + KeyHash Only for trie

func GenerateStoragePrefix

func GenerateStoragePrefix(addressHash []byte, incarnation uint64) []byte

address hash + incarnation prefix

func HeaderKey

func HeaderKey(number uint64, hash libcommon.Hash) []byte

HeaderKey = num (uint64 big endian) + hash

func LogKey

func LogKey(blockNumber uint64, txId uint32) []byte

LogKey = blockN (uint64 big endian) + txId (uint32 big endian)

func NextNibblesSubtree

func NextNibblesSubtree(in []byte, out *[]byte) bool

NextNibblesSubtree does []byte++. Returns false if overflow.

func ParseCompositeStorageKey

func ParseCompositeStorageKey(compositeKey []byte) (libcommon.Hash, uint64, libcommon.Hash)

func ParseStoragePrefix

func ParseStoragePrefix(prefix []byte) (libcommon.Hash, uint64)

func PlainGenerateCompositeStorageKey

func PlainGenerateCompositeStorageKey(address []byte, incarnation uint64, key []byte) []byte

AddrHash + incarnation + KeyHash For contract storage (for plain state)

func PlainGenerateStoragePrefix

func PlainGenerateStoragePrefix(address []byte, incarnation uint64) []byte

address hash + incarnation prefix (for plain state)

func PlainParseCompositeStorageKey

func PlainParseCompositeStorageKey(compositeKey []byte) (libcommon.Address, uint64, libcommon.Hash)

func PlainParseStoragePrefix

func PlainParseStoragePrefix(prefix []byte) (libcommon.Address, uint64)

Types

type Suffix

type Suffix []byte

func ToSuffix

func ToSuffix(b []byte) Suffix

func (Suffix) Add

func (s Suffix) Add(key []byte) Suffix

func (Suffix) KeyCount

func (s Suffix) KeyCount() uint32

func (Suffix) MultiAdd

func (s Suffix) MultiAdd(keys [][]byte) Suffix

func (Suffix) Walk

func (s Suffix) Walk(f func(k []byte) error) error

Jump to

Keyboard shortcuts

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