hs-libp2p-0.2.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

LibP2P.Discovery.Types

Description

Types shared by the discovery modules (mDNS, Rendezvous).

Each discovery mechanism delivers peers it finds as a DiscoveryEvent on an STM queue the application owns, so consumers use one shape regardless of the mechanism and never couple to a callback threading model.

Synopsis

Documentation

data DiscoveryEvent Source #

A peer found by a discovery mechanism, with the addresses it advertised. Deduplication is the consumer's job, not the queue's: discovery runs concurrently with the Switch's peer store, and suppressing re-announcements would hide refreshed address lists. A TQueue is unbounded, so producing never blocks; applications are expected to drain or poll at their own cadence.

Constructors

DiscoveryEvent 

Fields

newDiscoveryQueue :: IO (TQueue DiscoveryEvent) Source #

Create a discovery event queue.

tryReadDiscoveryQueue :: TQueue DiscoveryEvent -> IO (Maybe DiscoveryEvent) Source #

Read one event if any are queued.

drainDiscoveryQueue :: TQueue DiscoveryEvent -> IO [DiscoveryEvent] Source #

Drain every currently queued event, in order.