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 ligodb.Writer, hash common.Hash, number uint64)
- func DeleteBody(db ligodb.Writer, hash common.Hash, number uint64)
- func DeleteCanonicalHash(db ligodb.Writer, number uint64)
- func DeleteDataPruneTrieRootHash(db ligodb.Writer, scan, prune uint64)
- func DeleteHeader(db ligodb.Writer, hash common.Hash, number uint64)
- func DeletePreimage(db ligodb.Writer, hash common.Hash)
- func DeleteReceipts(db ligodb.Writer, hash common.Hash, number uint64)
- func DeleteTX3(db ligodb.Database, chainId string, txHash common.Hash)
- func DeleteTd(db ligodb.Writer, hash common.Hash, number uint64)
- func DeleteTxLookupEntry(db ligodb.Writer, hash common.Hash)
- func FindCommonAncestor(db ligodb.Reader, a, b *types.Header) *types.Header
- func GetAllTX3ProofData(db ligodb.Database) []*types.TX3ProofData
- func GetTX3(db ligodb.Reader, chainId string, txHash common.Hash) *types.Transaction
- func GetTX3LookupEntry(db ligodb.Reader, chainId string, txHash common.Hash) (common.Hash, uint64, uint64)
- func GetTX3ProofData(db ligodb.Reader, chainId string, txHash common.Hash) *types.TX3ProofData
- func HasBody(db ligodb.Reader, hash common.Hash, number uint64) bool
- func HasHeader(db ligodb.Reader, hash common.Hash, number uint64) bool
- func HasReceipts(db ligodb.Reader, hash common.Hash, number uint64) bool
- func NewDatabase(db ligodb.KeyValueStore) ligodb.Database
- func NewLevelDBDatabase(file string, cache int, handles int, namespace string) (ligodb.Database, error)
- func NewMemoryDatabase() ligodb.Database
- func NewMemoryDatabaseWithCap(size int) ligodb.Database
- func NewTable(db ligodb.Database, prefix string) ligodb.Database
- func ReadBlock(db ligodb.Reader, hash common.Hash, number uint64) *types.Block
- func ReadBloomBits(db ligodb.Reader, bit uint, section uint64, head common.Hash) ([]byte, error)
- func ReadBody(db ligodb.Reader, hash common.Hash, number uint64) *types.Body
- func ReadBodyRLP(db ligodb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadCanonicalHash(db ligodb.Reader, number uint64) common.Hash
- func ReadChainConfig(db ligodb.Reader, hash common.Hash) *params.ChainConfig
- func ReadDataPruneTrieRootHash(db ligodb.Reader, scan, prune uint64) common.Hash
- func ReadDatabaseVersion(db ligodb.Reader) *uint64
- func ReadFastTrieProgress(db ligodb.Reader) uint64
- func ReadHeadBlockHash(db ligodb.Reader) common.Hash
- func ReadHeadFastBlockHash(db ligodb.Reader) common.Hash
- func ReadHeadHeaderHash(db ligodb.Reader) common.Hash
- func ReadHeadPruneNumber(db ligodb.Reader) *uint64
- func ReadHeadScanNumber(db ligodb.Reader) *uint64
- func ReadHeader(db ligodb.Reader, hash common.Hash, number uint64) *types.Header
- func ReadHeaderNumber(db ligodb.Reader, hash common.Hash) *uint64
- func ReadHeaderRLP(db ligodb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadPreimage(db ligodb.Reader, hash common.Hash) []byte
- func ReadReceipt(db ligodb.Reader, hash common.Hash) (*types.Receipt, common.Hash, uint64, uint64)
- func ReadReceipts(db ligodb.Reader, hash common.Hash, number uint64) types.Receipts
- func ReadReceiptsRLP(db ligodb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadTd(db ligodb.Reader, hash common.Hash, number uint64) *big.Int
- func ReadTdRLP(db ligodb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadTransaction(db ligodb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
- func ReadTxLookupEntry(db ligodb.Reader, hash common.Hash) common.Hash
- func WriteBlock(db ligodb.Writer, block *types.Block)
- func WriteBloomBits(db ligodb.Writer, bit uint, section uint64, head common.Hash, bits []byte)
- func WriteBody(db ligodb.Writer, hash common.Hash, number uint64, body *types.Body)
- func WriteBodyRLP(db ligodb.Writer, hash common.Hash, number uint64, rlp rlp.RawValue)
- func WriteCanonicalHash(db ligodb.Writer, hash common.Hash, number uint64)
- func WriteChainConfig(db ligodb.Writer, hash common.Hash, cfg *params.ChainConfig)
- func WriteDataPruneTrieRootHash(db ligodb.Writer, hash common.Hash, scan, prune uint64)
- func WriteDatabaseVersion(db ligodb.Writer, version uint64)
- func WriteFastTrieProgress(db ligodb.Writer, count uint64)
- func WriteHeadBlockHash(db ligodb.Writer, hash common.Hash)
- func WriteHeadFastBlockHash(db ligodb.Writer, hash common.Hash)
- func WriteHeadHeaderHash(db ligodb.Writer, hash common.Hash)
- func WriteHeadPruneNumber(db ligodb.Writer, prune uint64)
- func WriteHeadScanNumber(db ligodb.Writer, scan uint64)
- func WriteHeader(db ligodb.Writer, header *types.Header)
- func WritePreimages(db ligodb.Writer, preimages map[common.Hash][]byte)
- func WriteReceipts(db ligodb.Writer, hash common.Hash, number uint64, receipts types.Receipts)
- func WriteTX3(db ligodb.Writer, chainId string, header *types.Header, txIndex uint, ...) error
- func WriteTX3ProofData(db ligodb.Database, proofData *types.TX3ProofData) error
- func WriteTd(db ligodb.Writer, hash common.Hash, number uint64, td *big.Int)
- func WriteTxLookupEntries(db ligodb.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 ligodb.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 ligodb.KeyValueStore) ligodb.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) (ligodb.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 ligodb.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 ligodb.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.