Documentation ¶
Index ¶
- Variables
- func NewByteValue(val []byte) atomic.Value
- func NewHeight(height message.Height) atomic.Value
- func NewRound(round message.Round) atomic.Value
- func ReportDecided(pk string, msg *message.SignedMessage)
- type InstanceConfig
- type RoundState
- type State
- func (s *State) GetHeight() message.Height
- func (s *State) GetIdentifier() message.Identifier
- func (s *State) GetInputValue() []byte
- func (s *State) GetPreparedRound() message.Round
- func (s *State) GetPreparedValue() []byte
- func (s *State) GetRound() message.Round
- func (s *State) MarshalJSON() ([]byte, error)
- func (s *State) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var RoundStateName = map[int32]string{
0: "NotStarted",
1: "PrePrepare",
2: "Prepare",
3: "Commit",
4: "ChangeRound",
5: "Decided",
6: "Stopped",
}
RoundStateName represents the map of the round state names
Functions ¶
func NewByteValue ¶
NewByteValue returns a new byte value
func ReportDecided ¶
func ReportDecided(pk string, msg *message.SignedMessage)
ReportDecided reports on a decided message
Types ¶
type InstanceConfig ¶
type InstanceConfig struct { RoundChangeDurationSeconds float32 LeaderPreprepareDelaySeconds float32 }
InstanceConfig is the configuration of the instance
func DefaultConsensusParams ¶
func DefaultConsensusParams() *InstanceConfig
DefaultConsensusParams returns the default round change duration time
type RoundState ¶
type RoundState int32
RoundState is the state of the round
const ( RoundStateNotStarted RoundState = 0 RoundStatePrePrepare RoundState = 1 RoundStatePrepare RoundState = 2 RoundStateCommit RoundState = 3 RoundStateChangeRound RoundState = 4 RoundStateDecided RoundState = 5 RoundStateStopped RoundState = 6 )
RoundState values
type State ¶
type State struct { Stage atomic.Int32 // RoundState // lambda is an instance unique identifier, much like a block hash in a blockchain Identifier atomic.Value // message.Identifier // Height is an incremental number for each instance, much like a block number would be in a blockchain Height atomic.Value // message.Height InputValue atomic.Value // []byte Round atomic.Value // message.Round PreparedRound atomic.Value // message.Round PreparedValue atomic.Value // []byte }
State holds an iBFT state, thread safe
func (*State) GetIdentifier ¶
func (s *State) GetIdentifier() message.Identifier
GetIdentifier returns the identifier of the state
func (*State) GetInputValue ¶
GetInputValue returns the input value of the state
func (*State) GetPreparedRound ¶
GetPreparedRound returns the prepared round of the state
func (*State) GetPreparedValue ¶
GetPreparedValue returns the prepared value of the state
func (*State) MarshalJSON ¶
MarshalJSON implements marshaling interface
func (*State) UnmarshalJSON ¶
UnmarshalJSON implements marshaling interface
Click to show internal directories.
Click to hide internal directories.