postgresql

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: CC0-1.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builder

func Builder(ctx *database.Context) (database.Database, error)

Builder creates a database connection with the given database connection info from config. It returns a database connection handle or an error if the connection fails.

Types

type Database

type Database struct {
	SQL            *sqlx.DB
	EncodingConfig *params.EncodingConfig
	Logger         logging.Logger
}

Database defines a wrapper around a SQL database and implements functionality for data aggregation and exporting.

func (*Database) Close

func (db *Database) Close()

Close implements database.Database

func (*Database) GetLastBlockHeight

func (db *Database) GetLastBlockHeight() (int64, error)

GetLastBlockHeight returns the last block height stored inside the database

func (*Database) GetLastPruned

func (db *Database) GetLastPruned() (int64, error)

GetLastPruned implements database.PruningDb

func (*Database) GetMissingHeights added in v4.1.0

func (db *Database) GetMissingHeights(startHeight, endHeight int64) []int64

GetMissingHeights returns a slice of missing block heights between startHeight and endHeight

func (*Database) GetTotalBlocks

func (db *Database) GetTotalBlocks() int64

GetTotalBlocks implements database.Database

func (*Database) HasBlock

func (db *Database) HasBlock(height int64) (bool, error)

HasBlock implements database.Database

func (*Database) HasValidator

func (db *Database) HasValidator(addr string) (bool, error)

HasValidator implements database.Database

func (*Database) Prune

func (db *Database) Prune(height int64) error

Prune implements database.PruningDb

func (*Database) SaveBlock

func (db *Database) SaveBlock(block *types.Block) error

SaveBlock implements database.Database

func (*Database) SaveCommitSignatures

func (db *Database) SaveCommitSignatures(signatures []*types.CommitSig) error

SaveCommitSignatures implements database.Database

func (*Database) SaveMessage

func (db *Database) SaveMessage(msg *types.Message) error

SaveMessage implements database.Database

func (*Database) SaveTx

func (db *Database) SaveTx(tx *types.Tx) error

SaveTx implements database.Database

func (*Database) SaveValidators

func (db *Database) SaveValidators(validators []*types.Validator) error

SaveValidators implements database.Database

func (*Database) StoreLastPruned

func (db *Database) StoreLastPruned(height int64) error

StoreLastPruned implements database.PruningDb

Jump to

Keyboard shortcuts

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