Files
tendermint/state/indexer/eventsink.go
William Banfield 4e96c6b234 tools: add mockery to tools.go and remove mockery version strings (#6787)
This change aims to keep versions of mockery consistent across developer laptops.

This change adds mockery to the `tools.go` file so that its version can be managed consistently in the `go.mod` file.

Additionally, this change temporarily disables adding mockery's version number to generated files. There is an outstanding issue against the mockery project related to the version string behavior when running from `go get`. I have created a pull request to fix this issue in the mockery project.
see: https://github.com/vektra/mockery/issues/397
2021-07-30 20:47:15 +00:00

57 lines
1.9 KiB
Go

package indexer
import (
"context"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/pubsub/query"
"github.com/tendermint/tendermint/types"
)
type EventSinkType string
const (
NULL EventSinkType = "null"
KV EventSinkType = "kv"
PSQL EventSinkType = "psql"
)
//go:generate ../../scripts/mockery_generate.sh EventSink
// EventSink interface is defined the APIs for the IndexerService to interact with the data store,
// including the block/transaction indexing and the search functions.
//
// The IndexerService will accept a list of one or more EventSink types. During the OnStart method
// it will call the appropriate APIs on each EventSink to index both block and transaction events.
type EventSink interface {
// IndexBlockEvents indexes the blockheader.
IndexBlockEvents(types.EventDataNewBlockHeader) error
// IndexTxEvents indexes the given result of transactions. To call it with multi transactions,
// must guarantee the index of given transactions are in order.
IndexTxEvents([]*abci.TxResult) error
// SearchBlockEvents provides the block search by given query conditions. This function only
// supported by the kvEventSink.
SearchBlockEvents(context.Context, *query.Query) ([]int64, error)
// SearchTxEvents provides the transaction search by given query conditions. This function only
// supported by the kvEventSink.
SearchTxEvents(context.Context, *query.Query) ([]*abci.TxResult, error)
// GetTxByHash provides the transaction search by given transaction hash. This function only
// supported by the kvEventSink.
GetTxByHash([]byte) (*abci.TxResult, error)
// HasBlock provides the transaction search by given transaction hash. This function only
// supported by the kvEventSink.
HasBlock(int64) (bool, error)
// Type checks the eventsink structure type.
Type() EventSinkType
// Stop will close the data store connection, if the eventsink supports it.
Stop() error
}