forwardchecker

package
v0.0.0-...-ff61ee7 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

ForwardCheckers keep track of successfully processes consensus messages and decide if they should be forwarded on the network or not.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAllToAllForwarder

func NewAllToAllForwarder() consinterface.ForwardChecker

NewAllToAllForwarder creates a new all to all forwarder, these forwarders are for all to all networks and do no forwarding.

func NewP2PForwarder

func NewP2PForwarder(requestForwarder bool, fanOut int, forwardPubs []sig.PubList,
	gc *generalconfig.GeneralConfig) consinterface.ForwardChecker

Creates a new peer to peer forwarder. If bufferForwarder is true, then it buffers messages before forwarding them as described in the buffer forwarder functions. If requestForwarder is true then this is being used for a local random member checker.

func NewRandomForwarder

func NewRandomForwarder(fanOut int, gc *generalconfig.GeneralConfig) consinterface.ForwardChecker

NewRandomForwarder creates a new random forwarder. If bufferForwarder is true, then it buffers messages before forwarding them as described in the buffer forwarder functions.

Types

type AllToAllForwarder

type AllToAllForwarder struct {
	// contains filtered or unexported fields
}

AllToAllForwarder is the forwarder used for all to all network patterns, no messages are forwarded since it is not needed for all to all.

func (*AllToAllForwarder) CheckForward

func (fwd *AllToAllForwarder) CheckForward(
	sndRcvChan *channelinterface.SendRecvChannel,
	msg *deserialized.DeserializedItem,
	shouldForward bool,
	isProposalMessage bool,
	endThreshold, maxPossible, sigCount int,
	msgID messages.MsgID,
	memberChecker *consinterface.MemCheckers)

CheckForward does nothing for the AllToAllForwarder.

func (*AllToAllForwarder) ConsDecided

func (fwd *AllToAllForwarder) ConsDecided(stats.NwStatsInterface)

ConsDecided does nothing for this forwarder.

func (*AllToAllForwarder) GetFanOut

func (fwd *AllToAllForwarder) GetFanOut() int

func (*AllToAllForwarder) GetHalfHalfForwardListFunc

func (fwd *AllToAllForwarder) GetHalfHalfForwardListFunc() (firstHalf, secondHalf channelinterface.NewForwardFuncFilter)

GetHalfHalfForwardListFunc is the same as GetNewForwardListFunc except is returns functions that broadcast to half of the participants.

func (*AllToAllForwarder) GetNewForwardListFunc

func (fwd *AllToAllForwarder) GetNewForwardListFunc() channelinterface.NewForwardFuncFilter

GetForwardList is called before a message is broadcast, it takes as input the list of all nodes in the system. It returns the list of public keys to which the message should be sent.

func (*AllToAllForwarder) GetNextForwardItem

GetNextForwardItem always returns a nil result for the AllToAllForwarder.

func (*AllToAllForwarder) GetNoProgressForwardFunc

func (fwd *AllToAllForwarder) GetNoProgressForwardFunc() channelinterface.NewForwardFuncFilter

GetNoProgressForwardFunc is called before a no progress message update is sent.

func (*AllToAllForwarder) New

func (fwd *AllToAllForwarder) New(idx types.ConsensusIndex, participants, allPubs sig.PubList) consinterface.ForwardChecker

New creates a new AllToAllForwarder for the consensus index. It will be always be called on an "initialForwardChecker" that is given as input to MemberCheckerState.Init.

func (*AllToAllForwarder) NewForwardFunc

func (fwd *AllToAllForwarder) NewForwardFunc() sig.PubList

func (*AllToAllForwarder) ShouldForward

func (fwd *AllToAllForwarder) ShouldForward(progress bool, isProposalMessage bool) bool

ShouldForward always returns false for the AllToAll forwarder.

type P2PForwarder

type P2PForwarder struct {
	// contains filtered or unexported fields
}

P2PForwarder is used for p2p network types, where node is connected to only fanOut neighbours. Messages will always be forwarded to these negibors. TODO when using P2PForwarder + BufferForwarder, having messages with endthreshold <= 1, will not be sent to everyone, because the inital broadcast will only be sent to the neighbours, then noone will forward it (see BufferForwarder).

func (*P2PForwarder) GetFanOut

func (fwd *P2PForwarder) GetFanOut() int

GetFanOut returns the number of neighbors the node is connected to.

func (*P2PForwarder) GetHalfHalfForwardListFunc

func (fwd *P2PForwarder) GetHalfHalfForwardListFunc() (firstHalf, secondHalf channelinterface.NewForwardFuncFilter)

GetHalfHalfForwardListFunc is the same as GetNewForwardListFunc except is returns functions that broadcast to half of the participants.

func (*P2PForwarder) GetNewForwardListFunc

func (fwd *P2PForwarder) GetNewForwardListFunc() channelinterface.NewForwardFuncFilter

GetForwardList is called before a message is broadcast, it takes as input the list of all nodes in the system. It returns the list of public keys to which the message should be sent.

func (*P2PForwarder) GetNoProgressForwardFunc

func (fwd *P2PForwarder) GetNoProgressForwardFunc() channelinterface.NewForwardFuncFilter

GetNoProgressForwardFunc is called before a no progress message update is sent.

func (*P2PForwarder) ShouldForward

func (fwd *P2PForwarder) ShouldForward(progress bool, isProposalMessage bool) bool

ShouldForward returns the same value as progress (i.e. only forward a message if it made progress towards a consensus decision.

type RandomForwarder

type RandomForwarder struct {
	// contains filtered or unexported fields
}

RandomForwarder will forward messages to a random set of nodes.

func (*RandomForwarder) GetFanOut

func (fwd *RandomForwarder) GetFanOut() int

GetFanOut returns the number of nodes messages are forwarded to.

func (*RandomForwarder) GetHalfHalfForwardListFunc

func (fwd *RandomForwarder) GetHalfHalfForwardListFunc() (firstHalf, secondHalf channelinterface.NewForwardFuncFilter)

GetHalfHalfForwardListFunc is the same as GetNewForwardListFunc except is returns functions that broadcast to half of the participants.

func (*RandomForwarder) GetNewForwardListFunc

func (fwd *RandomForwarder) GetNewForwardListFunc() channelinterface.NewForwardFuncFilter

GetForwardList is called before a message is broadcast, it takes as input the list of all nodes in the system. It returns the list of public keys to which the message should be sent.

func (*RandomForwarder) GetNoProgressForwardFunc

func (fwd *RandomForwarder) GetNoProgressForwardFunc() channelinterface.NewForwardFuncFilter

GetNoProgressForwardFunc is called before a no progress message update is sent.

func (*RandomForwarder) ShouldForward

func (fwd *RandomForwarder) ShouldForward(progress bool, isProposalMessage bool) bool

ShouldForward returns the same value as progress (i.e. only forward a message if it made progress towards a consensus decision.

Jump to

Keyboard shortcuts

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