Documentation ¶
Index ¶
- type MessageState
- type RbBcast1
- func (sc *RbBcast1) CanStartNext() bool
- func (sc *RbBcast1) Collect()
- func (*RbBcast1) GenerateMessageState(gc *generalconfig.GeneralConfig) consinterface.MessageState
- func (*RbBcast1) GenerateNewItem(index types.ConsensusIndex, items *consinterface.ConsInterfaceItems, ...) consinterface.ConsItem
- func (sc *RbBcast1) GetBinState(localOnly bool) ([]byte, error)
- func (sc *RbBcast1) GetBufferCount(hdr messages.MsgIDHeader, _ *generalconfig.GeneralConfig, ...) (int, int, messages.MsgID, error)
- func (sc *RbBcast1) GetCommitProof() []messages.MsgHeader
- func (sc *RbBcast1) GetConsType() types.ConsType
- func (sc *RbBcast1) GetDecision() (sig.Pub, []byte, types.ConsensusIndex, types.ConsensusIndex)
- func (*RbBcast1) GetHeader(emptyPub sig.Pub, gc *generalconfig.GeneralConfig, ...) (messages.MsgHeader, error)
- func (sc *RbBcast1) GetNextInfo() (prevIdx types.ConsensusIndex, proposer sig.Pub, preDecision []byte, ...)
- func (sc *RbBcast1) GetPrevCommitProof() (cordPub sig.Pub, proof []messages.MsgHeader)
- func (sc *RbBcast1) GetProposalIndex() (prevIdx types.ConsensusIndex, ready bool)
- func (sc *RbBcast1) GetProposeHeaderID() messages.HeaderID
- func (sc *RbBcast1) GotProposal(hdr messages.MsgHeader, mainChannel channelinterface.MainChannel) error
- func (sc *RbBcast1) HasDecided() bool
- func (sc *RbBcast1) HasValidStarted() bool
- func (sc *RbBcast1) NeedsCompletionConcurrentProposals() types.ConsensusInt
- func (sc *RbBcast1) PrevHasBeenReset()
- func (sc *RbBcast1) ProcessMessage(deser *deserialized.DeserializedItem, isLocal bool, ...) (bool, bool)
- func (sc *RbBcast1) SetInitialState([]byte, storage.StoreInterface)
- func (sc *RbBcast1) SetNextConsItem(consinterface.ConsItem)
- func (sc *RbBcast1) ShouldCreatePartial(headerType messages.HeaderID) bool
- func (sc *RbBcast1) Start(finishedLastIndex bool)
- type RbBcast1Config
- func (rb RbBcast1Config) GetBroadcastFunc(bt types.ByzType) consinterface.ByzBroadcastFunc
- func (RbBcast1Config) GetByzTypes(optionType cons.GetOptionType) []types.ByzType
- func (RbBcast1Config) GetCollectBroadcast(cons.GetOptionType) []types.CollectBroadcastType
- func (RbBcast1Config) GetIncludeProofsTypes(gt cons.GetOptionType) []bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageState ¶
type MessageState struct { *messagestate.SimpleMessageStateWrapper // the simple message state is used to track the actual messages // contains filtered or unexported fields }
RbBcast1Message state stores the message of RbBcast.
func NewRbBcast1MessageState ¶
func NewRbBcast1MessageState(gc *generalconfig.GeneralConfig) *MessageState
NewRbBcast1MessageState generates a new RbBcast1MessageStateObject.
func (*MessageState) GetValidMessageCount ¶
func (sms *MessageState) GetValidMessageCount() (echoMsgCount int)
GetValidMessage count returns the number of signed echo and commit messages received from different processes in round round.
func (*MessageState) GotMsg ¶
func (sms *MessageState) GotMsg(hdrFunc consinterface.HeaderFunc, deser *deserialized.DeserializedItem, gc *generalconfig.GeneralConfig, mc *consinterface.MemCheckers) ([]*deserialized.DeserializedItem, error)
GotMessage takes a deserialized message and the member checker for the current consensus index. If the message contains no new valid signatures then an error is returned. The value newTotalSigCount is the new number of signatures for the specific message, the value newMsgIDSigCount is the number of signatures for the MsgID of the message (see messages.MsgID). The valid message types are (1) HdrMvInit - the leaders proposal, here is ensures the message comes from the correct leader (2) HdrMvEcho - echo messages (4) HdrMvRequestRecover - unsigned message asking for the init message received for a given hash
func (*MessageState) New ¶
func (sms *MessageState) New(idx types.ConsensusIndex) consinterface.MessageState
New inits and returns a new RbBcast1MessageState object for the given consensus index.
type RbBcast1 ¶
type RbBcast1 struct { cons.AbsConsItem cons.AbsMVRecover // contains filtered or unexported fields }
func (*RbBcast1) CanStartNext ¶
CanStartNext should return true if it is safe to start the next consensus instance (if parallel instances are enabled)
func (*RbBcast1) Collect ¶
func (sc *RbBcast1) Collect()
Collect is called when the item is being garbage collected.
func (*RbBcast1) GenerateMessageState ¶
func (*RbBcast1) GenerateMessageState(gc *generalconfig.GeneralConfig) consinterface.MessageState
GenerateMessageState generates a new message state object given the inputs.
func (*RbBcast1) GenerateNewItem ¶
func (*RbBcast1) GenerateNewItem(index types.ConsensusIndex, items *consinterface.ConsInterfaceItems, mainChannel channelinterface.MainChannel, prevItem consinterface.ConsItem, broadcastFunc consinterface.ByzBroadcastFunc, gc *generalconfig.GeneralConfig) consinterface.ConsItem
GenerateNewItem creates a new cons item.
func (*RbBcast1) GetBinState ¶
GetBinState returns the entire state of the consensus as a string of bytes using MessageState.GetMsgState() as the list of all messages, with a messagetypes.ConsBinStateMessage header appended to the beginning).
func (*RbBcast1) GetBufferCount ¶
func (sc *RbBcast1) GetBufferCount(hdr messages.MsgIDHeader, _ *generalconfig.GeneralConfig, memberChecker *consinterface.MemCheckers) (int, int, messages.MsgID, error)
GetBufferCount checks a MessageID and returns the thresholds for which it should be forwarded using the BufferForwarder (see forwardchecker.ForwardChecker interface). The messages are: (1) HdrMvInit returns 0, 0 if generalconfig.MvBroadcastInitForBufferForwarder is true (meaning don't forward the message)
otherwise returns 1, 1 (meaning forward the message right away)
(2) HdrMvEcho returns n-t, n for the thresholds.
func (*RbBcast1) GetCommitProof ¶
GetCommitProof returns a signed message header that counts at the commit message for this consensus.
func (*RbBcast1) GetConsType ¶
GetConsType returns the type of consensus this instance implements.
func (*RbBcast1) GetDecision ¶
func (sc *RbBcast1) GetDecision() (sig.Pub, []byte, types.ConsensusIndex, types.ConsensusIndex)
GetDecision returns the decided value as a byte slice.
func (*RbBcast1) GetHeader ¶
func (*RbBcast1) GetHeader(emptyPub sig.Pub, gc *generalconfig.GeneralConfig, headerType messages.HeaderID) (messages.MsgHeader, error)
GetHeader return blank message header for the HeaderID, this object will be used to deserialize a message into itself (see consinterface.DeserializeMessage). The valid headers are HdrMvInit, HdrMvEcho, HdrMvCommit, HdrMvRequestRecover.
func (*RbBcast1) GetNextInfo ¶
func (sc *RbBcast1) GetNextInfo() (prevIdx types.ConsensusIndex, proposer sig.Pub, preDecision []byte, hasInfo bool)
GetNextInfo will be called after CanStartNext returns true. It returns sc.Index - 1, nil. If false is returned then the next is started, but the current instance has no state machine created. // TODO
func (*RbBcast1) GetPrevCommitProof ¶
GetPrevCommitProof returns a signed message header that counts at the commit message for the previous consensus. This should only be called after DoneKeep has been called on this instance. cordPub is the expected public key of the coordinator of the current round (used for collect broadcast)
func (*RbBcast1) GetProposalIndex ¶
func (sc *RbBcast1) GetProposalIndex() (prevIdx types.ConsensusIndex, ready bool)
GetProposalIndex returns sc.Index - 1. It returns false until start is called.
func (*RbBcast1) GetProposeHeaderID ¶
GetProposeHeaderID returns the HeaderID messages.HdrMvPropose that will be input to GotProposal.
func (*RbBcast1) GotProposal ¶
func (sc *RbBcast1) GotProposal(hdr messages.MsgHeader, mainChannel channelinterface.MainChannel) error
GotProposal takes the proposal, and broadcasts it if it is the leader.
func (*RbBcast1) HasDecided ¶
HasDecided should return true if this consensus item has reached a decision.
func (*RbBcast1) HasValidStarted ¶
HasReceivedProposal returns true if the cons has received a valid proposal.
func (*RbBcast1) NeedsCompletionConcurrentProposals ¶
func (sc *RbBcast1) NeedsCompletionConcurrentProposals() types.ConsensusInt
NeedsConcurrent returns 1.
func (*RbBcast1) PrevHasBeenReset ¶
func (sc *RbBcast1) PrevHasBeenReset()
PrevHasBeenReset is called when the previous consensus index has been reset to a new index
func (*RbBcast1) ProcessMessage ¶
func (sc *RbBcast1) ProcessMessage( deser *deserialized.DeserializedItem, isLocal bool, senderChan *channelinterface.SendRecvChannel) (bool, bool)
ProcessMessage is called on every message once it has been checked that it is a valid message (using the static method ConsItem.DerserializeMessage), that it comes from a member of the consensus and that it is not a duplicate message (using the MemberChecker and MessageState objects). This function processes the message and update the state of the consensus. For this consensus implementation messageState must be an instance of BinConsMessageStateInterface. It returns true in first position if made progress towards decision, or false if already decided, and return true in second position if the message should be forwarded. The following are the valid message types: messages.HdrMvInit is the leader proposal, once this is received an echo is sent containing the hash, and starts the echo timeoutout. messages.HdrMvEcho is the echo message, when these are received we run CheckEchoState. messages.HdrMvRequestRecover a node terminated bin cons with 1, but didn't get the init message, so if we have it we send it. messages.HdrMvRecoverTimeout if a node terminated bin cons with 1, but didn't get the init mesage this timeout is started, once it runs out, we ask other nodes to send the init message.
func (*RbBcast1) SetInitialState ¶
func (sc *RbBcast1) SetInitialState([]byte, storage.StoreInterface)
SetInitialState does noting for this algorithm.
func (*RbBcast1) SetNextConsItem ¶
func (sc *RbBcast1) SetNextConsItem(consinterface.ConsItem)
SetNextConsItem gives a pointer to the next consensus item at the next consensus instance, it is called when the next instance is created
func (*RbBcast1) ShouldCreatePartial ¶
ShouldCreatePartial returns true if the message type should be sent as a partial message
type RbBcast1Config ¶
type RbBcast1Config struct {
cons.StandardMvConfig
}
func (RbBcast1Config) GetBroadcastFunc ¶
func (rb RbBcast1Config) GetBroadcastFunc(bt types.ByzType) consinterface.ByzBroadcastFunc
GetBroadcastFunc returns the broadcast function for the given byzantine type
func (RbBcast1Config) GetByzTypes ¶
func (RbBcast1Config) GetByzTypes(optionType cons.GetOptionType) []types.ByzType
GetByzTypes returns the fault types to test.
func (RbBcast1Config) GetCollectBroadcast ¶
func (RbBcast1Config) GetCollectBroadcast(cons.GetOptionType) []types.CollectBroadcastType
GetCollectBroadcast returns the values for if the consensus supports broadcasting the commit message directly to the leader.
func (RbBcast1Config) GetIncludeProofsTypes ¶
func (RbBcast1Config) GetIncludeProofsTypes(gt cons.GetOptionType) []bool
GetOrderingTypes returns the types of ordering supported by the consensus.
func (RbBcast1Config) GetOrderingTypes(gt types.GetOptionType) []types.OrderingType { return []types.OrderingType{types.Causal} }
GetIncludeProofTypes returns the values for if the consensus supports including proofs or not or both.