mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-12 07:44:57 +00:00
store_request: tiny compilation fix
This commit is contained in:
parent
990847f686
commit
1b9c3fa9d6
@ -20,7 +20,9 @@ type StoreRequest* = object
|
|||||||
peerAddr: cstring
|
peerAddr: cstring
|
||||||
timeoutMs: cint
|
timeoutMs: cint
|
||||||
|
|
||||||
func fromJsonNode(T: type StoreRequest, jsonContent: JsonNode): StoreQueryRequest =
|
func fromJsonNode(
|
||||||
|
T: type StoreRequest, jsonContent: JsonNode
|
||||||
|
): Result[StoreQueryRequest, string] =
|
||||||
let contentTopics = collect(newSeq):
|
let contentTopics = collect(newSeq):
|
||||||
for cTopic in jsonContent["content_topics"].getElems():
|
for cTopic in jsonContent["content_topics"].getElems():
|
||||||
cTopic.getStr()
|
cTopic.getStr()
|
||||||
@ -64,14 +66,17 @@ func fromJsonNode(T: type StoreRequest, jsonContent: JsonNode): StoreQueryReques
|
|||||||
else:
|
else:
|
||||||
none(uint64)
|
none(uint64)
|
||||||
|
|
||||||
|
let startTime = ?jsonContent.getProtoInt64("time_start")
|
||||||
|
let endTime = ?jsonContent.getProtoInt64("time_end")
|
||||||
|
|
||||||
return ok(
|
return ok(
|
||||||
StoreQueryRequest(
|
StoreQueryRequest(
|
||||||
requestId: jsonContent["request_id"].getStr(),
|
requestId: jsonContent["request_id"].getStr(),
|
||||||
includeData: jsonContent["include_data"].getBool(),
|
includeData: jsonContent["include_data"].getBool(),
|
||||||
pubsubTopic: pubsubTopic,
|
pubsubTopic: pubsubTopic,
|
||||||
contentTopics: contentTopics,
|
contentTopics: contentTopics,
|
||||||
startTime: ?jsonContent.getProtoInt64("time_start"),
|
startTime: startTime,
|
||||||
endTime: ?jsonContent.getProtoInt64("time_end"),
|
endTime: endTime,
|
||||||
messageHashes: msgHashes,
|
messageHashes: msgHashes,
|
||||||
paginationCursor: paginationCursor,
|
paginationCursor: paginationCursor,
|
||||||
paginationForward: paginationForward,
|
paginationForward: paginationForward,
|
||||||
@ -110,12 +115,12 @@ proc process_remote_query(
|
|||||||
if jsonContentRes.isErr():
|
if jsonContentRes.isErr():
|
||||||
return err("StoreRequest failed parsing store request: " & jsonContentRes.error.msg)
|
return err("StoreRequest failed parsing store request: " & jsonContentRes.error.msg)
|
||||||
|
|
||||||
let storeQueryRequest = StoreRequest.fromJsonNode(jsonContentRes.get())
|
let storeQueryRequest = ?StoreRequest.fromJsonNode(jsonContentRes.get())
|
||||||
|
|
||||||
let peer = peers.parsePeerInfo(($self[].peerAddr).split(",")).valueOr:
|
let peer = peers.parsePeerInfo(($self[].peerAddr).split(",")).valueOr:
|
||||||
return err("StoreRequest failed to parse peer addr: " & $error)
|
return err("StoreRequest failed to parse peer addr: " & $error)
|
||||||
|
|
||||||
let queryResponse = (await waku.node.wakuStoreClient.query(?storeQueryRequest, peer)).valueOr:
|
let queryResponse = (await waku.node.wakuStoreClient.query(storeQueryRequest, peer)).valueOr:
|
||||||
return err("StoreRequest failed store query: " & $error)
|
return err("StoreRequest failed store query: " & $error)
|
||||||
|
|
||||||
return ok($(%*queryResponse)) ## returning the response in json format
|
return ok($(%*queryResponse)) ## returning the response in json format
|
||||||
|
Loading…
x
Reference in New Issue
Block a user