Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
Builder represents a method that allows to build any database from a given codec and configuration
type Context ¶
type Context struct { Cfg databaseconfig.Config EncodingConfig *params.EncodingConfig Logger logging.Logger }
Context contains the data that might be used to build a Database instance
func NewContext ¶
func NewContext(cfg databaseconfig.Config, encodingConfig *params.EncodingConfig, logger logging.Logger) *Context
NewContext allows to build a new Context instance
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 *types.Block) 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) // SaveValidators stores a list of validators if they do not already exist. // An error is returned if the operation fails. SaveValidators(validators []*types.Validator) error // SaveCommitSignatures stores a slice of validator commit signatures. // An error is returned if the operation fails. SaveCommitSignatures(signatures []*types.CommitSig) error // SaveMessage stores a single message. // An error is returned if the operation fails. SaveMessage(msg *types.Message) error // Close closes the connection to the database Close() }
Database represents an abstract database that can be used to save data inside it
type PruningDb ¶
type PruningDb interface { // Prune prunes the data for the given height, returning any error Prune(height int64) error // StoreLastPruned saves the last height at which the database was pruned StoreLastPruned(height int64) error // GetLastPruned returns the last height at which the database was pruned GetLastPruned() (int64, error) }
PruningDb represents a database that supports pruning properly
Click to show internal directories.
Click to hide internal directories.