mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-06-29 13:00:06 +00:00
api: drop the ILogosDelivery interface and its module
LogosDelivery is the top of the layering and nothing abstracts over it (the FFI holds the concrete FFIContext[LogosDelivery]), so the ILogosDelivery RootObj base bought nothing: its `method`s only returned "not implemented" and were never dispatched. Remove the interface, keep LogosDelivery as a plain object, and demote its start/stop/isOnline from `method` to `proc` (static dispatch on the concrete type). That left `api/logos_delivery_api.nim` holding only EventConnectionStatusChange. Move it to `waku/api/events/health_events.nim` -- alongside the sibling topic health events and next to its emitter (the health monitor, which already imported that module) -- and delete the now-empty `logos_delivery_api.nim`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
b7d1cb8872
commit
beaebf84d0
@ -1,33 +0,0 @@
|
||||
## `LogosDelivery` is the project entry point. It is a pure concentrator: it
|
||||
## owns exactly one instance of each API layer
|
||||
##
|
||||
## Waku <- MessagingClient <- ReliableChannelManager
|
||||
##
|
||||
## and chains them together (each layer drives the one below it). Every layer
|
||||
## keeps its own, separate public API — `LogosDelivery` only wires them up and
|
||||
## drives the shared `new` / `start` / `stop` lifecycle.
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
import results, chronos
|
||||
import brokers/event_broker
|
||||
import types as api_types
|
||||
|
||||
export api_types, event_broker
|
||||
|
||||
type
|
||||
## Entry point. Holds one instance of each API layer.
|
||||
ILogosDelivery* = ref object of RootObj
|
||||
|
||||
EventBroker:
|
||||
type EventConnectionStatusChange* = object
|
||||
connectionStatus*: ConnectionStatus
|
||||
|
||||
method start*(self: ILogosDelivery): Future[Result[void, string]] {.async, base.} =
|
||||
return err("ILogosDelivery.start not implemented")
|
||||
|
||||
method stop*(self: ILogosDelivery): Future[Result[void, string]] {.async, base.} =
|
||||
return err("ILogosDelivery.stop not implemented")
|
||||
|
||||
method isOnline*(self: ILogosDelivery): Future[Result[bool, string]] {.async, base.} =
|
||||
return err("ILogosDelivery.isOnline not implemented")
|
||||
@ -11,9 +11,6 @@
|
||||
|
||||
import results, chronos, chronicles
|
||||
|
||||
import logos_delivery/api/logos_delivery_api
|
||||
export logos_delivery_api
|
||||
|
||||
# Each layer has a core module (type + new/start/stop) and an api/ folder whose
|
||||
# modules each implement a differentiated set of operations, plus an events
|
||||
# surface. The concentrator re-exports them so library consumers get the full
|
||||
@ -75,7 +72,7 @@ type
|
||||
messaging*: MessagingClientConf
|
||||
reliableChannel*: ReliableChannelManagerConf
|
||||
|
||||
LogosDelivery* = ref object of ILogosDelivery
|
||||
LogosDelivery* = ref object
|
||||
## Entry point. Holds one instance of each API layer.
|
||||
waku*: Waku
|
||||
messagingClient*: MessagingClient
|
||||
@ -120,7 +117,7 @@ proc new*(
|
||||
)
|
||||
)
|
||||
|
||||
method start*(self: LogosDelivery): Future[Result[void, string]] {.async.} =
|
||||
proc start*(self: LogosDelivery): Future[Result[void, string]] {.async.} =
|
||||
## Starts each layer bottom-up: transport first, then messaging, then channels.
|
||||
if self.waku.isNil():
|
||||
return err("Waku node is not initialized")
|
||||
@ -140,7 +137,7 @@ method start*(self: LogosDelivery): Future[Result[void, string]] {.async.} =
|
||||
|
||||
return ok()
|
||||
|
||||
method stop*(self: LogosDelivery): Future[Result[void, string]] {.async.} =
|
||||
proc stop*(self: LogosDelivery): Future[Result[void, string]] {.async.} =
|
||||
## Stops in reverse order so higher layers drain before their dependencies.
|
||||
await self.reliableChannelManager.stop()
|
||||
await self.messagingClient.stop()
|
||||
@ -150,7 +147,7 @@ method stop*(self: LogosDelivery): Future[Result[void, string]] {.async.} =
|
||||
|
||||
return ok()
|
||||
|
||||
method isOnline*(self: LogosDelivery): Future[Result[bool, string]] {.async.} =
|
||||
proc isOnline*(self: LogosDelivery): Future[Result[bool, string]] {.async.} =
|
||||
if self.waku.isNil():
|
||||
return err("Waku node is not initialized")
|
||||
return ok(self.waku.healthMonitor.onlineMonitor.amIOnline())
|
||||
|
||||
@ -13,7 +13,7 @@ import
|
||||
import
|
||||
logos_delivery/api/kernel_api, # MessageSeenEvent
|
||||
logos_delivery/api/messaging_client_api, # MessageReceivedEvent
|
||||
logos_delivery/api/logos_delivery_api # EventConnectionStatusChange
|
||||
logos_delivery/waku/api/events/health_events # EventConnectionStatusChange
|
||||
|
||||
const MaxMessageLife = chronos.minutes(7) ## Max time we will keep track of rx messages
|
||||
|
||||
|
||||
@ -4,10 +4,12 @@ import logos_delivery/api/types
|
||||
import logos_delivery/waku/node/health_monitor/[protocol_health, topic_health]
|
||||
import logos_delivery/waku/waku_core/topics
|
||||
|
||||
export protocol_health, topic_health
|
||||
export event_broker, protocol_health, topic_health
|
||||
|
||||
# Note: `EventConnectionStatusChange` lives in `logos_delivery/api/logos_delivery_api`
|
||||
# (the top-level orchestrator interface owns the node-connectivity event).
|
||||
# Emitted by the health monitor when overall node connectivity changes.
|
||||
EventBroker:
|
||||
type EventConnectionStatusChange* = object
|
||||
connectionStatus*: ConnectionStatus
|
||||
|
||||
# Notify health changes to a subscribed topic
|
||||
# TODO: emit content topic health change events when subscribe/unsubscribe
|
||||
|
||||
@ -9,7 +9,6 @@ import
|
||||
libp2p/protocols/pubsub,
|
||||
libp2p/protocols/pubsub/rpc/messages,
|
||||
logos_delivery/api/types,
|
||||
logos_delivery/api/logos_delivery_api, # EventConnectionStatusChange
|
||||
logos_delivery/waku/[
|
||||
waku_relay,
|
||||
waku_rln_relay,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user