mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 11:45:18 +00:00
25 lines
756 B
Go
25 lines
756 B
Go
package indexer
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/tendermint/tendermint/libs/pubsub/query"
|
|
"github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
//go:generate ../../scripts/mockery_generate.sh BlockIndexer
|
|
|
|
// BlockIndexer defines an interface contract for indexing block events.
|
|
type BlockIndexer interface {
|
|
// Has returns true if the given height has been indexed. An error is returned
|
|
// upon database query failure.
|
|
Has(height int64) (bool, error)
|
|
|
|
// Index indexes BeginBlock and EndBlock events for a given block by its height.
|
|
Index(types.EventDataNewBlockHeader) error
|
|
|
|
// Search performs a query for block heights that match a given BeginBlock
|
|
// and Endblock event search criteria.
|
|
Search(ctx context.Context, q *query.Query) ([]int64, error)
|
|
}
|