Refactor waku/api into messaging_client, waku/api/types and api_conf into logos_delivery/api

This commit is contained in:
NagyZoltanPeter 2026-06-23 13:55:23 +02:00
parent 10634f8a05
commit 341556e964
No known key found for this signature in database
GPG Key ID: 3E1F97CF4A7B6F42
5 changed files with 1044 additions and 25 deletions

View File

@ -22,8 +22,6 @@ export reliable_channel_manager
import logos_delivery/waku/factory/waku_conf
import logos_delivery/waku/factory/app_callbacks
import tools/confutils/cli_args
import logos_delivery/waku/node/health_monitor/online_monitor
logScope:
topics = "logosdelivery"

View File

@ -43,25 +43,25 @@ proc stop*(self: MessagingClient) {.async.} =
await self.recvService.stopRecvService()
self.started = false
proc checkApiAvailability(self: MessagingClient): Result[void, string] =
if self.isNil():
proc checkApiAvailability(mc: MessagingClient): Result[void, string] =
if mc.isNil():
return err("MessagingClient is not initialized")
return ok()
proc subscribe*(
self: MessagingClient, contentTopic: ContentTopic
mc: MessagingClient, contentTopic: ContentTopic
): Future[Result[void, string]] {.async.} =
?checkApiAvailability(self)
?checkApiAvailability(mc)
return self.node.subscriptionManager.subscribe(contentTopic)
return mc.node.subscriptionManager.subscribe(contentTopic)
proc unsubscribe*(
self: MessagingClient, contentTopic: ContentTopic
mc: MessagingClient, contentTopic: ContentTopic
): Result[void, string] =
?checkApiAvailability(self)
?checkApiAvailability(mc)
return self.node.subscriptionManager.unsubscribe(contentTopic)
return mc.node.subscriptionManager.unsubscribe(contentTopic)
proc send*(
self: MessagingClient, envelope: MessageEnvelope

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import chronos, results, std/strutils
from logos_delivery/api/types import ConnectionStatus
import logos_delivery/api/types
export ConnectionStatus

View File

@ -50,9 +50,6 @@ import
factory/app_callbacks,
persistency/persistency,
factory/validator_signed,
waku_lightpush/client,
waku_lightpush_legacy/client,
waku_store/client,
],
./factory/waku_conf,
./factory/waku_state_info
@ -618,15 +615,8 @@ proc relaySubscribe*(
if self.node.wakuRelay.isNil():
return err("relaySubscribe: WakuRelay not mounted")
let handler = proc(topic: PubsubTopic, msg: WakuMessage) {.async.} =
## Bridge inbound relay traffic to the `ReceivedMessage` kernel event
## (replaces libwaku's set_event_callback message path).
ReceivedMessage.emit(
self.brokerCtx, ReceivedMessage(pubsubTopic: topic, message: msg)
)
self.node.subscribe(
(kind: SubscriptionKind.PubsubSub, topic: pubsubTopic), WakuRelayHandler(handler)
(kind: SubscriptionKind.PubsubSub, topic: pubsubTopic), WakuRelayHandler(nil)
).isOkOr:
return err($error)
@ -976,9 +966,6 @@ proc metrics*(self: Waku): Future[Result[string, string]] {.async.} =
except CatchableError as e:
return err(e.msg)
proc isOnline*(self: Waku): Future[Result[bool, string]] {.async.} =
return ok(self.healthMonitor.onlineMonitor.amIOnline())
proc pingPeer*(
self: Waku, peerAddr: string, timeoutMs: int
): Future[Result[int64, string]] {.async.} =