Documentation
¶
Overview ¶
Modified from go-ethereum under GNU Lesser General Public License
Modified from go-ethereum under GNU Lesser General Public License
Index ¶
- Constants
- Variables
- func DeleteBlock(db DatabaseDeleter, hash common.Hash)
- func DeleteBlockContentLookupEntry(db DatabaseDeleter, hash common.Hash)
- func DeleteCanonicalHash(db DatabaseDeleter, chainType ChainType, number uint64)
- func DeleteLatestMinorBlockHeaders(db DatabaseDeleter, hash common.Hash)
- func DeleteMinorBlock(db DatabaseDeleter, hash common.Hash)
- func DeleteMinorBlockHeader(db DatabaseDeleter, hash common.Hash)
- func DeleteRbCommittingHash(db DatabaseDeleter)
- func DeleteReceipts(db DatabaseDeleter, hash common.Hash)
- func DeleteRootBlock(db DatabaseDeleter, hash common.Hash)
- func DeleteRootBlockHeader(db DatabaseDeleter, hash common.Hash)
- func DeleteTd(db DatabaseDeleter, hash common.Hash)
- func DeleteValidateMinorBlockHash(db DatabaseDeleter, hash common.Hash)
- func FindCommonMinorAncestor(db DatabaseReader, a, b *types.MinorBlockHeader) *types.MinorBlockHeader
- func FindCommonRootAncestor(db DatabaseReader, a, b *types.RootBlockHeader) *types.RootBlockHeader
- func GetMinorBlockCnt(db DatabaseReader, fullShardID uint32, height uint32) []byte
- func HasBlock(db DatabaseReader, hash common.Hash) bool
- func HasHeader(db DatabaseReader, hash common.Hash) bool
- func HasReceipts(db DatabaseReader, hash common.Hash) bool
- func ReadBlockContentLookupEntry(db DatabaseReader, hash common.Hash) (common.Hash, uint32)
- func ReadBloomBits(db DatabaseReader, bit uint, section uint64, head common.Hash) ([]byte, error)
- func ReadCanonicalHash(db DatabaseReader, chainType ChainType, number uint64) common.Hash
- func ReadChainConfig(db DatabaseReader, hash common.Hash) *config.QuarkChainConfig
- func ReadConfirmedCrossShardTxList(db DatabaseReader, hash common.Hash) *types.CrossShardTransactionDepositList
- func ReadCrossShardTxList(db DatabaseReader, hash common.Hash) *types.CrossShardTransactionDepositList
- func ReadDatabaseVersion(db DatabaseReader) uint32
- func ReadFastTrieProgress(db DatabaseReader) uint64
- func ReadGenesis(db DatabaseReader, hash common.Hash) *types.MinorBlock
- func ReadHeadBlockHash(db DatabaseReader) common.Hash
- func ReadHeadFastBlockHash(db DatabaseReader) common.Hash
- func ReadHeadHeaderHash(db DatabaseReader) common.Hash
- func ReadHeaderNumber(db DatabaseReader, hash common.Hash) *uint64
- func ReadLastConfirmedMinorBlockHeaderAtRootBlock(db DatabaseReader, rHash common.Hash) common.Hash
- func ReadLatestMinorBlockHeaders(db DatabaseReader, hash common.Hash) []*types.MinorBlockHeader
- func ReadMinorBlock(db DatabaseReader, hash common.Hash) *types.MinorBlock
- func ReadMinorBlockHeader(db DatabaseReader, hash common.Hash) *types.MinorBlockHeader
- func ReadMinorHeaderFromRootBlock(db DatabaseReader, hash common.Hash) (*types.MinorBlockHeader, common.Hash, uint32)
- func ReadPreimage(db DatabaseReader, hash common.Hash) []byte
- func ReadRbCommittingHash(db DatabaseReader) common.Hash
- func ReadReceipt(db DatabaseReader, hash common.Hash) (*types.Receipt, common.Hash, uint32)
- func ReadReceipts(db DatabaseReader, hash common.Hash) types.Receipts
- func ReadRootBlock(db DatabaseReader, hash common.Hash) *types.RootBlock
- func ReadRootBlockHeader(db DatabaseReader, hash common.Hash) *types.RootBlockHeader
- func ReadTd(db DatabaseReader, hash common.Hash) *big.Int
- func ReadTotalTx(db DatabaseReader, hash common.Hash) *uint32
- func ReadTransaction(db DatabaseReader, hash common.Hash) (*types.Transaction, common.Hash, uint32)
- func ReadValidateMinorBlockHash(db DatabaseReader, hash common.Hash) bool
- func WriteBlockContentLookupEntries(db DatabaseWriter, block types.IBlock)
- func WriteBloomBits(db DatabaseWriter, bit uint, section uint64, head common.Hash, bits []byte)
- func WriteCanonicalHash(db DatabaseWriter, chainType ChainType, hash common.Hash, number uint64)
- func WriteChainConfig(db DatabaseWriter, hash common.Hash, cfg *config.QuarkChainConfig)
- func WriteConfirmedCrossShardTxList(db DatabaseWriter, hash common.Hash, ...)
- func WriteCrossShardTxList(db DatabaseWriter, hash common.Hash, ...)
- func WriteDatabaseVersion(db DatabaseWriter, version uint32)
- func WriteFastTrieProgress(db DatabaseWriter, count uint64)
- func WriteGenesisBlock(db DatabaseWriter, rHash common.Hash, block *types.MinorBlock)
- func WriteHeadBlockHash(db DatabaseWriter, hash common.Hash)
- func WriteHeadFastBlockHash(db DatabaseWriter, hash common.Hash)
- func WriteHeadHeaderHash(db DatabaseWriter, hash common.Hash)
- func WriteLastConfirmedMinorBlockHeaderAtRootBlock(db DatabaseWriter, rHash common.Hash, mHash common.Hash)
- func WriteLatestMinorBlockHeaders(db DatabaseWriter, hash common.Hash, headers []*types.MinorBlockHeader)
- func WriteMinorBlock(db DatabaseWriter, block *types.MinorBlock)
- func WriteMinorBlockCnt(db DatabaseWriter, fullShardID uint32, height uint32, data []byte)
- func WriteMinorBlockHeader(db DatabaseWriter, header *types.MinorBlockHeader)
- func WritePreimages(db DatabaseWriter, preimages map[common.Hash][]byte)
- func WriteReceipts(db DatabaseWriter, hash common.Hash, receipts types.Receipts)
- func WriteRootBlock(db DatabaseWriter, block *types.RootBlock)
- func WriteRootBlockCommittingHash(db DatabaseWriter, hash common.Hash)
- func WriteRootBlockHeader(db DatabaseWriter, header *types.RootBlockHeader)
- func WriteTd(db DatabaseWriter, hash common.Hash, td *big.Int)
- func WriteTotalTx(db DatabaseWriter, hash common.Hash, txCount uint32)
- func WriteValidateMinorBlockHash(db DatabaseWriter, hash common.Hash)
- type ChainType
- type DatabaseDeleter
- type DatabaseReader
- type DatabaseWriter
- type LookupEntry
Constants ¶
const ( ChainTypeRoot = ChainType(0) ChainTypeMinor = ChainType(1) )
const DBLOG = "db-operation"
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 ¶
func DeleteBlock(db DatabaseDeleter, hash common.Hash)
DeleteBlock removes block data associated with a hash.
func DeleteBlockContentLookupEntry ¶
func DeleteBlockContentLookupEntry(db DatabaseDeleter, hash common.Hash)
DeleteBlockContentLookupEntry removes all transaction data associated with a hash.
func DeleteCanonicalHash ¶
func DeleteCanonicalHash(db DatabaseDeleter, chainType ChainType, number uint64)
DeleteCanonicalHash removes the number to hash canonical mapping.
func DeleteLatestMinorBlockHeaders ¶
func DeleteLatestMinorBlockHeaders(db DatabaseDeleter, hash common.Hash)
func DeleteMinorBlock ¶
func DeleteMinorBlock(db DatabaseDeleter, hash common.Hash)
DeleteBlock removes all block data associated with a hash.
func DeleteMinorBlockHeader ¶
func DeleteMinorBlockHeader(db DatabaseDeleter, hash common.Hash)
DeleteMinorBlockHeader removes all block header data associated with a hash.
func DeleteRbCommittingHash ¶
func DeleteRbCommittingHash(db DatabaseDeleter)
func DeleteReceipts ¶
func DeleteReceipts(db DatabaseDeleter, hash common.Hash)
DeleteReceipts removes all receipt data associated with a block hash.
func DeleteRootBlock ¶
func DeleteRootBlock(db DatabaseDeleter, hash common.Hash)
DeleteRootBlock removes all block data associated with a hash.
func DeleteRootBlockHeader ¶
func DeleteRootBlockHeader(db DatabaseDeleter, hash common.Hash)
DeleteRootBlockHeader removes all block header data associated with a hash.
func DeleteTd ¶
func DeleteTd(db DatabaseDeleter, hash common.Hash)
DeleteTd removes all block total difficulty data associated with a hash.
func DeleteValidateMinorBlockHash ¶
func DeleteValidateMinorBlockHash(db DatabaseDeleter, hash common.Hash)
DeleteMinorBlockHeader removes all block header data associated with a hash.
func FindCommonMinorAncestor ¶
func FindCommonMinorAncestor(db DatabaseReader, a, b *types.MinorBlockHeader) *types.MinorBlockHeader
FindCommonMinorAncestor returns the last common ancestor of two block headers
func FindCommonRootAncestor ¶
func FindCommonRootAncestor(db DatabaseReader, a, b *types.RootBlockHeader) *types.RootBlockHeader
FindCommonRootAncestor returns the last common ancestor of two block headers
func GetMinorBlockCnt ¶
func GetMinorBlockCnt(db DatabaseReader, fullShardID uint32, height uint32) []byte
func HasBlock ¶
func HasBlock(db DatabaseReader, hash common.Hash) bool
HasBlock verifies the existence of a block body corresponding to the hash.
func HasHeader ¶
func HasHeader(db DatabaseReader, hash common.Hash) bool
HasHeader verifies the existence of a block header corresponding to the hash.
func HasReceipts ¶
func HasReceipts(db DatabaseReader, hash common.Hash) bool
HasReceipts verifies the existence of all the transaction receipts belonging to a block.
func ReadBlockContentLookupEntry ¶
ReadBlockContentLookupEntry retrieves the positional metadata associated with a transaction hash to allow retrieving the transaction or receipt by hash.
func ReadBloomBits ¶
ReadBloomBits retrieves the compressed bloom bit vector belonging to the given section and bit index from the.
func ReadCanonicalHash ¶
func ReadCanonicalHash(db DatabaseReader, chainType ChainType, number uint64) common.Hash
ReadCanonicalHash retrieves the hash assigned to a canonical block number.
func ReadChainConfig ¶
func ReadChainConfig(db DatabaseReader, hash common.Hash) *config.QuarkChainConfig
ReadChainConfig retrieves the consensus settings based on the given genesis hash.
func ReadConfirmedCrossShardTxList ¶
func ReadConfirmedCrossShardTxList(db DatabaseReader, hash common.Hash) *types.CrossShardTransactionDepositList
func ReadCrossShardTxList ¶
func ReadCrossShardTxList(db DatabaseReader, hash common.Hash) *types.CrossShardTransactionDepositList
func ReadDatabaseVersion ¶
func ReadDatabaseVersion(db DatabaseReader) uint32
ReadDatabaseVersion retrieves the version number of the database.
func ReadFastTrieProgress ¶
func ReadFastTrieProgress(db DatabaseReader) uint64
ReadFastTrieProgress retrieves the number of tries nodes fast synced to allow reporting correct numbers across restarts.
func ReadGenesis ¶
func ReadGenesis(db DatabaseReader, hash common.Hash) *types.MinorBlock
func ReadHeadBlockHash ¶
func ReadHeadBlockHash(db DatabaseReader) common.Hash
ReadHeadBlockHash retrieves the hash of the current canonical head block.
func ReadHeadFastBlockHash ¶
func ReadHeadFastBlockHash(db DatabaseReader) common.Hash
ReadHeadFastBlockHash retrieves the hash of the current fast-sync head block.
func ReadHeadHeaderHash ¶
func ReadHeadHeaderHash(db DatabaseReader) common.Hash
ReadHeadHeaderHash retrieves the hash of the current canonical head header.
func ReadHeaderNumber ¶
func ReadHeaderNumber(db DatabaseReader, hash common.Hash) *uint64
ReadHeaderNumber returns the header number assigned to a hash.
func ReadLastConfirmedMinorBlockHeaderAtRootBlock ¶
func ReadLastConfirmedMinorBlockHeaderAtRootBlock(db DatabaseReader, rHash common.Hash) common.Hash
func ReadLatestMinorBlockHeaders ¶
func ReadLatestMinorBlockHeaders(db DatabaseReader, hash common.Hash) []*types.MinorBlockHeader
func ReadMinorBlock ¶
func ReadMinorBlock(db DatabaseReader, hash common.Hash) *types.MinorBlock
ReadMinorBlock retrieves the block body corresponding to the hash.
func ReadMinorBlockHeader ¶
func ReadMinorBlockHeader(db DatabaseReader, hash common.Hash) *types.MinorBlockHeader
ReadMinorBlockHeader retrieves the block header corresponding to the hash.
func ReadMinorHeaderFromRootBlock ¶
func ReadMinorHeaderFromRootBlock(db DatabaseReader, hash common.Hash) (*types.MinorBlockHeader, common.Hash, uint32)
ReadMinorHeader retrieves a specific MinorHeader from the database, along with its added positional metadata.
func ReadPreimage ¶
func ReadPreimage(db DatabaseReader, hash common.Hash) []byte
ReadPreimage retrieves a single preimage of the provided hash.
func ReadRbCommittingHash ¶
func ReadRbCommittingHash(db DatabaseReader) common.Hash
func ReadReceipt ¶
ReadReceipt retrieves a specific transaction receipt from the database, along with its added positional metadata.
func ReadReceipts ¶
func ReadReceipts(db DatabaseReader, hash common.Hash) types.Receipts
ReadReceipts retrieves all the transaction receipts belonging to a block.
func ReadRootBlock ¶
func ReadRootBlock(db DatabaseReader, hash common.Hash) *types.RootBlock
ReadRootBlock retrieves the block rootBlockBody corresponding to the hash.
func ReadRootBlockHeader ¶
func ReadRootBlockHeader(db DatabaseReader, hash common.Hash) *types.RootBlockHeader
ReadRootBlockHeader retrieves the block header corresponding to the hash.
func ReadTd ¶
func ReadTd(db DatabaseReader, hash common.Hash) *big.Int
ReadTd retrieves a block's total difficulty corresponding to the hash.
func ReadTotalTx ¶
func ReadTotalTx(db DatabaseReader, hash common.Hash) *uint32
func ReadTransaction ¶
func ReadTransaction(db DatabaseReader, hash common.Hash) (*types.Transaction, common.Hash, uint32)
ReadTransaction retrieves a specific transaction from the database, along with its added positional metadata.
func ReadValidateMinorBlockHash ¶
func ReadValidateMinorBlockHash(db DatabaseReader, hash common.Hash) bool
ReadMinorBlockHeader retrieves the block header corresponding to the hash.
func WriteBlockContentLookupEntries ¶
func WriteBlockContentLookupEntries(db DatabaseWriter, block types.IBlock)
WriteBlockContentLookupEntries stores a positional metadata for every transaction from a block, enabling hash based transaction and receipt lookups.
func WriteBloomBits ¶
WriteBloomBits stores the compressed bloom bits vector belonging to the given section and bit index.
func WriteCanonicalHash ¶
func WriteCanonicalHash(db DatabaseWriter, chainType ChainType, hash common.Hash, number uint64)
WriteCanonicalHash stores the hash assigned to a canonical block number.
func WriteChainConfig ¶
func WriteChainConfig(db DatabaseWriter, hash common.Hash, cfg *config.QuarkChainConfig)
WriteChainConfig writes the chain config settings to the database.
func WriteConfirmedCrossShardTxList ¶
func WriteConfirmedCrossShardTxList(db DatabaseWriter, hash common.Hash, list types.CrossShardTransactionDepositList)
func WriteCrossShardTxList ¶
func WriteCrossShardTxList(db DatabaseWriter, hash common.Hash, list types.CrossShardTransactionDepositList)
func WriteDatabaseVersion ¶
func WriteDatabaseVersion(db DatabaseWriter, version uint32)
WriteDatabaseVersion stores the version number of the database
func WriteFastTrieProgress ¶
func WriteFastTrieProgress(db DatabaseWriter, count uint64)
WriteFastTrieProgress stores the fast sync trie process counter to support retrieving it across restarts.
func WriteGenesisBlock ¶
func WriteGenesisBlock(db DatabaseWriter, rHash common.Hash, block *types.MinorBlock)
func WriteHeadBlockHash ¶
func WriteHeadBlockHash(db DatabaseWriter, hash common.Hash)
WriteHeadBlockHash stores the head block's hash.
func WriteHeadFastBlockHash ¶
func WriteHeadFastBlockHash(db DatabaseWriter, hash common.Hash)
WriteHeadFastBlockHash stores the hash of the current fast-sync head block.
func WriteHeadHeaderHash ¶
func WriteHeadHeaderHash(db DatabaseWriter, hash common.Hash)
WriteHeadHeaderHash stores the hash of the current canonical head header.
func WriteLastConfirmedMinorBlockHeaderAtRootBlock ¶
func WriteLastConfirmedMinorBlockHeaderAtRootBlock(db DatabaseWriter, rHash common.Hash, mHash common.Hash)
func WriteLatestMinorBlockHeaders ¶
func WriteLatestMinorBlockHeaders(db DatabaseWriter, hash common.Hash, headers []*types.MinorBlockHeader)
func WriteMinorBlock ¶
func WriteMinorBlock(db DatabaseWriter, block *types.MinorBlock)
WriteMinorBlock storea a block body into the database.
func WriteMinorBlockCnt ¶
func WriteMinorBlockCnt(db DatabaseWriter, fullShardID uint32, height uint32, data []byte)
func WriteMinorBlockHeader ¶
func WriteMinorBlockHeader(db DatabaseWriter, header *types.MinorBlockHeader)
func WritePreimages ¶
func WritePreimages(db DatabaseWriter, preimages map[common.Hash][]byte)
WritePreimages writes the provided set of preimages to the database.
func WriteReceipts ¶
func WriteReceipts(db DatabaseWriter, hash common.Hash, receipts types.Receipts)
WriteReceipts stores all the transaction receipts belonging to a block.
func WriteRootBlock ¶
func WriteRootBlock(db DatabaseWriter, block *types.RootBlock)
WriteRootBlock storea a block rootBlockBody into the database.
func WriteRootBlockCommittingHash ¶
func WriteRootBlockCommittingHash(db DatabaseWriter, hash common.Hash)
func WriteRootBlockHeader ¶
func WriteRootBlockHeader(db DatabaseWriter, header *types.RootBlockHeader)
WriteRootBlockHeader stores a block header into the database and also stores the hash- to-number mapping.
func WriteTd ¶
func WriteTd(db DatabaseWriter, hash common.Hash, td *big.Int)
WriteTd stores the total difficulty of a block into the database.
func WriteTotalTx ¶
func WriteTotalTx(db DatabaseWriter, hash common.Hash, txCount uint32)
func WriteValidateMinorBlockHash ¶
func WriteValidateMinorBlockHash(db DatabaseWriter, hash common.Hash)
Types ¶
type DatabaseDeleter ¶
DatabaseDeleter wraps the Delete method of a backing data store.
type DatabaseReader ¶
DatabaseReader wraps the Has and Get method of a backing data store.
type DatabaseWriter ¶
DatabaseWriter wraps the Put method of a backing data store.
type LookupEntry ¶
LookupEntry is a positional metadata to help looking up the data content of a transaction or receipt given only its hash.