define logos delivery interface

This commit is contained in:
Ivan FB 2026-06-29 18:08:37 +02:00
parent 4c57d180b4
commit 026facb79b
No known key found for this signature in database
GPG Key ID: DF0C67A04C543270
2 changed files with 20 additions and 6 deletions

View File

@ -0,0 +1,11 @@
import chronos, results
# Structural API contract for the top-level entry point, implemented by
# `LogosDelivery` (the aggregate owning one instance of each API layer).
type LogosDeliveryApi* = concept ld
# --- lifecycle ---
start(ld) is Future[Result[void, string]]
stop(ld) is Future[Result[void, string]]
# --- health ---
isOnline(ld) is Future[Result[bool, string]]

View File

@ -52,12 +52,8 @@ export channel_send
import logos_delivery/events/reliable_channel_manager_events
export reliable_channel_manager_events
# Compile-time check that each layer's concrete type satisfies its API concept.
static:
doAssert Waku is KernelApi
doAssert MessagingClient is MessagingApi
doAssert ReliableChannelManager is ReliableChannelApi
import logos_delivery/api/logos_delivery_api
export logos_delivery_api
import logos_delivery/waku/factory/waku_conf
import logos_delivery/waku/factory/app_callbacks
import tools/confutils/cli_args
@ -153,3 +149,10 @@ proc isOnline*(self: LogosDelivery): Future[Result[bool, string]] {.async.} =
if self.waku.isNil():
return err("Waku node is not initialized")
return await self.waku.isOnline()
# Compile-time check that each concrete type satisfies its API concept.
static:
doAssert Waku is KernelApi
doAssert MessagingClient is MessagingApi
doAssert ReliableChannelManager is ReliableChannelApi
doAssert LogosDelivery is LogosDeliveryApi