Documentation ¶
Overview ¶
Package rawdb contains a collection of low level database accessors.
Package rawdb contains a collection of low level database accessors.
Index ¶
- Variables
- func DeleteBlock(db neatdb.Writer, hash common.Hash, number uint64)
- func DeleteBody(db neatdb.Writer, hash common.Hash, number uint64)
- func DeleteCanonicalHash(db neatdb.Writer, number uint64)
- func DeleteDataPruneTrieRootHash(db neatdb.Writer, scan, prune uint64)
- func DeleteHeader(db neatdb.Writer, hash common.Hash, number uint64)
- func DeletePreimage(db neatdb.Writer, hash common.Hash)
- func DeleteReceipts(db neatdb.Writer, hash common.Hash, number uint64)
- func DeleteTX3(db neatdb.Database, chainId string, txHash common.Hash)
- func DeleteTd(db neatdb.Writer, hash common.Hash, number uint64)
- func DeleteTxLookupEntry(db neatdb.Writer, hash common.Hash)
- func FindCommonAncestor(db neatdb.Reader, a, b *types.Header) *types.Header
- func GetAllTX3ProofData(db neatdb.Database) []*types.TX3ProofData
- func GetTX3(db neatdb.Reader, chainId string, txHash common.Hash) *types.Transaction
- func GetTX3LookupEntry(db neatdb.Reader, chainId string, txHash common.Hash) (common.Hash, uint64, uint64)
- func GetTX3ProofData(db neatdb.Reader, chainId string, txHash common.Hash) *types.TX3ProofData
- func HasBody(db neatdb.Reader, hash common.Hash, number uint64) bool
- func HasHeader(db neatdb.Reader, hash common.Hash, number uint64) bool
- func HasReceipts(db neatdb.Reader, hash common.Hash, number uint64) bool
- func NewDatabase(db neatdb.KeyValueStore) neatdb.Database
- func NewLevelDBDatabase(file string, cache int, handles int, namespace string) (neatdb.Database, error)
- func NewMemoryDatabase() neatdb.Database
- func NewMemoryDatabaseWithCap(size int) neatdb.Database
- func NewTable(db neatdb.Database, prefix string) neatdb.Database
- func ReadBlock(db neatdb.Reader, hash common.Hash, number uint64) *types.Block
- func ReadBloomBits(db neatdb.Reader, bit uint, section uint64, head common.Hash) ([]byte, error)
- func ReadBody(db neatdb.Reader, hash common.Hash, number uint64) *types.Body
- func ReadBodyRLP(db neatdb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadCanonicalHash(db neatdb.Reader, number uint64) common.Hash
- func ReadChainConfig(db neatdb.Reader, hash common.Hash) *params.ChainConfig
- func ReadDataPruneTrieRootHash(db neatdb.Reader, scan, prune uint64) common.Hash
- func ReadDatabaseVersion(db neatdb.Reader) *uint64
- func ReadFastTrieProgress(db neatdb.Reader) uint64
- func ReadHeadBlockHash(db neatdb.Reader) common.Hash
- func ReadHeadFastBlockHash(db neatdb.Reader) common.Hash
- func ReadHeadHeaderHash(db neatdb.Reader) common.Hash
- func ReadHeadPruneNumber(db neatdb.Reader) *uint64
- func ReadHeadScanNumber(db neatdb.Reader) *uint64
- func ReadHeader(db neatdb.Reader, hash common.Hash, number uint64) *types.Header
- func ReadHeaderNumber(db neatdb.Reader, hash common.Hash) *uint64
- func ReadHeaderRLP(db neatdb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadPreimage(db neatdb.Reader, hash common.Hash) []byte
- func ReadReceipt(db neatdb.Reader, hash common.Hash) (*types.Receipt, common.Hash, uint64, uint64)
- func ReadReceipts(db neatdb.Reader, hash common.Hash, number uint64) types.Receipts
- func ReadReceiptsRLP(db neatdb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadTd(db neatdb.Reader, hash common.Hash, number uint64) *big.Int
- func ReadTdRLP(db neatdb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadTransaction(db neatdb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
- func ReadTxLookupEntry(db neatdb.Reader, hash common.Hash) common.Hash
- func WriteBlock(db neatdb.Writer, block *types.Block)
- func WriteBloomBits(db neatdb.Writer, bit uint, section uint64, head common.Hash, bits []byte)
- func WriteBody(db neatdb.Writer, hash common.Hash, number uint64, body *types.Body)
- func WriteBodyRLP(db neatdb.Writer, hash common.Hash, number uint64, rlp rlp.RawValue)
- func WriteCanonicalHash(db neatdb.Writer, hash common.Hash, number uint64)
- func WriteChainConfig(db neatdb.Writer, hash common.Hash, cfg *params.ChainConfig)
- func WriteDataPruneTrieRootHash(db neatdb.Writer, hash common.Hash, scan, prune uint64)
- func WriteDatabaseVersion(db neatdb.Writer, version uint64)
- func WriteFastTrieProgress(db neatdb.Writer, count uint64)
- func WriteHeadBlockHash(db neatdb.Writer, hash common.Hash)
- func WriteHeadFastBlockHash(db neatdb.Writer, hash common.Hash)
- func WriteHeadHeaderHash(db neatdb.Writer, hash common.Hash)
- func WriteHeadPruneNumber(db neatdb.Writer, prune uint64)
- func WriteHeadScanNumber(db neatdb.Writer, scan uint64)
- func WriteHeader(db neatdb.Writer, header *types.Header)
- func WritePreimages(db neatdb.Writer, preimages map[common.Hash][]byte)
- func WriteReceipts(db neatdb.Writer, hash common.Hash, number uint64, receipts types.Receipts)
- func WriteTX3(db neatdb.Writer, chainId string, header *types.Header, txIndex uint, ...) error
- func WriteTX3ProofData(db neatdb.Database, proofData *types.TX3ProofData) error
- func WriteTd(db neatdb.Writer, hash common.Hash, number uint64, td *big.Int)
- func WriteTxLookupEntries(db neatdb.Writer, block *types.Block)
- type LegacyTxLookupEntry
- type TX3LookupEntry
Constants ¶
This section is empty.
Variables ¶
var ( // Chain index prefixes (use `i` + single byte to avoid mixing data types). BloomBitsIndexPrefix = []byte("iB") // BloomBitsIndexPrefix is the data table of a chain indexer to track its progress )
The fields below define the low level database schema prefixing.
Functions ¶
func DeleteBlock ¶
DeleteBlock removes all block data associated with a hash.
func DeleteBody ¶
DeleteBody removes all block body data associated with a hash.
func DeleteCanonicalHash ¶
DeleteCanonicalHash removes the number to hash canonical mapping.
func DeleteDataPruneTrieRootHash ¶
DeleteCanonicalHash removes the number to hash canonical mapping.
func DeleteHeader ¶
DeleteHeader removes all block header data associated with a hash.
func DeletePreimage ¶
DeletePreimage delete a single preimage of the provided hash. (Use carefully)
func DeleteReceipts ¶
DeleteReceipts removes all receipt data associated with a block hash.
func DeleteTxLookupEntry ¶
DeleteTxLookupEntry removes all transaction data associated with a hash.
func FindCommonAncestor ¶
FindCommonAncestor returns the last common ancestor of two block headers
func GetAllTX3ProofData ¶
func GetAllTX3ProofData(db neatdb.Database) []*types.TX3ProofData
func GetTX3LookupEntry ¶
func GetTX3ProofData ¶
func HasReceipts ¶
HasReceipts verifies the existence of all the transaction receipts belonging to a block.
func NewDatabase ¶
func NewDatabase(db neatdb.KeyValueStore) neatdb.Database
NewDatabase creates a high level database on top of a given key-value data store without a freezer moving immutable chain segments into cold storage.
func NewLevelDBDatabase ¶
func NewLevelDBDatabase(file string, cache int, handles int, namespace string) (neatdb.Database, error)
NewLevelDBDatabase creates a persistent key-value database without a freezer moving immutable chain segments into cold storage.
func NewMemoryDatabase ¶
NewMemoryDatabase creates an ephemeral in-memory key-value database without a freezer moving immutable chain segments into cold storage.
func NewMemoryDatabaseWithCap ¶
NewMemoryDatabaseWithCap creates an ephemeral in-memory key-value database with an initial starting capacity, but without a freezer moving immutable chain segments into cold storage.
func ReadBlock ¶
ReadBlock retrieves an entire block corresponding to the hash, assembling it back from the stored header and body. If either the header or body could not be retrieved nil is returned.
Note, due to concurrent download of header and block body the header and thus canonical hash can be stored in the database but the body data not (yet).
func ReadBloomBits ¶
ReadBloomBits retrieves the compressed bloom bit vector belonging to the given section and bit index from the.
func ReadBodyRLP ¶
ReadBodyRLP retrieves the block body (transactions and uncles) in RLP encoding.
func ReadCanonicalHash ¶
ReadCanonicalHash retrieves the hash assigned to a canonical block number.
func ReadChainConfig ¶
ReadChainConfig retrieves the consensus settings based on the given genesis hash.
func ReadDataPruneTrieRootHash ¶
ReadDataPruneTrieRootHash retrieves the root hash of a data prune process trie
func ReadDatabaseVersion ¶
ReadDatabaseVersion retrieves the version number of the database.
func ReadFastTrieProgress ¶
ReadFastTrieProgress retrieves the number of tries nodes fast synced to allow reporting correct numbers across restarts.
func ReadHeadBlockHash ¶
ReadHeadBlockHash retrieves the hash of the current canonical head block.
func ReadHeadFastBlockHash ¶
ReadHeadFastBlockHash retrieves the hash of the current fast-sync head block.
func ReadHeadHeaderHash ¶
ReadHeadHeaderHash retrieves the hash of the current canonical head header.
func ReadHeadPruneNumber ¶
ReadHeadPruneNumber retrieves the latest pruned number.
func ReadHeadScanNumber ¶
ReadHeadScanNumber retrieves the latest scaned number.
func ReadHeader ¶
ReadHeader retrieves the block header corresponding to the hash.
func ReadHeaderNumber ¶
ReadHeaderNumber returns the header number assigned to a hash.
func ReadHeaderRLP ¶
ReadHeaderRLP retrieves a block header in its raw RLP database encoding.
func ReadPreimage ¶
ReadPreimage retrieves a single preimage of the provided hash.
func ReadReceipt ¶
ReadReceipt retrieves a specific transaction receipt from the database, along with its added positional metadata.
func ReadReceipts ¶
ReadReceipts retrieves all the transaction receipts belonging to a block.
func ReadReceiptsRLP ¶
ReadReceiptsRLP retrieves all the transaction receipts belonging to a block in RLP encoding.
func ReadTdRLP ¶
ReadTdRLP retrieves a block's total difficulty corresponding to the hash in RLP encoding.
func ReadTransaction ¶
func ReadTransaction(db neatdb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
ReadTransaction retrieves a specific transaction from the database, along with its added positional metadata.
func ReadTxLookupEntry ¶
ReadTxLookupEntry retrieves the positional metadata associated with a transaction hash to allow retrieving the transaction or receipt by hash.
func WriteBlock ¶
WriteBlock serializes a block into the database, header and body separately.
func WriteBloomBits ¶
WriteBloomBits stores the compressed bloom bits vector belonging to the given section and bit index.
func WriteBodyRLP ¶
WriteBodyRLP stores an RLP encoded block body into the database.
func WriteCanonicalHash ¶
WriteCanonicalHash stores the hash assigned to a canonical block number.
func WriteChainConfig ¶
WriteChainConfig writes the chain config settings to the database.
func WriteDataPruneTrieRootHash ¶
WriteCanonicalHash stores the hash assigned to a canonical block number.
func WriteDatabaseVersion ¶
WriteDatabaseVersion stores the version number of the database
func WriteFastTrieProgress ¶
WriteFastTrieProgress stores the fast sync trie process counter to support retrieving it across restarts.
func WriteHeadBlockHash ¶
WriteHeadBlockHash stores the head block's hash.
func WriteHeadFastBlockHash ¶
WriteHeadFastBlockHash stores the hash of the current fast-sync head block.
func WriteHeadHeaderHash ¶
WriteHeadHeaderHash stores the hash of the current canonical head header.
func WriteHeadPruneNumber ¶
WriteHeadPruneNumber stores the number of the latest pruned block.
func WriteHeadScanNumber ¶
WriteHeadScanNumber stores the number of the latest scaned block.
func WriteHeader ¶
WriteHeader stores a block header into the database and also stores the hash- to-number mapping.
func WritePreimages ¶
WritePreimages writes the provided set of preimages to the database.
func WriteReceipts ¶
WriteReceipts stores all the transaction receipts belonging to a block.
func WriteTX3ProofData ¶
func WriteTX3ProofData(db neatdb.Database, proofData *types.TX3ProofData) error
WriteTX3ProofData serializes TX3ProofData into the database.
Types ¶
type LegacyTxLookupEntry ¶
LegacyTxLookupEntry is the legacy TxLookupEntry definition with some unnecessary fields.
type TX3LookupEntry ¶
TX3LookupEntry is a positional metadata to help looking up the tx3 proof content given only its chainId and hash.