messagelayer

package
v0.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultAverageNetworkDelay contains the default average time it takes for a network to propagate through gossip.
	DefaultAverageNetworkDelay = 5 * time.Second
)
View Source
const (
	// SyncBeaconFollowerPluginName is the plugin name of the sync beacon follower plugin.
	SyncBeaconFollowerPluginName = "SyncBeaconFollower"
)

Variables

View Source
var (
	// ErrMessageWasNotBookedInTime is returned if a message did not get booked
	// within the defined await time.
	ErrMessageWasNotBookedInTime = errors.New("message could not be booked in time")
)
View Source
var (

	// ErrMissingFollowNodes is returned if the node starts with no follow nodes list
	ErrMissingFollowNodes = errors.New("follow nodes list is required")
)
View Source
var FPCParameters = struct {
	// BindAddress defines on which address the FPC service should listen.
	BindAddress string `default:"0.0.0.0:10895" usage:"the bind address on which the FPC vote server binds to"`

	// Listen defines if the FPC service should listen.
	Listen bool `default:"true" usage:"if the FPC service should listen"`

	// RoundInterval defines how long a round lasts (in seconds).
	RoundInterval int64 `default:"10" usage:"FPC round interval [s]"`

	// QuerySampleSize defines how many nodes will be queried each round.
	QuerySampleSize int `default:"21" usage:"Size of the voting quorum (k)"`
}{}

FPCParameters contains the configuration parameters used by the FPC consensus.

View Source
var Parameters = struct {
	// TangleWidth can be used to specify the number of tips the Tangle tries to maintain.
	TangleWidth int `default:"0" usage:"the width of the Tangle"`

	// Snapshot contains snapshots related configuration parameters.
	Snapshot struct {
		// File is the path to the snapshot file.
		File        string `default:"./snapshot.bin" usage:"the path to the snapshot file"`
		GenesisNode string `` /* 140-byte string literal not displayed */
	}

	// FCOB contains parameters related to the fast consensus of barcelona.
	FCOB struct {
		AverageNetworkDelay int `default:"5" usage:"the avg. network delay to use for FCoB rules"`
	}
}{}

Parameters contains the configuration parameters used by the message layer.

View Source
var StatementParameters = struct {
	// WaitForStatement is the time in seconds for which the node wait for receiving the new statement.
	WaitForStatement int `default:"5" usage:"the time in seconds for which the node wait for receiving the new statement"`

	// WriteStatement defines if the node should write statements.
	WriteStatement bool `default:"false" usage:"if the node should make statements"`

	// ManaThreshold defines the Mana threshold to accept/write a statement.
	ManaThreshold float64 `default:"1" usage:"Mana threshold to accept/write a statement"`

	// CleanInterval defines the time interval [in minutes] for cleaning the statement registry.
	CleanInterval int `default:"5" usage:"the time in minutes after which the node cleans the statement registry"`

	// DeleteAfter defines the time [in minutes] after which older statements are deleted from the registry.
	DeleteAfter int `default:"5" usage:"the time in minutes after which older statements are deleted from the registry"`
}{}

StatementParameters contains the configuration parameters used by the FPC statements in the tangle.

View Source
var SyncBeaconFollowerParameters = struct {
	// FollowNodes defines the list of nodes this node should follow to determine its sync status.
	FollowNodes []string `` /* 157-byte string literal not displayed */

	// MaxTimeWindowSec defines the maximum time window for which a sync payload would be considerable.
	MaxTimeWindowSec int `default:"10" usage:"the maximum time window for which a sync payload would be considerable"`

	// MaxTimeOffline defines the maximum time a beacon node can stay without receiving updates.
	MaxTimeOffline int `default:"70" usage:"the maximum time the node should stay synced without receiving updates"`

	// CleanupInterval defines the interval that old beacon status are cleaned up.
	CleanupInterval int `default:"10" usage:"the interval at which cleanups are done"`

	// SyncPercentage defines the percentage of following nodes that have to be synced.
	SyncPercentage float64 `default:"0.5" usage:"percentage of nodes being followed that need to be synced in order to consider the node synced"`
}{}

SyncBeaconFollowerParameters contains the configuration parameters used by the syncbeacon follower plugin.

Functions

func AwaitMessageToBeBooked added in v0.4.0

func AwaitMessageToBeBooked(f func() (*tangle.Message, error), txID ledgerstate.TransactionID, maxAwait time.Duration) (*tangle.Message, error)

AwaitMessageToBeBooked awaits maxAwait for the given message to get booked.

func ConsensusMechanism added in v0.5.0

func ConsensusMechanism() *fcob.ConsensusMechanism

ConsensusMechanism return the FcoB ConsensusMechanism used by the Tangle.

func ConsensusPlugin added in v0.5.0

func ConsensusPlugin() *node.Plugin

ConsensusPlugin returns the consensus plugin.

func OpinionGiverFunc added in v0.5.0

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

OpinionGiverFunc returns a slice of opinion givers.

func OpinionRetriever added in v0.5.0

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 gets the plugin instance.

func Registry added in v0.5.0

func Registry() *statement.Registry

Registry returns the registry.

func SyncBeaconFollowerPlugin added in v0.5.0

func SyncBeaconFollowerPlugin() *node.Plugin

SyncBeaconFollowerPlugin gets the plugin instance.

func SyncStatus added in v0.5.0

func SyncStatus() (bool, map[ed25519.PublicKey]Status)

SyncStatus returns the detailed status per beacon node.

func Tangle

func Tangle() *tangle.Tangle

Tangle gets the tangle instance.

func Voter added in v0.5.0

func Voter() vote.DRNGRoundBasedVoter

Voter returns the DRNGRoundBasedVoter instance used by the FPC plugin.

Types

type OpinionGiver added in v0.5.0

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

OpinionGiver is a wrapper for both statements and peers.

func (*OpinionGiver) ID added in v0.5.0

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

ID returns the identifier of the underlying Peer.

func (*OpinionGiver) Query added in v0.5.0

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

Query retrieves the opinions about the given conflicts and timestamps.

type OpinionGivers added in v0.5.0

type OpinionGivers map[identity.ID]OpinionGiver

OpinionGivers is a map of OpinionGiver.

type PeerOpinionGiver added in v0.5.0

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

PeerOpinionGiver implements the OpinionGiver interface based on a peer.

func (*PeerOpinionGiver) Address added in v0.5.0

func (pog *PeerOpinionGiver) Address() string

Address returns the FPC address of the underlying Peer.

func (*PeerOpinionGiver) ID added in v0.5.0

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

ID returns the identifier of the underlying Peer.

func (*PeerOpinionGiver) Query added in v0.5.0

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

Query queries another node for its opinion.

type Status added in v0.5.0

type Status struct {
	MsgID    tangle.MessageID
	SentTime int64
	Synced   bool
}

Status represents the status of a beacon node consisting of latest messageID, sentTime and sync status.

Jump to

Keyboard shortcuts

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