firststep

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateReducer

func CreateReducer(broker *eventbus.EventBus, rpcBus *rpcbus.RPCBus, keys key.Keys, timeout time.Duration) reduction.Reducer

CreateReducer is a reduction.FactoryFunc

func NewComponent

func NewComponent(broker eventbus.Broker, rpcBus *rpcbus.RPCBus, keys key.Keys, timeOut time.Duration) reduction.Reducer

NewComponent returns an uninitialized reduction component.

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

func (f *Factory) Instantiate() consensus.Component

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

func (hlp *Helper) ActivateReduction(hash []byte)

ActivateReduction sends the reducer a BestScore event to trigger a EvenPlayer.Resume

func (*Helper) FailOnFetching

func (hlp *Helper) FailOnFetching(flag bool)

FailOnFetching sets the failOnFetching flag

func (*Helper) FailOnVerification

func (hlp *Helper) FailOnVerification(flag bool)

FailOnVerification tells the RPC bus to return an error

func (*Helper) NextBatch

func (hlp *Helper) NextBatch() []byte

NextBatch forwards additional batches of consensus.Event. It takes care of marshaling the right Step when creating the Signature

type Reducer

type Reducer struct {
	Timer *reduction.Timer
	// contains filtered or unexported fields
}

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

func (r *Reducer) Filter(hdr header.Header) bool

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

func (r *Reducer) Halt(hash []byte, svs ...*message.StepVotes)

Halt will end the first step of reduction, and forwards whatever result it received on the StepVotes topic.

func (*Reducer) ID

func (r *Reducer) ID() uint32

ID returns the listener ID of the reducer. Implements consensus.Component.

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL