gossipsubbuilder

package
v0.31.8 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

The Builder struct is used to configure and create a new GossipSub pubsub system.

func NewGossipSubBuilder

func NewGossipSubBuilder(logger zerolog.Logger, metrics module.GossipSubMetrics) *Builder

func (*Builder) Build

Build creates a new GossipSub pubsub system. It returns the newly created GossipSub pubsub system and any errors encountered during its creation. Arguments: - ctx: the irrecoverable context of the node.

Returns: - p2p.PubSubAdapter: a GossipSub pubsub system for the libp2p node. - p2p.PeerScoreTracer: a peer score tracer for the GossipSub pubsub system (if enabled, otherwise nil). - error: if an error occurs during the creation of the GossipSub pubsub system, it is returned. Otherwise, nil is returned. Note that on happy path, the returned error is nil. Any error returned is unexpected and should be handled as irrecoverable.

func (*Builder) SetAppSpecificScoreParams

func (g *Builder) SetAppSpecificScoreParams(f func(peer.ID) float64)

func (*Builder) SetGossipSubConfigFunc

func (g *Builder) SetGossipSubConfigFunc(gossipSubConfigFunc p2p.GossipSubAdapterConfigFunc)

SetGossipSubConfigFunc sets the gossipsub config function of the builder. We expect the node to initialize with a default gossipsub config. Hence, this function overrides the default config.

func (*Builder) SetGossipSubFactory

func (g *Builder) SetGossipSubFactory(gossipSubFactory p2p.GossipSubFactoryFunc)

SetGossipSubFactory sets the gossipsub factory of the builder. We expect the node to initialize with a default gossipsub factory. Hence, this function overrides the default config.

func (*Builder) SetGossipSubPeerScoring

func (g *Builder) SetGossipSubPeerScoring(gossipSubPeerScoring bool)

SetGossipSubPeerScoring sets the gossipsub peer scoring of the builder. If the gossipsub peer scoring flag has already been set, a fatal error is logged.

func (*Builder) SetGossipSubRPCInspectorSuite added in v0.31.0

func (g *Builder) SetGossipSubRPCInspectorSuite(inspectorSuite p2p.GossipSubInspectorSuite)

SetGossipSubRPCInspectorSuite sets the gossipsub rpc inspector suite of the builder. It contains the inspector function that is injected into the gossipsub rpc layer, as well as the notification distributors that are used to notify the app specific scoring mechanism of misbehaving peers..

func (*Builder) SetGossipSubScoreTracerInterval

func (g *Builder) SetGossipSubScoreTracerInterval(gossipSubScoreTracerInterval time.Duration)

SetGossipSubScoreTracerInterval sets the gossipsub score tracer interval of the builder. If the gossipsub score tracer interval has already been set, a fatal error is logged.

func (*Builder) SetGossipSubTracer

func (g *Builder) SetGossipSubTracer(gossipSubTracer p2p.PubSubTracer)

SetGossipSubTracer sets the gossipsub tracer of the builder. If the gossipsub tracer has already been set, a fatal error is logged.

func (*Builder) SetHost

func (g *Builder) SetHost(h host.Host)

SetHost sets the host of the builder. If the host has already been set, a fatal error is logged.

func (*Builder) SetIDProvider

func (g *Builder) SetIDProvider(idProvider module.IdentityProvider)

SetIDProvider sets the identity provider of the builder. If the identity provider has already been set, a fatal error is logged.

func (*Builder) SetRoutingSystem

func (g *Builder) SetRoutingSystem(routingSystem routing.Routing)

SetRoutingSystem sets the routing system of the builder. If the routing system has already been set, a fatal error is logged.

func (*Builder) SetSubscriptionFilter

func (g *Builder) SetSubscriptionFilter(subscriptionFilter pubsub.SubscriptionFilter)

SetSubscriptionFilter sets the subscription filter of the builder. If the subscription filter has already been set, a fatal error is logged.

func (*Builder) SetTopicScoreParams

func (g *Builder) SetTopicScoreParams(topic channels.Topic, topicScoreParams *pubsub.TopicScoreParams)

Jump to

Keyboard shortcuts

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