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

LibP2P.Protocol.GossipSub.PartialMessages

Description

Generic application-defined GossipSub partial-message runtime.

Synopsis

Documentation

data PartialMessagesConfig state Source #

Application callbacks and bounded-state limits.

Callbacks are serialized with partial-message state updates. They should return sends through partialPublishActions rather than recursively calling publishPartial.

Constructors

PartialMessagesConfig 

Fields

data PartialCallbackResult state Source #

Updated application state plus per-peer messages to send.

type PartialPublishPlan state = Map PeerId state -> (PeerId -> Bool) -> IO (PartialCallbackResult state) Source #

Plan sends for a locally published or updated group. The predicate reports whether a peer requested partial data; metadata-only peers return False.

defaultPartialMessagesConfig :: state -> (PeerId -> Map PeerId state -> PartialMessage -> IO (PartialCallbackResult state)) -> (Topic -> ByteString -> [PeerId] -> Map PeerId state -> IO (PartialCallbackResult state)) -> PartialMessagesConfig state Source #

Go-compatible defaults for group state limits and lifetime.

installPartialMessages :: GossipSubRouter -> PartialMessagesExtension state -> IO (Either PartialMessagesError ()) Source #

Attach one partial-message runtime to a router.

partialMeshPeers :: PartialMessagesExtension state -> Topic -> IO (Either PartialMessagesError [PeerId]) Source #

Compatible mesh/fanout peers for an enabled topic.

partialPeerRequests :: PartialMessagesExtension state -> PeerId -> Topic -> IO Bool Source #

Whether a peer requested partial data for a topic.

publishPartial :: PartialMessagesExtension state -> Topic -> ByteString -> PartialPublishPlan state -> IO (Either PartialMessagesError ()) Source #

Publish or update one application-defined partial-message group. The application owns the encoding of data and metadata; this runtime only routes the opaque bytes and bounds group state.