mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-07-24 21:43:19 +00:00
* bump nim-libp2p pin to v2.0.0 tag * bump json_rpc to v0.6.1, lsquic to v0.5.1, boringssl to v0.0.8 (latest tags) * add libp2p_mix dep; repoint libp2p/protocols/mix -> libp2p_mix * pin nimble.lock: websock / protobuf_serialization / npeg / jwt * Makefile: add -d:libp2p_quic_support * regenerate nix/deps.nix (adds libp2p_mix, refreshes pins) * migrate rng ref HmacDrbgContext -> libp2p Rng across prod/channels/tests (interface-only; same DRBG) * waku_switch: TransportConfig factory; unified 2.0.0 connection limits (withMaxInOut, withMaxConnections); local MaxConnections * waku_relay/rendezvous/discv5/kademlia: v2.0.0 API (rng, config, ServiceDiscovery rename) * call Service.setup() on post-build switch services (2.0.0 split setup/start) * drop libp2p/utils/semaphore -> chronos AsyncSemaphore * add logos_delivery/waku/compat/option_valueor shim (Option[T] valueOr/withValue, dropped upstream) * add std/options where a transitive re-export was removed * add newStandardSwitch shim (libp2p removed it in 2.0.0); mounts yamux+mplex to match prod muxer * PeerId.random(rng); common.rng()/crypto.newRng(); hoist shared rng (instantiation cleanup) * update expectations for 2.0.0 defaults: DEFAULT_PROTOCOLS += /ipfs/id/push/1.0.0; agent "nim-libp2p" * drop relay reboot/reconnect test (asserted a Switch restart capability that is simply not supported) * fix up a few tests that were flaking on MacOS (libp2p upgrade may have exposed these)
36 lines
1.3 KiB
Nim
36 lines
1.3 KiB
Nim
import logos_delivery/waku/compat/option_valueor
|
|
##
|
|
## This file is aimed to attend the requests that come directly
|
|
## from the 'self' node. It is expected to attend the store requests that
|
|
## come from REST-store endpoint when those requests don't indicate
|
|
## any store-peer address.
|
|
##
|
|
## Notice that the REST-store requests normally assume that the REST
|
|
## server is acting as a store-client. In this module, we allow that
|
|
## such REST-store node can act as store-server as well by retrieving
|
|
## its own stored messages. The typical use case for that is when
|
|
## using `nwaku-compose`, which spawn a Waku node connected to a local
|
|
## database, and the user is interested in retrieving the messages
|
|
## stored by that local store node.
|
|
##
|
|
|
|
import results, chronos
|
|
import ./protocol, ./common
|
|
|
|
proc handleSelfStoreRequest*(
|
|
self: WakuStore, req: StoreQueryRequest
|
|
): Future[WakuStoreResult[StoreQueryResponse]] {.async.} =
|
|
## Handles the store requests made by the node to itself.
|
|
## Normally used in REST-store requests
|
|
|
|
let handlerResult = catch:
|
|
await self.requestHandler(req)
|
|
|
|
let resResult = handlerResult.valueOr:
|
|
return err("exception in handleSelfStoreRequest: " & error.msg)
|
|
|
|
let res = resResult.valueOr:
|
|
return err("error in handleSelfStoreRequest: " & $error)
|
|
|
|
return ok(res)
|