Documentation ¶
Index ¶
- type Builder
- func (g *Builder) Build(ctx irrecoverable.SignalerContext) (p2p.PubSubAdapter, p2p.PeerScoreTracer, error)
- func (g *Builder) SetAppSpecificScoreParams(f func(peer.ID) float64)
- func (g *Builder) SetGossipSubConfigFunc(gossipSubConfigFunc p2p.GossipSubAdapterConfigFunc)
- func (g *Builder) SetGossipSubFactory(gossipSubFactory p2p.GossipSubFactoryFunc)
- func (g *Builder) SetGossipSubPeerScoring(gossipSubPeerScoring bool)
- func (g *Builder) SetGossipSubRPCInspectorSuite(inspectorSuite p2p.GossipSubInspectorSuite)
- func (g *Builder) SetGossipSubScoreTracerInterval(gossipSubScoreTracerInterval time.Duration)
- func (g *Builder) SetGossipSubTracer(gossipSubTracer p2p.PubSubTracer)
- func (g *Builder) SetHost(h host.Host)
- func (g *Builder) SetIDProvider(idProvider module.IdentityProvider)
- func (g *Builder) SetRoutingSystem(routingSystem routing.Routing)
- func (g *Builder) SetSubscriptionFilter(subscriptionFilter pubsub.SubscriptionFilter)
- func (g *Builder) SetTopicScoreParams(topic channels.Topic, topicScoreParams *pubsub.TopicScoreParams)
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 ¶
func (g *Builder) Build(ctx irrecoverable.SignalerContext) (p2p.PubSubAdapter, p2p.PeerScoreTracer, error)
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 (*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 ¶
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 ¶
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 ¶
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 ¶
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)