qbftstorage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeRoundStore

type ChangeRoundStore interface {
	// GetLastChangeRoundMsg returns the latest broadcasted msg from the instance
	GetLastChangeRoundMsg(identifier []byte, signers ...spectypes.OperatorID) ([]*specqbft.SignedMessage, error)
	// SaveLastChangeRoundMsg returns the latest broadcasted msg from the instance
	SaveLastChangeRoundMsg(msg *specqbft.SignedMessage) error
	// CleanLastChangeRound cleans last change round message of some validator, should be called upon controller init
	CleanLastChangeRound(identifier []byte) error
}

ChangeRoundStore manages change round data

type DecidedMsgStore

type DecidedMsgStore interface {
	GetLastDecided(identifier []byte) (*specqbft.SignedMessage, error)
	// SaveLastDecided saves the given decided message, after checking that it is indeed the highest
	SaveLastDecided(signedMsg ...*specqbft.SignedMessage) error
	// GetDecided returns historical decided messages in the given range
	GetDecided(identifier []byte, from specqbft.Height, to specqbft.Height) ([]*specqbft.SignedMessage, error)
	// SaveDecided saves historical decided messages
	SaveDecided(signedMsg ...*specqbft.SignedMessage) error
	// CleanAllDecided removes all decided & last decided for msgId
	CleanAllDecided(msgID []byte) error
}

DecidedMsgStore manages persistence of messages

type InstanceStore

type InstanceStore interface {
	// SaveCurrentInstance saves the state for the current running (not yet decided) instance
	SaveCurrentInstance(identifier []byte, state *qbft.State) error
	// GetCurrentInstance returns the state for the current running (not yet decided) instance
	GetCurrentInstance(identifier []byte) (*qbft.State, bool, error)
}

InstanceStore manages instance data

type QBFTStore

type QBFTStore interface {
	DecidedMsgStore
	InstanceStore
	ChangeRoundStore
}

QBFTStore is the store used by QBFT components

func NewQBFTStore

func NewQBFTStore(db basedb.IDb, logger *zap.Logger, instanceType string) QBFTStore

NewQBFTStore create new ibft storage

func PopulatedStorage added in v0.3.0

func PopulatedStorage(t *testing.T, sks map[spectypes.OperatorID]*bls.SecretKey, round specqbft.Round, highestHeight specqbft.Height) QBFTStore

PopulatedStorage create new QBFTStore instance, save the highest height and then populated from 0 to highestHeight

Jump to

Keyboard shortcuts

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