Documentation
¶
Index ¶
- Variables
- func NewComponent(broker eventbus.Broker, rpcBus *rpcbus.RPCBus, keys key.ConsensusKeys, ...) reduction.Reducer
- type Factory
- type Helper
- type Reducer
- func (r *Reducer) Collect(e consensus.Event) error
- func (r *Reducer) CollectStepVotes(e consensus.Event) error
- func (r *Reducer) Filter(hdr header.Header) bool
- func (r *Reducer) Finalize()
- func (r *Reducer) Halt(hash []byte, b ...*agreement.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.ConsensusKeys, 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.ConsensusKeys
// contains filtered or unexported fields
}
Factory creates a second step reduction Component
func NewFactory ¶
func NewFactory(broker eventbus.Broker, rpcBus *rpcbus.RPCBus, keys key.ConsensusKeys, 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 bytes.Buffer
RestartChan chan bytes.Buffer
}
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) CollectStepVotes ¶
CollectStepVotes is triggered when the first StepVotes get published by the first step Reducer, and starts the second step of reduction.
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 succesful 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