mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-07-01 05:49:36 +00:00
The messaging api layer reached around the Waku kernel into the libp2p node (`waku.node.subscriptionManager`, `waku.node.rng`, `waku.node.brokerCtx`). That breaks the declared layering: messaging depends on the Waku *kernel* abstraction, not the raw node. Add a content-topic subscription api on the Waku layer (`waku/api/subscriptions.nim`) and switch the messaging send/subscription paths onto it, plus the kernel's own `rng`/`brokerCtx` fields, so the layer no longer touches `node` internals. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
20 lines
601 B
Nim
20 lines
601 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/api/subscriptions
|
|
|
|
proc subscribe*(
|
|
self: MessagingClient, contentTopic: ContentTopic
|
|
): Future[Result[void, string]] {.async.} =
|
|
?self.checkApiAvailability()
|
|
return self.waku.subscribe(contentTopic)
|
|
|
|
proc unsubscribe*(
|
|
self: MessagingClient, contentTopic: ContentTopic
|
|
): Result[void, string] =
|
|
?self.checkApiAvailability()
|
|
return self.waku.unsubscribe(contentTopic)
|