Documentation ¶
Index ¶
- func ExtractConfirmationsFromViewChangeMessages(vcms []*ViewChangeMessage) []*protocol.ViewChangeMessageContentBuilder
- type Block
- type BlockUtils
- type CommitMessage
- func (cm *CommitMessage) BlockHeight() primitives.BlockHeight
- func (cm *CommitMessage) Content() *protocol.CommitContent
- func (cm *CommitMessage) InstanceId() primitives.InstanceId
- func (cm *CommitMessage) MessageType() protocol.MessageType
- func (cm *CommitMessage) Raw() []byte
- func (cm *CommitMessage) SenderMemberId() primitives.MemberId
- func (cm *CommitMessage) String() string
- func (cm *CommitMessage) ToConsensusRawMessage() *ConsensusRawMessage
- func (cm *CommitMessage) View() primitives.View
- type Communication
- type Config
- type ConsensusMessage
- type ConsensusRawMessage
- type ConsensusRawMessageConverter
- type ElectionScheduler
- type ElectionTrigger
- type KeyManager
- type Logger
- type Membership
- type NewViewMessage
- func (nvm *NewViewMessage) Block() Block
- func (nvm *NewViewMessage) BlockHeight() primitives.BlockHeight
- func (nvm *NewViewMessage) Content() *protocol.NewViewMessageContent
- func (nvm *NewViewMessage) InstanceId() primitives.InstanceId
- func (nvm *NewViewMessage) MessageType() protocol.MessageType
- func (nvm *NewViewMessage) Raw() []byte
- func (nvm *NewViewMessage) SenderMemberId() primitives.MemberId
- func (nvm *NewViewMessage) String() string
- func (nvm *NewViewMessage) ToConsensusRawMessage() *ConsensusRawMessage
- func (nvm *NewViewMessage) View() primitives.View
- type OnCommitCallback
- type OnElectionCallback
- type OnNewConsensusRoundCallback
- type PrepareMessage
- func (pm *PrepareMessage) BlockHeight() primitives.BlockHeight
- func (pm *PrepareMessage) Content() *protocol.PrepareContent
- func (pm *PrepareMessage) InstanceId() primitives.InstanceId
- func (pm *PrepareMessage) MessageType() protocol.MessageType
- func (pm *PrepareMessage) Raw() []byte
- func (pm *PrepareMessage) SenderMemberId() primitives.MemberId
- func (pm *PrepareMessage) String() string
- func (pm *PrepareMessage) ToConsensusRawMessage() *ConsensusRawMessage
- func (pm *PrepareMessage) View() primitives.View
- type PreprepareMessage
- func (ppm *PreprepareMessage) Block() Block
- func (ppm *PreprepareMessage) BlockHeight() primitives.BlockHeight
- func (ppm *PreprepareMessage) Content() *protocol.PreprepareContent
- func (ppm *PreprepareMessage) InstanceId() primitives.InstanceId
- func (ppm *PreprepareMessage) MessageType() protocol.MessageType
- func (ppm *PreprepareMessage) Raw() []byte
- func (ppm *PreprepareMessage) SenderMemberId() primitives.MemberId
- func (ppm *PreprepareMessage) String() string
- func (ppm *PreprepareMessage) ToConsensusRawMessage() *ConsensusRawMessage
- func (ppm *PreprepareMessage) View() primitives.View
- type Serializable
- type Storage
- type ViewChangeMessage
- func (vcm *ViewChangeMessage) Block() Block
- func (vcm *ViewChangeMessage) BlockHeight() primitives.BlockHeight
- func (vcm *ViewChangeMessage) Content() *protocol.ViewChangeMessageContent
- func (vcm *ViewChangeMessage) InstanceId() primitives.InstanceId
- func (vcm *ViewChangeMessage) MessageType() protocol.MessageType
- func (vcm *ViewChangeMessage) Raw() []byte
- func (vcm *ViewChangeMessage) SenderMemberId() primitives.MemberId
- func (vcm *ViewChangeMessage) String() string
- func (vcm *ViewChangeMessage) ToConsensusRawMessage() *ConsensusRawMessage
- func (vcm *ViewChangeMessage) View() primitives.View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractConfirmationsFromViewChangeMessages ¶
func ExtractConfirmationsFromViewChangeMessages(vcms []*ViewChangeMessage) []*protocol.ViewChangeMessageContentBuilder
Types ¶
type BlockUtils ¶
type BlockUtils interface { RequestNewBlockProposal(ctx context.Context, blockHeight primitives.BlockHeight, memberId primitives.MemberId, prevBlock Block) (Block, primitives.BlockHash) ValidateBlockProposal(ctx context.Context, blockHeight primitives.BlockHeight, memberId primitives.MemberId, block Block, blockHash primitives.BlockHash, prevBlock Block) error ValidateBlockCommitment(blockHeight primitives.BlockHeight, block Block, blockHash primitives.BlockHash) bool }
type CommitMessage ¶
type CommitMessage struct {
// contains filtered or unexported fields
}
--------- Commit ---------
func NewCommitMessage ¶
func NewCommitMessage(content *protocol.CommitContent) *CommitMessage
func (*CommitMessage) BlockHeight ¶
func (cm *CommitMessage) BlockHeight() primitives.BlockHeight
func (*CommitMessage) Content ¶
func (cm *CommitMessage) Content() *protocol.CommitContent
func (*CommitMessage) InstanceId ¶
func (cm *CommitMessage) InstanceId() primitives.InstanceId
func (*CommitMessage) MessageType ¶
func (cm *CommitMessage) MessageType() protocol.MessageType
func (*CommitMessage) Raw ¶
func (cm *CommitMessage) Raw() []byte
func (*CommitMessage) SenderMemberId ¶
func (cm *CommitMessage) SenderMemberId() primitives.MemberId
func (*CommitMessage) String ¶
func (cm *CommitMessage) String() string
func (*CommitMessage) ToConsensusRawMessage ¶
func (cm *CommitMessage) ToConsensusRawMessage() *ConsensusRawMessage
func (*CommitMessage) View ¶
func (cm *CommitMessage) View() primitives.View
type Communication ¶
type Communication interface {
SendConsensusMessage(ctx context.Context, recipients []primitives.MemberId, message *ConsensusRawMessage) error
}
type Config ¶
type Config struct { InstanceId primitives.InstanceId Communication Communication Membership Membership BlockUtils BlockUtils KeyManager KeyManager ElectionTimeoutOnV0 time.Duration OnElectionCB OnElectionCallback Storage Storage // optional Logger Logger // optional MsgChanBufLen uint64 UpdateStateChanBufLen uint64 ElectionChanBufLen uint64 OverrideElectionTrigger ElectionScheduler }
type ConsensusMessage ¶
type ConsensusMessage interface { Serializable ConsensusRawMessageConverter InstanceId() primitives.InstanceId MessageType() protocol.MessageType SenderMemberId() primitives.MemberId BlockHeight() primitives.BlockHeight View() primitives.View }
func ToConsensusMessage ¶
func ToConsensusMessage(consensusMessage *ConsensusRawMessage) ConsensusMessage
type ConsensusRawMessage ¶
func CreateConsensusRawMessage ¶
func CreateConsensusRawMessage(message ConsensusMessage) *ConsensusRawMessage
type ConsensusRawMessageConverter ¶
type ConsensusRawMessageConverter interface {
ToConsensusRawMessage() *ConsensusRawMessage
}
type ElectionScheduler ¶ added in v0.2.0
type ElectionScheduler interface { RegisterOnElection(blockHeight primitives.BlockHeight, view primitives.View, cb func(blockHeight primitives.BlockHeight, view primitives.View, onElectionCB OnElectionCallback)) ElectionChannel() chan *ElectionTrigger CalcTimeout(view primitives.View) time.Duration Stop() }
type ElectionTrigger ¶
type ElectionTrigger struct { MoveToNextLeader func() Hv *state.HeightView }
type KeyManager ¶
type KeyManager interface { SignConsensusMessage(ctx context.Context, blockHeight primitives.BlockHeight, content []byte) primitives.Signature VerifyConsensusMessage(blockHeight primitives.BlockHeight, content []byte, sender *protocol.SenderSignature) error SignRandomSeed(ctx context.Context, blockHeight primitives.BlockHeight, content []byte) primitives.RandomSeedSignature VerifyRandomSeed(blockHeight primitives.BlockHeight, content []byte, sender *protocol.SenderSignature) error AggregateRandomSeed(blockHeight primitives.BlockHeight, randomSeedShares []*protocol.SenderSignature) primitives.RandomSeedSignature }
type Membership ¶
type Membership interface { MyMemberId() primitives.MemberId RequestOrderedCommittee(ctx context.Context, blockHeight primitives.BlockHeight, randomSeed uint64) ([]primitives.MemberId, error) }
type NewViewMessage ¶
type NewViewMessage struct {
// contains filtered or unexported fields
}
---------- New View ----------
func NewNewViewMessage ¶
func NewNewViewMessage(content *protocol.NewViewMessageContent, block Block) *NewViewMessage
func (*NewViewMessage) Block ¶
func (nvm *NewViewMessage) Block() Block
func (*NewViewMessage) BlockHeight ¶
func (nvm *NewViewMessage) BlockHeight() primitives.BlockHeight
func (*NewViewMessage) Content ¶
func (nvm *NewViewMessage) Content() *protocol.NewViewMessageContent
func (*NewViewMessage) InstanceId ¶
func (nvm *NewViewMessage) InstanceId() primitives.InstanceId
func (*NewViewMessage) MessageType ¶
func (nvm *NewViewMessage) MessageType() protocol.MessageType
func (*NewViewMessage) Raw ¶
func (nvm *NewViewMessage) Raw() []byte
func (*NewViewMessage) SenderMemberId ¶
func (nvm *NewViewMessage) SenderMemberId() primitives.MemberId
func (*NewViewMessage) String ¶
func (nvm *NewViewMessage) String() string
func (*NewViewMessage) ToConsensusRawMessage ¶
func (nvm *NewViewMessage) ToConsensusRawMessage() *ConsensusRawMessage
func (*NewViewMessage) View ¶
func (nvm *NewViewMessage) View() primitives.View
type OnCommitCallback ¶
type OnElectionCallback ¶ added in v0.2.0
type OnElectionCallback func(m metrics.ElectionMetrics)
type OnNewConsensusRoundCallback ¶ added in v0.2.0
type OnNewConsensusRoundCallback func(ctx context.Context, newHeight primitives.BlockHeight, prevBlock Block, canBeFirstLeader bool)
type PrepareMessage ¶
type PrepareMessage struct {
// contains filtered or unexported fields
}
--------- Prepare ---------
func NewPrepareMessage ¶
func NewPrepareMessage(content *protocol.PrepareContent) *PrepareMessage
func (*PrepareMessage) BlockHeight ¶
func (pm *PrepareMessage) BlockHeight() primitives.BlockHeight
func (*PrepareMessage) Content ¶
func (pm *PrepareMessage) Content() *protocol.PrepareContent
func (*PrepareMessage) InstanceId ¶
func (pm *PrepareMessage) InstanceId() primitives.InstanceId
func (*PrepareMessage) MessageType ¶
func (pm *PrepareMessage) MessageType() protocol.MessageType
func (*PrepareMessage) Raw ¶
func (pm *PrepareMessage) Raw() []byte
func (*PrepareMessage) SenderMemberId ¶
func (pm *PrepareMessage) SenderMemberId() primitives.MemberId
func (*PrepareMessage) String ¶
func (pm *PrepareMessage) String() string
func (*PrepareMessage) ToConsensusRawMessage ¶
func (pm *PrepareMessage) ToConsensusRawMessage() *ConsensusRawMessage
func (*PrepareMessage) View ¶
func (pm *PrepareMessage) View() primitives.View
type PreprepareMessage ¶
type PreprepareMessage struct { ConsensusMessage // contains filtered or unexported fields }
func NewPreprepareMessage ¶
func NewPreprepareMessage(content *protocol.PreprepareContent, block Block) *PreprepareMessage
func (*PreprepareMessage) Block ¶
func (ppm *PreprepareMessage) Block() Block
func (*PreprepareMessage) BlockHeight ¶
func (ppm *PreprepareMessage) BlockHeight() primitives.BlockHeight
func (*PreprepareMessage) Content ¶
func (ppm *PreprepareMessage) Content() *protocol.PreprepareContent
func (*PreprepareMessage) InstanceId ¶
func (ppm *PreprepareMessage) InstanceId() primitives.InstanceId
func (*PreprepareMessage) MessageType ¶
func (ppm *PreprepareMessage) MessageType() protocol.MessageType
func (*PreprepareMessage) Raw ¶
func (ppm *PreprepareMessage) Raw() []byte
func (*PreprepareMessage) SenderMemberId ¶
func (ppm *PreprepareMessage) SenderMemberId() primitives.MemberId
func (*PreprepareMessage) String ¶
func (ppm *PreprepareMessage) String() string
func (*PreprepareMessage) ToConsensusRawMessage ¶
func (ppm *PreprepareMessage) ToConsensusRawMessage() *ConsensusRawMessage
func (*PreprepareMessage) View ¶
func (ppm *PreprepareMessage) View() primitives.View
type Serializable ¶
SHARED interfaces //
type Storage ¶
type Storage interface { StorePreprepare(ppm *PreprepareMessage) bool GetPreprepareMessage(blockHeight primitives.BlockHeight, view primitives.View) (*PreprepareMessage, bool) GetPreprepareBlock(blockHeight primitives.BlockHeight, view primitives.View) (Block, bool) GetLatestPreprepare(blockHeight primitives.BlockHeight) (*PreprepareMessage, bool) GetPreprepareFromView(blockHeight primitives.BlockHeight, view primitives.View) (*PreprepareMessage, bool) StorePrepare(pp *PrepareMessage) bool GetPrepareMessages(blockHeight primitives.BlockHeight, view primitives.View, blockHash primitives.BlockHash) ([]*PrepareMessage, bool) GetPrepareSendersIds(blockHeight primitives.BlockHeight, view primitives.View, blockHash primitives.BlockHash) []primitives.MemberId StoreCommit(cm *CommitMessage) bool GetCommitMessages(blockHeight primitives.BlockHeight, view primitives.View, blockHash primitives.BlockHash) ([]*CommitMessage, bool) StoreViewChange(vcm *ViewChangeMessage) bool GetViewChangeMessages(blockHeight primitives.BlockHeight, view primitives.View) ([]*ViewChangeMessage, bool) ClearBlockHeightLogs(blockHeight primitives.BlockHeight) }
type ViewChangeMessage ¶
type ViewChangeMessage struct {
// contains filtered or unexported fields
}
------------- View Change -------------
func NewViewChangeMessage ¶
func NewViewChangeMessage(content *protocol.ViewChangeMessageContent, block Block) *ViewChangeMessage
func (*ViewChangeMessage) Block ¶
func (vcm *ViewChangeMessage) Block() Block
func (*ViewChangeMessage) BlockHeight ¶
func (vcm *ViewChangeMessage) BlockHeight() primitives.BlockHeight
func (*ViewChangeMessage) Content ¶
func (vcm *ViewChangeMessage) Content() *protocol.ViewChangeMessageContent
func (*ViewChangeMessage) InstanceId ¶
func (vcm *ViewChangeMessage) InstanceId() primitives.InstanceId
func (*ViewChangeMessage) MessageType ¶
func (vcm *ViewChangeMessage) MessageType() protocol.MessageType
func (*ViewChangeMessage) Raw ¶
func (vcm *ViewChangeMessage) Raw() []byte
func (*ViewChangeMessage) SenderMemberId ¶
func (vcm *ViewChangeMessage) SenderMemberId() primitives.MemberId
func (*ViewChangeMessage) String ¶
func (vcm *ViewChangeMessage) String() string
func (*ViewChangeMessage) ToConsensusRawMessage ¶
func (vcm *ViewChangeMessage) ToConsensusRawMessage() *ConsensusRawMessage
func (*ViewChangeMessage) View ¶
func (vcm *ViewChangeMessage) View() primitives.View
Click to show internal directories.
Click to hide internal directories.