@streamr/dht 100.0.0-testnet-one.4 → 100.0.0-testnet-two.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/dist/src/connection/ConnectionLockHandler.d.ts +11 -11
  2. package/dist/src/connection/ConnectionLockHandler.js.map +1 -1
  3. package/dist/src/connection/ConnectionLockRpcLocal.d.ts +3 -3
  4. package/dist/src/connection/ConnectionLockRpcLocal.js +4 -4
  5. package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -1
  6. package/dist/src/connection/ConnectionLockRpcRemote.d.ts +3 -5
  7. package/dist/src/connection/ConnectionLockRpcRemote.js +4 -7
  8. package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
  9. package/dist/src/connection/ConnectionManager.d.ts +4 -6
  10. package/dist/src/connection/ConnectionManager.js +48 -46
  11. package/dist/src/connection/ConnectionManager.js.map +1 -1
  12. package/dist/src/connection/ConnectorFacade.d.ts +2 -2
  13. package/dist/src/connection/ConnectorFacade.js +2 -1
  14. package/dist/src/connection/ConnectorFacade.js.map +1 -1
  15. package/dist/src/connection/ManagedConnection.d.ts +3 -6
  16. package/dist/src/connection/ManagedConnection.js +6 -10
  17. package/dist/src/connection/ManagedConnection.js.map +1 -1
  18. package/dist/src/connection/connectivityChecker.js +1 -0
  19. package/dist/src/connection/connectivityChecker.js.map +1 -1
  20. package/dist/src/connection/simulator/Simulator.d.ts +0 -3
  21. package/dist/src/connection/simulator/Simulator.js +3 -51
  22. package/dist/src/connection/simulator/Simulator.js.map +1 -1
  23. package/dist/src/connection/simulator/SimulatorConnector.js +5 -5
  24. package/dist/src/connection/simulator/SimulatorConnector.js.map +1 -1
  25. package/dist/src/connection/webrtc/NodeWebrtcConnection.js +2 -2
  26. package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
  27. package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -1
  28. package/dist/src/connection/webrtc/WebrtcConnector.js +7 -9
  29. package/dist/src/connection/webrtc/WebrtcConnector.js.map +1 -1
  30. package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +2 -2
  31. package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +11 -12
  32. package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -1
  33. package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +2 -5
  34. package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js +1 -4
  35. package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +1 -1
  36. package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +1 -2
  37. package/dist/src/connection/websocket/AutoCertifierClientFacade.js +3 -4
  38. package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -1
  39. package/dist/src/connection/websocket/ClientWebsocket.js.map +1 -1
  40. package/dist/src/connection/websocket/WebsocketConnector.d.ts +2 -7
  41. package/dist/src/connection/websocket/WebsocketConnector.js +32 -38
  42. package/dist/src/connection/websocket/WebsocketConnector.js.map +1 -1
  43. package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.d.ts +3 -2
  44. package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js +8 -10
  45. package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js.map +1 -1
  46. package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.d.ts +3 -6
  47. package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js +0 -3
  48. package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js.map +1 -1
  49. package/dist/src/connection/websocket/WebsocketServer.d.ts +1 -4
  50. package/dist/src/connection/websocket/WebsocketServer.js +11 -12
  51. package/dist/src/connection/websocket/WebsocketServer.js.map +1 -1
  52. package/dist/src/dht/DhtNode.d.ts +10 -13
  53. package/dist/src/dht/DhtNode.js +39 -52
  54. package/dist/src/dht/DhtNode.js.map +1 -1
  55. package/dist/src/dht/DhtNodeRpcLocal.d.ts +0 -1
  56. package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -1
  57. package/dist/src/dht/DhtNodeRpcRemote.d.ts +7 -7
  58. package/dist/src/dht/DhtNodeRpcRemote.js +8 -7
  59. package/dist/src/dht/DhtNodeRpcRemote.js.map +1 -1
  60. package/dist/src/dht/ExternalApiRpcLocal.d.ts +5 -4
  61. package/dist/src/dht/ExternalApiRpcLocal.js +3 -2
  62. package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -1
  63. package/dist/src/dht/ExternalApiRpcRemote.d.ts +2 -2
  64. package/dist/src/dht/ExternalApiRpcRemote.js +2 -0
  65. package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
  66. package/dist/src/dht/PeerManager.d.ts +13 -14
  67. package/dist/src/dht/PeerManager.js +45 -60
  68. package/dist/src/dht/PeerManager.js.map +1 -1
  69. package/dist/src/dht/contact/Contact.d.ts +2 -2
  70. package/dist/src/dht/contact/Contact.js +2 -2
  71. package/dist/src/dht/contact/Contact.js.map +1 -1
  72. package/dist/src/dht/contact/ContactList.d.ts +7 -7
  73. package/dist/src/dht/contact/ContactList.js +3 -3
  74. package/dist/src/dht/contact/ContactList.js.map +1 -1
  75. package/dist/src/dht/contact/RandomContactList.d.ts +4 -4
  76. package/dist/src/dht/contact/RandomContactList.js +12 -11
  77. package/dist/src/dht/contact/RandomContactList.js.map +1 -1
  78. package/dist/src/dht/contact/RpcRemote.d.ts +7 -4
  79. package/dist/src/dht/contact/RpcRemote.js +5 -2
  80. package/dist/src/dht/contact/RpcRemote.js.map +1 -1
  81. package/dist/src/dht/contact/SortedContactList.d.ts +13 -13
  82. package/dist/src/dht/contact/SortedContactList.js +33 -29
  83. package/dist/src/dht/contact/SortedContactList.js.map +1 -1
  84. package/dist/src/dht/discovery/DiscoverySession.d.ts +2 -4
  85. package/dist/src/dht/discovery/DiscoverySession.js +19 -20
  86. package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
  87. package/dist/src/dht/discovery/PeerDiscovery.d.ts +2 -5
  88. package/dist/src/dht/discovery/PeerDiscovery.js +12 -20
  89. package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
  90. package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +36 -0
  91. package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +165 -0
  92. package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +1 -0
  93. package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +14 -0
  94. package/dist/src/dht/{find/FindRpcLocal.js → recursive-operation/RecursiveOperationRpcLocal.js} +7 -7
  95. package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +1 -0
  96. package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.d.ts +6 -0
  97. package/dist/src/dht/{routing/FindRpcRemote.js → recursive-operation/RecursiveOperationRpcRemote.js} +11 -11
  98. package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +1 -0
  99. package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +42 -0
  100. package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +182 -0
  101. package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +1 -0
  102. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +12 -0
  103. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +17 -0
  104. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +1 -0
  105. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.d.ts +6 -0
  106. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js +21 -0
  107. package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js.map +1 -0
  108. package/dist/src/dht/routing/Router.d.ts +4 -19
  109. package/dist/src/dht/routing/Router.js +41 -33
  110. package/dist/src/dht/routing/Router.js.map +1 -1
  111. package/dist/src/dht/routing/RouterRpcLocal.js +6 -5
  112. package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -1
  113. package/dist/src/dht/routing/RouterRpcRemote.d.ts +2 -2
  114. package/dist/src/dht/routing/RouterRpcRemote.js +7 -7
  115. package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -1
  116. package/dist/src/dht/routing/RoutingSession.d.ts +20 -16
  117. package/dist/src/dht/routing/RoutingSession.js +37 -45
  118. package/dist/src/dht/routing/RoutingSession.js.map +1 -1
  119. package/dist/src/dht/store/LocalDataStore.d.ts +11 -13
  120. package/dist/src/dht/store/LocalDataStore.js +36 -56
  121. package/dist/src/dht/store/LocalDataStore.js.map +1 -1
  122. package/dist/src/dht/store/StoreManager.d.ts +33 -0
  123. package/dist/src/dht/store/StoreManager.js +186 -0
  124. package/dist/src/dht/store/StoreManager.js.map +1 -0
  125. package/dist/src/dht/store/StoreRpcLocal.d.ts +8 -40
  126. package/dist/src/dht/store/StoreRpcLocal.js +13 -229
  127. package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
  128. package/dist/src/dht/store/StoreRpcRemote.d.ts +5 -5
  129. package/dist/src/dht/store/StoreRpcRemote.js +4 -5
  130. package/dist/src/dht/store/StoreRpcRemote.js.map +1 -1
  131. package/dist/src/exports.d.ts +2 -0
  132. package/dist/src/exports.js.map +1 -1
  133. package/dist/src/helpers/MapWithTtl.d.ts +14 -0
  134. package/dist/src/helpers/MapWithTtl.js +59 -0
  135. package/dist/src/helpers/MapWithTtl.js.map +1 -0
  136. package/dist/src/helpers/PeerID.d.ts +2 -0
  137. package/dist/src/helpers/PeerID.js +4 -0
  138. package/dist/src/helpers/PeerID.js.map +1 -1
  139. package/dist/src/helpers/nodeId.d.ts +5 -0
  140. package/dist/src/helpers/nodeId.js +18 -1
  141. package/dist/src/helpers/nodeId.js.map +1 -1
  142. package/dist/src/helpers/peerIdFromPeerDescriptor.d.ts +2 -1
  143. package/dist/src/helpers/peerIdFromPeerDescriptor.js +2 -1
  144. package/dist/src/helpers/peerIdFromPeerDescriptor.js.map +1 -1
  145. package/dist/src/helpers/protoClasses.js +2 -3
  146. package/dist/src/helpers/protoClasses.js.map +1 -1
  147. package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +21 -22
  148. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +18 -18
  149. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
  150. package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +36 -60
  151. package/dist/src/proto/packages/dht/protos/DhtRpc.js +34 -53
  152. package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
  153. package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +11 -12
  154. package/dist/src/rpc-protocol/DhtCallContext.d.ts +2 -1
  155. package/dist/src/rpc-protocol/DhtCallContext.js.map +1 -1
  156. package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +2 -1
  157. package/dist/src/transport/ITransport.d.ts +9 -1
  158. package/dist/src/transport/ITransport.js +5 -0
  159. package/dist/src/transport/ITransport.js.map +1 -1
  160. package/dist/src/transport/ListeningRpcCommunicator.js +1 -1
  161. package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
  162. package/dist/src/transport/RoutingRpcCommunicator.d.ts +2 -1
  163. package/dist/src/transport/RoutingRpcCommunicator.js +16 -11
  164. package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -1
  165. package/jest.config.js +4 -1
  166. package/karma-setup.js +2 -0
  167. package/karma.config.js +11 -7
  168. package/package.json +6 -7
  169. package/protos/DhtRpc.proto +17 -23
  170. package/src/connection/ConnectionLockHandler.ts +15 -15
  171. package/src/connection/ConnectionLockRpcLocal.ts +8 -9
  172. package/src/connection/ConnectionLockRpcRemote.ts +7 -16
  173. package/src/connection/ConnectionManager.ts +58 -55
  174. package/src/connection/ConnectorFacade.ts +3 -0
  175. package/src/connection/ManagedConnection.ts +12 -30
  176. package/src/connection/connectivityChecker.ts +1 -0
  177. package/src/connection/simulator/Simulator.ts +5 -36
  178. package/src/connection/simulator/SimulatorConnector.ts +8 -8
  179. package/src/connection/webrtc/BrowserWebrtcConnection.ts +0 -3
  180. package/src/connection/webrtc/NodeWebrtcConnection.ts +3 -4
  181. package/src/connection/webrtc/WebrtcConnector.ts +11 -13
  182. package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +16 -16
  183. package/src/connection/webrtc/WebrtcConnectorRpcRemote.ts +3 -13
  184. package/src/connection/websocket/AutoCertifierClientFacade.ts +4 -6
  185. package/src/connection/websocket/ClientWebsocket.ts +1 -0
  186. package/src/connection/websocket/WebsocketConnector.ts +43 -56
  187. package/src/connection/websocket/WebsocketConnectorRpcLocal.ts +11 -13
  188. package/src/connection/websocket/WebsocketConnectorRpcRemote.ts +4 -15
  189. package/src/connection/websocket/WebsocketServer.ts +14 -17
  190. package/src/dht/DhtNode.ts +67 -69
  191. package/src/dht/DhtNodeRpcLocal.ts +0 -1
  192. package/src/dht/DhtNodeRpcRemote.ts +13 -13
  193. package/src/dht/ExternalApiRpcLocal.ts +16 -6
  194. package/src/dht/ExternalApiRpcRemote.ts +5 -3
  195. package/src/dht/PeerManager.ts +73 -90
  196. package/src/dht/contact/Contact.ts +5 -4
  197. package/src/dht/contact/ContactList.ts +9 -9
  198. package/src/dht/contact/RandomContactList.ts +14 -14
  199. package/src/dht/contact/RpcRemote.ts +10 -7
  200. package/src/dht/contact/SortedContactList.ts +48 -45
  201. package/src/dht/discovery/DiscoverySession.ts +25 -25
  202. package/src/dht/discovery/PeerDiscovery.ts +16 -37
  203. package/src/dht/recursive-operation/RecursiveOperationManager.ts +240 -0
  204. package/src/dht/{find/FindRpcLocal.ts → recursive-operation/RecursiveOperationRpcLocal.ts} +9 -9
  205. package/src/dht/{routing/FindRpcRemote.ts → recursive-operation/RecursiveOperationRpcRemote.ts} +10 -10
  206. package/src/dht/recursive-operation/RecursiveOperationSession.ts +224 -0
  207. package/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +25 -0
  208. package/src/dht/{find/FindSessionRpcRemote.ts → recursive-operation/RecursiveOperationSessionRpcRemote.ts} +8 -8
  209. package/src/dht/routing/Router.ts +45 -64
  210. package/src/dht/routing/RouterRpcLocal.ts +7 -6
  211. package/src/dht/routing/RouterRpcRemote.ts +9 -10
  212. package/src/dht/routing/RoutingSession.ts +59 -68
  213. package/src/dht/store/LocalDataStore.ts +47 -66
  214. package/src/dht/store/StoreManager.ts +217 -0
  215. package/src/dht/store/StoreRpcLocal.ts +26 -302
  216. package/src/dht/store/StoreRpcRemote.ts +9 -11
  217. package/src/exports.ts +2 -0
  218. package/src/helpers/MapWithTtl.ts +71 -0
  219. package/src/helpers/PeerID.ts +5 -0
  220. package/src/helpers/nodeId.ts +20 -0
  221. package/src/helpers/peerIdFromPeerDescriptor.ts +5 -3
  222. package/src/helpers/protoClasses.ts +4 -6
  223. package/src/proto/packages/dht/protos/DhtRpc.client.ts +31 -32
  224. package/src/proto/packages/dht/protos/DhtRpc.server.ts +11 -12
  225. package/src/proto/packages/dht/protos/DhtRpc.ts +49 -80
  226. package/src/rpc-protocol/DhtCallContext.ts +2 -1
  227. package/src/rpc-protocol/DhtRpcOptions.ts +2 -1
  228. package/src/transport/ITransport.ts +10 -1
  229. package/src/transport/ListeningRpcCommunicator.ts +1 -1
  230. package/src/transport/RoutingRpcCommunicator.ts +18 -12
  231. package/test/benchmark/Find.test.ts +8 -21
  232. package/test/benchmark/KademliaCorrectness.test.ts +11 -20
  233. package/test/benchmark/SortedContactListBenchmark.test.ts +9 -9
  234. package/test/benchmark/kademlia-simulation/Contact.ts +9 -8
  235. package/test/benchmark/kademlia-simulation/KademliaSimulation.ts +2 -2
  236. package/test/benchmark/kademlia-simulation/SimulationNode.ts +17 -17
  237. package/test/end-to-end/Layer0-Layer1.test.ts +10 -14
  238. package/test/end-to-end/Layer0.test.ts +15 -18
  239. package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +7 -9
  240. package/test/end-to-end/Layer0Webrtc-Layer1.test.ts +4 -10
  241. package/test/end-to-end/Layer0Webrtc.test.ts +5 -6
  242. package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +8 -16
  243. package/test/end-to-end/Layer1-Scale-Webrtc.test.ts +6 -13
  244. package/test/end-to-end/WebsocketConnectionRequest.test.ts +5 -6
  245. package/test/end-to-end/memory-leak.test.ts +6 -8
  246. package/test/integration/ConnectionLocking.test.ts +6 -13
  247. package/test/integration/ConnectionManager.test.ts +26 -43
  248. package/test/integration/DhtJoinPeerDiscovery.test.ts +5 -10
  249. package/test/integration/DhtNodeExternalAPI.test.ts +16 -22
  250. package/test/integration/DhtNodeRpcRemote.test.ts +13 -22
  251. package/test/integration/DhtRpc.test.ts +13 -18
  252. package/test/integration/Find.test.ts +10 -10
  253. package/test/integration/Layer1-scale.test.ts +17 -28
  254. package/test/integration/Mock-Layer1-Layer0.test.ts +25 -43
  255. package/test/integration/MultipleEntryPointJoining.test.ts +7 -7
  256. package/test/integration/ReplicateData.test.ts +28 -30
  257. package/test/integration/RouteMessage.test.ts +30 -27
  258. package/test/integration/RouterRpcRemote.test.ts +12 -18
  259. package/test/integration/RpcErrors.test.ts +8 -21
  260. package/test/integration/ScaleDownDht.test.ts +11 -10
  261. package/test/integration/SimultaneousConnections.test.ts +43 -67
  262. package/test/integration/Store.test.ts +23 -36
  263. package/test/integration/StoreAndDelete.test.ts +30 -50
  264. package/test/integration/StoreOnDhtWithTwoNodes.test.ts +16 -37
  265. package/test/integration/StoreRpcRemote.test.ts +20 -30
  266. package/test/integration/WebrtcConnectionManagement.test.ts +3 -13
  267. package/test/integration/WebrtcConnectorRpc.test.ts +3 -9
  268. package/test/integration/WebsocketConnectionManagement.test.ts +7 -10
  269. package/test/integration/WebsocketConnectorRpc.test.ts +8 -17
  270. package/test/unit/ConnectivityHelpers.test.ts +9 -17
  271. package/test/unit/DuplicateDetector.test.ts +7 -4
  272. package/test/unit/LocalDataStore.test.ts +66 -77
  273. package/test/unit/PeerManager.test.ts +31 -0
  274. package/test/unit/RandomContactList.test.ts +13 -8
  275. package/test/unit/{Finder.test.ts → RecursiveOperationManager.test.ts} +38 -43
  276. package/test/unit/RecursiveOperationSession.test.ts +68 -0
  277. package/test/unit/Router.test.ts +15 -22
  278. package/test/unit/RoutingSession.test.ts +23 -25
  279. package/test/unit/SortedContactList.test.ts +41 -26
  280. package/test/unit/StoreManager.test.ts +132 -0
  281. package/test/unit/WebsocketConnector.test.ts +27 -35
  282. package/test/unit/customMatchers.test.ts +16 -0
  283. package/test/utils/FakeTransport.ts +44 -0
  284. package/test/utils/customMatchers.ts +70 -0
  285. package/test/utils/mock/MockRpcCommunicator.ts +7 -0
  286. package/test/utils/mock/Router.ts +3 -2
  287. package/test/utils/mock/mockDataEntry.ts +36 -0
  288. package/test/utils/utils.ts +49 -87
  289. package/dist/src/dht/find/FindRpcLocal.d.ts +0 -14
  290. package/dist/src/dht/find/FindRpcLocal.js.map +0 -1
  291. package/dist/src/dht/find/FindSession.d.ts +0 -44
  292. package/dist/src/dht/find/FindSession.js +0 -150
  293. package/dist/src/dht/find/FindSession.js.map +0 -1
  294. package/dist/src/dht/find/FindSessionRpcLocal.d.ts +0 -12
  295. package/dist/src/dht/find/FindSessionRpcLocal.js +0 -17
  296. package/dist/src/dht/find/FindSessionRpcLocal.js.map +0 -1
  297. package/dist/src/dht/find/FindSessionRpcRemote.d.ts +0 -6
  298. package/dist/src/dht/find/FindSessionRpcRemote.js +0 -21
  299. package/dist/src/dht/find/FindSessionRpcRemote.js.map +0 -1
  300. package/dist/src/dht/find/Finder.d.ts +0 -49
  301. package/dist/src/dht/find/Finder.js +0 -197
  302. package/dist/src/dht/find/Finder.js.map +0 -1
  303. package/dist/src/dht/routing/FindRpcRemote.d.ts +0 -6
  304. package/dist/src/dht/routing/FindRpcRemote.js.map +0 -1
  305. package/src/dht/find/FindSession.ts +0 -183
  306. package/src/dht/find/FindSessionRpcLocal.ts +0 -25
  307. package/src/dht/find/Finder.ts +0 -295
@@ -1,37 +1,22 @@
1
1
  import { Message, PeerDescriptor, RouteMessageAck, RouteMessageWrapper } from '../../proto/packages/dht/protos/DhtRpc';
2
2
  import { RoutingMode, RoutingSession } from './RoutingSession';
3
3
  import { RoutingRpcCommunicator } from '../../transport/RoutingRpcCommunicator';
4
- import { PeerIDKey } from '../../helpers/PeerID';
5
4
  import { ConnectionManager } from '../../connection/ConnectionManager';
6
5
  import { DhtNodeRpcRemote } from '../DhtNodeRpcRemote';
7
- import { ServiceID } from '../../types/ServiceID';
6
+ import { NodeID } from '../../helpers/nodeId';
8
7
  export interface RouterConfig {
9
8
  rpcCommunicator: RoutingRpcCommunicator;
10
9
  localPeerDescriptor: PeerDescriptor;
11
- connections: Map<PeerIDKey, DhtNodeRpcRemote>;
10
+ connections: Map<NodeID, DhtNodeRpcRemote>;
12
11
  addContact: (contact: PeerDescriptor, setActive?: boolean) => void;
13
- serviceId: ServiceID;
14
12
  connectionManager?: ConnectionManager;
15
- rpcRequestTimeout?: number;
16
13
  }
17
- export interface IRouter {
18
- doRouteMessage(routedMessage: RouteMessageWrapper, mode: RoutingMode, excludedPeer?: PeerDescriptor): RouteMessageAck;
19
- send(msg: Message, reachableThrough: PeerDescriptor[]): void;
20
- isMostLikelyDuplicate(requestId: string): boolean;
21
- addToDuplicateDetector(requestId: string): void;
22
- addRoutingSession(session: RoutingSession): void;
23
- removeRoutingSession(sessionId: string): void;
24
- stop(): void;
25
- }
26
- export declare class Router implements IRouter {
27
- private readonly rpcCommunicator;
28
- private readonly localPeerDescriptor;
29
- private readonly connections;
30
- private readonly serviceId;
14
+ export declare class Router {
31
15
  private readonly forwardingTable;
32
16
  private ongoingRoutingSessions;
33
17
  private readonly duplicateRequestDetector;
34
18
  private stopped;
19
+ private readonly config;
35
20
  constructor(config: RouterConfig);
36
21
  private registerLocalRpcMethods;
37
22
  send(msg: Message, reachableThrough: PeerDescriptor[]): void;
@@ -8,35 +8,34 @@ const utils_1 = require("@streamr/utils");
8
8
  const DuplicateDetector_1 = require("./DuplicateDetector");
9
9
  const uuid_1 = require("uuid");
10
10
  const RouterRpcLocal_1 = require("./RouterRpcLocal");
11
+ const nodeId_1 = require("../../helpers/nodeId");
11
12
  const logger = new utils_1.Logger(module);
12
13
  class Router {
13
14
  constructor(config) {
14
15
  this.forwardingTable = new Map();
15
16
  this.ongoingRoutingSessions = new Map();
17
+ // TODO use config option or named constant?
16
18
  this.duplicateRequestDetector = new DuplicateDetector_1.DuplicateDetector(100000, 100);
17
19
  this.stopped = false;
18
- this.rpcCommunicator = config.rpcCommunicator;
19
- this.localPeerDescriptor = config.localPeerDescriptor;
20
- this.connections = config.connections;
21
- this.serviceId = config.serviceId;
22
- this.registerLocalRpcMethods(config);
20
+ this.config = config;
21
+ this.registerLocalRpcMethods();
23
22
  }
24
- registerLocalRpcMethods(config) {
23
+ registerLocalRpcMethods() {
25
24
  const rpcLocal = new RouterRpcLocal_1.RouterRpcLocal({
26
25
  doRouteMessage: (routedMessage, mode) => this.doRouteMessage(routedMessage, mode),
27
- addContact: (contact, setActive) => config.addContact(contact, setActive),
26
+ addContact: (contact, setActive) => this.config.addContact(contact, setActive),
28
27
  setForwardingEntries: (routedMessage) => this.setForwardingEntries(routedMessage),
29
28
  duplicateRequestDetector: this.duplicateRequestDetector,
30
- localPeerDescriptor: this.localPeerDescriptor,
31
- connectionManager: config.connectionManager
29
+ localPeerDescriptor: this.config.localPeerDescriptor,
30
+ connectionManager: this.config.connectionManager
32
31
  });
33
- this.rpcCommunicator.registerRpcMethod(DhtRpc_1.RouteMessageWrapper, DhtRpc_1.RouteMessageAck, 'routeMessage', async (routedMessage) => {
32
+ this.config.rpcCommunicator.registerRpcMethod(DhtRpc_1.RouteMessageWrapper, DhtRpc_1.RouteMessageAck, 'routeMessage', async (routedMessage) => {
34
33
  if (this.stopped) {
35
34
  return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage, DhtRpc_1.RouteMessageError.STOPPED);
36
35
  }
37
36
  return rpcLocal.routeMessage(routedMessage);
38
37
  });
39
- this.rpcCommunicator.registerRpcMethod(DhtRpc_1.RouteMessageWrapper, DhtRpc_1.RouteMessageAck, 'forwardMessage', async (forwardMessage) => {
38
+ this.config.rpcCommunicator.registerRpcMethod(DhtRpc_1.RouteMessageWrapper, DhtRpc_1.RouteMessageAck, 'forwardMessage', async (forwardMessage) => {
40
39
  if (this.stopped) {
41
40
  return (0, RouterRpcLocal_1.createRouteMessageAck)(forwardMessage, DhtRpc_1.RouteMessageError.STOPPED);
42
41
  }
@@ -44,16 +43,15 @@ class Router {
44
43
  });
45
44
  }
46
45
  send(msg, reachableThrough) {
47
- msg.sourceDescriptor = this.localPeerDescriptor;
46
+ msg.sourceDescriptor = this.config.localPeerDescriptor;
48
47
  const targetPeerDescriptor = msg.targetDescriptor;
49
- const forwardingEntry = this.forwardingTable.get((0, peerIdFromPeerDescriptor_1.keyFromPeerDescriptor)(targetPeerDescriptor));
48
+ const forwardingEntry = this.forwardingTable.get((0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(targetPeerDescriptor));
50
49
  if (forwardingEntry && forwardingEntry.peerDescriptors.length > 0) {
51
- const forwardingPeer = forwardingEntry.peerDescriptors[0];
52
50
  const forwardedMessage = {
53
51
  message: msg,
54
52
  requestId: (0, uuid_1.v4)(),
55
- destinationPeer: forwardingPeer,
56
- sourcePeer: this.localPeerDescriptor,
53
+ target: forwardingEntry.peerDescriptors[0].nodeId,
54
+ sourcePeer: this.config.localPeerDescriptor,
57
55
  reachableThrough,
58
56
  routingPath: []
59
57
  };
@@ -68,8 +66,8 @@ class Router {
68
66
  const routedMessage = {
69
67
  message: msg,
70
68
  requestId: (0, uuid_1.v4)(),
71
- destinationPeer: targetPeerDescriptor,
72
- sourcePeer: this.localPeerDescriptor,
69
+ target: targetPeerDescriptor.nodeId,
70
+ sourcePeer: this.config.localPeerDescriptor,
73
71
  reachableThrough,
74
72
  routingPath: []
75
73
  };
@@ -86,7 +84,7 @@ class Router {
86
84
  return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage, DhtRpc_1.RouteMessageError.STOPPED);
87
85
  }
88
86
  logger.trace(`Routing message ${routedMessage.requestId} from ${(0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(routedMessage.sourcePeer)} `
89
- + `to ${(0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(routedMessage.destinationPeer)}`);
87
+ + `to ${(0, nodeId_1.getNodeIdFromBinary)(routedMessage.target)}`);
90
88
  const session = this.createRoutingSession(routedMessage, mode, excludedPeer);
91
89
  const contacts = session.updateAndGetRoutablePeers();
92
90
  if (contacts.length > 0) {
@@ -100,6 +98,7 @@ class Router {
100
98
  });
101
99
  setImmediate(async () => {
102
100
  try {
101
+ // TODO use config option or named constant?
103
102
  await (0, utils_1.withTimeout)(eventReceived, 10000);
104
103
  logger.trace('raceEvents ended from routingSession: ' + session.sessionId);
105
104
  }
@@ -117,13 +116,22 @@ class Router {
117
116
  return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage, DhtRpc_1.RouteMessageError.NO_TARGETS);
118
117
  }
119
118
  }
120
- createRoutingSession(routedMessage, mode, excludedPeer) {
121
- const excludedPeers = routedMessage.routingPath.map((descriptor) => (0, peerIdFromPeerDescriptor_1.peerIdFromPeerDescriptor)(descriptor));
122
- if (excludedPeer) {
123
- excludedPeers.push((0, peerIdFromPeerDescriptor_1.peerIdFromPeerDescriptor)(excludedPeer));
119
+ createRoutingSession(routedMessage, mode, excludedNode) {
120
+ const excludedNodeIds = new Set(routedMessage.routingPath.map((descriptor) => (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(descriptor)));
121
+ if (excludedNode) {
122
+ excludedNodeIds.add((0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(excludedNode));
124
123
  }
125
- logger.trace('routing session created with connections: ' + this.connections.size);
126
- return new RoutingSession_1.RoutingSession(this.rpcCommunicator, this.localPeerDescriptor, routedMessage, this.connections, (0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(this.localPeerDescriptor, routedMessage.sourcePeer) ? 2 : 1, mode, excludedPeers);
124
+ logger.trace('routing session created with connections: ' + this.config.connections.size);
125
+ return new RoutingSession_1.RoutingSession({
126
+ rpcCommunicator: this.config.rpcCommunicator,
127
+ localPeerDescriptor: this.config.localPeerDescriptor,
128
+ routedMessage,
129
+ connections: this.config.connections,
130
+ // TODO use config option or named constant?
131
+ parallelism: (0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(this.config.localPeerDescriptor, routedMessage.sourcePeer) ? 2 : 1,
132
+ mode,
133
+ excludedNodeIds
134
+ });
127
135
  }
128
136
  isMostLikelyDuplicate(requestId) {
129
137
  return this.duplicateRequestDetector.isMostLikelyDuplicate(requestId);
@@ -151,22 +159,22 @@ class Router {
151
159
  }
152
160
  setForwardingEntries(routedMessage) {
153
161
  const reachableThroughWithoutSelf = routedMessage.reachableThrough.filter((peer) => {
154
- return !(0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(peer, this.localPeerDescriptor);
162
+ return !(0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(peer, this.config.localPeerDescriptor);
155
163
  });
156
164
  if (reachableThroughWithoutSelf.length > 0) {
157
- const sourceKey = (0, peerIdFromPeerDescriptor_1.keyFromPeerDescriptor)(routedMessage.sourcePeer);
158
- if (this.forwardingTable.has(sourceKey)) {
159
- const oldEntry = this.forwardingTable.get(sourceKey);
165
+ const sourceNodeId = (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(routedMessage.sourcePeer);
166
+ if (this.forwardingTable.has(sourceNodeId)) {
167
+ const oldEntry = this.forwardingTable.get(sourceNodeId);
160
168
  clearTimeout(oldEntry.timeout);
161
- this.forwardingTable.delete(sourceKey);
169
+ this.forwardingTable.delete(sourceNodeId);
162
170
  }
163
171
  const forwardingEntry = {
164
172
  peerDescriptors: reachableThroughWithoutSelf,
165
173
  timeout: setTimeout(() => {
166
- this.forwardingTable.delete(sourceKey);
167
- }, 10000)
174
+ this.forwardingTable.delete(sourceNodeId);
175
+ }, 10000) // TODO use config option or named constant?
168
176
  };
169
- this.forwardingTable.set(sourceKey, forwardingEntry);
177
+ this.forwardingTable.set(sourceNodeId, forwardingEntry);
170
178
  }
171
179
  }
172
180
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Router.js","sourceRoot":"","sources":["../../../../src/dht/routing/Router.ts"],"names":[],"mappings":";;;AAAA,mEAAyI;AACzI,qFAK+C;AAC/C,qDAAoF;AACpF,0CAAqF;AAGrF,2DAAuD;AAGvD,+BAAyB;AACzB,qDAAwE;AA6BxE,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAa,MAAM;IAUf,YAAY,MAAoB;QALf,oBAAe,GAAsC,IAAI,GAAG,EAAE,CAAA;QACvE,2BAAsB,GAAgC,IAAI,GAAG,EAAE,CAAA;QACtD,6BAAwB,GAAsB,IAAI,qCAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACzF,YAAO,GAAG,KAAK,CAAA;QAGnB,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAA;QAC7C,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAA;QACrD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAA;QACrC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;QACjC,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC;IAEO,uBAAuB,CAAC,MAAoB;QAChD,MAAM,QAAQ,GAAG,IAAI,+BAAc,CAAC;YAChC,cAAc,EAAE,CAAC,aAAkC,EAAE,IAAkB,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,IAAI,CAAC;YACpH,UAAU,EAAE,CAAC,OAAuB,EAAE,SAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC;YAClG,oBAAoB,EAAE,CAAC,aAAkC,EAAE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AM,GAAG,CAAC,EAAE;YACxC,MAAM,YAAY,GAAG,IAAA,sDAA2B,EAAC,aAAa,CAAC,UAAW,CAAC,CAAA;YAC3E,IAAI,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;gBACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;gBACvD,YAAY,CAAC,QAAS,CAAC,OAAO,CAAC,CAAA;gBAC/B,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;aAC5C;YACD,MAAM,eAAe,GAAyB;gBAC1C,eAAe,EAAE,2BAA2B;gBAC5C,OAAO,EAAE,UAAU,CAAC,GAAG,EAAE;oBACrB,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;gBAC7C,CAAC,EAAE,KAAK,CAAC,CAAE,4CAA4C;aAC1D,CAAA;YACD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,EAAE,eAAe,CAAC,CAAA;SAC1D;IACL,CAAC;CACJ;AAjMD,wBAiMC"}
@@ -5,6 +5,7 @@ const utils_1 = require("@streamr/utils");
5
5
  const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
6
6
  const DhtRpc_1 = require("../../proto/packages/dht/protos/DhtRpc");
7
7
  const RoutingSession_1 = require("./RoutingSession");
8
+ const nodeId_1 = require("../../helpers/nodeId");
8
9
  const logger = new utils_1.Logger(module);
9
10
  const createRouteMessageAck = (routedMessage, error) => {
10
11
  const ack = {
@@ -21,13 +22,13 @@ class RouterRpcLocal {
21
22
  async routeMessage(routedMessage) {
22
23
  if (this.config.duplicateRequestDetector.isMostLikelyDuplicate(routedMessage.requestId)) {
23
24
  logger.trace(`Routing message ${routedMessage.requestId} from ${(0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(routedMessage.sourcePeer)} `
24
- + `to ${(0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(routedMessage.destinationPeer)} is likely a duplicate`);
25
+ + `to ${(0, nodeId_1.getNodeIdFromBinary)(routedMessage.target)} is likely a duplicate`);
25
26
  return (0, exports.createRouteMessageAck)(routedMessage, DhtRpc_1.RouteMessageError.DUPLICATE);
26
27
  }
27
28
  logger.trace(`Processing received routeMessage ${routedMessage.requestId}`);
28
29
  this.config.addContact(routedMessage.sourcePeer, true);
29
30
  this.config.duplicateRequestDetector.add(routedMessage.requestId);
30
- if ((0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(this.config.localPeerDescriptor, routedMessage.destinationPeer)) {
31
+ if ((0, utils_1.areEqualBinaries)(this.config.localPeerDescriptor.nodeId, routedMessage.target)) {
31
32
  logger.trace(`routing message targeted to self ${routedMessage.requestId}`);
32
33
  this.config.setForwardingEntries(routedMessage);
33
34
  this.config.connectionManager?.handleMessage(routedMessage.message);
@@ -40,13 +41,13 @@ class RouterRpcLocal {
40
41
  async forwardMessage(forwardMessage) {
41
42
  if (this.config.duplicateRequestDetector.isMostLikelyDuplicate(forwardMessage.requestId)) {
42
43
  logger.trace(`Forwarding message ${forwardMessage.requestId} from ${(0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(forwardMessage.sourcePeer)} `
43
- + `to ${(0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(forwardMessage.destinationPeer)} is likely a duplicate`);
44
+ + `to ${(0, nodeId_1.getNodeIdFromBinary)(forwardMessage.target)} is likely a duplicate`);
44
45
  return (0, exports.createRouteMessageAck)(forwardMessage, DhtRpc_1.RouteMessageError.DUPLICATE);
45
46
  }
46
47
  logger.trace(`Processing received forward routeMessage ${forwardMessage.requestId}`);
47
48
  this.config.addContact(forwardMessage.sourcePeer, true);
48
49
  this.config.duplicateRequestDetector.add(forwardMessage.requestId);
49
- if ((0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(this.config.localPeerDescriptor, forwardMessage.destinationPeer)) {
50
+ if ((0, utils_1.areEqualBinaries)(this.config.localPeerDescriptor.nodeId, forwardMessage.target)) {
50
51
  return this.forwardToDestination(forwardMessage);
51
52
  }
52
53
  else {
@@ -60,7 +61,7 @@ class RouterRpcLocal {
60
61
  this.config.connectionManager?.handleMessage(forwardedMessage);
61
62
  return (0, exports.createRouteMessageAck)(routedMessage);
62
63
  }
63
- return this.config.doRouteMessage({ ...routedMessage, destinationPeer: forwardedMessage.targetDescriptor });
64
+ return this.config.doRouteMessage({ ...routedMessage, target: forwardedMessage.targetDescriptor.nodeId });
64
65
  }
65
66
  }
66
67
  exports.RouterRpcLocal = RouterRpcLocal;
@@ -1 +1 @@
1
- {"version":3,"file":"RouterRpcLocal.js","sourceRoot":"","sources":["../../../../src/dht/routing/RouterRpcLocal.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AAEvC,qFAA6G;AAC7G,mEAAgI;AAGhI,qDAA8C;AAW9C,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAE1B,MAAM,qBAAqB,GAAG,CAAC,aAAkC,EAAE,KAAyB,EAAmB,EAAE;IACpH,MAAM,GAAG,GAAoB;QACzB,SAAS,EAAE,aAAa,CAAC,SAAS;QAClC,KAAK;KACR,CAAA;IACD,OAAO,GAAG,CAAA;AACd,CAAC,CAAA;AANY,QAAA,qBAAqB,yBAMjC;AAED,MAAa,cAAc;IAIvB,YAAY,MAA4B;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,aAAkC;QACjD,IAAI,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YACrF,MAAM,CAAC,KAAK,CAAC,mBAAmB,aAAa,CAAC,SAAS,SAAS,IAAA,sDAA2B,EAAC,aAAa,CAAC,UAAW,CAAC,GAAG;kBACnH,MAAM,IAAA,sDAA2B,EAAC,aAAa,CAAC,eAAgB,CA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SACzE;IACL,CAAC;IAEO,oBAAoB,CAAC,aAAkC;QAC3D,MAAM,CAAC,KAAK,CAAC,6CAA6C,aAAa,CAAC,SAAS,EAAE,CAAC,CAAA;QACpF,MAAM,gBAAgB,GAAG,aAAa,CAAC,OAAQ,CAAA;QAC/C,IAAI,IAAA,kDAAuB,EAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,gBAAiB,CAAC,EAAE;YAC9F,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;YAC9D,OAAO,IAAA,6BAAqB,EAAC,aAAa,CAAC,CAAA;SAC9C;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,GAAG,aAAa,EAAE,MAAM,EAAE,gBAAgB,CAAC,gBAAiB,CAAC,MAAM,EAAE,CAAC,CAAA;IAC9G,CAAC;CAEJ;AArDD,wCAqDC"}
@@ -1,7 +1,7 @@
1
1
  import { RouteMessageWrapper } from '../../proto/packages/dht/protos/DhtRpc';
2
- import { IRouterRpcClient } from '../../proto/packages/dht/protos/DhtRpc.client';
2
+ import { RouterRpcClient } from '../../proto/packages/dht/protos/DhtRpc.client';
3
3
  import { RpcRemote } from '../contact/RpcRemote';
4
- export declare class RouterRpcRemote extends RpcRemote<IRouterRpcClient> {
4
+ export declare class RouterRpcRemote extends RpcRemote<RouterRpcClient> {
5
5
  routeMessage(params: RouteMessageWrapper): Promise<boolean>;
6
6
  forwardMessage(params: RouteMessageWrapper): Promise<boolean>;
7
7
  }
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RouterRpcRemote = void 0;
4
- const DhtRpc_1 = require("../../proto/packages/dht/protos/DhtRpc");
4
+ const utils_1 = require("@streamr/utils");
5
5
  const uuid_1 = require("uuid");
6
6
  const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
7
+ const DhtRpc_1 = require("../../proto/packages/dht/protos/DhtRpc");
7
8
  const RpcRemote_1 = require("../contact/RpcRemote");
8
- const utils_1 = require("@streamr/utils");
9
9
  const getPreviousPeer_1 = require("./getPreviousPeer");
10
10
  const logger = new utils_1.Logger(module);
11
11
  class RouterRpcRemote extends RpcRemote_1.RpcRemote {
12
12
  async routeMessage(params) {
13
13
  const message = {
14
- destinationPeer: params.destinationPeer,
14
+ target: params.target,
15
15
  sourcePeer: params.sourcePeer,
16
16
  message: params.message,
17
17
  requestId: params.requestId ?? (0, uuid_1.v4)(),
@@ -19,13 +19,13 @@ class RouterRpcRemote extends RpcRemote_1.RpcRemote {
19
19
  routingPath: params.routingPath
20
20
  };
21
21
  const options = this.formDhtRpcOptions({
22
- doNotConnect: true
22
+ connect: false
23
23
  });
24
24
  try {
25
25
  const ack = await this.getClient().routeMessage(message, options);
26
26
  // Success signal if sent to destination and error includes duplicate
27
27
  if (ack.error === DhtRpc_1.RouteMessageError.DUPLICATE
28
- && (0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(params.destinationPeer, this.getPeerDescriptor())) {
28
+ && (0, utils_1.areEqualBinaries)(params.target, this.getPeerDescriptor().nodeId)) {
29
29
  return true;
30
30
  }
31
31
  else if (ack.error !== undefined) {
@@ -44,7 +44,7 @@ class RouterRpcRemote extends RpcRemote_1.RpcRemote {
44
44
  }
45
45
  async forwardMessage(params) {
46
46
  const message = {
47
- destinationPeer: params.destinationPeer,
47
+ target: params.target,
48
48
  sourcePeer: params.sourcePeer,
49
49
  message: params.message,
50
50
  requestId: params.requestId ?? (0, uuid_1.v4)(),
@@ -52,7 +52,7 @@ class RouterRpcRemote extends RpcRemote_1.RpcRemote {
52
52
  routingPath: params.routingPath
53
53
  };
54
54
  const options = this.formDhtRpcOptions({
55
- doNotConnect: true
55
+ connect: false
56
56
  });
57
57
  try {
58
58
  const ack = await this.getClient().forwardMessage(message, options);
@@ -1 +1 @@
1
- {"version":3,"file":"RouterRpcRemote.js","sourceR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,CAAC,IAAA,sDAA2B,EAAC,MAAM,CAAC,UAAW,CAAC,CAAA;YACrD,MAAM,CAAC,KAAK,CACR,sCAAsC,QAAQ,OAAO,IAAA,sDAA2B,EAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,UAAU,GAAG,EAAE,CAC5H,CAAA;YACD,OAAO,KAAK,CAAA;SACf;QACD,OAAO,IAAI,CAAA;IACf,CAAC;CACJ;AAhED,0CAgEC"}
@@ -1,43 +1,47 @@
1
1
  import { DhtNodeRpcRemote } from '../DhtNodeRpcRemote';
2
- import { PeerID, PeerIDKey } from '../../helpers/PeerID';
3
2
  import EventEmitter from 'eventemitter3';
4
3
  import { PeerDescriptor, RouteMessageWrapper } from '../../proto/packages/dht/protos/DhtRpc';
5
4
  import { RouterRpcRemote } from './RouterRpcRemote';
6
5
  import { RoutingRpcCommunicator } from '../../transport/RoutingRpcCommunicator';
7
6
  import { Contact } from '../contact/Contact';
8
- import { FindRpcRemote } from './FindRpcRemote';
7
+ import { RecursiveOperationRpcRemote } from '../recursive-operation/RecursiveOperationRpcRemote';
8
+ import { NodeID } from '../../helpers/nodeId';
9
9
  declare class RemoteContact extends Contact {
10
10
  private routerRpcRemote;
11
- private findRpcRemote;
11
+ private recursiveOperationRpcRemote;
12
12
  constructor(peer: DhtNodeRpcRemote, localPeerDescriptor: PeerDescriptor, rpcCommunicator: RoutingRpcCommunicator);
13
13
  getRouterRpcRemote(): RouterRpcRemote;
14
- getFindRpcRemote(): FindRpcRemote;
14
+ getRecursiveOperationRpcRemote(): RecursiveOperationRpcRemote;
15
15
  }
16
16
  export interface RoutingSessionEvents {
17
- routingSucceeded: (sessionId: string) => void;
18
- partialSuccess: (sessionId: string) => void;
19
- routingFailed: (sessionId: string) => void;
20
- stopped: (sessionId: string) => void;
17
+ routingSucceeded: () => void;
18
+ partialSuccess: () => void;
19
+ routingFailed: () => void;
20
+ stopped: () => void;
21
21
  }
22
22
  export declare enum RoutingMode {
23
23
  ROUTE = 0,
24
24
  FORWARD = 1,
25
- FIND = 2
25
+ RECURSIVE = 2
26
+ }
27
+ interface RoutingSessionConfig {
28
+ rpcCommunicator: RoutingRpcCommunicator;
29
+ localPeerDescriptor: PeerDescriptor;
30
+ routedMessage: RouteMessageWrapper;
31
+ connections: Map<NodeID, DhtNodeRpcRemote>;
32
+ parallelism: number;
33
+ mode: RoutingMode;
34
+ excludedNodeIds?: Set<NodeID>;
26
35
  }
27
36
  export declare class RoutingSession extends EventEmitter<RoutingSessionEvents> {
28
37
  readonly sessionId: string;
29
- private readonly rpcCommunicator;
30
38
  private ongoingRequests;
31
39
  private contactList;
32
- private readonly localPeerDescriptor;
33
- private readonly messageToRoute;
34
- private connections;
35
- private readonly parallelism;
36
40
  private failedHopCounter;
37
41
  private successfulHopCounter;
38
- private readonly mode;
39
42
  private stopped;
40
- constructor(rpcCommunicator: RoutingRpcCommunicator, localPeerDescriptor: PeerDescriptor, messageToRoute: RouteMessageWrapper, connections: Map<PeerIDKey, DhtNodeRpcRemote>, parallelism: number, mode?: RoutingMode, excludedPeerIDs?: PeerID[]);
43
+ private readonly config;
44
+ constructor(config: RoutingSessionConfig);
41
45
  private onRequestFailed;
42
46
  private emitFailure;
43
47
  private onRequestSucceeded;