Documentation ¶
Overview ¶
Package rawdb contains a collection of low level database accessors.
Index ¶
- Variables
- func DeleteBlock(db ethdb.Writer, hash common.Hash, number uint64)
- func DeleteBody(db ethdb.Writer, hash common.Hash, number uint64)
- func DeleteCanonicalHash(db ethdb.Writer, number uint64)
- func DeleteEbnIndex(db ethdb.Writer, index uint, number uint64)
- func DeleteExecuionTimeTx(db ethdb.Writer, index uint, number uint64, hash common.Hash)
- func DeleteExecutionTxByBlock(db ethdb.Writer, index uint, number uint64, hash common.Hash)
- func DeleteHeader(db ethdb.Writer, hash common.Hash, number uint64)
- func DeleteReceipts(db ethdb.Writer, hash common.Hash, number uint64)
- func DeleteTd(db ethdb.Writer, hash common.Hash, number uint64)
- func DeleteTxLookupEntry(db ethdb.Writer, hash common.Hash)
- func FindCommonAncestor(db ethdb.Reader, a, b *types.Header) *types.Header
- func GetEbnIndex(db ethdb.Reader, number uint64) *uint
- func GetExistFTx(db ethdb.Reader, number uint64, hash common.Hash) bool
- func HasBody(db ethdb.Reader, hash common.Hash, number uint64) bool
- func HasEbnIndex(db ethdb.Reader, index uint, number uint64) bool
- func HasEbnTx(db ethdb.Reader, index uint, number uint64, hash common.Hash) bool
- func HasHeader(db ethdb.Reader, hash common.Hash, number uint64) bool
- func HasReceipts(db ethdb.Reader, hash common.Hash, number uint64) bool
- func NewDatabase(db ethdb.KeyValueStore) ethdb.Database
- func NewLevelDBDatabase(file string, cache int, handles int, namespace string) (ethdb.Database, error)
- func NewMemoryDatabase() ethdb.Database
- func NewMemoryDatabaseWithCap(size int) ethdb.Database
- func NewTable(db ethdb.Database, prefix string) ethdb.Database
- func ReadBlock(db ethdb.Reader, hash common.Hash, number uint64) *types.Block
- func ReadBloomBits(db ethdb.Reader, bit uint, section uint64, head common.Hash) ([]byte, error)
- func ReadBody(db ethdb.Reader, hash common.Hash, number uint64) *types.Body
- func ReadBodyRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadCanonicalHash(db ethdb.Reader, number uint64) common.Hash
- func ReadChainConfig(db ethdb.Reader, hash common.Hash) *params.ChainConfig
- func ReadDatabaseVersion(db ethdb.Reader) *uint64
- func ReadEbnIndex(db ethdb.Reader, index uint, number uint64) common.Hash
- func ReadEbnTx(db ethdb.Reader, index uint, number uint64, hash common.Hash) *types.Transaction
- func ReadFastTrieProgress(db ethdb.Reader) uint64
- func ReadHeadBlockHash(db ethdb.Reader) common.Hash
- func ReadHeadFastBlockHash(db ethdb.Reader) common.Hash
- func ReadHeadHeaderHash(db ethdb.Reader) common.Hash
- func ReadHeader(db ethdb.Reader, hash common.Hash, number uint64) *types.Header
- func ReadHeaderNumber(db ethdb.Reader, hash common.Hash) *uint64
- func ReadHeaderRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadPreimage(db ethdb.Reader, hash common.Hash) []byte
- func ReadReceipt(db ethdb.Reader, hash common.Hash) (*types.Receipt, common.Hash, uint64, uint64)
- func ReadReceipts(db ethdb.Reader, hash common.Hash, number uint64) types.Receipts
- func ReadReceiptsRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadTd(db ethdb.Reader, hash common.Hash, number uint64) *big.Int
- func ReadTdRLP(db ethdb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadTransaction(db ethdb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
- func ReadTxLookupEntry(db ethdb.Reader, hash common.Hash) common.Hash
- func WriteBlock(db ethdb.Writer, block *types.Block)
- func WriteBloomBits(db ethdb.Writer, bit uint, section uint64, head common.Hash, bits []byte)
- func WriteBody(db ethdb.Writer, hash common.Hash, number uint64, body *types.Body)
- func WriteBodyRLP(db ethdb.Writer, hash common.Hash, number uint64, rlp rlp.RawValue)
- func WriteCanonicalHash(db ethdb.Writer, hash common.Hash, number uint64)
- func WriteChainConfig(db ethdb.Writer, hash common.Hash, cfg *params.ChainConfig)
- func WriteDatabaseVersion(db ethdb.Writer, version uint64)
- func WriteEbnIndex(db ethdb.Writer, index uint, number uint64, hash common.Hash)
- func WriteEbnTx(db ethdb.Writer, index uint, number uint64, head common.Hash, ...)
- func WriteFastTrieProgress(db ethdb.Writer, count uint64)
- func WriteHeadBlockHash(db ethdb.Writer, hash common.Hash)
- func WriteHeadFastBlockHash(db ethdb.Writer, hash common.Hash)
- func WriteHeadHeaderHash(db ethdb.Writer, hash common.Hash)
- func WriteHeader(db ethdb.Writer, header *types.Header)
- func WritePreimages(db ethdb.Writer, preimages map[common.Hash][]byte)
- func WriteReceipts(db ethdb.Writer, hash common.Hash, number uint64, receipts types.Receipts)
- func WriteTd(db ethdb.Writer, hash common.Hash, number uint64, td *big.Int)
- func WriteTxLookupEntries(db ethdb.Writer, block *types.Block)
- type LegacyTxLookupEntry
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 DeleteExecuionTimeTx ¶
func DeleteHeader ¶
DeleteHeader removes all block header data associated with a hash.
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 GetEbnIndex ¶
ReadReceipts retrieves all the transaction receipts belonging to a block.
func HasReceipts ¶
HasReceipts verifies the existence of all the transaction receipts belonging to a block.
func NewDatabase ¶
func NewDatabase(db ethdb.KeyValueStore) ethdb.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) (ethdb.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 ReadDatabaseVersion ¶
ReadDatabaseVersion retrieves the version number of the database.
func ReadEbnIndex ¶
ReadReceipts retrieves all the transaction receipts belonging to a block.
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 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 ethdb.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 WriteDatabaseVersion ¶
WriteDatabaseVersion stores the version number of the database
func WriteEbnIndex ¶
WriteBloomBits stores the compressed bloom bits vector belonging to the given section and bit index.
func WriteEbnTx ¶
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 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.