2026-06-25 19:32:54 +02:00
|
|
|
import chronos, results
|
|
|
|
|
import brokers/event_broker
|
|
|
|
|
|
|
|
|
|
import logos_delivery/api/types as api_types
|
|
|
|
|
import logos_delivery/waku/waku_core/topics/pubsub_topic
|
Move events back into interface-class source files (restore #3975 placement)
Reverses the earlier dedup-by-re-export: event TYPE definitions now live in the
interface classes, and the emptied decomposed event files are removed.
- MessageSeenEvent -> logos_delivery/api/kernel_api.nim
- Message{Sent,Error,Propagated,Received}Event -> api/messaging_client_api.nim
- ChannelMessage{Received,Sent,Error}Event -> api/reliable_channel_manager_api.nim
- EventConnectionStatusChange -> api/logos_delivery_api.nim
Deleted (became empty after the move):
- logos_delivery/waku/api/events/message_events.nim
- logos_delivery/messaging/api/events.nim
- logos_delivery/channels/api/events.nim
health_events.nim keeps its two remaining events (content/shard topic health).
Rewiring: each layer re-exports its interface module (waku->kernel_api,
messaging_client->messaging_client_api, reliable_channel->reliable_channel_manager_api,
which also re-exports messaging_client_api). Deep emitters/listeners
(subscription_manager, waku_node, waku_node/relay, node_health_monitor,
recv_service, send_service) import the owning interface module directly.
kernel_api stays below node level (types/topics/message/store-common) so the
node->kernel_api imports are acyclic. liblogosdelivery builds.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:07:13 +02:00
|
|
|
import logos_delivery/waku/waku_core/message
|
2026-06-26 12:30:07 +02:00
|
|
|
import logos_delivery/waku/waku_core/subscription/push_handler
|
2026-06-25 19:32:54 +02:00
|
|
|
import logos_delivery/waku/waku_store/common as store_types
|
|
|
|
|
|
|
|
|
|
export event_broker
|
|
|
|
|
export api_types, pubsub_topic, store_types
|
|
|
|
|
|
Move events back into interface-class source files (restore #3975 placement)
Reverses the earlier dedup-by-re-export: event TYPE definitions now live in the
interface classes, and the emptied decomposed event files are removed.
- MessageSeenEvent -> logos_delivery/api/kernel_api.nim
- Message{Sent,Error,Propagated,Received}Event -> api/messaging_client_api.nim
- ChannelMessage{Received,Sent,Error}Event -> api/reliable_channel_manager_api.nim
- EventConnectionStatusChange -> api/logos_delivery_api.nim
Deleted (became empty after the move):
- logos_delivery/waku/api/events/message_events.nim
- logos_delivery/messaging/api/events.nim
- logos_delivery/channels/api/events.nim
health_events.nim keeps its two remaining events (content/shard topic health).
Rewiring: each layer re-exports its interface module (waku->kernel_api,
messaging_client->messaging_client_api, reliable_channel->reliable_channel_manager_api,
which also re-exports messaging_client_api). Deep emitters/listeners
(subscription_manager, waku_node, waku_node/relay, node_health_monitor,
recv_service, send_service) import the owning interface module directly.
kernel_api stays below node level (types/topics/message/store-common) so the
node->kernel_api imports are acyclic. liblogosdelivery builds.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:07:13 +02:00
|
|
|
EventBroker:
|
|
|
|
|
# Internal event emitted when a message arrives from the network via any protocol
|
|
|
|
|
type MessageSeenEvent* = object
|
|
|
|
|
topic*: PubsubTopic
|
|
|
|
|
message*: WakuMessage
|
|
|
|
|
|
2026-06-26 12:30:07 +02:00
|
|
|
# Structural API contract for the Kernel surface, implemented by `Waku`
|
|
|
|
|
# (ops in `waku/api/*`).
|
|
|
|
|
type KernelApi* = concept w
|
|
|
|
|
# --- topic construction ---
|
2026-06-29 10:51:34 +02:00
|
|
|
buildContentTopic(
|
|
|
|
|
w, appName = string, appVersion = uint32, name = string, encoding = string
|
|
|
|
|
) is Future[Result[ContentTopic, string]]
|
|
|
|
|
buildPubsubTopic(w, topicName = string) is Future[Result[PubsubTopic, string]]
|
2026-06-26 12:30:07 +02:00
|
|
|
defaultPubsubTopic(w) is Future[Result[PubsubTopic, string]]
|
|
|
|
|
|
|
|
|
|
# --- relay ---
|
2026-06-29 10:51:34 +02:00
|
|
|
relayPublish(w, pubsubTopic = PubsubTopic, message = WakuMessage, timeoutMs = uint32) is
|
|
|
|
|
Future[Result[string, string]]
|
|
|
|
|
relaySubscribe(w, pubsubTopic = PubsubTopic) is Future[Result[bool, string]]
|
|
|
|
|
relayUnsubscribe(w, pubsubTopic = PubsubTopic) is Future[Result[bool, string]]
|
|
|
|
|
relayAddProtectedShard(w, clusterId = uint16, shardId = uint16, publicKey = string) is
|
|
|
|
|
Future[Result[bool, string]]
|
|
|
|
|
relayConnectedPeers(w, pubsubTopic = PubsubTopic) is
|
|
|
|
|
Future[Result[seq[string], string]]
|
|
|
|
|
relayPeersInMesh(w, pubsubTopic = PubsubTopic) is Future[Result[seq[string], string]]
|
|
|
|
|
relayNumPeersInMesh(w, pubsubTopic = PubsubTopic) is Future[Result[int, string]]
|
|
|
|
|
relayNumConnectedPeers(w, pubsubTopic = PubsubTopic) is Future[Result[int, string]]
|
2026-06-26 12:30:07 +02:00
|
|
|
|
|
|
|
|
# --- filter ---
|
2026-06-29 10:51:34 +02:00
|
|
|
filterSubscribe(
|
|
|
|
|
w,
|
|
|
|
|
pubsubTopic = PubsubTopic,
|
|
|
|
|
contentTopics = seq[ContentTopic],
|
|
|
|
|
pushHandler = FilterPushHandler,
|
|
|
|
|
) is Future[Result[bool, string]]
|
|
|
|
|
filterUnsubscribe(w, pubsubTopic = PubsubTopic, contentTopics = seq[ContentTopic]) is
|
2026-06-26 12:30:07 +02:00
|
|
|
Future[Result[bool, string]]
|
|
|
|
|
filterUnsubscribeAll(w) is Future[Result[bool, string]]
|
|
|
|
|
|
|
|
|
|
# --- lightpush ---
|
2026-06-29 10:51:34 +02:00
|
|
|
lightpushPublish(w, pubsubTopic = PubsubTopic, message = WakuMessage) is
|
|
|
|
|
Future[Result[string, string]]
|
2026-06-26 12:30:07 +02:00
|
|
|
|
|
|
|
|
# --- store ---
|
2026-06-29 10:51:34 +02:00
|
|
|
storeQuery(w, request = StoreQueryRequest, peer = string, timeoutMs = int) is
|
2026-06-26 12:30:07 +02:00
|
|
|
Future[Result[StoreQueryResponse, string]]
|
|
|
|
|
|
|
|
|
|
# --- peer management ---
|
2026-06-29 10:51:34 +02:00
|
|
|
connect(w, peers = seq[string], timeoutMs = uint32) is Future[Result[bool, string]]
|
|
|
|
|
disconnectPeerById(w, peerId = string) is Future[Result[bool, string]]
|
2026-06-26 12:30:07 +02:00
|
|
|
disconnectAllPeers(w) is Future[Result[bool, string]]
|
2026-06-29 10:51:34 +02:00
|
|
|
dialPeer(w, peerAddr = string, protocol = string, timeoutMs = int) is
|
|
|
|
|
Future[Result[bool, string]]
|
|
|
|
|
dialPeerById(w, peerId = string, protocol = string, timeoutMs = int) is
|
|
|
|
|
Future[Result[bool, string]]
|
2026-06-26 12:30:07 +02:00
|
|
|
peerIdsFromPeerstore(w) is Future[Result[seq[string], string]]
|
|
|
|
|
connectedPeersInfo(w) is Future[Result[seq[PeerConnInfo], string]]
|
|
|
|
|
connectedPeers(w) is Future[Result[seq[string], string]]
|
2026-06-29 10:51:34 +02:00
|
|
|
peerIdsByProtocol(w, protocol = string) is Future[Result[seq[string], string]]
|
2026-06-26 12:30:07 +02:00
|
|
|
|
|
|
|
|
# --- discovery ---
|
2026-06-29 10:51:34 +02:00
|
|
|
dnsDiscovery(w, enrTreeUrl = string, nameServer = string, timeoutMs = int) is
|
|
|
|
|
Future[Result[seq[string], string]]
|
|
|
|
|
discv5UpdateBootnodes(w, bootnodes = string) is Future[Result[bool, string]]
|
2026-06-26 12:30:07 +02:00
|
|
|
startDiscv5(w) is Future[Result[bool, string]]
|
|
|
|
|
stopDiscv5(w) is Future[Result[bool, string]]
|
2026-06-29 10:51:34 +02:00
|
|
|
peerExchangeRequest(w, numPeers = uint64) is Future[Result[int, string]]
|
2026-06-26 12:30:07 +02:00
|
|
|
|
|
|
|
|
# --- debug / info ---
|
|
|
|
|
version(w) is Future[Result[string, string]]
|
|
|
|
|
listenAddresses(w) is Future[Result[seq[string], string]]
|
|
|
|
|
myEnr(w) is Future[Result[string, string]]
|
|
|
|
|
myPeerId(w) is Future[Result[string, string]]
|
|
|
|
|
metrics(w) is Future[Result[string, string]]
|
|
|
|
|
isOnline(w) is Future[Result[bool, string]]
|
2026-06-29 10:51:34 +02:00
|
|
|
pingPeer(w, peerAddr = string, timeoutMs = int) is Future[Result[int64, string]]
|