Documentation ¶
Index ¶
- Constants
- func IsDecidedMsg(share *spectypes.Share, signedDecided *specqbft.SignedMessage) bool
- func ValidateDecided(config qbft.IConfig, signedDecided *specqbft.SignedMessage, ...) error
- func ValidateFutureMsg(config qbft.IConfig, msg *specqbft.SignedMessage, ...) error
- type Controller
- func (c *Controller) BaseMsgValidation(msg *specqbft.SignedMessage) error
- func (c *Controller) CanStartInstance() error
- func (c *Controller) Decode(data []byte) error
- func (c *Controller) Encode() ([]byte, error)
- func (c *Controller) GetConfig() qbft.IConfig
- func (c *Controller) GetIdentifier() []byte
- func (c *Controller) GetRoot() ([]byte, error)
- func (c *Controller) InstanceForHeight(logger *zap.Logger, height specqbft.Height) *instance.Instance
- func (c *Controller) LoadHighestInstance(identifier []byte) error
- func (c *Controller) OnTimeout(logger *zap.Logger, msg types.EventMsg) error
- func (c *Controller) ProcessMsg(logger *zap.Logger, msg *specqbft.SignedMessage) (*specqbft.SignedMessage, error)
- func (c *Controller) SaveInstance(i *instance.Instance, msg *specqbft.SignedMessage) error
- func (c *Controller) StartNewInstance(logger *zap.Logger, value []byte) error
- func (c *Controller) UponDecided(logger *zap.Logger, msg *specqbft.SignedMessage) (*specqbft.SignedMessage, error)
- func (c *Controller) UponExistingInstanceMsg(logger *zap.Logger, msg *specqbft.SignedMessage) (*specqbft.SignedMessage, error)
- func (c *Controller) UponFutureMsg(logger *zap.Logger, msg *specqbft.SignedMessage) (*specqbft.SignedMessage, error)
- type InstanceContainer
- type NewDecidedHandler
Constants ¶
const ( // InstanceContainerDefaultCapacity is the default capacity for InstanceContainer. InstanceContainerDefaultCapacity int = 2 // InstanceContainerTestCapacity is the capacity for InstanceContainer used in tests. InstanceContainerTestCapacity int = 1024 )
Variables ¶
This section is empty.
Functions ¶
func IsDecidedMsg ¶
func IsDecidedMsg(share *spectypes.Share, signedDecided *specqbft.SignedMessage) bool
IsDecidedMsg returns true if signed commit has all quorum sigs
func ValidateDecided ¶
func ValidateFutureMsg ¶
Types ¶
type Controller ¶
type Controller struct { Identifier []byte Height specqbft.Height // incremental Height for InstanceContainer // StoredInstances stores the last HistoricalInstanceCapacity in an array for message processing purposes. StoredInstances InstanceContainer // FutureMsgsContainer holds all msgs from a higher height FutureMsgsContainer map[spectypes.OperatorID]specqbft.Height // maps msg signer to height of higher height received msgs Domain spectypes.DomainType NewDecidedHandler NewDecidedHandler `json:"-"` // contains filtered or unexported fields }
Controller is a QBFT coordinator responsible for starting and following the entire life cycle of multiple QBFT InstanceContainer
func NewController ¶
func NewController( identifier []byte, share *spectypes.Share, domain spectypes.DomainType, config qbft.IConfig, fullNode bool, ) *Controller
func (*Controller) BaseMsgValidation ¶
func (c *Controller) BaseMsgValidation(msg *specqbft.SignedMessage) error
BaseMsgValidation returns error if msg is invalid (base validation)
func (*Controller) CanStartInstance ¶
func (c *Controller) CanStartInstance() error
CanStartInstance returns nil if controller can start a new instance
func (*Controller) GetConfig ¶
func (c *Controller) GetConfig() qbft.IConfig
func (*Controller) GetIdentifier ¶
func (c *Controller) GetIdentifier() []byte
GetIdentifier returns QBFT Identifier, used to identify messages
func (*Controller) GetRoot ¶
func (c *Controller) GetRoot() ([]byte, error)
GetRoot returns the state's deterministic root
func (*Controller) InstanceForHeight ¶
func (*Controller) LoadHighestInstance ¶
func (c *Controller) LoadHighestInstance(identifier []byte) error
func (*Controller) ProcessMsg ¶
func (c *Controller) ProcessMsg(logger *zap.Logger, msg *specqbft.SignedMessage) (*specqbft.SignedMessage, error)
ProcessMsg processes a new msg, returns decided message or error
func (*Controller) SaveInstance ¶
func (c *Controller) SaveInstance(i *instance.Instance, msg *specqbft.SignedMessage) error
SaveInstance saves the given instance to the storage.
func (*Controller) StartNewInstance ¶
func (c *Controller) StartNewInstance(logger *zap.Logger, value []byte) error
StartNewInstance will start a new QBFT instance, if can't will return error
func (*Controller) UponDecided ¶
func (c *Controller) UponDecided(logger *zap.Logger, msg *specqbft.SignedMessage) (*specqbft.SignedMessage, error)
UponDecided returns decided msg if decided, nil otherwise
func (*Controller) UponExistingInstanceMsg ¶
func (c *Controller) UponExistingInstanceMsg(logger *zap.Logger, msg *specqbft.SignedMessage) (*specqbft.SignedMessage, error)
func (*Controller) UponFutureMsg ¶
func (c *Controller) UponFutureMsg(logger *zap.Logger, msg *specqbft.SignedMessage) (*specqbft.SignedMessage, error)
type InstanceContainer ¶
InstanceContainer is a fixed-capacity container for instances.
func (InstanceContainer) FindInstance ¶
func (i InstanceContainer) FindInstance(height specqbft.Height) *instance.Instance
func (*InstanceContainer) String ¶
func (i *InstanceContainer) String() string
String returns a human-readable representation of the instances. Useful for debugging.
type NewDecidedHandler ¶
type NewDecidedHandler func(msg *specqbft.SignedMessage)
NewDecidedHandler handles newly saved decided messages. it will be called in a new goroutine to avoid concurrency issues