mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-08-10 22:03:19 +00:00
Move the discovery/lightpush/store/ping/debug/health/topics operations into logos_delivery/waku/api/ and relocate the waku event definitions under waku/api/events/. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
979 B
Nim
32 lines
979 B
Nim
## Waku layer API — store (historical query) operations.
|
|
{.push raises: [].}
|
|
|
|
import results, chronos, chronicles
|
|
|
|
import logos_delivery/waku/waku
|
|
import
|
|
logos_delivery/waku/[
|
|
waku_core, node/waku_node, waku_store/common, waku_store/client
|
|
]
|
|
|
|
proc storeQuery*(
|
|
self: Waku, request: StoreQueryRequest, peer: string, timeoutMs: int
|
|
): Future[Result[StoreQueryResponse, string]] {.async.} =
|
|
try:
|
|
if self.node.wakuStoreClient.isNil():
|
|
return err("wakuStoreClient is not mounted")
|
|
|
|
let remotePeer = parsePeerInfo(peer).valueOr:
|
|
return err("storeQuery failed to parse peer addr: " & $error)
|
|
|
|
let queryFut = self.node.wakuStoreClient.query(request, remotePeer)
|
|
if not await queryFut.withTimeout(timeoutMs.milliseconds):
|
|
return err("storeQuery timed out")
|
|
|
|
let queryResponse = queryFut.read().valueOr:
|
|
return err("storeQuery failed: " & $error)
|
|
|
|
return ok(queryResponse)
|
|
except CatchableError as e:
|
|
return err(e.msg)
|