Documentation ¶
Index ¶
- Constants
- type GossipSubMeshTracer
- type GossipSubNoopTracer
- func (t *GossipSubNoopTracer) AddPeer(p peer.ID, proto protocol.ID)
- func (t *GossipSubNoopTracer) DeliverMessage(msg *pubsub.Message)
- func (t *GossipSubNoopTracer) DropRPC(rpc *pubsub.RPC, p peer.ID)
- func (t *GossipSubNoopTracer) DuplicateMessage(msg *pubsub.Message)
- func (t *GossipSubNoopTracer) Graft(p peer.ID, topic string)
- func (t *GossipSubNoopTracer) Join(topic string)
- func (t *GossipSubNoopTracer) Leave(topic string)
- func (t *GossipSubNoopTracer) Prune(p peer.ID, topic string)
- func (t *GossipSubNoopTracer) RecvRPC(rpc *pubsub.RPC)
- func (t *GossipSubNoopTracer) RejectMessage(msg *pubsub.Message, reason string)
- func (t *GossipSubNoopTracer) RemovePeer(p peer.ID)
- func (t *GossipSubNoopTracer) SendRPC(rpc *pubsub.RPC, p peer.ID)
- func (t *GossipSubNoopTracer) ThrottlePeer(p peer.ID)
- func (t *GossipSubNoopTracer) UndeliverableMessage(msg *pubsub.Message)
- func (t *GossipSubNoopTracer) ValidateMessage(msg *pubsub.Message)
- type GossipSubScoreTracer
- func (g *GossipSubScoreTracer) GetAppScore(peerID peer.ID) (float64, bool)
- func (g *GossipSubScoreTracer) GetBehaviourPenalty(peerID peer.ID) (float64, bool)
- func (g *GossipSubScoreTracer) GetIPColocationFactor(peerID peer.ID) (float64, bool)
- func (g *GossipSubScoreTracer) GetScore(peerID peer.ID) (float64, bool)
- func (g *GossipSubScoreTracer) GetTopicScores(peerID peer.ID) (map[string]p2p.TopicScoreSnapshot, bool)
- func (g *GossipSubScoreTracer) UpdateInterval() time.Duration
- func (g *GossipSubScoreTracer) UpdatePeerScoreSnapshots(snapshot map[peer.ID]*p2p.PeerScoreSnapshot)
Constants ¶
const ( // MeshLogIntervalMsg is the message logged by the tracer every logInterval. MeshLogIntervalMsg = "topic mesh peers of local node since last heartbeat" // MeshLogIntervalWarnMsg is the message logged by the tracer every logInterval if there are unknown peers in the mesh. MeshLogIntervalWarnMsg = "unknown peers in topic mesh peers of local node since last heartbeat" )
const (
PeerScoreLogMessage = "peer score snapshot update"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GossipSubMeshTracer ¶
type GossipSubMeshTracer struct { component.Component pubsub.RawTracer // contains filtered or unexported fields }
The GossipSubMeshTracer component in the GossipSub pubsub.RawTracer that is designed to track the local mesh peers for each topic. By logging the mesh peers and updating the local mesh size metric, the GossipSubMeshTracer provides insights into the behavior of the topology.
This component also provides real-time and historical visibility into the topology. The GossipSubMeshTracer logs the mesh peers of the local node for each topic at a regular interval, enabling users to monitor the state of the mesh network and take appropriate action. Additionally, it allows users to configure the logging interval.
func NewGossipSubMeshTracer ¶
func NewGossipSubMeshTracer( logger zerolog.Logger, metrics module.GossipSubLocalMeshMetrics, idProvider module.IdentityProvider, loggerInterval time.Duration) *GossipSubMeshTracer
func (*GossipSubMeshTracer) GetMeshPeers ¶
func (t *GossipSubMeshTracer) GetMeshPeers(topic string) []peer.ID
GetMeshPeers returns the local mesh peers for the given topic.
type GossipSubNoopTracer ¶
type GossipSubNoopTracer struct { }
GossipSubNoopTracer is a no-op tracer that implements the RawTracer interface for the Flow network.
func NewGossipSubNoopTracer ¶
func NewGossipSubNoopTracer() *GossipSubNoopTracer
func (*GossipSubNoopTracer) AddPeer ¶
func (t *GossipSubNoopTracer) AddPeer(p peer.ID, proto protocol.ID)
func (*GossipSubNoopTracer) DeliverMessage ¶
func (t *GossipSubNoopTracer) DeliverMessage(msg *pubsub.Message)
func (*GossipSubNoopTracer) DropRPC ¶
func (t *GossipSubNoopTracer) DropRPC(rpc *pubsub.RPC, p peer.ID)
func (*GossipSubNoopTracer) DuplicateMessage ¶
func (t *GossipSubNoopTracer) DuplicateMessage(msg *pubsub.Message)
func (*GossipSubNoopTracer) Join ¶
func (t *GossipSubNoopTracer) Join(topic string)
func (*GossipSubNoopTracer) Leave ¶
func (t *GossipSubNoopTracer) Leave(topic string)
func (*GossipSubNoopTracer) RecvRPC ¶
func (t *GossipSubNoopTracer) RecvRPC(rpc *pubsub.RPC)
func (*GossipSubNoopTracer) RejectMessage ¶
func (t *GossipSubNoopTracer) RejectMessage(msg *pubsub.Message, reason string)
func (*GossipSubNoopTracer) RemovePeer ¶
func (t *GossipSubNoopTracer) RemovePeer(p peer.ID)
func (*GossipSubNoopTracer) SendRPC ¶
func (t *GossipSubNoopTracer) SendRPC(rpc *pubsub.RPC, p peer.ID)
func (*GossipSubNoopTracer) ThrottlePeer ¶
func (t *GossipSubNoopTracer) ThrottlePeer(p peer.ID)
func (*GossipSubNoopTracer) UndeliverableMessage ¶
func (t *GossipSubNoopTracer) UndeliverableMessage(msg *pubsub.Message)
func (*GossipSubNoopTracer) ValidateMessage ¶
func (t *GossipSubNoopTracer) ValidateMessage(msg *pubsub.Message)
type GossipSubScoreTracer ¶
GossipSubScoreTracer is a tracer that keeps track of the peer scores of the gossipsub router. It is used to log the peer scores at regular intervals.
func NewGossipSubScoreTracer ¶
func NewGossipSubScoreTracer( logger zerolog.Logger, provider module.IdentityProvider, collector module.GossipSubScoringMetrics, updateInterval time.Duration) *GossipSubScoreTracer
func (*GossipSubScoreTracer) GetAppScore ¶
func (g *GossipSubScoreTracer) GetAppScore(peerID peer.ID) (float64, bool)
GetAppScore returns the application score for the given peer.
func (*GossipSubScoreTracer) GetBehaviourPenalty ¶
func (g *GossipSubScoreTracer) GetBehaviourPenalty(peerID peer.ID) (float64, bool)
GetBehaviourPenalty returns the behaviour penalty for the given peer.
func (*GossipSubScoreTracer) GetIPColocationFactor ¶
func (g *GossipSubScoreTracer) GetIPColocationFactor(peerID peer.ID) (float64, bool)
GetIPColocationFactor returns the IP colocation factor for the given peer.
func (*GossipSubScoreTracer) GetScore ¶
func (g *GossipSubScoreTracer) GetScore(peerID peer.ID) (float64, bool)
GetScore returns the overall score for the given peer.
func (*GossipSubScoreTracer) GetTopicScores ¶
func (g *GossipSubScoreTracer) GetTopicScores(peerID peer.ID) (map[string]p2p.TopicScoreSnapshot, bool)
GetTopicScores returns the topic scores for the given peer. The returned map is keyed by topic name.
func (*GossipSubScoreTracer) UpdateInterval ¶
func (g *GossipSubScoreTracer) UpdateInterval() time.Duration
UpdateInterval returns the interval at which the tracer expects to receive updates from the gossipsub router.
func (*GossipSubScoreTracer) UpdatePeerScoreSnapshots ¶
func (g *GossipSubScoreTracer) UpdatePeerScoreSnapshots(snapshot map[peer.ID]*p2p.PeerScoreSnapshot)
UpdatePeerScoreSnapshots updates the tracer's snapshot of the peer scores. It is called by the gossipsub router. It is non-blocking and asynchrounous. If there is no update pending, it queues an update. If there is an update pending, it drops the update.