Gossip based publishing
Procs
proc addDirectPeer(g: GossipSub; id: PeerId; addrs: seq[MultiAddress]): Future[ void] {.stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Source Edit
proc init(_: type[GossipSubParams]; pruneBackoff = 1.minutes; unsubscribeBackoff = 5.seconds; floodPublish = true; gossipFactor: float64 = 0.25; d = GossipSubD; dLow = GossipSubDlo; dHigh = GossipSubDhi; dScore = GossipSubDlo; dOut = GossipSubDlo - 1; dLazy = GossipSubD; heartbeatInterval = GossipSubHeartbeatInterval; historyLength = GossipSubHistoryLength; historyGossip = GossipSubHistoryGossip; fanoutTTL = GossipSubFanoutTTL; seenTTL = 2.minutes; gossipThreshold = -100.0; publishThreshold = -1000.0; graylistThreshold = -10000.0; opportunisticGraftThreshold = 0.0; decayInterval = 1.seconds; decayToZero = 0.01; retainScore = 2.minutes; appSpecificWeight = 0.0; ipColocationFactorWeight = 0.0; ipColocationFactorThreshold = 1.0; behaviourPenaltyWeight = -1.0; behaviourPenaltyDecay = 0.999; directPeers = initTable(); disconnectBadPeers = false; enablePX = false; bandwidthEstimatebps = 100000000; overheadRateLimit = Opt.none(tuple[bytes: int, interval: Duration]); disconnectPeerAboveRateLimit = false; maxNumElementsInNonPriorityQueue = DefaultMaxNumElementsInNonPriorityQueue): GossipSubParams {. ...raises: [].}
- Source Edit
proc rateLimit(g: GossipSub; peer: PubSubPeer; overhead: int): Future[void] {. stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Source Edit
proc validateParameters(parameters: GossipSubParams): Result[void, cstring] {. ...raises: [], tags: [].}
- Source Edit
proc validateParameters(parameters: TopicParams): Result[void, cstring] {. ...raises: [], tags: [].}
- Source Edit
Methods
method getOrCreatePeer(g: GossipSub; peerId: PeerId; protosToDial: seq[string]; protoNegotiated: string = ""): PubSubPeer {....raises: [], tags: [WriteIOEffect, TimeEffect, RootEffect].}
- Source Edit
method initPubSub(g: GossipSub) {....raises: [InitializationError], raises: [], tags: [RootEffect].}
- Source Edit
method onNewPeer(g: GossipSub; peer: PubSubPeer) {....raises: [], tags: [RootEffect, WriteIOEffect, TimeEffect].}
- Source Edit
method onPubSubPeerEvent(p: GossipSub; peer: PubSubPeer; event: PubSubPeerEvent) {. ...gcsafe, raises: [], tags: [RootEffect, WriteIOEffect, TimeEffect].}
- Source Edit
method onTopicSubscription(g: GossipSub; topic: string; subscribed: bool) {. ...raises: [], tags: [RootEffect, WriteIOEffect, TimeEffect].}
- Source Edit
method publish(g: GossipSub; topic: string; data: seq[byte]): Future[int] {. stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Source Edit
method rpcHandler(g: GossipSub; peer: PubSubPeer; data: seq[byte]): Future[void] {. stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Source Edit
method start(g: GossipSub): InternalRaisesFuture[void, (CancelledError,)] {. stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [WriteIOEffect, TimeEffect, RootEffect].}
- Source Edit
method stop(g: GossipSub): InternalRaisesFuture[void, void] {.stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [WriteIOEffect, TimeEffect, RootEffect].}
- Source Edit
method unsubscribePeer(g: GossipSub; peer: PeerId) {....raises: [], tags: [WriteIOEffect, TimeEffect, RootEffect].}
- handle peer disconnects Source Edit
Exports
-
GossipSubD, IHaveMaxLength, BackoffSlackTime, GossipSubHistoryLength, GossipBackoffPeriod, PeerStats, IHavePeerBudget, GossipSub, GossipSubParams, GossipSubFanoutTTL, GossipSubCodec_10, GossipSubDlo, RoutingRecordsHandler, GossipSubHistoryGossip, GossipSubCodec_11, GossipSubHeartbeatInterval, MeshMetrics, BackoffTable, RoutingRecordsPair, TopicInfo, ValidationSeenTable, GossipSubDhi, PingsPeerBudget, TopicParams, updateScores, libp2p_gossipsub_peers_rate_limit_hits, disconnectPeer, init, disconnectIfBadScorePeer, withPeerStats, byScore, punishInvalidMessage, rewardDelivered, scoringHeartbeat, addCapped, getGossipPeers, handleIDontWant, replenishFanout, rebalanceMesh, dropFanoutPeers, handleIWant, pruned, handleBackingOff, peerExchangeList, handleGraft, grafted, handleIHave, handlePrune, heartbeat, maxIncomingStreams=, codec=, libp2p_pubsub_received_subscriptions, libp2p_pubsub_broadcast_unsubscriptions, libp2p_pubsub_messages_rebroadcasted, libp2p_pubsub_received_graft, removeValidator, DefaultMaxIncomingStreams, handler, handler=, send, libp2p_pubsub_received_prune, ValidatorHandler, libp2p_pubsub_broadcast_iwant, init, unsubscribe, validate, removeObserver, libp2p_pubsub_broadcast_graft, libp2p_pubsub_received_unsubscriptions, sendSubs, codec, MsgIdProvider, PubSub, SubscriptionValidator, start, onTopicSubscription, handler=, updateMetrics, libp2p_pubsub_broadcast_subscriptions, addValidator, KnownLibP2PTopics, handleConn, onPubSubPeerEvent, publish, LPProtocol, ValidationResult, new, broadcast, subscribe, addObserver, PubSubObserver, handler, PubSubPeer, unsubscribePeer, rpcHandler, init, KnownLibP2PTopicsSeq, handleData, LPProtoHandler, libp2p_pubsub_received_ihave, libp2p_pubsub_broadcast_prune, new, TopicPair, libp2p_pubsub_broadcast_ihave, subscribePeer, libp2p_pubsub_received_iwant, maxIncomingStreams, libp2p_pubsub_broadcast_messages, initPubSub, libp2p_pubsub_messages_published, TopicHandler, unsubscribeAll, InitializationError, libp2p_pubsub_received_messages, unsubscribe, getOrCreatePeer, stop