blockdao

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockDAO

type BlockDAO interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Height() (uint64, error)
	GetBlockHash(uint64) (hash.Hash256, error)
	GetBlockHeight(hash.Hash256) (uint64, error)
	GetBlock(hash.Hash256) (*block.Block, error)
	GetBlockByHeight(uint64) (*block.Block, error)
	GetReceipts(uint64) ([]*action.Receipt, error)
	ContainsTransactionLog() bool
	TransactionLogs(uint64) (*iotextypes.TransactionLogs, error)
	PutBlock(context.Context, *block.Block) error
	Header(hash.Hash256) (*block.Header, error)
	HeaderByHeight(uint64) (*block.Header, error)
	FooterByHeight(uint64) (*block.Footer, error)
}

BlockDAO represents the block data access object

func NewBlockDAOWithIndexersAndCache added in v1.14.0

func NewBlockDAOWithIndexersAndCache(blkStore BlockDAO, indexers []BlockIndexer, cacheSize int) BlockDAO

NewBlockDAOWithIndexersAndCache returns a BlockDAO with indexers which will consume blocks appended, and caches which will speed up reading

type BlockIndexer added in v0.11.0

type BlockIndexer interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Height() (uint64, error)
	PutBlock(context.Context, *block.Block) error
	DeleteTipBlock(context.Context, *block.Block) error
}

BlockIndexer defines an interface to accept block to build index

type BlockIndexerChecker added in v1.8.0

type BlockIndexerChecker struct {
	// contains filtered or unexported fields
}

BlockIndexerChecker defines a checker of block indexer

func NewBlockIndexerChecker added in v1.8.0

func NewBlockIndexerChecker(dao BlockDAO) *BlockIndexerChecker

NewBlockIndexerChecker creates a new block indexer checker

func (*BlockIndexerChecker) CheckIndexer added in v1.8.0

func (bic *BlockIndexerChecker) CheckIndexer(ctx context.Context, indexer BlockIndexer, targetHeight uint64, progressReporter func(uint64)) error

CheckIndexer checks a block indexer against block dao

type BlockIndexerWithStart added in v1.11.0

type BlockIndexerWithStart interface {
	BlockIndexer
	// StartHeight returns the start height of the indexer
	StartHeight() uint64
}

BlockIndexerWithStart defines an interface to accept block to build index from a start height

Jump to

Keyboard shortcuts

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