Documentation ¶
Overview ¶
Package rawdb contains a collection of low level database accessors. e.g. read, write
Index ¶
- func CountStates(db xordb.Iteratee) int
- func DeleteBlock(db xordb.Writer, hash common.Hash, number uint64)
- func DeleteBody(db xordb.Writer, hash common.Hash, number uint64)
- func DeleteHash(db xordb.Writer, number uint64)
- func DeleteHeader(db xordb.Writer, hash common.Hash, number uint64)
- func DeleteRawTxData(db xordb.Writer, hash common.Hash)
- func DeleteState(db xordb.Writer, publicKey *ecdsa.PublicKey)
- func DeleteTd(db xordb.Writer, hash common.Hash, number uint64)
- func DeleteTxLookupEntry(db xordb.Writer, hash common.Hash)
- func HasBody(db xordb.Reader, hash common.Hash, number uint64) bool
- func HasHeader(db xordb.Reader, hash common.Hash, number uint64) bool
- func LoadBlock(db xordb.Reader, hash common.Hash, number uint64) *types.Block
- func LoadBlockByBN(db xordb.Reader, number uint64) *types.Block
- func LoadHeader(db xordb.Reader, hash common.Hash, number uint64) *types.Header
- func LoadHeaderByBN(db xordb.Reader, number uint64) *types.Header
- func NewDatabase(db xordb.KeyValueStore) xordb.Database
- func NewLevelDBDatabase(file string, cache int, handles int, namespace string) (xordb.Database, error)
- func NewMemoryDatabase() xordb.Database
- func NewMemoryDatabaseWithCap(size int) xordb.Database
- func ReadBody(db xordb.Reader, hash common.Hash, number uint64) *types.Body
- func ReadBodyData(db xordb.Reader, hash common.Hash, number uint64) []byte
- func ReadGenesisHeaderHash(db xordb.Reader) common.Hash
- func ReadHash(db xordb.Reader, number uint64) common.Hash
- func ReadHeadBlockHash(db xordb.Reader) common.Hash
- func ReadHeader(db xordb.Reader, hash common.Hash, number uint64) *types.Header
- func ReadHeaderData(db xordb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadHeaderNumber(db xordb.Reader, hash common.Hash) *uint64
- func ReadLastHeaderHash(db xordb.Reader) common.Hash
- func ReadRawTxData(db xordb.Reader, hash common.Hash) []byte
- func ReadState(db xordb.Reader, publicKey *ecdsa.PublicKey) common.Hash
- func ReadStates(db xordb.Database)
- func ReadTd(db xordb.Reader, hash common.Hash, number uint64) *big.Int
- func ReadTdData(db xordb.Reader, hash common.Hash, number uint64) rlp.RawValue
- func ReadTransaction(db xordb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
- func ReadTxLookupEntry(db xordb.Reader, hash common.Hash) *uint64
- func StoreBlock(db xordb.Writer, block *types.Block)
- func WriteBody(db xordb.Writer, hash common.Hash, number uint64, body *types.Body)
- func WriteBodyData(db xordb.Writer, hash common.Hash, number uint64, data []byte)
- func WriteGenesisHeaderHash(db xordb.Writer, hash common.Hash)
- func WriteHash(db xordb.Writer, hash common.Hash, number uint64)
- func WriteHeadBlockHash(db xordb.Writer, hash common.Hash)
- func WriteHeader(db xordb.Writer, header *types.Header)
- func WriteLastHeaderHash(db xordb.Writer, hash common.Hash)
- func WriteRawTxData(db xordb.Writer, hash common.Hash, data []byte)
- func WriteState(db xordb.Writer, address common.Address, txHash common.Hash)
- func WriteTd(db xordb.Writer, hash common.Hash, number uint64, td *big.Int)
- func WriteTransaction(db xordb.Database, hash common.Hash, tx *types.Transaction)
- func WriteTxLookupEntries(db xordb.Writer, block *types.Block)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 DeleteHash ¶
DeleteHash removes the number to hash mapping.
func DeleteHeader ¶
DeleteHeader removes all block header data associated with a hash.
func DeleteRawTxData ¶
DeleteRawTxData removes the raw tx data corresponding to the hash
func DeleteState ¶
DeleteState deletes a tx hash corresponding to the PublicKey's address
func DeleteTxLookupEntry ¶
DeleteTxLookupEntry removes all transaction data associated with a hash.
func LoadBlockByBN ¶
LoadBlockByBN retrieves an entire block corresponding to the number
func LoadHeader ¶
LoadHeader retrieves an entire header corresponding to the hash & number
func LoadHeaderByBN ¶
LoadHeaderByBN retrieves an entire header corresponding to the number
func NewDatabase ¶
func NewDatabase(db xordb.KeyValueStore) xordb.Database
NewDatabase creates a high level database on top of a given key-value data
func NewLevelDBDatabase ¶
func NewLevelDBDatabase(file string, cache int, handles int, namespace string) (xordb.Database, error)
NewLevelDBDatabase creates a persistent key-value database
func NewMemoryDatabase ¶
NewMemoryDatabase creates an in-memory key-value database
func NewMemoryDatabaseWithCap ¶
NewMemoryDatabaseWithCap creates an in-memory key-value database with an initial starting capacity
func ReadBodyData ¶
ReadBodyData retrieves the block body in json encoding
func ReadGenesisHeaderHash ¶
ReadGenesisHeaderHash retrieves the hash of the genesis block.
func ReadHeadBlockHash ¶
ReadHeadBlockHash retrieves the hash of the last block.
func ReadHeader ¶
ReadHeader retrieves the block header corresponding to the hash.
func ReadHeaderData ¶
ReadHeaderData retrieves a block header data in rlp encoding
func ReadHeaderNumber ¶
ReadHeaderNumber returns the header number assigned to a hash.
func ReadLastHeaderHash ¶
ReadLastHeaderHash retrieves the hash of the last header.
func ReadRawTxData ¶
ReadRawTxData retrieves the raw tx data corresponding to the hash
func ReadStates ¶
ReadStates reads all address - txHash mappings in the db
func ReadTdData ¶
ReadTdData retrieves a block's total difficulty corresponding to the hash.
func ReadTransaction ¶
func ReadTransaction(db xordb.Reader, hash common.Hash) (*types.Transaction, common.Hash, uint64, uint64)
ReadTransaction retrieves a transaction and its metadata. returns (tx, blockHash, *blockNumber, uint64(txIndex))
func ReadTxLookupEntry ¶
ReadTxLookupEntry retrieves the blocknumber of the block the tx is in
func StoreBlock ¶
StoreBlock serializes a block into the database, header and body separately.
func WriteBodyData ¶
WriteBodyData stores block body into the database in json encoding
func WriteGenesisHeaderHash ¶
WriteGenesisHeaderHash stores the hash of the genesis block.
func WriteHeadBlockHash ¶
WriteHeadBlockHash stores the last block's hash.
func WriteHeader ¶
WriteHeader stores a block header into the database and also stores the hash- to-number mapping.
func WriteLastHeaderHash ¶
WriteLastHeaderHash stores the hash of the last header.
func WriteRawTxData ¶
WriteRawTxData stores the raw tx data corresponding to the hash
func WriteState ¶
WriteState writes a tx hash corresponding to the PublicKey's address
func WriteTransaction ¶
WriteTransaction stores a transaction into the database.
Types ¶
This section is empty.