Documentation ¶
Index ¶
- type Database
- func (db *Database) ExportBlock(b *tmctypes.ResultBlock, txs []sdk.TxResponse, vals *tmctypes.ResultValidators) error
- func (db *Database) ExportPreCommits(commit *tmtypes.Commit, vals *tmctypes.ResultValidators) error
- func (db *Database) ExportValidator(val *tmtypes.Validator) error
- func (db *Database) HasBlock(height int64) (bool, error)
- func (db *Database) HasValidator(addr string) (bool, error)
- func (db *Database) LastBlockHeight() (int64, error)
- func (db *Database) SetBlock(b *tmctypes.ResultBlock, tg, pc uint64) (uint64, error)
- func (db *Database) SetPreCommit(pc *tmtypes.CommitSig, vp, pp int64) (uint64, error)
- func (db *Database) SetTx(tx sdk.TxResponse) (uint64, error)
- func (db *Database) SetValidator(addr, pk string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
Database defines a wrapper around a SQL database and implements functionality for data aggregation and exporting.
func OpenDB ¶
OpenDB opens a database connection with the given database connection info from config. It returns a database connection handle or an error if the connection fails.
func (*Database) ExportBlock ¶
func (db *Database) ExportBlock(b *tmctypes.ResultBlock, txs []sdk.TxResponse, vals *tmctypes.ResultValidators) error
ExportBlock accepts a finalized block and a corresponding set of transactions and persists them to the database along with attributable metadata. An error is returned if the write fails.
func (*Database) ExportPreCommits ¶
ExportPreCommits accepts a block commitment and a coressponding set of validators for the commitment and persists them to the database. An error is returned if any write fails or if there is any missing aggregated data.
func (*Database) ExportValidator ¶
ExportValidator persists a Tendermint validator with an address and a consensus public key. An error is returned if the public key cannot be Bech32 encoded or if the DB write fails.
func (*Database) HasBlock ¶
HasBlock returns true if a block by height exists. An error should never be returned.
func (*Database) HasValidator ¶
HasValidator returns true if a given validator by HEX address exists. An error should never be returned.
func (*Database) LastBlockHeight ¶
LastBlockHeight returns the latest block stored.
func (*Database) SetBlock ¶
SetBlock stores a block and returns the resulting record ID. An error is returned if the operation fails.
func (*Database) SetPreCommit ¶
SetPreCommit stores a validator's pre-commit and returns the resulting record ID. An error is returned if the operation fails.
func (*Database) SetTx ¶
func (db *Database) SetTx(tx sdk.TxResponse) (uint64, error)
SetTx stores a transaction and returns the resulting record ID. An error is returned if the operation fails.
func (*Database) SetValidator ¶
SetValidator stores a validator if it does not already exist. An error is returned if the operation fails.