indexer

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRangeOperation

func IsRangeOperation(op query.Operator) bool

IsRangeOperation returns a boolean signifying if a query Operator is a range operation or not.

func LookForRangesWithHeight

func LookForRangesWithHeight(conditions []query.Condition) (ranges QueryRanges, indexes []int, heightRange QueryRange)

LookForRangesWithHeight returns a mapping of QueryRanges and the matching indexes in the provided query conditions. If we are matching attributes within events we need to remember the height range from the condition

Types

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 deprecated

func LookForRanges(conditions []query.Condition) (ranges QueryRanges, indexes []int)

LookForRanges returns a mapping of QueryRanges and the matching indexes in the provided query conditions.

Deprecated: This function will be replaced with LookForRangesWithHeight

Directories

Path Synopsis
block
kv
sink
psql
Package psql implements an event sink backed by a PostgreSQL database.
Package psql implements an event sink backed by a PostgreSQL database.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL