psql

package
v0.0.0-...-1abf0d1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 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 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) 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) Type

func (es *EventSink) Type() indexer.EventSinkType

Type returns the structure type for this sink, which is Postgres.

Jump to

Keyboard shortcuts

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