store

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockStore

type BlockStore struct {
	log.Logger
	// contains filtered or unexported fields
}

func NewBlockStore

func NewBlockStore(logger log.Logger) (*BlockStore, error)

func (*BlockStore) Close

func (bs *BlockStore) Close() error

func (*BlockStore) DeleteHashByHeight

func (bs *BlockStore) DeleteHashByHeight(height uint64)

func (*BlockStore) DeleteHashByHeightFrom

func (bs *BlockStore) DeleteHashByHeightFrom(height uint64)

func (*BlockStore) DeleteHeaderHeight

func (bs *BlockStore) DeleteHeaderHeight(hash types.Hash)

DeleteHeaderHeight removes hash->height mapping.

func (*BlockStore) DeleteTd

func (bs *BlockStore) DeleteTd(height uint64, hash types.Hash)

DeleteTd removes all block total difficulty data associated with a hash.

func (*BlockStore) ReadBlock

func (bs *BlockStore) ReadBlock(height uint64, hash types.Hash) *types.Block

func (*BlockStore) ReadData

func (bs *BlockStore) ReadData(hash types.Hash, result interface{}) error

ReadData retrieves the data corresponding to the hash and decode into result.

func (*BlockStore) ReadDataRLP

func (bs *BlockStore) ReadDataRLP(hash types.Hash) rlp.RawValue

ReadDataRLP retrieves the data in RLP encoding.

func (*BlockStore) ReadHashByHeight

func (bs *BlockStore) ReadHashByHeight(height uint64) types.Hash

func (*BlockStore) ReadHeadBlock

func (bs *BlockStore) ReadHeadBlock() *types.Block

func (*BlockStore) ReadHeadBlockHash

func (bs *BlockStore) ReadHeadBlockHash() types.Hash

func (*BlockStore) ReadHeader

func (bs *BlockStore) ReadHeader(height uint64, hash types.Hash) *types.Header

ReadHeader retrieves the block header corresponding to the hash.

func (*BlockStore) ReadHeightByHash

func (bs *BlockStore) ReadHeightByHash(hash types.Hash) *uint64

ReadHeightByHash returns the header height assigned to a hash.

func (*BlockStore) ReadReceipt

func (bs *BlockStore) ReadReceipt(hash types.Hash) (result *types.StoredReceipt)

func (*BlockStore) ReadTd

func (bs *BlockStore) ReadTd(height uint64, hash types.Hash) *big.Int

ReadTd retrieves a block's total difficulty corresponding to the hash.

func (*BlockStore) ReadTx

func (bs *BlockStore) ReadTx(hash types.Hash) (result types.Tx)

func (*BlockStore) WriteBlock

func (bs *BlockStore) WriteBlock(block *types.Block)

func (*BlockStore) WriteData

func (bs *BlockStore) WriteData(hash types.Hash, data interface{})

func (*BlockStore) WriteHashByHeight

func (bs *BlockStore) WriteHashByHeight(height uint64, hash types.Hash)

GetHashByHeight stores hash by height for the head chain

func (*BlockStore) WriteHeadBlockHash

func (bs *BlockStore) WriteHeadBlockHash(hash types.Hash)

func (*BlockStore) WriteHeader

func (bs *BlockStore) WriteHeader(header *types.Header)

WriteHeader writes the block header corresponding to the hash.

func (*BlockStore) WriteHeightByHash

func (bs *BlockStore) WriteHeightByHash(hash types.Hash, height uint64)

WriteHeightByHash stores the hash->height mapping.

func (*BlockStore) WriteTd

func (bs *BlockStore) WriteTd(height uint64, hash types.Hash, td *big.Int)

WriteTd stores the total difficulty of a block into the database.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL