Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrorEmptyHash = errors.New("transaction hash cannot be empty")
ErrorEmptyHash indicates empty hash
Functions ¶
func IsRangeOperation ¶
IsRangeOperation returns a boolean signifying if a query Operator is a range operation or not.
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 BlockIndexer ¶
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) }
BlockIndexer defines an interface contract for indexing block events.
type QueryRange ¶
type QueryRange struct { LowerBound interface{} // int || time.Time UpperBound interface{} // int || time.Time Key string IncludeLowerBound bool IncludeUpperBound bool }
QueryRange defines a range within a query condition.
func (QueryRange) AnyBound ¶
func (qr QueryRange) AnyBound() interface{}
AnyBound returns either the lower bound if non-nil, otherwise the upper bound.
func (QueryRange) LowerBoundValue ¶
func (qr QueryRange) LowerBoundValue() interface{}
LowerBoundValue returns the value for the lower bound. If the lower bound is nil, nil will be returned.
func (QueryRange) UpperBoundValue ¶
func (qr QueryRange) UpperBoundValue() interface{}
UpperBoundValue returns the value for the upper bound. If the upper bound is nil, nil will be returned.
type QueryRanges ¶
type QueryRanges map[string]QueryRange
QueryRanges defines a mapping between a composite event key and a QueryRange.
e.g.account.number => queryRange{lowerBound: 1, upperBound: 5}
func LookForRanges ¶
func LookForRanges(conditions []query.Condition) (ranges QueryRanges, indexes []int)
LookForRanges returns a mapping of QueryRanges and the matching indexes in the provided query conditions.
type Service ¶
type Service struct { service.BaseService // contains filtered or unexported fields }
Service 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 BlockIndexer, eventBus *types.EventBus, ) *Service
NewIndexerService returns a new service instance.
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) ([]*abci.TxResult, error) }
TxIndexer interface defines methods to index and search transactions.