github.com/badrootd/celestia-core@v0.0.0-20240305091328-aa4207a4b25d/state/indexer/block.go (about) 1 package indexer 2 3 import ( 4 "context" 5 6 "github.com/badrootd/celestia-core/libs/pubsub/query" 7 "github.com/badrootd/celestia-core/types" 8 ) 9 10 //go:generate ../../scripts/mockery_generate.sh BlockIndexer 11 12 // BlockIndexer defines an interface contract for indexing block events. 13 type BlockIndexer interface { 14 // Has returns true if the given height has been indexed. An error is returned 15 // upon database query failure. 16 Has(height int64) (bool, error) 17 18 // Index indexes BeginBlock and EndBlock events for a given block by its height. 19 Index(types.EventDataNewBlockHeader) error 20 21 // Search performs a query for block heights that match a given BeginBlock 22 // and Endblock event search criteria. 23 Search(ctx context.Context, q *query.Query) ([]int64, error) 24 }