consensus

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: Apache-2.0, BSD-2-Clause Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConsensusPluginName contains the human readable name of the plugin.
	ConsensusPluginName = "Consensus"

	// CfgFPCQuerySampleSize defines how many nodes will be queried each round.
	CfgFPCQuerySampleSize = "fpc.querySampleSize"

	// CfgFPCRoundInterval defines how long a round lasts (in seconds)
	CfgFPCRoundInterval = "fpc.roundInterval"

	// CfgFPCListen defines if the FPC service should listen.
	CfgFPCListen = "fpc.listen"

	// CfgFPCBindAddress defines on which address the FPC service should listen.
	CfgFPCBindAddress = "fpc.bindAddress"

	// CfgWaitForStatement is the time in seconds for which the node wait for receiveing the new statement.
	CfgWaitForStatement = "statement.waitForStatement"

	// CfgManaThreshold defines the Mana threshold to accept/write a statement.
	CfgManaThreshold = "statement.manaThreshold"

	// CfgCleanInterval defines the time interval [in minutes] for cleaning the statement registry.
	CfgCleanInterval = "statement.cleanInterval"

	// CfgDeleteAfter defines the time [in minutes] after which older statements are deleted from the registry.
	CfgDeleteAfter = "statement.deleteAfter"
	// CfgWriteStatement defines if the node should write statements.
	CfgWriteStatement = "statement.writeStatement"
)

Variables

This section is empty.

Functions

func OpinionGiverFunc

func OpinionGiverFunc() (givers []opinion.OpinionGiver, err error)

OpinionGiverFunc returns a slice of opinion givers.

func OpinionRetriever

func OpinionRetriever(id string, objectType vote.ObjectType) opinion.Opinion

OpinionRetriever returns the current opinion of the given id.

func Plugin

func Plugin() *node.Plugin

Plugin returns the consensus plugin.

func Registry

func Registry() *statement.Registry

Registry returns the registry.

func Voter

func Voter() vote.DRNGRoundBasedVoter

Voter returns the DRNGRoundBasedVoter instance used by the FPC plugin.

Types

type OpinionGiver

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

OpinionGiver is a wrapper for both statements and peers.

func (*OpinionGiver) ID

func (o *OpinionGiver) ID() identity.ID

ID returns the identifier of the underlying Peer.

func (*OpinionGiver) Query

func (o *OpinionGiver) Query(ctx context.Context, conflictIDs []string, timestampIDs []string) (opinions opinion.Opinions, err error)

Query retrievs the opinions about the given conflicts and timestamps.

type OpinionGivers

type OpinionGivers map[identity.ID]OpinionGiver

OpinionGivers is a map of OpinionGiver.

type PeerOpinionGiver

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

PeerOpinionGiver implements the OpinionGiver interface based on a peer.

func (*PeerOpinionGiver) Address

func (pog *PeerOpinionGiver) Address() string

Address returns the FPC address of the underlying Peer.

func (*PeerOpinionGiver) ID

func (pog *PeerOpinionGiver) ID() identity.ID

ID returns the identifier of the underlying Peer.

func (*PeerOpinionGiver) Query

func (pog *PeerOpinionGiver) Query(ctx context.Context, conflictIDs []string, timestampIDs []string) (opinion.Opinions, error)

Query queries another node for its opinion.

Jump to

Keyboard shortcuts

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