Ivan FB 4dfe72e12f
messaging & channels: per-layer api/ folders + concentrator
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>
2026-06-25 04:17:49 +02:00

40 lines
1.4 KiB
Nim

## Reliable Channel layer API — event surface.
##
## Lifecycle events for individual segments (sent / propagated / errored)
## are the same as the network-level ones the MessagingClient already
## emits — `requestId` is shared across layers — so we just re-export
## `messaging/api/events` and avoid declaring duplicates.
##
## Only the channel-level `MessageReceivedEvent` carries data that has
## no analogue in the lower layer (reassembled application payload,
## senderId, channelId), so it lives here.
import logos_delivery/messaging/api/events as messaging_events
import brokers/event_broker
import logos_delivery/channels/types as channel_types
export messaging_events, channel_types, event_broker
EventBroker:
type ChannelMessageReceivedEvent* = object
channelId*: ChannelId
senderId*: SdsParticipantID
payload*: seq[byte]
EventBroker:
## Emitted when every segment of a channel-level `send()` reached
## `Confirmed`. Channel-level analogue of `MessageSentEvent`; the
## `requestId` is the channel-layer parent returned by `send()`.
type ChannelMessageSentEvent* = object
channelId*: ChannelId
requestId*: RequestId
EventBroker:
## Emitted when a channel-level `send()` finalises with at least one
## segment in `Failed`. Channel-level analogue of `MessageErrorEvent`.
type ChannelMessageErrorEvent* = object
channelId*: ChannelId
requestId*: RequestId
error*: string