Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorHashMissLength = errors.New("the lenght of Block hash is not 32")
---------------------------------------------------- Errors ErrorHashMissLength indicates length of hash is not correct
Functions ¶
This section is empty.
Types ¶
type BlockIndexer ¶
type BlockIndexer interface { // Index analyzes, indexes and stores a single (block hash -- block height) key-value. Index(block *types.Header) error // Get returns the block height specified by hash or 0 if the block is not indexed. Get(hash []byte) (int64, error) }
BlockIndexer interface defines methods to index and search blocks.
type IndexerService ¶
type IndexerService struct { cmn.BaseService // contains filtered or unexported fields }
IndexerService connects event bus and block indexer together in order to index blocks coming from event bus.
func NewIndexerService ¶
func NewIndexerService(idr BlockIndexer, eventBus *types.EventBus) *IndexerService
NewIndexerService returns a new service instance.
func (*IndexerService) OnStart ¶
func (is *IndexerService) OnStart() error
OnStart implements cmn.Service by subscribing for blocks and indexing them by hash.
func (*IndexerService) OnStop ¶
func (is *IndexerService) OnStop()
OnStop implements cmn.Service by unsubscribing from blocks.
Click to show internal directories.
Click to hide internal directories.