Documentation ¶
Index ¶
- func MockingManager(signers []crypto.Signer) (Manager, []*MockConsensus)
- type ConcreteMediator
- type Config
- type Consensus
- type Manager
- type ManagerReader
- type MockConsensus
- func (m *MockConsensus) AddVote(v *vote.Vote)
- func (m *MockConsensus) AllVotes() []*vote.Vote
- func (m *MockConsensus) Fingerprint() string
- func (m *MockConsensus) HasVote(hash hash.Hash) bool
- func (m *MockConsensus) HeightRound() (uint32, int16)
- func (m *MockConsensus) IsActive() bool
- func (m *MockConsensus) MoveToNewHeight()
- func (m *MockConsensus) PickRandomVote() *vote.Vote
- func (m *MockConsensus) RoundProposal(round int16) *proposal.Proposal
- func (m *MockConsensus) SetActive(active bool)
- func (m *MockConsensus) SetProposal(p *proposal.Proposal)
- func (m *MockConsensus) SignerKey() crypto.PublicKey
- func (m *MockConsensus) Start() error
- func (m *MockConsensus) Stop()
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockingManager ¶ added in v0.10.0
func MockingManager(signers []crypto.Signer) (Manager, []*MockConsensus)
Types ¶
type ConcreteMediator ¶ added in v0.10.0
type ConcreteMediator struct {
// contains filtered or unexported fields
}
ConcreteMediator struct
func (*ConcreteMediator) OnBlockAnnounce ¶ added in v0.10.0
func (m *ConcreteMediator) OnBlockAnnounce(from Consensus)
func (*ConcreteMediator) OnPublishProposal ¶ added in v0.10.0
func (m *ConcreteMediator) OnPublishProposal(from Consensus, proposal *proposal.Proposal)
func (*ConcreteMediator) OnPublishVote ¶ added in v0.10.0
func (m *ConcreteMediator) OnPublishVote(from Consensus, vote *vote.Vote)
func (*ConcreteMediator) Register ¶ added in v0.10.0
func (m *ConcreteMediator) Register(cons Consensus)
Register a new Consensus instance to the mediator
type Config ¶
type Config struct { ChangeProposerTimeout time.Duration `toml:"change_proposer_timeout"` ChangeProposerDelta time.Duration `toml:"change_proposer_delta"` }
func DefaultConfig ¶
func DefaultConfig() *Config
func (*Config) CalculateChangeProposerTimeout ¶
func (*Config) SanityCheck ¶
SanityCheck performs basic checks on the configuration.
type Consensus ¶
type Manager ¶ added in v0.10.0
type Manager interface { ManagerReader Start() error Stop() MoveToNewHeight() AddVote(v *vote.Vote) SetProposal(proposal *proposal.Proposal) }
func NewManager ¶ added in v0.10.0
func NewManager( conf *Config, state state.Facade, signers []crypto.Signer, rewardAddrs []crypto.Address, broadcastCh chan message.Message) Manager
NewManager creates a new manager instance that manages a set of consensus instances, each associated with a signer and reward address.
type ManagerReader ¶ added in v0.10.0
type MockConsensus ¶
type MockConsensus struct { Signer crypto.Signer Votes []*vote.Vote Proposal *proposal.Proposal Active bool Height uint32 Round int16 // contains filtered or unexported fields }
func MockingConsensus ¶
func MockingConsensus(signer crypto.Signer) *MockConsensus
func (*MockConsensus) AddVote ¶
func (m *MockConsensus) AddVote(v *vote.Vote)
func (*MockConsensus) AllVotes ¶
func (m *MockConsensus) AllVotes() []*vote.Vote
func (*MockConsensus) Fingerprint ¶
func (m *MockConsensus) Fingerprint() string
func (*MockConsensus) HasVote ¶ added in v0.11.0
func (m *MockConsensus) HasVote(hash hash.Hash) bool
func (*MockConsensus) HeightRound ¶
func (m *MockConsensus) HeightRound() (uint32, int16)
func (*MockConsensus) IsActive ¶ added in v0.10.0
func (m *MockConsensus) IsActive() bool
func (*MockConsensus) MoveToNewHeight ¶
func (m *MockConsensus) MoveToNewHeight()
func (*MockConsensus) PickRandomVote ¶
func (m *MockConsensus) PickRandomVote() *vote.Vote
func (*MockConsensus) RoundProposal ¶
func (m *MockConsensus) RoundProposal(round int16) *proposal.Proposal
func (*MockConsensus) SetActive ¶ added in v0.10.0
func (m *MockConsensus) SetActive(active bool)
func (*MockConsensus) SetProposal ¶
func (m *MockConsensus) SetProposal(p *proposal.Proposal)
func (*MockConsensus) SignerKey ¶ added in v0.10.0
func (m *MockConsensus) SignerKey() crypto.PublicKey
func (*MockConsensus) Start ¶
func (m *MockConsensus) Start() error
func (*MockConsensus) Stop ¶
func (m *MockConsensus) Stop()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.