psql

package
v0.0.0-...-b8dbfa3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package psql implements an event sink backed by a PostgreSQL database.

Index

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

Index indexes block begin and end events for the specified block. It is part of the BlockIndexer interface.

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.

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

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) Index

func (b BackportTxIndexer) Index(txr *abci.TxResult) error

Index indexes a single transaction result in Postgres, as part of TxIndexer.

func (BackportTxIndexer) Search

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.

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

func NewEventSink(connStr, chainID string) (*EventSink, error)

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

func (es *EventSink) DB() *sql.DB

DB returns the underlying Postgres connection used by the sink. This is exported to support testing.

func (*EventSink) GetTxByHash

func (es *EventSink) GetTxByHash(hash []byte) (*abci.TxResult, error)

GetTxByHash is not implemented by this sink, and reports an error for all queries.

func (*EventSink) HasBlock

func (es *EventSink) HasBlock(h int64) (bool, error)

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) IndexTxEvents

func (es *EventSink) IndexTxEvents(txrs []*abci.TxResult) error

func (*EventSink) SearchBlockEvents

func (es *EventSink) SearchBlockEvents(ctx context.Context, q *query.Query) ([]int64, error)

SearchBlockEvents is not implemented by this sink, and reports an error for all queries.

func (*EventSink) SearchTxEvents

func (es *EventSink) SearchTxEvents(ctx context.Context, q *query.Query) ([]*abci.TxResult, error)

SearchTxEvents is not implemented by this sink, and reports an error for all queries.

func (*EventSink) Stop

func (es *EventSink) Stop() error

Stop closes the underlying PostgreSQL database.

func (*EventSink) TxIndexer

func (es *EventSink) TxIndexer() BackportTxIndexer

TxIndexer returns a bridge from es to the CometBFT v0.34 transaction indexer.

Jump to

Keyboard shortcuts

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