Defines and wires the client-facing API (Step 2 of #435).
Scope
PartialMessagesHandler<PeerState> interface:
onIncomingRpc(from, peerStates, rpc) — fast, non-blocking; runs on pubsub event thread.
onEmitGossip(topic, groupId, gossipPeers, peerStates) — called during heartbeat for partial-capable lazy-push targets.
PublishAction<PeerState>(partialMessage?, partsMetadata?, nextPeerState?, error?) — library applies nextPeerState atomically per peer (no in-place map mutation; deliberately different from go-libp2p).
PublishActionsFn<PeerState> — app-supplied per-publish decision function returning Sequence<Pair<PeerId, PublishAction<PeerState>>>.
PartialMessagesPeerFeedback side-channel — reportFeedback(topic, peer, USEFUL | INVALID | IGNORED) for driving peer scoring (matches Prysm's pattern).
GroupState container, not thread-safe, event-loop serialised.
- Builder wiring:
GossipRouterBuilder.partialMessagesHandler optional field; null + PARTIAL_MESSAGES flag enabled → build-time error.
Non-goals
Reference
Design: docs/partial-messages.md §4 (lands with the first PR on #435).
Defines and wires the client-facing API (Step 2 of #435).
Scope
PartialMessagesHandler<PeerState>interface:onIncomingRpc(from, peerStates, rpc)— fast, non-blocking; runs on pubsub event thread.onEmitGossip(topic, groupId, gossipPeers, peerStates)— called during heartbeat for partial-capable lazy-push targets.PublishAction<PeerState>(partialMessage?, partsMetadata?, nextPeerState?, error?)— library appliesnextPeerStateatomically per peer (no in-place map mutation; deliberately different from go-libp2p).PublishActionsFn<PeerState>— app-supplied per-publish decision function returningSequence<Pair<PeerId, PublishAction<PeerState>>>.PartialMessagesPeerFeedbackside-channel —reportFeedback(topic, peer, USEFUL | INVALID | IGNORED)for driving peer scoring (matches Prysm's pattern).GroupStatecontainer, not thread-safe, event-loop serialised.GossipRouterBuilder.partialMessagesHandleroptional field; null +PARTIAL_MESSAGESflag enabled → build-time error.Non-goals
partsMetadataorgroupIDmean — fully opaque to the library.Reference
Design:
docs/partial-messages.md§4 (lands with the first PR on #435).