mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-06-29 13:00:06 +00:00
MessagingClient sat one layer below where the documented layering
(Waku <- MessagingClient <- ReliableChannelManager) places it: it took a
raw WakuNode and reached around the Waku kernel to its internals. Make the
messaging layer hold the Waku kernel and read `waku.node` from there, so the
declared dependency matches the layering and the layer holds the kernel handle
it will later route through.
The health-monitor test hand-builds a WakuNode, so it now wraps it in a
minimal Waku (conf/stateInfo only satisfy {.requiresInit.}; the messaging
path reads neither).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
20 lines
672 B
Nim
20 lines
672 B
Nim
## Messaging layer API — subscription operations.
|
|
import results, chronos
|
|
|
|
import logos_delivery/api/types
|
|
import logos_delivery/messaging/messaging_client
|
|
import logos_delivery/waku/waku
|
|
import logos_delivery/waku/node/[waku_node, subscription_manager]
|
|
|
|
proc subscribe*(
|
|
self: MessagingClient, contentTopic: ContentTopic
|
|
): Future[Result[void, string]] {.async.} =
|
|
?self.checkApiAvailability()
|
|
return self.waku.node.subscriptionManager.subscribe(contentTopic)
|
|
|
|
proc unsubscribe*(
|
|
self: MessagingClient, contentTopic: ContentTopic
|
|
): Result[void, string] =
|
|
?self.checkApiAvailability()
|
|
return self.waku.node.subscriptionManager.unsubscribe(contentTopic)
|