Documentation ¶
Overview ¶
Package psql implements an event sink backed by a PostgreSQL database.
Index ¶
- type BackportBlockIndexer
- type BackportTxIndexer
- type EventSink
- func (es *EventSink) BlockIndexer() BackportBlockIndexer
- func (es *EventSink) DB() *sql.DB
- func (es *EventSink) GetTxByHash(hash []byte) (*abci.TxResult, error)
- func (es *EventSink) HasBlock(h int64) (bool, error)
- func (es *EventSink) IndexBlockEvents(h types.EventDataNewBlockHeader) error
- func (es *EventSink) IndexTxEvents(txrs []*abci.TxResult) error
- func (es *EventSink) SearchBlockEvents(ctx context.Context, q *query.Query) ([]int64, error)
- func (es *EventSink) SearchTxEvents(ctx context.Context, q *query.Query) ([]*abci.TxResult, error)
- func (es *EventSink) Stop() error
- func (es *EventSink) TxIndexer() BackportTxIndexer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackportBlockIndexer ¶
type BackportBlockIndexer struct {
// contains filtered or unexported fields
}
BackportBlockIndexer implements the indexer.BlockIndexer interface by delegating indexing operations to an underlying PostgreSQL event sink.
func (BackportBlockIndexer) Has ¶
func (BackportBlockIndexer) Has(height int64) (bool, error)
Has is implemented to satisfy the BlockIndexer interface, but it is not supported by the psql event sink and reports an error for all inputs.
func (BackportBlockIndexer) Index ¶
func (b BackportBlockIndexer) Index(block types.EventDataNewBlockHeader) error
Index indexes block begin and end events for the specified block. It is part of the BlockIndexer interface.
type BackportTxIndexer ¶
type BackportTxIndexer struct {
// contains filtered or unexported fields
}
BackportTxIndexer implements the txindex.TxIndexer interface by delegating indexing operations to an underlying PostgreSQL event sink.
func (BackportTxIndexer) AddBatch ¶
func (b BackportTxIndexer) AddBatch(batch *txindex.Batch) error
AddBatch indexes a batch of transactions in Postgres, as part of TxIndexer.
func (BackportTxIndexer) Get ¶
func (BackportTxIndexer) Get([]byte) (*abci.TxResult, error)
Get is implemented to satisfy the TxIndexer interface, but is not supported by the psql event sink and reports an error for all inputs.
type EventSink ¶
type EventSink struct {
// contains filtered or unexported fields
}
EventSink is an indexer backend providing the tx/block index services. This implementation stores records in a PostgreSQL database using the schema defined in state/indexer/sink/psql/schema.sql.
func NewEventSink ¶
NewEventSink constructs an event sink associated with the PostgreSQL database specified by connStr. Events written to the sink are attributed to the specified chainID.
func (*EventSink) BlockIndexer ¶
func (es *EventSink) BlockIndexer() BackportBlockIndexer
BlockIndexer returns a bridge that implements the Tendermint v0.34 block indexer interface, using the Postgres event sink as a backing store.
func (*EventSink) DB ¶
DB returns the underlying Postgres connection used by the sink. This is exported to support testing.
func (*EventSink) GetTxByHash ¶
GetTxByHash is not implemented by this sink, and reports an error for all queries.
func (*EventSink) HasBlock ¶
HasBlock is not implemented by this sink, and reports an error for all queries.
func (*EventSink) IndexBlockEvents ¶
func (es *EventSink) IndexBlockEvents(h types.EventDataNewBlockHeader) error
IndexBlockEvents indexes the specified block header, part of the indexer.EventSink interface.
func (*EventSink) SearchBlockEvents ¶
SearchBlockEvents is not implemented by this sink, and reports an error for all queries.
func (*EventSink) SearchTxEvents ¶
SearchTxEvents is not implemented by this sink, and reports an error for all queries.
func (*EventSink) TxIndexer ¶
func (es *EventSink) TxIndexer() BackportTxIndexer
TxIndexer returns a bridge from es to the Tendermint v0.34 transaction indexer.