commonsubset

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0, BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonSubset

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

CommonSubject is responsible for executing a single instance of agreement. The main task for this object is to manage all the redeliveries and acknowledgements.

func NewCommonSubset

func NewCommonSubset(
	sessionID uint64,
	stateIndex uint32,
	peeringID peering.PeeringID,
	netGroup peering.GroupProvider,
	dkShare *tcrypto.DKShare,
	allRandom bool,
	outputCh chan map[uint16][]byte,
	log *logger.Logger,
) (*CommonSubset, error)

func (*CommonSubset) Close

func (cs *CommonSubset) Close()

func (*CommonSubset) HandleMsgBatch

func (cs *CommonSubset) HandleMsgBatch(mb *msgBatch)

HandleMsgBatch accepts a parsed msgBatch as an input from other node. This function is used in the CommonSubsetCoordinator to avoid parsing the received message multiple times.

func (*CommonSubset) Input

func (cs *CommonSubset) Input(input []byte)

Input accepts the current node's proposal for the consensus.

func (*CommonSubset) OutputCh

func (cs *CommonSubset) OutputCh() chan map[uint16][]byte

OutputCh returns the output channel, so that the called don't need to track it.

func (*CommonSubset) TryHandleMessage

func (cs *CommonSubset) TryHandleMessage(recv *peering.RecvEvent) bool

TryHandleMessage checks, if the RecvEvent is of suitable type and processed the message as an input from a peer if the type matches. This one is called from the ACS tests.

type CommonSubsetCoordinator

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

CommonSubsetCoordinator is responsible for maintaining a series of ACS instances and to implement the AsynchronousCommonSubsetRunner interface.

The main functions:

  • Check new CommonSubset instances.
  • Terminate outdated CommonSubset instances.
  • Dispatch incoming messages to appropriate instances.

NOTE: On the termination of the ACS instances. The instances are initiated either by the current node or by a message from other node.

  • If we have a newer StateOutput, older ACS are irrelevant, because the state is already in the Ledger and is confirmed.

  • It is safe to drop messages for some future ACS instances, because if they are correct ones, they will redeliver the messages until we wil catch up to their StateIndex. So the handling of the future ACS instance is only a performance optimization.

What to do in the case of reset? Set the current state index as the last one this node has provided. Some future ACS instances will be left for some time, until they will be discarded because of the growing StateIndex in the new branch.

func NewCommonSubsetCoordinator

func NewCommonSubsetCoordinator(
	peeringID peering.PeeringID,
	net peering.NetworkProvider,
	netGroup peering.GroupProvider,
	dkShare *tcrypto.DKShare,
	log *logger.Logger,
) *CommonSubsetCoordinator

func (*CommonSubsetCoordinator) Close

func (csc *CommonSubsetCoordinator) Close()

Close implements the AsynchronousCommonSubsetRunner interface.

func (*CommonSubsetCoordinator) RunACSConsensus

func (csc *CommonSubsetCoordinator) RunACSConsensus(
	value []byte,
	sessionID uint64,
	stateIndex uint32,
	callback func(sessionID uint64, acs [][]byte),
)

RunACSConsensus implements the AsynchronousCommonSubsetRunner interface. It is possible that the instacne is already created because of the messages from other nodes. In such case we will just provide our input and register the callback.

func (*CommonSubsetCoordinator) TryHandleMessage

func (csc *CommonSubsetCoordinator) TryHandleMessage(recv *peering.RecvEvent) bool

TryHandleMessage implements the AsynchronousCommonSubsetRunner interface. It handles the network messages, if they are of correct type.

Jump to

Keyboard shortcuts

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