database

package
v0.0.0-...-a08de0b Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: CC0-1.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builder

func Builder(cfg types.DatabaseConfig, encodingConfig *params.EncodingConfig) (db.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            *sql.DB
	EncodingConfig *params.EncodingConfig
	Logger         logging.Logger
	PartitionSize  int
}

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 db.Database

func (*Database) CreatePartition

func (db *Database) CreatePartition(table string, height uint64) error

createPartition allows to create a partition with the id for the given table name

func (*Database) DropPartition

func (db *Database) DropPartition(name string) error

dropPartition allows to drop a partition with the given partition name

func (*Database) GetLastPruned

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

GetLastPruned implements db.PruningDb

func (*Database) GetPartitionSize

func (db *Database) GetPartitionSize() int

func (*Database) HasBlock

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

HasBlock implements db.Database

func (*Database) HasValidator

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

HasValidator implements db.Database

func (*Database) LastBlockHeight

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

LastBlockHeight implements db.Database

func (*Database) Prune

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

Prune implements db.PruningDb

func (*Database) SaveBlock

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

SaveBlock implements db.Database

func (*Database) SaveCollection

func (db *Database) SaveCollection(collection []types.Collection) error

func (*Database) SaveCommitSignatures

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

SaveCommitSignatures implements db.Database

func (*Database) SaveEvents

func (db *Database) SaveEvents(events []types.Event) error

func (*Database) SaveMessage

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

SaveMessage implements db.Database

func (*Database) SaveNodeInfos

func (db *Database) SaveNodeInfos(infos []*types.StakerNodeInfo) error

func (*Database) SaveTransactionResult

func (db *Database) SaveTransactionResult(transactionResult []types.TransactionResult, height uint64) error

func (*Database) SaveTxs

func (db *Database) SaveTxs(txs types.Txs) error

SaveTx implements db.Database

func (*Database) SaveValidators

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

SaveValidators implements db.Database

func (*Database) StoreLastPruned

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

StoreLastPruned implements db.PruningDb

Jump to

Keyboard shortcuts

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