mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-07-31 17:03:14 +00:00
Callers need to know whether a channel is open before create/send, and had no way to ask without inferring it from a "channel already exists" error. Exposed at both layers so FFI consumers get the same answer. "Exists" means currently held by the manager, i.e. between a successful createReliableChannel and closeChannel. Persisted SDS state outlives a close, so a closed channel reports false -- this is a liveness check, not a "was this channel ever created" check. Cherry-picked from chore/channel-exists, which forked before the nim-ffi 0.2.0 migration. The FFI proc is re-expressed in the typed model, which also lets it carry a real bool instead of a "true"/"false" string; the hand-written header hunk is dropped since that header is generated now. Closes #4039 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
17 lines
647 B
Nim
17 lines
647 B
Nim
import chronos, results
|
|
|
|
import logos_delivery/api/types as api_types
|
|
import logos_delivery/channels/types as channel_types
|
|
|
|
export api_types, channel_types
|
|
|
|
# Structural API contract for the reliable-channel surface (ops in `channels/api/*`).
|
|
type ReliableChannelApi* = concept c
|
|
createReliableChannel(
|
|
c, channelId = ChannelId, contentTopic = ContentTopic, senderId = SdsParticipantID
|
|
) is Result[ChannelId, string]
|
|
channelExists(c, channelId = ChannelId) is bool
|
|
closeChannel(c, channelId = ChannelId) is Future[Result[void, string]]
|
|
send(c, channelId = ChannelId, appPayload = seq[byte]) is
|
|
Future[Result[RequestId, string]]
|