libp2p/services/identify_pusher

Search:
Group by:
Source   Edit  

IdentifyPusher orchestrates the IdentifyPush protocol as a Switch Service.

Tracks which connected peers advertise the IdentifyPush codec, keeps that set in sync with connect / disconnect / re-identify events, and broadcasts our updated PeerInfo to every tracked peer when triggered.

Lifecycle

  • setup: Initializes the identify push protocol and mounts it to the switch.
  • start: Registers event handlers for peer connect/disconnect and enables automatic broadcasting when peer info changes. Called by the switch after it has been fully started.
  • stop: Cleans up event handlers and cancels any pending broadcasts.

Broadcasting Behavior

Broadcasting is triggered automatically when:

  • The local PeerInfo changes (via observer pattern)
  • A peer connects and supports IdentifyPush

It can also be triggered manually via broadcast. Each push is fire-and-forget and runs in the background.

Types

IdentifyPusher = ref object of Service
  identifyPush*: IdentifyPush
Source   Edit  

Procs

proc new(T: type IdentifyPusher): T:type {....raises: [].}
Source   Edit  

Methods

method setup(p: IdentifyPusher; switch: Switch) {....raises: [ServiceSetupError],
    raises: [], tags: [RootEffect], forbids: [].}
Source   Edit  
method start(p: IdentifyPusher; switch: Switch): InternalRaisesFuture[void,
    (CancelledError,)] {....stackTrace: false, raises: [], gcsafe, raises: [],
                         tags: [RootEffect], forbids: [].}
Source   Edit  
method stop(p: IdentifyPusher; switch: Switch): InternalRaisesFuture[void,
    (CancelledError,)] {....stackTrace: false, raises: [], gcsafe, raises: [],
                         tags: [RootEffect], forbids: [].}
Source   Edit