Documentation ¶
Index ¶
- Variables
- type BlockStore
- func (bs *BlockStore) Close() error
- func (bs *BlockStore) DeleteBlock(height uint64, hash types.Hash)
- func (bs *BlockStore) DeleteData(hash types.Hash)
- func (bs *BlockStore) DeleteHashByHeight(height uint64)
- func (bs *BlockStore) DeleteHashByHeightFrom(height uint64)
- func (bs *BlockStore) DeleteHeader(height uint64, hash types.Hash)
- func (bs *BlockStore) DeleteHeaderHeight(hash types.Hash)
- func (bs *BlockStore) DeleteTd(height uint64, hash types.Hash)
- func (bs *BlockStore) ReadBlock(height uint64, hash types.Hash) *types.Block
- func (bs *BlockStore) ReadData(hash types.Hash, result interface{}) error
- func (bs *BlockStore) ReadDataRLP(hash types.Hash) rlp.RawValue
- func (bs *BlockStore) ReadHashByHeight(height uint64) types.Hash
- func (bs *BlockStore) ReadHeadBlock() *types.Block
- func (bs *BlockStore) ReadHeadBlockHash() types.Hash
- func (bs *BlockStore) ReadHeader(height uint64, hash types.Hash) *types.Header
- func (bs *BlockStore) ReadHeightByHash(hash types.Hash) *uint64
- func (bs *BlockStore) ReadReceipt(hash types.Hash) (result *types.StoredReceipt)
- func (bs *BlockStore) ReadTd(height uint64, hash types.Hash) *big.Int
- func (bs *BlockStore) ReadTx(hash types.Hash) (result types.Tx)
- func (bs *BlockStore) WriteBlock(block *types.Block)
- func (bs *BlockStore) WriteData(hash types.Hash, data interface{})
- func (bs *BlockStore) WriteHashByHeight(height uint64, hash types.Hash, miner types.Address)
- func (bs *BlockStore) WriteHeadBlockHash(hash types.Hash)
- func (bs *BlockStore) WriteHeader(header *types.Header)
- func (bs *BlockStore) WriteHeightByHash(hash types.Hash, height uint64)
- func (bs *BlockStore) WriteTd(height uint64, hash types.Hash, td *big.Int)
- type MinerStore
- type MinerStoreNop
- func (*MinerStoreNop) AddMiner(height uint64, miner types.Address) bool
- func (s *MinerStoreNop) Close()
- func (*MinerStoreNop) CountBlockByMiner(miner types.Address, limit int) int
- func (*MinerStoreNop) QueryBlockByMiner(miner types.Address, limit int, page int) []uint64
- func (*MinerStoreNop) RemoveMinerByHeight(height uint64) bool
- func (*MinerStoreNop) RemoveMinerFromHeight(height uint64) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is returned when record not found. ErrNotFound = errors.New("not found") )
Functions ¶
This section is empty.
Types ¶
type BlockStore ¶
type BlockStore struct { log.Logger MinerDb MinerStore // contains filtered or unexported fields }
func NewBlockStore ¶
func NewBlockStore(logger log.Logger) (*BlockStore, error)
func (*BlockStore) Close ¶
func (bs *BlockStore) Close() error
func (*BlockStore) DeleteBlock ¶ added in v0.2.0
func (bs *BlockStore) DeleteBlock(height uint64, hash types.Hash)
func (*BlockStore) DeleteData ¶ added in v0.2.0
func (bs *BlockStore) DeleteData(hash types.Hash)
func (*BlockStore) DeleteHashByHeight ¶
func (bs *BlockStore) DeleteHashByHeight(height uint64)
func (*BlockStore) DeleteHashByHeightFrom ¶
func (bs *BlockStore) DeleteHashByHeightFrom(height uint64)
func (*BlockStore) DeleteHeader ¶ added in v0.2.0
func (bs *BlockStore) DeleteHeader(height uint64, hash types.Hash)
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) 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 ¶
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) WriteBlock ¶
func (bs *BlockStore) WriteBlock(block *types.Block)
func (*BlockStore) WriteData ¶
func (bs *BlockStore) WriteData(hash types.Hash, data interface{})
func (*BlockStore) WriteHashByHeight ¶
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.
type MinerStore ¶ added in v0.2.0
type MinerStoreNop ¶ added in v0.2.0
type MinerStoreNop struct { }
func (*MinerStoreNop) AddMiner ¶ added in v0.2.0
func (*MinerStoreNop) AddMiner(height uint64, miner types.Address) bool
func (*MinerStoreNop) Close ¶ added in v0.2.0
func (s *MinerStoreNop) Close()
func (*MinerStoreNop) CountBlockByMiner ¶ added in v0.2.0
func (*MinerStoreNop) CountBlockByMiner(miner types.Address, limit int) int
func (*MinerStoreNop) QueryBlockByMiner ¶ added in v0.2.0
func (*MinerStoreNop) RemoveMinerByHeight ¶ added in v0.2.0
func (*MinerStoreNop) RemoveMinerByHeight(height uint64) bool
func (*MinerStoreNop) RemoveMinerFromHeight ¶ added in v0.2.0
func (*MinerStoreNop) RemoveMinerFromHeight(height uint64) bool
Click to show internal directories.
Click to hide internal directories.