Documentation ¶
Overview ¶
Package psql implements an event sink backed by a PostgreSQL database.
Index ¶
- type BackportBlockIndexer
- func (BackportBlockIndexer) GetRetainHeight() (int64, error)
- func (BackportBlockIndexer) Has(_ int64) (bool, error)
- func (b BackportBlockIndexer) Index(block types.EventDataNewBlockEvents) error
- func (BackportBlockIndexer) Prune(_ int64) (numPruned, newRetainHeight int64, err error)
- func (BackportBlockIndexer) Search(context.Context, *query.Query) ([]int64, error)
- func (BackportBlockIndexer) SetLogger(log.Logger)
- func (BackportBlockIndexer) SetRetainHeight(_ int64) error
- type BackportTxIndexer
- func (b BackportTxIndexer) AddBatch(batch *txindex.Batch) error
- func (BackportTxIndexer) Get([]byte) (*abci.TxResult, error)
- func (BackportTxIndexer) GetRetainHeight() (int64, error)
- func (b BackportTxIndexer) Index(txr *abci.TxResult) error
- func (BackportTxIndexer) Prune(_ int64) (numPruned, newRetainHeight int64, err error)
- func (BackportTxIndexer) Search(context.Context, *query.Query, txindex.Pagination) ([]*abci.TxResult, int, error)
- func (BackportTxIndexer) SetLogger(log.Logger)
- func (BackportTxIndexer) SetRetainHeight(_ int64) error
- type EventSink
- func (es *EventSink) BlockIndexer() BackportBlockIndexer
- func (es *EventSink) DB() *sql.DB
- func (*EventSink) GetTxByHash(_ []byte) (*abci.TxResult, error)
- func (*EventSink) HasBlock(_ int64) (bool, error)
- func (es *EventSink) IndexBlockEvents(h types.EventDataNewBlockEvents) error
- func (es *EventSink) IndexTxEvents(txrs []*abci.TxResult) error
- func (*EventSink) SearchBlockEvents(_ context.Context, _ *query.Query) ([]int64, error)
- func (*EventSink) SearchTxEvents(_ context.Context, _ *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) GetRetainHeight ¶
func (BackportBlockIndexer) GetRetainHeight() (int64, error)
func (BackportBlockIndexer) Has ¶
func (BackportBlockIndexer) Has(_ 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.EventDataNewBlockEvents) error
Index indexes block begin and end events for the specified block. It is part of the BlockIndexer interface.
func (BackportBlockIndexer) Prune ¶
func (BackportBlockIndexer) Prune(_ int64) (numPruned, newRetainHeight int64, err error)
func (BackportBlockIndexer) Search ¶
Search 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) SetLogger ¶
func (BackportBlockIndexer) SetLogger(log.Logger)
func (BackportBlockIndexer) SetRetainHeight ¶
func (BackportBlockIndexer) SetRetainHeight(_ int64) error
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.
func (BackportTxIndexer) GetRetainHeight ¶
func (BackportTxIndexer) GetRetainHeight() (int64, error)
func (BackportTxIndexer) Index ¶
func (b BackportTxIndexer) Index(txr *abci.TxResult) error
Index indexes a single transaction result in Postgres, as part of TxIndexer.
func (BackportTxIndexer) Prune ¶
func (BackportTxIndexer) Prune(_ int64) (numPruned, newRetainHeight int64, err error)
func (BackportTxIndexer) Search ¶
func (BackportTxIndexer) Search(context.Context, *query.Query, txindex.Pagination) ([]*abci.TxResult, int, error)
Search is implemented to satisfy the TxIndexer interface, but it is not supported by the psql event sink and reports an error for all inputs.
func (BackportTxIndexer) SetLogger ¶
func (BackportTxIndexer) SetLogger(log.Logger)
func (BackportTxIndexer) SetRetainHeight ¶
func (BackportTxIndexer) SetRetainHeight(_ int64) error
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 CometBFT 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.EventDataNewBlockEvents) 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 CometBFT v0.34 transaction indexer.