idxdb

package
v0.0.0-...-26dab60 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SetMintEventQuery        = `` /* 196-byte string literal not displayed */
	SetLivenessEventQuery    = `` /* 191-byte string literal not displayed */
	SetValidatorIncomeQuery  = "" /* 213-byte string literal not displayed */
	SetTransferEventQuery    = "" /* 197-byte string literal not displayed */
	UpdateTransferEventQuery = `UPDATE event_transfer SET sender_address = $1 WHERE height = $2 AND event_index = $3;`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Height    int64
	Timestamp time.Time
	NumTxs    int
	Hash      string
	Proposer  string
}

func NewBlock

func NewBlock(b *coretypes.ResultBlock) *Block

type IndexerDB

type IndexerDB struct {
	Pool *pgxpool.Pool
	// contains filtered or unexported fields
}

IndexerDB is a DB instance containing a pool of connections

func NewIndexerDB

func NewIndexerDB(cfg *config.Config) *IndexerDB

NewIndexerDB returns a new IndexerDB struct

func (*IndexerDB) Close

func (idxdb *IndexerDB) Close()

Close closes the idxdb connection pool

func (*IndexerDB) CloseSendBatch

func (idxdb *IndexerDB) CloseSendBatch(batch *pgx.Batch)

CloseSendBatch submits and closes a batch query. Panics if an error occurs.

func (*IndexerDB) InitDB

func (idxdb *IndexerDB) InitDB()

InitDB parses a connection config string and connects to a postgres idxdb instance

func (*IndexerDB) LatestBlockHeight

func (idxdb *IndexerDB) LatestBlockHeight() (height int64, err error)

LatestBlockHeight returns the highest block height stored in the idxdb

func (*IndexerDB) QueryMissingBlocks

func (idxdb *IndexerDB) QueryMissingBlocks(jobs chan<- int64)

QueryMissingBlocks queries the idxdb for missing block heights between the highest saved block height and block height 1. All missing block heights are added to the queue for indexing

func (*IndexerDB) SetBlock

func (idxdb *IndexerDB) SetBlock(b Block) error

func (*IndexerDB) Stats

func (idxdb *IndexerDB) Stats()

Stats prints idxdb information to the console

Jump to

Keyboard shortcuts

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