db

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder func(cfg *config.Config, cdc *codec.Codec) (Database, error)

Create represents a method that allows to build any database from a given codec and configuration

type Database

type Database interface {
	// HasBlock tells whether or not the database has already stored the block having the given height.
	// An error is returned if the operation fails.
	HasBlock(height int64) (bool, error)

	// SaveBlock will be called when a new block is parsed, passing the block itself
	// and the transactions contained inside that block.
	// An error is returned if the operation fails.
	// NOTE. For each transaction inside txs, SaveTx will be called as well.
	SaveBlock(block *tmctypes.ResultBlock, totalGas, commitSignatures uint64) error

	// SaveTx will be called to save each transaction contained inside a block.
	// An error is returned if the operation fails.
	SaveTx(tx *types.Tx) error

	// HasValidator returns true if a given validator by consensus address exists.
	// An error is returned if the operation fails.
	HasValidator(address string) (bool, error)

	// SetValidator stores a validator if it does not already exist.
	// An error is returned if the operation fails.
	// The address should be the consensus address of the validator.
	SaveValidator(address, publicKey string) error

	// SetPreCommit stores a validator's pre-commit.
	// An error is returned if the operation fails.
	SaveCommitSig(height int64, commitSig tmtypes.CommitSig, votingPower, proposerPriority int64) error
}

Database represents an abstract database that can be used to save data inside it

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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