Documentation
¶
Index ¶
- func CreateReducer(broker *eventbus.EventBus, rpcBus *rpcbus.RPCBus, keys key.Keys, ...) reduction.Reducer
- func NewComponent(broker eventbus.Broker, rpcBus *rpcbus.RPCBus, keys key.Keys, ...) reduction.Reducer
- type Factory
- type Helper
- func Kickstart(eb *eventbus.EventBus, rpcbus *rpcbus.RPCBus, nr int, timeOut time.Duration) (*Helper, []byte)
- func NewHelper(eb *eventbus.EventBus, rpcbus *rpcbus.RPCBus, provisioners int, ...) *Helper
- func ProduceFirstStepVotes(eb *eventbus.EventBus, rpcbus *rpcbus.RPCBus, nr int, timeOut time.Duration) (*Helper, []byte)
- type Reducer
- func (r *Reducer) Collect(e consensus.InternalPacket) error
- func (r *Reducer) CollectBestScore(e consensus.InternalPacket) error
- func (r *Reducer) Filter(hdr header.Header) bool
- func (r *Reducer) Finalize()
- func (r *Reducer) Halt(hash []byte, svs ...*message.StepVotes)
- func (r *Reducer) ID() uint32
- func (r *Reducer) Initialize(eventPlayer consensus.EventPlayer, signer consensus.Signer, ...) []consensus.TopicListener
- type StepVotesMsgFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Factory ¶
type Factory struct {
Bus eventbus.Broker
RBus *rpcbus.RPCBus
Keys key.Keys
Republisher *republisher.Republisher
// contains filtered or unexported fields
}
Factory creates a first step reduction Component
func NewFactory ¶
func NewFactory(broker eventbus.Broker, rpcBus *rpcbus.RPCBus, keys key.Keys, timeout time.Duration) *Factory
NewFactory instantiates a Factory
func (*Factory) Instantiate ¶
Instantiate a first step reduction Component Implements consensus.ComponentFactory.
type Helper ¶
type Helper struct {
*reduction.Helper
StepVotesChan chan message.Message
// contains filtered or unexported fields
}
Helper for reducing test boilerplate
func Kickstart ¶
func Kickstart(eb *eventbus.EventBus, rpcbus *rpcbus.RPCBus, nr int, timeOut time.Duration) (*Helper, []byte)
Kickstart a Helper without sending any reduction event
func NewHelper ¶
func NewHelper(eb *eventbus.EventBus, rpcbus *rpcbus.RPCBus, provisioners int, timeOut time.Duration) *Helper
NewHelper creates a Helper
func ProduceFirstStepVotes ¶
func ProduceFirstStepVotes(eb *eventbus.EventBus, rpcbus *rpcbus.RPCBus, nr int, timeOut time.Duration) (*Helper, []byte)
ProduceFirstStepVotes encapsulates the process of creating and forwarding Reduction events
func (*Helper) ActivateReduction ¶
ActivateReduction sends the reducer a BestScore event to trigger a EvenPlayer.Resume
func (*Helper) FailOnFetching ¶
FailOnFetching sets the failOnFetching flag
func (*Helper) FailOnVerification ¶
FailOnVerification tells the RPC bus to return an error
type Reducer ¶
Reducer for the firststep. Although its logic is fairly close to the second step reducer, there are nuances that prevent the use of a generalized Reducer for both steps. For instance, the first step reducer produces a StepVote as a result (as opposed to an Agreement), while the start of Reduction event collection should happen after a BestScore event is received (as opposed to a first StepVote)
func (*Reducer) Collect ¶
func (r *Reducer) Collect(e consensus.InternalPacket) error
Collect forwards Reduction to the aggregator
func (*Reducer) CollectBestScore ¶
func (r *Reducer) CollectBestScore(e consensus.InternalPacket) error
CollectBestScore activates the 2-step reduction cycle. TODO: interface - rename into CollectStartReductionSignal
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 will end the first step of reduction, and forwards whatever result it received on the StepVotes topic.
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
type StepVotesMsgFactory ¶ added in v0.3.0
type StepVotesMsgFactory struct {
// contains filtered or unexported fields
}
StepVotesMsgFactory creates a StepVotesMsg to be passed internally within the Consensus components
func (StepVotesMsgFactory) Create ¶ added in v0.3.0
func (s StepVotesMsgFactory) Create(sender []byte, round uint64, step uint8) consensus.InternalPacket
Create a new StepVotesMsgFactory