mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-07-21 07:40:30 +00:00
Extract the messaging (send/subscription) and reliable-channel (lifecycle/send) operations into their own api/ folders with events moved to the owning layer, thin messaging_client and reliable_channel_manager, and add the LogosDelivery concentrator that aggregates the per-layer APIs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
791 B
Nim
22 lines
791 B
Nim
## Reliable Channel layer API — channel send operation.
|
|
import std/tables
|
|
import results, chronos
|
|
|
|
import logos_delivery/api/types
|
|
import logos_delivery/channels/reliable_channel_manager
|
|
import logos_delivery/channels/reliable_channel
|
|
|
|
proc send*(
|
|
self: ReliableChannelManager,
|
|
channelId: ChannelId,
|
|
appPayload: seq[byte],
|
|
ephemeral: bool = false,
|
|
): Future[Result[RequestId, string]] {.async: (raises: []).} =
|
|
## Spec-level entry point. Looks the channel up by id and delegates
|
|
## to `ReliableChannel.send`, which exposes the visible pipeline
|
|
## segmentation -> sds -> rate_limit_manager -> encryption.
|
|
let chn = self.channels.getOrDefault(channelId)
|
|
if chn.isNil():
|
|
return err("unknown channel: " & channelId)
|
|
return await chn.send(appPayload, ephemeral)
|