Gossip based publishing
Imports
-
pubsub, floodsub, gossipsub/partial_message, pubsubpeer, peertable, mcache, timedcache, rpc/messages, rpc/message, rpc/protobuf, ../protocol, ../../stream/connection, ../../peerinfo, ../../peerid, ../../utils/opt, ../../utils/shortlog, ../../utils/collections, ../../switch, gossipsub/types, gossipsub/scoring, gossipsub/behavior, gossipsub/preamblestore, gossipsub/extensions, ../../utils/heartbeat, ../../utils/future
Procs
proc addDirectPeer(g: GossipSub; id: PeerId; addrs: seq[MultiAddress]): InternalRaisesFuture[ void, (CancelledError,)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- 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 = 4 - 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; slowPeerPenaltyWeight = 0.0; slowPeerPenaltyThreshold = 2.0; slowPeerPenaltyDecay = 0.2; behaviourPenaltyWeight = -1.0; behaviourPenaltyDecay = 0.999; directPeers = initTable[PeerId, seq[MultiAddress]](); disconnectBadPeers = false; enablePX = false; bandwidthEstimatebps = 100000000; overheadRateLimit = Opt.none(tuple[bytes: int, interval: Duration]); disconnectPeerAboveRateLimit = false; maxHighPriorityQueueLen = DefaultMaxHighPriorityQueueLen; maxMediumPriorityQueueLen = DefaultMaxMediumPriorityQueueLen; maxLowPriorityQueueLen = DefaultMaxLowPriorityQueueLen; sendIDontWantOnPublish = false; testExtensionConfig = Opt.none(TestExtensionConfig); partialMessageExtensionConfig = Opt.none(PartialMessageExtensionConfig); pingpongExtensionConfig = Opt.none(PingPongExtensionConfig)): GossipSubParams {. ...raises: [].}
- Source Edit
proc publishPartial(g: GossipSub; topic: string; pm: PartialMessage; peers: seq[PeerId] = @[]): InternalRaisesFuture[void, void] {. ...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc rateLimit(g: GossipSub; peer: PubSubPeer; overhead: int): InternalRaisesFuture[ void, (PeerRateLimitError,)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc validateParameters(parameters: GossipSubParams): Result[void, cstring] {. ...raises: [], tags: [], forbids: [].}
- Source Edit
proc validateParameters(parameters: TopicParams): Result[void, cstring] {. ...raises: [], tags: [], forbids: [].}
- Source Edit
Methods
method getOrCreatePeer(g: GossipSub; peerId: PeerId; protosToDial: seq[string]; protoNegotiated: string = ""): PubSubPeer {....raises: [], tags: [RootEffect, WriteIOEffect], forbids: [].}
- Source Edit
method initPubSub(g: GossipSub) {....raises: [InitializationError], raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
method onNewPeer(g: GossipSub; peer: PubSubPeer) {....raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
method onPubSubPeerEvent(p: GossipSub; peer: PubSubPeer; event: PubSubPeerEvent) {. ...gcsafe, raises: [], tags: [RootEffect, WriteIOEffect], forbids: [].}
- Source Edit
method onTopicSubscription(g: GossipSub; topic: string; subscribed: bool) {. ...raises: [], tags: [RootEffect, WriteIOEffect], forbids: [].}
- Source Edit
method publish(g: GossipSub; topic: string; data: sink seq[byte]; publishParams: Opt[PublishParams] = Opt.none(PublishParams)): InternalRaisesFuture[ int, void] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
method rpcHandler(g: GossipSub; peer: PubSubPeer; data: sink seq[byte]): InternalRaisesFuture[ void, (CancelledError, PeerMessageDecodeError, PeerRateLimitError)] {. ...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
method unsubscribePeer(g: GossipSub; peer: PeerId) {....raises: [], tags: [RootEffect, WriteIOEffect], forbids: [].}
- handle peer disconnects Source Edit
Exports
-
GossipSubHistoryLength, GossipSubD, IHavePeerBudget, GossipSub, BackoffSlackTime, GossipSubParams, GossipSubCodec_10, OngoingReceivesStore, RoutingRecordsHandler, RoutingRecordsPair, GossipSubHeartbeatInterval, IHaveMaxLength, GossipSubHistoryGossip, IDontWantMaxCount, GossipSubDhi, ValidationSeenTable, PreamblePeerBudget, MaxOpportunisticGraftPeers, GossipSubFanoutTTL, GossipBackoffPeriod, PeerStats, GossipSubDlo, PullOperation, MeshMetrics, GossipSubCodec_11, BackoffTable, GossipSubCodec_13, TopicInfo, GossipSubCodec_12, TopicParams, updateScores, libp2p_gossipsub_peers_rate_limit_hits, disconnectPeer, init, disconnectIfBadScorePeer, withPeerStats, byScore, punishInvalidMessage, rewardDelivered, scoringHeartbeat, addCapped, handleIDontWant, replenishFanout, rebalanceMesh, dropFanoutPeers, makeGossipControlMessages, handleIWant, pruned, handleBackingOff, peerExchangeList, handleGraft, grafted, handleIHave, handlePrune, heartbeat, sendSubs, codec=, removeObserver, libp2p_pubsub_received_subscriptions, libp2p_pubsub_broadcast_unsubscriptions, libp2p_pubsub_messages_rebroadcasted, libp2p_pubsub_received_graft, PeerMessageDecodeError, handler, libp2p_pubsub_received_ihave, PublishParams, libp2p_pubsub_received_prune, ValidatorHandler, libp2p_pubsub_broadcast_iwant, init, unsubscribe, validate, send, topicLabel, libp2p_pubsub_broadcast_graft, libp2p_pubsub_received_unsubscriptions, canAcceptIncoming, releaseOutgoing, MsgIdProvider, PubSub, handleSelfPublishing, SubscriptionValidator, start, publish, onTopicSubscription, handler=, updateMetrics, libp2p_pubsub_broadcast_subscriptions, canOpenOutgoing, addValidator, KnownLibP2PTopics, handleConn, onPubSubPeerEvent, libp2p_pubsub_messages_published_partial, LPProtocol, releaseIncoming, ValidationResult, broadcast, subscribe, reserveIncoming, PubSubObserver, handler, PubSubPeer, removeValidator, unsubscribePeer, rpcHandler, KnownLibP2PTopicsSeq, handleData, LPProtoHandler, libp2p_pubsub_broadcast_prune, TopicData, new, TopicPair, libp2p_pubsub_broadcast_ihave, subscribePeer, init, reserveOutgoing, DefaultTopicsHigh, libp2p_pubsub_received_iwant, codec, addObserver, libp2p_pubsub_broadcast_messages, initPubSub, libp2p_pubsub_messages_published, TopicHandler, unsubscribeAll, InitializationError, libp2p_pubsub_received_messages, unsubscribe, getOrCreatePeer, stop