mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-06-29 21:09:29 +00:00
define logos delivery interface
This commit is contained in:
parent
4c57d180b4
commit
026facb79b
11
logos_delivery/api/logos_delivery_api.nim
Normal file
11
logos_delivery/api/logos_delivery_api.nim
Normal 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]]
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user