Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrorEmptyHash = errors.New("transaction hash cannot be empty")
ErrorEmptyHash indicates empty hash.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
Batch groups together multiple Index operations to be performed at the same time. NOTE: Batch is NOT thread-safe and must not be modified after starting its execution.
type IndexerService ¶
type IndexerService struct { service.BaseService // contains filtered or unexported fields }
IndexerService connects event bus, transaction and block indexers together in order to index transactions and blocks coming from the event bus.
func NewIndexerService ¶
func NewIndexerService( txIdxr TxIndexer, blockIdxr indexer.BlockIndexer, eventBus *types.EventBus, terminateOnError bool, ) *IndexerService
NewIndexerService returns a new service instance.
func (*IndexerService) OnStart ¶
func (is *IndexerService) OnStart() error
OnStart implements service.Service by subscribing for all transactions and indexing them by events.
func (*IndexerService) OnStop ¶
func (is *IndexerService) OnStop()
OnStop implements service.Service by unsubscribing from all transactions.
type Pagination ¶
Pagination provides pagination information for queries. This allows us to use the same TxSearch API for pruning to return all relevant data, while still limiting public queries to pagination.
type TxIndexer ¶
type TxIndexer interface { // AddBatch analyzes, indexes and stores a batch of transactions. AddBatch(b *Batch) error // Index analyzes, indexes and stores a single transaction. Index(result *abci.TxResult) error // Get returns the transaction specified by hash or nil if the transaction is not indexed // or stored. Get(hash []byte) (*abci.TxResult, error) // Search allows you to query for transactions. Search(ctx context.Context, q *query.Query, pagSettings Pagination) ([]*abci.TxResult, int, error) // Set Logger SetLogger(l log.Logger) Prune(retainHeight int64) (int64, int64, error) GetRetainHeight() (int64, error) SetRetainHeight(retainHeight int64) error }
TxIndexer interface defines methods to index and search transactions.