Documentation
¶
Index ¶
- Variables
- func NewComponent(broker eventbus.Broker, rpcBus *rpcbus.RPCBus, keys key.Keys, ...) reduction.Reducer
- type Factory
- type Helper
- type Reducer
- func (r *Reducer) Collect(e consensus.InternalPacket) error
- func (r *Reducer) CollectStepVotes(e consensus.InternalPacket) error
- func (r *Reducer) Filter(hdr header.Header) bool
- func (r *Reducer) Finalize()
- func (r *Reducer) Halt(hash []byte, b ...*message.StepVotes)
- func (r *Reducer) ID() uint32
- func (r *Reducer) Initialize(eventPlayer consensus.EventPlayer, signer consensus.Signer, ...) []consensus.TopicListener
Constants ¶
This section is empty.
Variables ¶
var CreateReducer reduction.FactoryFunc = func(eb *eventbus.EventBus, rpcBus *rpcbus.RPCBus, keys key.Keys, timeout time.Duration) reduction.Reducer { f := NewFactory(eb, rpcBus, keys, timeout) a := f.Instantiate() return a.(*Reducer) }
CreateReducer is callback used by reduction.Helper to wire up the tests
Functions ¶
Types ¶
type Factory ¶
type Factory struct {
Bus eventbus.Broker
RBus *rpcbus.RPCBus
Keys key.Keys
// contains filtered or unexported fields
}
Factory creates a second step reduction Component
func NewFactory ¶
func NewFactory(broker eventbus.Broker, rpcBus *rpcbus.RPCBus, keys key.Keys, timeout time.Duration) *Factory
NewFactory creates a Factory
func (*Factory) Instantiate ¶
Instantiate a second step reduction Component Implements consensus.ComponentFactory.
type Helper ¶
type Helper struct {
*reduction.Helper
AgreementChan chan message.Message
RestartChan chan message.Message
}
Helper for reducing test boilerplate
type Reducer ¶
type Reducer struct {
// contains filtered or unexported fields
}
Reducer for the second step. This reducer starts whenever it receives an internal StepVotes message. It combines the contents of this message (if any) with the result of it's own reduction step, and on success, creates and sends an Agreement message.
func (*Reducer) Collect ¶
func (r *Reducer) Collect(e consensus.InternalPacket) error
Collect complies with the consensus.Component interface. It gathers a message.Reduction, verifies its signature and forwards it to the aggregator
func (*Reducer) CollectStepVotes ¶
func (r *Reducer) CollectStepVotes(e consensus.InternalPacket) error
CollectStepVotes is triggered when the first StepVotes get published by the first step Reducer, and starts the second step of reduction. If the first step did not have a winning block, we should get an empty StepVotesMsg and run with it anyway (to keep the security assumptions of the protocol right).
func (*Reducer) Filter ¶
Filter an incoming Reduction message, by checking whether or not it was sent by a member of the voting committee for the given round and step.
func (*Reducer) Finalize ¶
func (r *Reducer) Finalize()
Finalize the Reducer component by killing the timer, and pausing event streaming. This will stop a reduction cycle short, and renders this Reducer useless after calling. Implements consensus.Component.
func (*Reducer) Halt ¶
Halt is used by either the Aggregator in case of successful reduction or the timer in case of a timeout. In the latter case no agreement message is pushed forward
func (*Reducer) Initialize ¶
func (r *Reducer) Initialize(eventPlayer consensus.EventPlayer, signer consensus.Signer, ru consensus.RoundUpdate) []consensus.TopicListener
Initialize the reduction component, by instantiating the handler and creating the topic subscribers. Implements consensus.Component