libp2p/discovery/discoverymngr

    Dark Mode
Search:
Group by:
  Source   Edit

Types

DiscoveryError = object of LPError
  Source   Edit
DiscoveryFinished = object of LPError
  Source   Edit
DiscoveryInterface = ref object of RootObj
  onPeerFound*: PeerFoundCallback
  toAdvertise*: PeerAttributes
  advertisementUpdated*: AsyncEvent
  advertiseLoop*: Future[void]
  Source   Edit
DiscoveryManager = ref object
  interfaces: seq[DiscoveryInterface]
  queries: seq[DiscoveryQuery]
  Source   Edit
DiscoveryQuery = ref object
  attr: PeerAttributes
  peers: AsyncQueue[PeerAttributes]
  finished: bool
  futs: seq[Future[void]]
  Source   Edit
DiscoveryService = distinct string
  Source   Edit
PeerAttributes = object
  attributes: seq[BaseAttr]
  Source   Edit
PeerFoundCallback = proc (pa: PeerAttributes) {....raises: [], gcsafe.}
  Source   Edit

Procs

proc `==`(a, b: DiscoveryService): bool {.borrow, ...raises: [], tags: [].}
  Source   Edit
proc `[]`[T](pa: PeerAttributes; t: typedesc[T]): T {....raises: [KeyError],
    raises: [].}
  Source   Edit
proc `{}`[T](pa: PeerAttributes; t: typedesc[T]): Opt[T] {....raises: [].}
  Source   Edit
proc add(dm: DiscoveryManager; di: DiscoveryInterface) {....raises: [], tags: [].}
  Source   Edit
proc add[T](pa: var PeerAttributes; value: T) {....raises: [].}
  Source   Edit
proc advertise[T](dm: DiscoveryManager; value: T) {....raises: [].}
  Source   Edit
proc getAll[T](pa: PeerAttributes; t: typedesc[T]): seq[T] {....raises: [].}
  Source   Edit
proc getPeer(query: DiscoveryQuery): InternalRaisesFuture[PeerAttributes,
    (CancelledError, DiscoveryError, DiscoveryFinished)] {.stackTrace: false,
    ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
  Source   Edit
proc match(pa, candidate: PeerAttributes): bool {....raises: [], tags: [RootEffect].}
  Source   Edit
proc ofType[T](f: BaseAttr; _: type[T]): bool {....raises: [].}
  Source   Edit
proc request(dm: DiscoveryManager; pa: PeerAttributes): DiscoveryQuery {.
    ...raises: [], tags: [RootEffect].}
  Source   Edit
proc request[T](dm: DiscoveryManager; value: T): DiscoveryQuery {....raises: [].}
  Source   Edit
proc stop(dm: DiscoveryManager) {....raises: [], tags: [RootEffect].}
  Source   Edit
proc stop(query: DiscoveryQuery) {....raises: [], tags: [RootEffect].}
  Source   Edit
proc to[T](f: BaseAttr; _: type[T]): T {....raises: [].}
  Source   Edit

Methods

method advertise(self: DiscoveryInterface): InternalRaisesFuture[void,
    (CancelledError, AdvertiseError)] {.base, stackTrace: false, ...raises: [],
                                        gcsafe, raises: [], raises: [],
                                        tags: [RootEffect].}
  Source   Edit
method request(self: DiscoveryInterface; pa: PeerAttributes): InternalRaisesFuture[
    void, (DiscoveryError, CancelledError)] {.base, stackTrace: false,
    ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
  Source   Edit

Iterators

iterator items(pa: PeerAttributes): BaseAttr {....raises: [], tags: [].}
  Source   Edit

Templates

template forEach(query: DiscoveryQuery; code: untyped)
Will execute code for each discovered peer. The peer attritubtes are available through the variable peer   Source   Edit