mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-02 05:53:11 +00:00
chore: clarify api folders (#3637)
* Rename waku_api to rest_api and underlying rest to endpoint for clearity * Rename node/api to node/kernel_api to suggest that it is an internal accessor to node interface + make everything compile after renaming * make waku api a top level import * fix use of relative path imports and use default to root rather in case of waku and tools modules
This commit is contained in:
parent
262d33e394
commit
1762548741
@ -240,7 +240,7 @@ proc stop*(cmb: Chat2MatterBridge) {.async: (raises: [Exception]).} =
|
|||||||
{.pop.}
|
{.pop.}
|
||||||
# @TODO confutils.nim(775, 17) Error: can raise an unlisted exception: ref IOError
|
# @TODO confutils.nim(775, 17) Error: can raise an unlisted exception: ref IOError
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
import waku/common/utils/nat, waku/waku_api/message_cache
|
import waku/common/utils/nat, waku/rest_api/message_cache
|
||||||
|
|
||||||
let
|
let
|
||||||
rng = newRng()
|
rng = newRng()
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import
|
|||||||
libp2p/wire
|
libp2p/wire
|
||||||
|
|
||||||
import
|
import
|
||||||
../../tools/confutils/cli_args,
|
tools/confutils/cli_args,
|
||||||
waku/[
|
waku/[
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
waku_lightpush/common,
|
waku_lightpush/common,
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import
|
|||||||
confutils
|
confutils
|
||||||
|
|
||||||
import
|
import
|
||||||
../../tools/confutils/cli_args,
|
tools/confutils/cli_args,
|
||||||
waku/[
|
waku/[
|
||||||
common/enr,
|
common/enr,
|
||||||
common/logging,
|
common/logging,
|
||||||
|
|||||||
@ -77,7 +77,7 @@ proc maintainSubscription(
|
|||||||
some(filterPubsubTopic), filterContentTopic, actualFilterPeer
|
some(filterPubsubTopic), filterContentTopic, actualFilterPeer
|
||||||
)
|
)
|
||||||
).errorOr:
|
).errorOr:
|
||||||
await sleepAsync(subscriptionMaintenanceMs)
|
await sleepAsync(SubscriptionMaintenanceMs)
|
||||||
if noFailedSubscribes > 0:
|
if noFailedSubscribes > 0:
|
||||||
noFailedSubscribes -= 1
|
noFailedSubscribes -= 1
|
||||||
notice "subscribe request successful."
|
notice "subscribe request successful."
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import
|
|||||||
libp2p/wire
|
libp2p/wire
|
||||||
|
|
||||||
import
|
import
|
||||||
../wakunode2/cli_args,
|
tools/confutils/cli_args,
|
||||||
waku/[
|
waku/[
|
||||||
common/enr,
|
common/enr,
|
||||||
waku_node,
|
waku_node,
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import
|
|||||||
results,
|
results,
|
||||||
libp2p/peerid
|
libp2p/peerid
|
||||||
|
|
||||||
|
from std/sugar import `=>`
|
||||||
|
|
||||||
import ./tester_message, ./lpt_metrics
|
import ./tester_message, ./lpt_metrics
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import
|
|||||||
json_serialization/std/options,
|
json_serialization/std/options,
|
||||||
json_serialization/lexer
|
json_serialization/lexer
|
||||||
|
|
||||||
import ../../waku/waku_api/rest/serdes
|
import waku/rest_api/endpoint/serdes
|
||||||
|
|
||||||
type ProtocolTesterMessage* = object
|
type ProtocolTesterMessage* = object
|
||||||
sender*: string
|
sender*: string
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import
|
|||||||
common/logging,
|
common/logging,
|
||||||
factory/waku,
|
factory/waku,
|
||||||
node/health_monitor,
|
node/health_monitor,
|
||||||
waku_api/rest/builder as rest_server_builder,
|
rest_api/endpoint/builder as rest_server_builder,
|
||||||
waku_core/message/default_values,
|
waku_core/message/default_values,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import ../../apps/wakunode2/cli_args
|
import tools/confutils/cli_args
|
||||||
import waku/[common/logging, factory/[waku, networks_config]]
|
import waku/[common/logging, factory/[waku, networks_config]]
|
||||||
import
|
import
|
||||||
std/[options, strutils, os, sequtils],
|
std/[options, strutils, os, sequtils],
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import
|
|||||||
../../../waku/discovery/waku_discv5,
|
../../../waku/discovery/waku_discv5,
|
||||||
../../../waku/waku_core/peers,
|
../../../waku/waku_core/peers,
|
||||||
../../../waku/node/waku_node,
|
../../../waku/node/waku_node,
|
||||||
../../../waku/node/api,
|
../../../waku/node/kernel_api,
|
||||||
../../alloc
|
../../alloc
|
||||||
|
|
||||||
type DiscoveryMsgType* = enum
|
type DiscoveryMsgType* = enum
|
||||||
|
|||||||
@ -2,13 +2,15 @@ import std/[options, json, strutils, net]
|
|||||||
import chronos, chronicles, results, confutils, confutils/std/net
|
import chronos, chronicles, results, confutils, confutils/std/net
|
||||||
|
|
||||||
import
|
import
|
||||||
../../../waku/node/peer_manager/peer_manager,
|
waku/node/peer_manager/peer_manager,
|
||||||
../../../tools/confutils/cli_args,
|
tools/confutils/cli_args,
|
||||||
../../../waku/factory/waku,
|
waku/factory/waku,
|
||||||
../../../waku/factory/node_factory,
|
waku/factory/node_factory,
|
||||||
../../../waku/factory/networks_config,
|
waku/factory/networks_config,
|
||||||
../../../waku/factory/app_callbacks,
|
waku/factory/app_callbacks,
|
||||||
../../../waku/waku_api/rest/builder,
|
waku/rest_api/endpoint/builder
|
||||||
|
|
||||||
|
import
|
||||||
../../alloc
|
../../alloc
|
||||||
|
|
||||||
type NodeLifecycleMsgType* = enum
|
type NodeLifecycleMsgType* = enum
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import
|
|||||||
../../../../waku/waku_core/subscription/push_handler,
|
../../../../waku/waku_core/subscription/push_handler,
|
||||||
../../../../waku/node/peer_manager/peer_manager,
|
../../../../waku/node/peer_manager/peer_manager,
|
||||||
../../../../waku/node/waku_node,
|
../../../../waku/node/waku_node,
|
||||||
../../../../waku/node/api,
|
../../../../waku/node/kernel_api,
|
||||||
../../../../waku/waku_core/topics/pubsub_topic,
|
../../../../waku/waku_core/topics/pubsub_topic,
|
||||||
../../../../waku/waku_core/topics/content_topic,
|
../../../../waku/waku_core/topics/content_topic,
|
||||||
../../../alloc
|
../../../alloc
|
||||||
|
|||||||
@ -1,16 +1,18 @@
|
|||||||
import std/[net, sequtils, strutils]
|
import std/[net, sequtils, strutils]
|
||||||
import chronicles, chronos, stew/byteutils, results
|
import chronicles, chronos, stew/byteutils, results
|
||||||
import
|
import
|
||||||
../../../../waku/waku_core/message/message,
|
waku/waku_core/message/message,
|
||||||
../../../../waku/factory/[validator_signed, waku],
|
waku/factory/[validator_signed, waku],
|
||||||
../../../../tools/confutils/cli_args,
|
tools/confutils/cli_args,
|
||||||
../../../../waku/waku_node,
|
waku/waku_node,
|
||||||
../../../../waku/waku_core/message,
|
waku/waku_core/message,
|
||||||
../../../../waku/waku_core/time, # Timestamp
|
waku/waku_core/time, # Timestamp
|
||||||
../../../../waku/waku_core/topics/pubsub_topic,
|
waku/waku_core/topics/pubsub_topic,
|
||||||
../../../../waku/waku_core/topics,
|
waku/waku_core/topics,
|
||||||
../../../../waku/waku_relay/protocol,
|
waku/waku_relay/protocol,
|
||||||
../../../../waku/node/peer_manager,
|
waku/node/peer_manager
|
||||||
|
|
||||||
|
import
|
||||||
../../../alloc
|
../../../alloc
|
||||||
|
|
||||||
type RelayMsgType* = enum
|
type RelayMsgType* = enum
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import
|
|||||||
waku_core,
|
waku_core,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
node/waku_node,
|
node/waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
waku_filter_v2,
|
waku_filter_v2,
|
||||||
waku_filter_v2/client,
|
waku_filter_v2/client,
|
||||||
waku_filter_v2/subscriptions,
|
waku_filter_v2/subscriptions,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import
|
|||||||
waku_core,
|
waku_core,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
node/waku_node,
|
node/waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
waku_lightpush_legacy,
|
waku_lightpush_legacy,
|
||||||
waku_lightpush_legacy/common,
|
waku_lightpush_legacy/common,
|
||||||
waku_lightpush_legacy/protocol_metrics,
|
waku_lightpush_legacy/protocol_metrics,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import
|
|||||||
waku/[
|
waku/[
|
||||||
common/paging,
|
common/paging,
|
||||||
node/waku_node,
|
node/waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
waku_core,
|
waku_core,
|
||||||
waku_store_legacy,
|
waku_store_legacy,
|
||||||
@ -446,7 +446,7 @@ suite "Waku Store - End to End - Sorted Archive":
|
|||||||
await otherServer.start()
|
await otherServer.start()
|
||||||
let otherServerRemotePeerInfo = otherServer.peerInfo.toRemotePeerInfo()
|
let otherServerRemotePeerInfo = otherServer.peerInfo.toRemotePeerInfo()
|
||||||
|
|
||||||
# When making a history query to the first server node
|
# When making a history query to the first server node
|
||||||
let queryResponse = await client.query(historyQuery, serverRemotePeerInfo)
|
let queryResponse = await client.query(historyQuery, serverRemotePeerInfo)
|
||||||
|
|
||||||
# Then the response contains the messages
|
# Then the response contains the messages
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import
|
|||||||
waku_core,
|
waku_core,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
node/waku_node,
|
node/waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
waku_lightpush,
|
waku_lightpush,
|
||||||
waku_rln_relay,
|
waku_rln_relay,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import
|
|||||||
import
|
import
|
||||||
waku/[
|
waku/[
|
||||||
waku_node,
|
waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
discovery/waku_discv5,
|
discovery/waku_discv5,
|
||||||
waku_peer_exchange,
|
waku_peer_exchange,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import
|
|||||||
waku_core,
|
waku_core,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
node/waku_node,
|
node/waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
discovery/waku_discv5,
|
discovery/waku_discv5,
|
||||||
waku_filter_v2/common,
|
waku_filter_v2/common,
|
||||||
waku_relay/protocol,
|
waku_relay/protocol,
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import
|
|||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
waku_core,
|
waku_core,
|
||||||
waku_node,
|
waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
common/error_handling,
|
common/error_handling,
|
||||||
waku_rln_relay,
|
waku_rln_relay,
|
||||||
waku_rln_relay/rln,
|
waku_rln_relay/rln,
|
||||||
@ -514,7 +514,7 @@ suite "Waku RlnRelay - End to End - OnChain":
|
|||||||
## Issues
|
## Issues
|
||||||
### TreeIndex
|
### TreeIndex
|
||||||
For some reason the calls to `getWakuRlnConfigOnChain` need to be made with `treeIndex` = 0 and 1, in that order.
|
For some reason the calls to `getWakuRlnConfigOnChain` need to be made with `treeIndex` = 0 and 1, in that order.
|
||||||
But the registration needs to be made with 1 and 2.
|
But the registration needs to be made with 1 and 2.
|
||||||
#### Solutions
|
#### Solutions
|
||||||
Requires investigation
|
Requires investigation
|
||||||
### Monkeypatching
|
### Monkeypatching
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import
|
|||||||
waku_core/topics/sharding,
|
waku_core/topics/sharding,
|
||||||
waku_store_legacy/common,
|
waku_store_legacy/common,
|
||||||
node/waku_node,
|
node/waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
common/paging,
|
common/paging,
|
||||||
waku_core,
|
waku_core,
|
||||||
waku_store/common,
|
waku_store/common,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import
|
|||||||
waku/[
|
waku/[
|
||||||
common/paging,
|
common/paging,
|
||||||
node/waku_node,
|
node/waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
waku_core,
|
waku_core,
|
||||||
waku_core/message/digest,
|
waku_core/message/digest,
|
||||||
@ -486,7 +486,7 @@ suite "Waku Store - End to End - Sorted Archive":
|
|||||||
await otherServer.start()
|
await otherServer.start()
|
||||||
let otherServerRemotePeerInfo = otherServer.peerInfo.toRemotePeerInfo()
|
let otherServerRemotePeerInfo = otherServer.peerInfo.toRemotePeerInfo()
|
||||||
|
|
||||||
# When making a history query to the first server node
|
# When making a history query to the first server node
|
||||||
let queryResponse = await client.query(storeQuery, serverRemotePeerInfo)
|
let queryResponse = await client.query(storeQuery, serverRemotePeerInfo)
|
||||||
|
|
||||||
# Then the response contains the messages
|
# Then the response contains the messages
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
import std/[sets, random], results, stew/byteutils, testutils/unittests
|
import std/[sets, random], results, stew/byteutils, testutils/unittests
|
||||||
import waku/waku_core, waku/waku_api/message_cache, ./testlib/wakucore
|
import waku/waku_core, waku/rest_api/message_cache, ./testlib/wakucore
|
||||||
|
|
||||||
randomize()
|
randomize()
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import
|
|||||||
factory/conf_builder/conf_builder,
|
factory/conf_builder/conf_builder,
|
||||||
factory/waku,
|
factory/waku,
|
||||||
node/waku_node,
|
node/waku_node,
|
||||||
node/api,
|
node/kernel_api,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
],
|
],
|
||||||
../testlib/[wakucore, testasync, assertions, futures, wakunode, testutils],
|
../testlib/[wakucore, testasync, assertions, futures, wakunode, testutils],
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
import std/[options, sequtils, json], testutils/unittests, results, chronos
|
import std/[options, sequtils, json], testutils/unittests, results, chronos
|
||||||
|
|
||||||
import
|
import
|
||||||
waku/node/[peer_manager, waku_node, api],
|
waku/node/[peer_manager, waku_node, kernel_api],
|
||||||
waku/waku_core,
|
waku/waku_core,
|
||||||
waku/waku_filter_v2/[common, client, subscriptions, protocol, rpc_codec],
|
waku/waku_filter_v2/[common, client, subscriptions, protocol, rpc_codec],
|
||||||
../testlib/[wakucore, testasync, testutils, futures, sequtils, wakunode],
|
../testlib/[wakucore, testasync, testutils, futures, sequtils, wakunode],
|
||||||
|
|||||||
@ -14,12 +14,12 @@ import
|
|||||||
waku_node,
|
waku_node,
|
||||||
waku_filter_v2/client,
|
waku_filter_v2/client,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
waku_api/rest/server,
|
rest_api/endpoint/server,
|
||||||
waku_api/rest/client,
|
rest_api/endpoint/client,
|
||||||
waku_api/rest/responses,
|
rest_api/endpoint/responses,
|
||||||
waku_api/rest/admin/types,
|
rest_api/endpoint/admin/types,
|
||||||
waku_api/rest/admin/handlers as admin_api,
|
rest_api/endpoint/admin/handlers as admin_rest_interface,
|
||||||
waku_api/rest/admin/client as admin_api_client,
|
rest_api/endpoint/admin/client as admin_rest_client,
|
||||||
waku_relay,
|
waku_relay,
|
||||||
waku_peer_exchange,
|
waku_peer_exchange,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -11,8 +11,8 @@ import
|
|||||||
waku/[
|
waku/[
|
||||||
waku_node,
|
waku_node,
|
||||||
node/waku_node as waku_node2,
|
node/waku_node as waku_node2,
|
||||||
waku_api/rest/server,
|
rest_api/endpoint/server,
|
||||||
waku_api/rest/debug/handlers as debug_api,
|
rest_api/endpoint/debug/handlers as debug_rest_interface,
|
||||||
],
|
],
|
||||||
../testlib/common,
|
../testlib/common,
|
||||||
../testlib/wakucore,
|
../testlib/wakucore,
|
||||||
|
|||||||
@ -12,11 +12,11 @@ import
|
|||||||
waku_node,
|
waku_node,
|
||||||
node/waku_node as waku_node2,
|
node/waku_node as waku_node2,
|
||||||
# TODO: Remove after moving `git_version` to the app code.
|
# TODO: Remove after moving `git_version` to the app code.
|
||||||
waku_api/rest/server,
|
rest_api/endpoint/server,
|
||||||
waku_api/rest/client,
|
rest_api/endpoint/client,
|
||||||
waku_api/rest/responses,
|
rest_api/endpoint/responses,
|
||||||
waku_api/rest/debug/handlers as debug_api,
|
rest_api/endpoint/debug/handlers as debug_rest_interface,
|
||||||
waku_api/rest/debug/client as debug_api_client,
|
rest_api/endpoint/debug/client as debug_rest_client,
|
||||||
],
|
],
|
||||||
../testlib/common,
|
../testlib/common,
|
||||||
../testlib/wakucore,
|
../testlib/wakucore,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
import results, stew/byteutils, testutils/unittests, json_serialization
|
import results, stew/byteutils, testutils/unittests, json_serialization
|
||||||
import waku/waku_api/rest/serdes, waku/waku_api/rest/debug/types
|
import waku/rest_api/endpoint/serdes, waku/rest_api/endpoint/debug/types
|
||||||
|
|
||||||
suite "Waku v2 REST API - Debug - serialization":
|
suite "Waku v2 REST API - Debug - serialization":
|
||||||
suite "DebugWakuInfo - decode":
|
suite "DebugWakuInfo - decode":
|
||||||
|
|||||||
@ -9,21 +9,21 @@ import
|
|||||||
libp2p/crypto/crypto
|
libp2p/crypto/crypto
|
||||||
import
|
import
|
||||||
waku/[
|
waku/[
|
||||||
waku_api/message_cache,
|
rest_api/message_cache,
|
||||||
waku_core,
|
waku_core,
|
||||||
waku_node,
|
waku_node,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
waku_api/rest/server,
|
rest_api/endpoint/server,
|
||||||
waku_api/rest/client,
|
rest_api/endpoint/client,
|
||||||
waku_api/rest/responses,
|
rest_api/endpoint/responses,
|
||||||
waku_api/rest/filter/types,
|
rest_api/endpoint/filter/types,
|
||||||
waku_api/rest/filter/handlers as filter_api,
|
rest_api/endpoint/filter/handlers as filter_rest_interface,
|
||||||
waku_api/rest/filter/client as filter_api_client,
|
rest_api/endpoint/filter/client as filter_rest_client,
|
||||||
waku_relay,
|
waku_relay,
|
||||||
waku_filter_v2/subscriptions,
|
waku_filter_v2/subscriptions,
|
||||||
waku_filter_v2/common,
|
waku_filter_v2/common,
|
||||||
waku_api/rest/relay/handlers as relay_api,
|
rest_api/endpoint/relay/handlers as relay_rest_interface,
|
||||||
waku_api/rest/relay/client as relay_api_client,
|
rest_api/endpoint/relay/client as relay_rest_client,
|
||||||
],
|
],
|
||||||
../testlib/wakucore,
|
../testlib/wakucore,
|
||||||
../testlib/wakunode
|
../testlib/wakunode
|
||||||
|
|||||||
@ -13,11 +13,11 @@ import
|
|||||||
waku_node,
|
waku_node,
|
||||||
node/waku_node as waku_node2,
|
node/waku_node as waku_node2,
|
||||||
# TODO: Remove after moving `git_version` to the app code.
|
# TODO: Remove after moving `git_version` to the app code.
|
||||||
waku_api/rest/server,
|
rest_api/endpoint/server,
|
||||||
waku_api/rest/client,
|
rest_api/endpoint/client,
|
||||||
waku_api/rest/responses,
|
rest_api/endpoint/responses,
|
||||||
waku_api/rest/health/handlers as health_api,
|
rest_api/endpoint/health/handlers as health_rest_interface,
|
||||||
waku_api/rest/health/client as health_api_client,
|
rest_api/endpoint/health/client as health_rest_client,
|
||||||
waku_rln_relay,
|
waku_rln_relay,
|
||||||
node/health_monitor,
|
node/health_monitor,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -10,17 +10,17 @@ import
|
|||||||
|
|
||||||
import
|
import
|
||||||
waku/[
|
waku/[
|
||||||
waku_api/message_cache,
|
rest_api/message_cache,
|
||||||
waku_core,
|
waku_core,
|
||||||
waku_node,
|
waku_node,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
waku_lightpush/common,
|
waku_lightpush/common,
|
||||||
waku_api/rest/server,
|
rest_api/endpoint/server,
|
||||||
waku_api/rest/client,
|
rest_api/endpoint/client,
|
||||||
waku_api/rest/responses,
|
rest_api/endpoint/responses,
|
||||||
waku_api/rest/lightpush/types,
|
rest_api/endpoint/lightpush/types,
|
||||||
waku_api/rest/lightpush/handlers as lightpush_api,
|
rest_api/endpoint/lightpush/handlers as lightpush_rest_interface,
|
||||||
waku_api/rest/lightpush/client as lightpush_api_client,
|
rest_api/endpoint/lightpush/client as lightpush_rest_client,
|
||||||
waku_relay,
|
waku_relay,
|
||||||
common/rate_limit/setting,
|
common/rate_limit/setting,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -10,17 +10,17 @@ import
|
|||||||
|
|
||||||
import
|
import
|
||||||
waku/[
|
waku/[
|
||||||
waku_api/message_cache,
|
rest_api/message_cache,
|
||||||
waku_core,
|
waku_core,
|
||||||
waku_node,
|
waku_node,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
waku_lightpush_legacy/common,
|
waku_lightpush_legacy/common,
|
||||||
waku_api/rest/server,
|
rest_api/endpoint/server,
|
||||||
waku_api/rest/client,
|
rest_api/endpoint/client,
|
||||||
waku_api/rest/responses,
|
rest_api/endpoint/responses,
|
||||||
waku_api/rest/legacy_lightpush/types,
|
rest_api/endpoint/legacy_lightpush/types,
|
||||||
waku_api/rest/legacy_lightpush/handlers as lightpush_api,
|
rest_api/endpoint/legacy_lightpush/handlers as lightpush_rest_interface,
|
||||||
waku_api/rest/legacy_lightpush/client as lightpush_api_client,
|
rest_api/endpoint/legacy_lightpush/client as lightpush_rest_client,
|
||||||
waku_relay,
|
waku_relay,
|
||||||
common/rate_limit/setting,
|
common/rate_limit/setting,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -12,13 +12,13 @@ import
|
|||||||
common/base64,
|
common/base64,
|
||||||
waku_core,
|
waku_core,
|
||||||
waku_node,
|
waku_node,
|
||||||
waku_api/message_cache,
|
rest_api/message_cache,
|
||||||
waku_api/rest/server,
|
rest_api/endpoint/server,
|
||||||
waku_api/rest/client,
|
rest_api/endpoint/client,
|
||||||
waku_api/rest/responses,
|
rest_api/endpoint/responses,
|
||||||
waku_api/rest/relay/types,
|
rest_api/endpoint/relay/types,
|
||||||
waku_api/rest/relay/handlers as relay_api,
|
rest_api/endpoint/relay/handlers as relay_rest_interface,
|
||||||
waku_api/rest/relay/client as relay_api_client,
|
rest_api/endpoint/relay/client as relay_rest_client,
|
||||||
waku_relay,
|
waku_relay,
|
||||||
waku_rln_relay,
|
waku_rln_relay,
|
||||||
],
|
],
|
||||||
@ -263,7 +263,7 @@ suite "Waku v2 Rest API - Relay":
|
|||||||
|
|
||||||
await node.mountRlnRelay(wakuRlnConfig)
|
await node.mountRlnRelay(wakuRlnConfig)
|
||||||
await node.start()
|
await node.start()
|
||||||
# Registration is mandatory before sending messages with rln-relay
|
# Registration is mandatory before sending messages with rln-relay
|
||||||
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
||||||
let idCredentials = generateCredentials()
|
let idCredentials = generateCredentials()
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ suite "Waku v2 Rest API - Relay":
|
|||||||
|
|
||||||
await node.mountRlnRelay(wakuRlnConfig)
|
await node.mountRlnRelay(wakuRlnConfig)
|
||||||
await node.start()
|
await node.start()
|
||||||
# Registration is mandatory before sending messages with rln-relay
|
# Registration is mandatory before sending messages with rln-relay
|
||||||
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
||||||
let idCredentials = generateCredentials()
|
let idCredentials = generateCredentials()
|
||||||
|
|
||||||
@ -586,7 +586,7 @@ suite "Waku v2 Rest API - Relay":
|
|||||||
await node.mountRlnRelay(wakuRlnConfig)
|
await node.mountRlnRelay(wakuRlnConfig)
|
||||||
await node.start()
|
await node.start()
|
||||||
|
|
||||||
# Registration is mandatory before sending messages with rln-relay
|
# Registration is mandatory before sending messages with rln-relay
|
||||||
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
||||||
let idCredentials = generateCredentials()
|
let idCredentials = generateCredentials()
|
||||||
|
|
||||||
@ -648,7 +648,7 @@ suite "Waku v2 Rest API - Relay":
|
|||||||
await node.mountRlnRelay(wakuRlnConfig)
|
await node.mountRlnRelay(wakuRlnConfig)
|
||||||
await node.start()
|
await node.start()
|
||||||
|
|
||||||
# Registration is mandatory before sending messages with rln-relay
|
# Registration is mandatory before sending messages with rln-relay
|
||||||
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
||||||
let idCredentials = generateCredentials()
|
let idCredentials = generateCredentials()
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ suite "Waku v2 Rest API - Relay":
|
|||||||
await node.mountRlnRelay(wakuRlnConfig)
|
await node.mountRlnRelay(wakuRlnConfig)
|
||||||
await node.start()
|
await node.start()
|
||||||
|
|
||||||
# Registration is mandatory before sending messages with rln-relay
|
# Registration is mandatory before sending messages with rln-relay
|
||||||
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
let manager = cast[OnchainGroupManager](node.wakuRlnRelay.groupManager)
|
||||||
let idCredentials = generateCredentials()
|
let idCredentials = generateCredentials()
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
import results, stew/byteutils, unittest2, json_serialization
|
import results, stew/byteutils, unittest2, json_serialization
|
||||||
import waku/[common/base64, waku_api/rest/serdes, waku_api/rest/relay/types, waku_core]
|
import
|
||||||
|
waku/
|
||||||
|
[common/base64, rest_api/endpoint/serdes, rest_api/endpoint/relay/types, waku_core]
|
||||||
|
|
||||||
suite "Waku v2 Rest API - Relay - serialization":
|
suite "Waku v2 Rest API - Relay - serialization":
|
||||||
suite "RelayWakuMessage - decode":
|
suite "RelayWakuMessage - decode":
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
import results, stew/byteutils, chronicles, unittest2, json_serialization
|
import results, stew/byteutils, chronicles, unittest2, json_serialization
|
||||||
import waku/waku_api/rest/serdes, waku/waku_api/rest/debug/types
|
import waku/rest_api/endpoint/serdes, waku/rest_api/endpoint/debug/types
|
||||||
|
|
||||||
# TODO: Decouple this test suite from the `debug_api` module by defining
|
# TODO: Decouple this test suite from the `debug_rest_interface` module by defining
|
||||||
# private custom types for this test suite module
|
# private custom types for this test suite module
|
||||||
suite "Waku v2 Rest API - Serdes":
|
suite "Waku v2 Rest API - Serdes":
|
||||||
suite "decode":
|
suite "decode":
|
||||||
|
|||||||
@ -17,12 +17,12 @@ import
|
|||||||
waku_core/time,
|
waku_core/time,
|
||||||
waku_node,
|
waku_node,
|
||||||
node/peer_manager,
|
node/peer_manager,
|
||||||
waku_api/rest/server,
|
rest_api/endpoint/server,
|
||||||
waku_api/rest/client,
|
rest_api/endpoint/client,
|
||||||
waku_api/rest/responses,
|
rest_api/endpoint/responses,
|
||||||
waku_api/rest/store/handlers as store_api,
|
rest_api/endpoint/store/handlers as store_rest_interface,
|
||||||
waku_api/rest/store/client as store_api_client,
|
rest_api/endpoint/store/client as store_rest_client,
|
||||||
waku_api/rest/store/types,
|
rest_api/endpoint/store/types,
|
||||||
waku_archive,
|
waku_archive,
|
||||||
waku_archive/driver/queue_driver,
|
waku_archive/driver/queue_driver,
|
||||||
waku_archive/driver/sqlite_driver,
|
waku_archive/driver/sqlite_driver,
|
||||||
@ -34,7 +34,7 @@ import
|
|||||||
../testlib/wakunode
|
../testlib/wakunode
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "waku node rest store_api test"
|
topics = "waku node rest store_rest_interface test"
|
||||||
|
|
||||||
proc put(
|
proc put(
|
||||||
store: ArchiveDriver, pubsubTopic: PubsubTopic, message: WakuMessage
|
store: ArchiveDriver, pubsubTopic: PubsubTopic, message: WakuMessage
|
||||||
|
|||||||
@ -34,7 +34,9 @@ import
|
|||||||
|
|
||||||
import ./envvar as confEnvvarDefs, ./envvar_net as confEnvvarNet
|
import ./envvar as confEnvvarDefs, ./envvar_net as confEnvvarNet
|
||||||
|
|
||||||
export confTomlDefs, confTomlNet, confEnvvarDefs, confEnvvarNet, ProtectedShard
|
export
|
||||||
|
confTomlDefs, confTomlNet, confEnvvarDefs, confEnvvarNet, ProtectedShard,
|
||||||
|
DefaultMaxWakuMessageSizeStr
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "waku cli args"
|
topics = "waku cli args"
|
||||||
|
|||||||
3
waku/api.nim
Normal file
3
waku/api.nim
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import ./api/[api, api_conf, entry_nodes]
|
||||||
|
|
||||||
|
export api, api_conf, entry_nodes
|
||||||
@ -28,9 +28,9 @@ import
|
|||||||
../node/health_monitor,
|
../node/health_monitor,
|
||||||
../node/waku_metrics,
|
../node/waku_metrics,
|
||||||
../node/delivery_monitor/delivery_monitor,
|
../node/delivery_monitor/delivery_monitor,
|
||||||
../waku_api/message_cache,
|
../rest_api/message_cache,
|
||||||
../waku_api/rest/server,
|
../rest_api/endpoint/server,
|
||||||
../waku_api/rest/builder as rest_server_builder,
|
../rest_api/endpoint/builder as rest_server_builder,
|
||||||
../waku_archive,
|
../waku_archive,
|
||||||
../waku_relay/protocol,
|
../waku_relay/protocol,
|
||||||
../discovery/waku_dnsdisc,
|
../discovery/waku_dnsdisc,
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import
|
|||||||
|
|
||||||
import
|
import
|
||||||
../waku_rln_relay/rln_relay,
|
../waku_rln_relay/rln_relay,
|
||||||
../waku_api/rest/builder,
|
../rest_api/endpoint/builder,
|
||||||
../discovery/waku_discv5,
|
../discovery/waku_discv5,
|
||||||
../node/waku_metrics,
|
../node/waku_metrics,
|
||||||
../common/logging,
|
../common/logging,
|
||||||
@ -38,7 +38,7 @@ type ProtectedShard* {.requiresInit.} = object
|
|||||||
|
|
||||||
type DnsDiscoveryConf* {.requiresInit.} = object
|
type DnsDiscoveryConf* {.requiresInit.} = object
|
||||||
enrTreeUrl*: string
|
enrTreeUrl*: string
|
||||||
# TODO: should probably only have one set of name servers (see dnsaddrs)
|
# TODO: should probably only have one set of name servers (see dnsaddrs)
|
||||||
nameServers*: seq[IpAddress]
|
nameServers*: seq[IpAddress]
|
||||||
|
|
||||||
type StoreSyncConf* {.requiresInit.} = object
|
type StoreSyncConf* {.requiresInit.} = object
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
import
|
|
||||||
./api/filter as filter_api,
|
|
||||||
./api/lightpush as lightpush_api,
|
|
||||||
./api/store as store_api,
|
|
||||||
./api/relay as relay_api,
|
|
||||||
./api/peer_exchange as peer_exchange_api,
|
|
||||||
./api/ping as ping_api
|
|
||||||
|
|
||||||
export filter_api, lightpush_api, store_api, relay_api, peer_exchange_api, ping_api
|
|
||||||
@ -8,7 +8,7 @@ import
|
|||||||
|
|
||||||
import
|
import
|
||||||
../waku_node,
|
../waku_node,
|
||||||
../api,
|
../kernel_api,
|
||||||
../../waku_rln_relay,
|
../../waku_rln_relay,
|
||||||
../../waku_relay,
|
../../waku_relay,
|
||||||
../peer_manager,
|
../peer_manager,
|
||||||
|
|||||||
9
waku/node/kernel_api.nim
Normal file
9
waku/node/kernel_api.nim
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import
|
||||||
|
./kernel_api/filter as filter_api,
|
||||||
|
./kernel_api/lightpush as lightpush_api,
|
||||||
|
./kernel_api/store as store_api,
|
||||||
|
./kernel_api/relay as relay_api,
|
||||||
|
./kernel_api/peer_exchange as peer_exchange_api,
|
||||||
|
./kernel_api/ping as ping_api
|
||||||
|
|
||||||
|
export filter_api, lightpush_api, store_api, relay_api, peer_exchange_api, ping_api
|
||||||
@ -5,18 +5,18 @@ import presto
|
|||||||
import
|
import
|
||||||
waku/waku_node,
|
waku/waku_node,
|
||||||
waku/discovery/waku_discv5,
|
waku/discovery/waku_discv5,
|
||||||
waku/waku_api/message_cache,
|
waku/rest_api/message_cache,
|
||||||
waku/waku_api/handlers,
|
waku/rest_api/handlers,
|
||||||
waku/waku_api/rest/server,
|
waku/rest_api/endpoint/server,
|
||||||
waku/waku_api/rest/debug/handlers as rest_debug_api,
|
waku/rest_api/endpoint/debug/handlers as rest_debug_endpoint,
|
||||||
waku/waku_api/rest/relay/handlers as rest_relay_api,
|
waku/rest_api/endpoint/relay/handlers as rest_relay_endpoint,
|
||||||
waku/waku_api/rest/filter/handlers as rest_filter_api,
|
waku/rest_api/endpoint/filter/handlers as rest_filter_endpoint,
|
||||||
waku/waku_api/rest/legacy_lightpush/handlers as rest_legacy_lightpush_api,
|
waku/rest_api/endpoint/legacy_lightpush/handlers as rest_legacy_lightpush_endpoint,
|
||||||
waku/waku_api/rest/lightpush/handlers as rest_lightpush_api,
|
waku/rest_api/endpoint/lightpush/handlers as rest_lightpush_endpoint,
|
||||||
waku/waku_api/rest/store/handlers as rest_store_api,
|
waku/rest_api/endpoint/store/handlers as rest_store_endpoint,
|
||||||
waku/waku_api/rest/legacy_store/handlers as rest_store_legacy_api,
|
waku/rest_api/endpoint/legacy_store/handlers as rest_store_legacy_endpoint,
|
||||||
waku/waku_api/rest/health/handlers as rest_health_api,
|
waku/rest_api/endpoint/health/handlers as rest_health_endpoint,
|
||||||
waku/waku_api/rest/admin/handlers as rest_admin_api,
|
waku/rest_api/endpoint/admin/handlers as rest_admin_endpoint,
|
||||||
waku/waku_core/topics,
|
waku/waku_core/topics,
|
||||||
waku/waku_relay/protocol
|
waku/waku_relay/protocol
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ proc startRestServerProtocolSupport*(
|
|||||||
else:
|
else:
|
||||||
none(DiscoveryHandler)
|
none(DiscoveryHandler)
|
||||||
|
|
||||||
rest_filter_api.installFilterRestApiHandlers(
|
rest_filter_endpoint.installFilterRestApiHandlers(
|
||||||
router, node, filterCache, filterDiscoHandler
|
router, node, filterCache, filterDiscoHandler
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -193,8 +193,8 @@ proc startRestServerProtocolSupport*(
|
|||||||
else:
|
else:
|
||||||
none(DiscoveryHandler)
|
none(DiscoveryHandler)
|
||||||
|
|
||||||
rest_store_api.installStoreApiHandlers(router, node, storeDiscoHandler)
|
rest_store_endpoint.installStoreApiHandlers(router, node, storeDiscoHandler)
|
||||||
rest_store_legacy_api.installStoreApiHandlers(router, node, storeDiscoHandler)
|
rest_store_legacy_endpoint.installStoreApiHandlers(router, node, storeDiscoHandler)
|
||||||
|
|
||||||
## Light push API
|
## Light push API
|
||||||
## Install it either if client is mounted)
|
## Install it either if client is mounted)
|
||||||
@ -208,10 +208,12 @@ proc startRestServerProtocolSupport*(
|
|||||||
else:
|
else:
|
||||||
none(DiscoveryHandler)
|
none(DiscoveryHandler)
|
||||||
|
|
||||||
rest_legacy_lightpush_api.installLightPushRequestHandler(
|
rest_legacy_lightpush_endpoint.installLightPushRequestHandler(
|
||||||
|
router, node, lightDiscoHandler
|
||||||
|
)
|
||||||
|
rest_lightpush_endpoint.installLightPushRequestHandler(
|
||||||
router, node, lightDiscoHandler
|
router, node, lightDiscoHandler
|
||||||
)
|
)
|
||||||
rest_lightpush_api.installLightPushRequestHandler(router, node, lightDiscoHandler)
|
|
||||||
else:
|
else:
|
||||||
restServerNotInstalledTab["lightpush"] = "/lightpush endpoints are not available."
|
restServerNotInstalledTab["lightpush"] = "/lightpush endpoints are not available."
|
||||||
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
import ./waku_api/message_cache, ./waku_api/rest, ./waku_api/json_rpc
|
|
||||||
|
|
||||||
export message_cache, rest
|
|
||||||
@ -31,7 +31,7 @@ proc computeDigest*(msg: WakuMessage): MessageDigest =
|
|||||||
# Computes the hash
|
# Computes the hash
|
||||||
return ctx.finish()
|
return ctx.finish()
|
||||||
|
|
||||||
## Public API types
|
## API types
|
||||||
|
|
||||||
type
|
type
|
||||||
#TODO Once Store v2 is removed, the cursor becomes the hash of the last message
|
#TODO Once Store v2 is removed, the cursor becomes the hash of the last message
|
||||||
|
|||||||
@ -3,6 +3,6 @@ import
|
|||||||
./node/waku_switch as switch,
|
./node/waku_switch as switch,
|
||||||
./node/waku_node as node,
|
./node/waku_node as node,
|
||||||
./node/health_monitor as health_monitor,
|
./node/health_monitor as health_monitor,
|
||||||
./node/api as api
|
./node/kernel_api as kernel_api
|
||||||
|
|
||||||
export net_config, switch, node, health_monitor, api
|
export net_config, switch, node, health_monitor, kernel_api
|
||||||
|
|||||||
3
waku/waku_rest.nim
Normal file
3
waku/waku_rest.nim
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import ./rest_api/message_cache, ./rest_api/endpoint, ./rest_api/json_rpc
|
||||||
|
|
||||||
|
export message_cache, rest
|
||||||
@ -15,7 +15,7 @@ const
|
|||||||
|
|
||||||
type WakuStoreResult*[T] = Result[T, string]
|
type WakuStoreResult*[T] = Result[T, string]
|
||||||
|
|
||||||
## Public API types
|
## API types
|
||||||
|
|
||||||
type
|
type
|
||||||
StoreQueryRequest* = object
|
StoreQueryRequest* = object
|
||||||
|
|||||||
@ -29,7 +29,7 @@ proc computeDigest*(msg: WakuMessage): MessageDigest =
|
|||||||
# Computes the hash
|
# Computes the hash
|
||||||
return ctx.finish()
|
return ctx.finish()
|
||||||
|
|
||||||
## Public API types
|
## API types
|
||||||
|
|
||||||
type
|
type
|
||||||
HistoryCursor* = object
|
HistoryCursor* = object
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user