postgres

package
v0.0.0-...-3979f71 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexerDb

type IndexerDb struct {
	// contains filtered or unexported fields
}

IndexerDb is an idb.IndexerDB implementation

func OpenPostgres

func OpenPostgres(connection string, opts idb.IndexerDbOptions, log *log.Logger) (*IndexerDb, chan struct{}, error)

OpenPostgres is available for creating test instances of postgres.IndexerDb Returns an error object and a channel that gets closed when blocking migrations finish running successfully.

func (*IndexerDb) AddBlock

func (db *IndexerDb) AddBlock(vb *itypes.ValidatedBlock) error

AddBlock is part of idb.IndexerDb.

func (*IndexerDb) AppLocalState

func (db *IndexerDb) AppLocalState(ctx context.Context, filter idb.ApplicationQuery) (<-chan idb.AppLocalStateRow, uint64)

AppLocalState is part of idb.IndexerDB

func (*IndexerDb) ApplicationBoxes

func (db *IndexerDb) ApplicationBoxes(ctx context.Context, queryOpts idb.ApplicationBoxQuery) (<-chan idb.ApplicationBoxRow, uint64)

ApplicationBoxes is part of interface idb.IndexerDB. The most complex query formed looks like:

WITH apps AS (SELECT index AS app FROM app WHERE index = $1) SELECT a.app, ab.name, ab.value FROM apps a LEFT OUTER JOIN app_box ab ON ab.app = a.app AND name [= or >] $2 ORDER BY ab.name ASC LIMIT {queryOpts.Limit}

where the binary operator in the last line is `=` for the box lookup and `>` for boxes search with query substitutions: $1 <-- queryOpts.ApplicationID $2 <-- queryOpts.BoxName $3 <-- queryOpts.PrevFinalBox

func (*IndexerDb) Applications

func (db *IndexerDb) Applications(ctx context.Context, filter idb.ApplicationQuery) (<-chan idb.ApplicationRow, uint64)

Applications is part of idb.IndexerDB

func (*IndexerDb) AssetBalances

func (db *IndexerDb) AssetBalances(ctx context.Context, abq idb.AssetBalanceQuery) (<-chan idb.AssetBalanceRow, uint64)

AssetBalances is part of idb.IndexerDB

func (*IndexerDb) Assets

func (db *IndexerDb) Assets(ctx context.Context, filter idb.AssetsQuery) (<-chan idb.AssetRow, uint64)

Assets is part of idb.IndexerDB

func (*IndexerDb) Close

func (db *IndexerDb) Close()

Close is part of idb.IndexerDb.

func (*IndexerDb) DeleteTransactions

func (db *IndexerDb) DeleteTransactions(ctx context.Context, keep uint64) error

DeleteTransactions removes old transactions keep is the number of rounds to keep in db

func (*IndexerDb) GetAccounts

func (db *IndexerDb) GetAccounts(ctx context.Context, opts idb.AccountQueryOptions) (<-chan idb.AccountRow, uint64)

GetAccounts is part of idb.IndexerDB

func (*IndexerDb) GetBlock

func (db *IndexerDb) GetBlock(ctx context.Context, round uint64, options idb.GetBlockOptions) (blockHeader sdk.BlockHeader, transactions []idb.TxnRow, err error)

GetBlock is part of idb.IndexerDB

func (*IndexerDb) GetNetworkState

func (db *IndexerDb) GetNetworkState() (idb.NetworkState, error)

GetNetworkState is part of idb.IndexerDB

func (*IndexerDb) GetNextRoundToAccount

func (db *IndexerDb) GetNextRoundToAccount() (uint64, error)

GetNextRoundToAccount is part of idb.IndexerDB Returns ErrorNotInitialized if genesis is not loaded.

func (*IndexerDb) GetSpecialAccounts

func (db *IndexerDb) GetSpecialAccounts(ctx context.Context) (itypes.SpecialAddresses, error)

GetSpecialAccounts is part of idb.IndexerDB

func (*IndexerDb) Health

func (db *IndexerDb) Health(ctx context.Context) (idb.Health, error)

Health is part of idb.IndexerDB

func (*IndexerDb) LoadGenesis

func (db *IndexerDb) LoadGenesis(genesis sdk.Genesis) error

LoadGenesis is part of idb.IndexerDB

func (*IndexerDb) SetNetworkState

func (db *IndexerDb) SetNetworkState(gh sdk.Digest) error

SetNetworkState is part of idb.IndexerDB

func (*IndexerDb) Transactions

func (db *IndexerDb) Transactions(ctx context.Context, tf idb.TransactionFilter) (<-chan idb.TxnRow, uint64)

Transactions is part of idb.IndexerDB

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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