secondstep

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func NewComponent

func NewComponent(broker eventbus.Broker, rpcBus *rpcbus.RPCBus, keys key.ConsensusKeys, 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.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

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

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

func Kickstart

func Kickstart(nr int, timeOut time.Duration) (*Helper, []byte)

Kickstart creates a Helper and wires up the tests

func NewHelper

func NewHelper(eb *eventbus.EventBus, rpcbus *rpcbus.RPCBus, provisioners int, timeOut time.Duration) *Helper

NewHelper creates a Helper

func (*Helper) ActivateReduction

func (hlp *Helper) ActivateReduction(hash []byte, sv *agreement.StepVotes) error

ActivateReduction starts/resumes the secondstep reduction by sending a StepVotes to Reducer.CollectStepVotes

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.Event) error

func (*Reducer) CollectStepVotes

func (r *Reducer) CollectStepVotes(e consensus.Event) error

CollectStepVotes is triggered when the first StepVotes get published by the first step Reducer, and starts the second step of reduction.

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, b ...*agreement.StepVotes)

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) 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

Jump to

Keyboard shortcuts

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