@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.
- package/dist/src/connection/ConnectionLockHandler.d.ts +11 -11
- package/dist/src/connection/ConnectionLockHandler.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcLocal.d.ts +3 -3
- package/dist/src/connection/ConnectionLockRpcLocal.js +4 -4
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcRemote.d.ts +3 -5
- package/dist/src/connection/ConnectionLockRpcRemote.js +4 -7
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
- package/dist/src/connection/ConnectionManager.d.ts +4 -6
- package/dist/src/connection/ConnectionManager.js +48 -46
- package/dist/src/connection/ConnectionManager.js.map +1 -1
- package/dist/src/connection/ConnectorFacade.d.ts +2 -2
- package/dist/src/connection/ConnectorFacade.js +2 -1
- package/dist/src/connection/ConnectorFacade.js.map +1 -1
- package/dist/src/connection/ManagedConnection.d.ts +3 -6
- package/dist/src/connection/ManagedConnection.js +6 -10
- package/dist/src/connection/ManagedConnection.js.map +1 -1
- package/dist/src/connection/connectivityChecker.js +1 -0
- package/dist/src/connection/connectivityChecker.js.map +1 -1
- package/dist/src/connection/simulator/Simulator.d.ts +0 -3
- package/dist/src/connection/simulator/Simulator.js +3 -51
- package/dist/src/connection/simulator/Simulator.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnector.js +5 -5
- package/dist/src/connection/simulator/SimulatorConnector.js.map +1 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js +2 -2
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -1
- package/dist/src/connection/webrtc/WebrtcConnector.js +7 -9
- package/dist/src/connection/webrtc/WebrtcConnector.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +2 -2
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +11 -12
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +2 -5
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js +1 -4
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +1 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +1 -2
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +3 -4
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -1
- package/dist/src/connection/websocket/ClientWebsocket.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnector.d.ts +2 -7
- package/dist/src/connection/websocket/WebsocketConnector.js +32 -38
- package/dist/src/connection/websocket/WebsocketConnector.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.d.ts +3 -2
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js +8 -10
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.d.ts +3 -6
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js +0 -3
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketServer.d.ts +1 -4
- package/dist/src/connection/websocket/WebsocketServer.js +11 -12
- package/dist/src/connection/websocket/WebsocketServer.js.map +1 -1
- package/dist/src/dht/DhtNode.d.ts +10 -13
- package/dist/src/dht/DhtNode.js +39 -52
- package/dist/src/dht/DhtNode.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +0 -1
- package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcRemote.d.ts +7 -7
- package/dist/src/dht/DhtNodeRpcRemote.js +8 -7
- package/dist/src/dht/DhtNodeRpcRemote.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +5 -4
- package/dist/src/dht/ExternalApiRpcLocal.js +3 -2
- package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcRemote.d.ts +2 -2
- package/dist/src/dht/ExternalApiRpcRemote.js +2 -0
- package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
- package/dist/src/dht/PeerManager.d.ts +13 -14
- package/dist/src/dht/PeerManager.js +45 -60
- package/dist/src/dht/PeerManager.js.map +1 -1
- package/dist/src/dht/contact/Contact.d.ts +2 -2
- package/dist/src/dht/contact/Contact.js +2 -2
- package/dist/src/dht/contact/Contact.js.map +1 -1
- package/dist/src/dht/contact/ContactList.d.ts +7 -7
- package/dist/src/dht/contact/ContactList.js +3 -3
- package/dist/src/dht/contact/ContactList.js.map +1 -1
- package/dist/src/dht/contact/RandomContactList.d.ts +4 -4
- package/dist/src/dht/contact/RandomContactList.js +12 -11
- package/dist/src/dht/contact/RandomContactList.js.map +1 -1
- package/dist/src/dht/contact/RpcRemote.d.ts +7 -4
- package/dist/src/dht/contact/RpcRemote.js +5 -2
- package/dist/src/dht/contact/RpcRemote.js.map +1 -1
- package/dist/src/dht/contact/SortedContactList.d.ts +13 -13
- package/dist/src/dht/contact/SortedContactList.js +33 -29
- package/dist/src/dht/contact/SortedContactList.js.map +1 -1
- package/dist/src/dht/discovery/DiscoverySession.d.ts +2 -4
- package/dist/src/dht/discovery/DiscoverySession.js +19 -20
- package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +2 -5
- package/dist/src/dht/discovery/PeerDiscovery.js +12 -20
- package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +36 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +165 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +14 -0
- package/dist/src/dht/{find/FindRpcLocal.js → recursive-operation/RecursiveOperationRpcLocal.js} +7 -7
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.d.ts +6 -0
- package/dist/src/dht/{routing/FindRpcRemote.js → recursive-operation/RecursiveOperationRpcRemote.js} +11 -11
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +42 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +182 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +12 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +17 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.d.ts +6 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js +21 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js.map +1 -0
- package/dist/src/dht/routing/Router.d.ts +4 -19
- package/dist/src/dht/routing/Router.js +41 -33
- package/dist/src/dht/routing/Router.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcLocal.js +6 -5
- package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcRemote.d.ts +2 -2
- package/dist/src/dht/routing/RouterRpcRemote.js +7 -7
- package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +20 -16
- package/dist/src/dht/routing/RoutingSession.js +37 -45
- package/dist/src/dht/routing/RoutingSession.js.map +1 -1
- package/dist/src/dht/store/LocalDataStore.d.ts +11 -13
- package/dist/src/dht/store/LocalDataStore.js +36 -56
- package/dist/src/dht/store/LocalDataStore.js.map +1 -1
- package/dist/src/dht/store/StoreManager.d.ts +33 -0
- package/dist/src/dht/store/StoreManager.js +186 -0
- package/dist/src/dht/store/StoreManager.js.map +1 -0
- package/dist/src/dht/store/StoreRpcLocal.d.ts +8 -40
- package/dist/src/dht/store/StoreRpcLocal.js +13 -229
- package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
- package/dist/src/dht/store/StoreRpcRemote.d.ts +5 -5
- package/dist/src/dht/store/StoreRpcRemote.js +4 -5
- package/dist/src/dht/store/StoreRpcRemote.js.map +1 -1
- package/dist/src/exports.d.ts +2 -0
- package/dist/src/exports.js.map +1 -1
- package/dist/src/helpers/MapWithTtl.d.ts +14 -0
- package/dist/src/helpers/MapWithTtl.js +59 -0
- package/dist/src/helpers/MapWithTtl.js.map +1 -0
- package/dist/src/helpers/PeerID.d.ts +2 -0
- package/dist/src/helpers/PeerID.js +4 -0
- package/dist/src/helpers/PeerID.js.map +1 -1
- package/dist/src/helpers/nodeId.d.ts +5 -0
- package/dist/src/helpers/nodeId.js +18 -1
- package/dist/src/helpers/nodeId.js.map +1 -1
- package/dist/src/helpers/peerIdFromPeerDescriptor.d.ts +2 -1
- package/dist/src/helpers/peerIdFromPeerDescriptor.js +2 -1
- package/dist/src/helpers/peerIdFromPeerDescriptor.js.map +1 -1
- package/dist/src/helpers/protoClasses.js +2 -3
- package/dist/src/helpers/protoClasses.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +21 -22
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +18 -18
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +36 -60
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +34 -53
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +11 -12
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +2 -1
- package/dist/src/rpc-protocol/DhtCallContext.js.map +1 -1
- package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +2 -1
- package/dist/src/transport/ITransport.d.ts +9 -1
- package/dist/src/transport/ITransport.js +5 -0
- package/dist/src/transport/ITransport.js.map +1 -1
- package/dist/src/transport/ListeningRpcCommunicator.js +1 -1
- package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +2 -1
- package/dist/src/transport/RoutingRpcCommunicator.js +16 -11
- package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -1
- package/jest.config.js +4 -1
- package/karma-setup.js +2 -0
- package/karma.config.js +11 -7
- package/package.json +6 -7
- package/protos/DhtRpc.proto +17 -23
- package/src/connection/ConnectionLockHandler.ts +15 -15
- package/src/connection/ConnectionLockRpcLocal.ts +8 -9
- package/src/connection/ConnectionLockRpcRemote.ts +7 -16
- package/src/connection/ConnectionManager.ts +58 -55
- package/src/connection/ConnectorFacade.ts +3 -0
- package/src/connection/ManagedConnection.ts +12 -30
- package/src/connection/connectivityChecker.ts +1 -0
- package/src/connection/simulator/Simulator.ts +5 -36
- package/src/connection/simulator/SimulatorConnector.ts +8 -8
- package/src/connection/webrtc/BrowserWebrtcConnection.ts +0 -3
- package/src/connection/webrtc/NodeWebrtcConnection.ts +3 -4
- package/src/connection/webrtc/WebrtcConnector.ts +11 -13
- package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +16 -16
- package/src/connection/webrtc/WebrtcConnectorRpcRemote.ts +3 -13
- package/src/connection/websocket/AutoCertifierClientFacade.ts +4 -6
- package/src/connection/websocket/ClientWebsocket.ts +1 -0
- package/src/connection/websocket/WebsocketConnector.ts +43 -56
- package/src/connection/websocket/WebsocketConnectorRpcLocal.ts +11 -13
- package/src/connection/websocket/WebsocketConnectorRpcRemote.ts +4 -15
- package/src/connection/websocket/WebsocketServer.ts +14 -17
- package/src/dht/DhtNode.ts +67 -69
- package/src/dht/DhtNodeRpcLocal.ts +0 -1
- package/src/dht/DhtNodeRpcRemote.ts +13 -13
- package/src/dht/ExternalApiRpcLocal.ts +16 -6
- package/src/dht/ExternalApiRpcRemote.ts +5 -3
- package/src/dht/PeerManager.ts +73 -90
- package/src/dht/contact/Contact.ts +5 -4
- package/src/dht/contact/ContactList.ts +9 -9
- package/src/dht/contact/RandomContactList.ts +14 -14
- package/src/dht/contact/RpcRemote.ts +10 -7
- package/src/dht/contact/SortedContactList.ts +48 -45
- package/src/dht/discovery/DiscoverySession.ts +25 -25
- package/src/dht/discovery/PeerDiscovery.ts +16 -37
- package/src/dht/recursive-operation/RecursiveOperationManager.ts +240 -0
- package/src/dht/{find/FindRpcLocal.ts → recursive-operation/RecursiveOperationRpcLocal.ts} +9 -9
- package/src/dht/{routing/FindRpcRemote.ts → recursive-operation/RecursiveOperationRpcRemote.ts} +10 -10
- package/src/dht/recursive-operation/RecursiveOperationSession.ts +224 -0
- package/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +25 -0
- package/src/dht/{find/FindSessionRpcRemote.ts → recursive-operation/RecursiveOperationSessionRpcRemote.ts} +8 -8
- package/src/dht/routing/Router.ts +45 -64
- package/src/dht/routing/RouterRpcLocal.ts +7 -6
- package/src/dht/routing/RouterRpcRemote.ts +9 -10
- package/src/dht/routing/RoutingSession.ts +59 -68
- package/src/dht/store/LocalDataStore.ts +47 -66
- package/src/dht/store/StoreManager.ts +217 -0
- package/src/dht/store/StoreRpcLocal.ts +26 -302
- package/src/dht/store/StoreRpcRemote.ts +9 -11
- package/src/exports.ts +2 -0
- package/src/helpers/MapWithTtl.ts +71 -0
- package/src/helpers/PeerID.ts +5 -0
- package/src/helpers/nodeId.ts +20 -0
- package/src/helpers/peerIdFromPeerDescriptor.ts +5 -3
- package/src/helpers/protoClasses.ts +4 -6
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +31 -32
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +11 -12
- package/src/proto/packages/dht/protos/DhtRpc.ts +49 -80
- package/src/rpc-protocol/DhtCallContext.ts +2 -1
- package/src/rpc-protocol/DhtRpcOptions.ts +2 -1
- package/src/transport/ITransport.ts +10 -1
- package/src/transport/ListeningRpcCommunicator.ts +1 -1
- package/src/transport/RoutingRpcCommunicator.ts +18 -12
- package/test/benchmark/Find.test.ts +8 -21
- package/test/benchmark/KademliaCorrectness.test.ts +11 -20
- package/test/benchmark/SortedContactListBenchmark.test.ts +9 -9
- package/test/benchmark/kademlia-simulation/Contact.ts +9 -8
- package/test/benchmark/kademlia-simulation/KademliaSimulation.ts +2 -2
- package/test/benchmark/kademlia-simulation/SimulationNode.ts +17 -17
- package/test/end-to-end/Layer0-Layer1.test.ts +10 -14
- package/test/end-to-end/Layer0.test.ts +15 -18
- package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +7 -9
- package/test/end-to-end/Layer0Webrtc-Layer1.test.ts +4 -10
- package/test/end-to-end/Layer0Webrtc.test.ts +5 -6
- package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +8 -16
- package/test/end-to-end/Layer1-Scale-Webrtc.test.ts +6 -13
- package/test/end-to-end/WebsocketConnectionRequest.test.ts +5 -6
- package/test/end-to-end/memory-leak.test.ts +6 -8
- package/test/integration/ConnectionLocking.test.ts +6 -13
- package/test/integration/ConnectionManager.test.ts +26 -43
- package/test/integration/DhtJoinPeerDiscovery.test.ts +5 -10
- package/test/integration/DhtNodeExternalAPI.test.ts +16 -22
- package/test/integration/DhtNodeRpcRemote.test.ts +13 -22
- package/test/integration/DhtRpc.test.ts +13 -18
- package/test/integration/Find.test.ts +10 -10
- package/test/integration/Layer1-scale.test.ts +17 -28
- package/test/integration/Mock-Layer1-Layer0.test.ts +25 -43
- package/test/integration/MultipleEntryPointJoining.test.ts +7 -7
- package/test/integration/ReplicateData.test.ts +28 -30
- package/test/integration/RouteMessage.test.ts +30 -27
- package/test/integration/RouterRpcRemote.test.ts +12 -18
- package/test/integration/RpcErrors.test.ts +8 -21
- package/test/integration/ScaleDownDht.test.ts +11 -10
- package/test/integration/SimultaneousConnections.test.ts +43 -67
- package/test/integration/Store.test.ts +23 -36
- package/test/integration/StoreAndDelete.test.ts +30 -50
- package/test/integration/StoreOnDhtWithTwoNodes.test.ts +16 -37
- package/test/integration/StoreRpcRemote.test.ts +20 -30
- package/test/integration/WebrtcConnectionManagement.test.ts +3 -13
- package/test/integration/WebrtcConnectorRpc.test.ts +3 -9
- package/test/integration/WebsocketConnectionManagement.test.ts +7 -10
- package/test/integration/WebsocketConnectorRpc.test.ts +8 -17
- package/test/unit/ConnectivityHelpers.test.ts +9 -17
- package/test/unit/DuplicateDetector.test.ts +7 -4
- package/test/unit/LocalDataStore.test.ts +66 -77
- package/test/unit/PeerManager.test.ts +31 -0
- package/test/unit/RandomContactList.test.ts +13 -8
- package/test/unit/{Finder.test.ts → RecursiveOperationManager.test.ts} +38 -43
- package/test/unit/RecursiveOperationSession.test.ts +68 -0
- package/test/unit/Router.test.ts +15 -22
- package/test/unit/RoutingSession.test.ts +23 -25
- package/test/unit/SortedContactList.test.ts +41 -26
- package/test/unit/StoreManager.test.ts +132 -0
- package/test/unit/WebsocketConnector.test.ts +27 -35
- package/test/unit/customMatchers.test.ts +16 -0
- package/test/utils/FakeTransport.ts +44 -0
- package/test/utils/customMatchers.ts +70 -0
- package/test/utils/mock/MockRpcCommunicator.ts +7 -0
- package/test/utils/mock/Router.ts +3 -2
- package/test/utils/mock/mockDataEntry.ts +36 -0
- package/test/utils/utils.ts +49 -87
- package/dist/src/dht/find/FindRpcLocal.d.ts +0 -14
- package/dist/src/dht/find/FindRpcLocal.js.map +0 -1
- package/dist/src/dht/find/FindSession.d.ts +0 -44
- package/dist/src/dht/find/FindSession.js +0 -150
- package/dist/src/dht/find/FindSession.js.map +0 -1
- package/dist/src/dht/find/FindSessionRpcLocal.d.ts +0 -12
- package/dist/src/dht/find/FindSessionRpcLocal.js +0 -17
- package/dist/src/dht/find/FindSessionRpcLocal.js.map +0 -1
- package/dist/src/dht/find/FindSessionRpcRemote.d.ts +0 -6
- package/dist/src/dht/find/FindSessionRpcRemote.js +0 -21
- package/dist/src/dht/find/FindSessionRpcRemote.js.map +0 -1
- package/dist/src/dht/find/Finder.d.ts +0 -49
- package/dist/src/dht/find/Finder.js +0 -197
- package/dist/src/dht/find/Finder.js.map +0 -1
- package/dist/src/dht/routing/FindRpcRemote.d.ts +0 -6
- package/dist/src/dht/routing/FindRpcRemote.js.map +0 -1
- package/src/dht/find/FindSession.ts +0 -183
- package/src/dht/find/FindSessionRpcLocal.ts +0 -25
- package/src/dht/find/Finder.ts +0 -295
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecursiveOperationManager = void 0;
|
|
4
|
+
const DhtRpc_1 = require("../../proto/packages/dht/protos/DhtRpc");
|
|
5
|
+
const RoutingSession_1 = require("../routing/RoutingSession");
|
|
6
|
+
const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
|
|
7
|
+
const utils_1 = require("@streamr/utils");
|
|
8
|
+
const RecursiveOperationSessionRpcRemote_1 = require("./RecursiveOperationSessionRpcRemote");
|
|
9
|
+
const RecursiveOperationSession_1 = require("./RecursiveOperationSession");
|
|
10
|
+
const ListeningRpcCommunicator_1 = require("../../transport/ListeningRpcCommunicator");
|
|
11
|
+
const DhtRpc_client_1 = require("../../proto/packages/dht/protos/DhtRpc.client");
|
|
12
|
+
const SortedContactList_1 = require("../contact/SortedContactList");
|
|
13
|
+
const getPreviousPeer_1 = require("../routing/getPreviousPeer");
|
|
14
|
+
const RouterRpcLocal_1 = require("../routing/RouterRpcLocal");
|
|
15
|
+
const RecursiveOperationRpcLocal_1 = require("./RecursiveOperationRpcLocal");
|
|
16
|
+
const nodeId_1 = require("../../helpers/nodeId");
|
|
17
|
+
const PeerManager_1 = require("../PeerManager");
|
|
18
|
+
const logger = new utils_1.Logger(module);
|
|
19
|
+
class RecursiveOperationManager {
|
|
20
|
+
constructor(config) {
|
|
21
|
+
this.ongoingSessions = new Map();
|
|
22
|
+
this.stopped = false;
|
|
23
|
+
this.config = config;
|
|
24
|
+
this.registerLocalRpcMethods();
|
|
25
|
+
}
|
|
26
|
+
registerLocalRpcMethods() {
|
|
27
|
+
const rpcLocal = new RecursiveOperationRpcLocal_1.RecursiveOperationRpcLocal({
|
|
28
|
+
doRouteRequest: (routedMessage) => this.doRouteRequest(routedMessage),
|
|
29
|
+
addContact: (contact) => this.config.addContact(contact),
|
|
30
|
+
isMostLikelyDuplicate: (requestId) => this.config.router.isMostLikelyDuplicate(requestId),
|
|
31
|
+
addToDuplicateDetector: (requestId) => this.config.router.addToDuplicateDetector(requestId)
|
|
32
|
+
});
|
|
33
|
+
this.config.rpcCommunicator.registerRpcMethod(DhtRpc_1.RouteMessageWrapper, DhtRpc_1.RouteMessageAck, 'routeRequest', async (routedMessage) => {
|
|
34
|
+
if (this.stopped) {
|
|
35
|
+
return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage, DhtRpc_1.RouteMessageError.STOPPED);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return rpcLocal.routeRequest(routedMessage);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async execute(targetId, operation, excludedPeer, waitForCompletion = true) {
|
|
43
|
+
if (this.stopped) {
|
|
44
|
+
return { closestNodes: [] };
|
|
45
|
+
}
|
|
46
|
+
const session = new RecursiveOperationSession_1.RecursiveOperationSession({
|
|
47
|
+
transport: this.config.sessionTransport,
|
|
48
|
+
targetId,
|
|
49
|
+
localPeerDescriptor: this.config.localPeerDescriptor,
|
|
50
|
+
// TODO use config option or named constant?
|
|
51
|
+
waitedRoutingPathCompletions: this.config.connections.size > 1 ? 2 : 1,
|
|
52
|
+
operation,
|
|
53
|
+
// TODO would it make sense to give excludedPeer as one of the fields RecursiveOperationSession?
|
|
54
|
+
doRouteRequest: (routedMessage) => {
|
|
55
|
+
return this.doRouteRequest(routedMessage, excludedPeer);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
if (this.config.connections.size === 0) {
|
|
59
|
+
const data = this.config.localDataStore.getEntries(targetId);
|
|
60
|
+
session.onResponseReceived([this.config.localPeerDescriptor], [this.config.localPeerDescriptor], Array.from(data.values()), true);
|
|
61
|
+
return session.getResults();
|
|
62
|
+
}
|
|
63
|
+
this.ongoingSessions.set(session.getId(), session);
|
|
64
|
+
if (waitForCompletion === true) {
|
|
65
|
+
try {
|
|
66
|
+
await (0, utils_1.runAndWaitForEvents3)([() => session.start(this.config.serviceId)], [[session, 'completed']],
|
|
67
|
+
// TODO use config option or named constant?
|
|
68
|
+
15000);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
logger.debug(`start failed with error ${err}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
session.start(this.config.serviceId);
|
|
76
|
+
// Wait for delete operation to be sent out by the router
|
|
77
|
+
// TODO: Add a feature to wait for the router to pass the message?
|
|
78
|
+
await (0, utils_1.wait)(50);
|
|
79
|
+
}
|
|
80
|
+
if (operation === DhtRpc_1.RecursiveOperation.FETCH_DATA) {
|
|
81
|
+
const dataEntries = Array.from(this.config.localDataStore.getEntries(targetId).values());
|
|
82
|
+
if (dataEntries.length > 0) {
|
|
83
|
+
this.sendResponse([], this.config.localPeerDescriptor, session.getId(), [], dataEntries, true);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (operation === DhtRpc_1.RecursiveOperation.DELETE_DATA) {
|
|
87
|
+
this.config.localDataStore.markAsDeleted(targetId, (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(this.config.localPeerDescriptor));
|
|
88
|
+
}
|
|
89
|
+
this.ongoingSessions.delete(session.getId());
|
|
90
|
+
session.stop();
|
|
91
|
+
return session.getResults();
|
|
92
|
+
}
|
|
93
|
+
sendResponse(routingPath, targetPeerDescriptor, serviceId, closestNodes, dataEntries, noCloserNodesFound = false) {
|
|
94
|
+
const isOwnNode = (0, peerIdFromPeerDescriptor_1.areEqualPeerDescriptors)(this.config.localPeerDescriptor, targetPeerDescriptor);
|
|
95
|
+
if (isOwnNode && this.ongoingSessions.has(serviceId)) {
|
|
96
|
+
this.ongoingSessions.get(serviceId)
|
|
97
|
+
.onResponseReceived(routingPath, closestNodes, dataEntries, noCloserNodesFound);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
// TODO use config option or named constant?
|
|
101
|
+
const remoteCommunicator = new ListeningRpcCommunicator_1.ListeningRpcCommunicator(serviceId, this.config.sessionTransport, { rpcRequestTimeout: 15000 });
|
|
102
|
+
const rpcRemote = new RecursiveOperationSessionRpcRemote_1.RecursiveOperationSessionRpcRemote(this.config.localPeerDescriptor, targetPeerDescriptor, serviceId, remoteCommunicator, DhtRpc_client_1.RecursiveOperationSessionRpcClient,
|
|
103
|
+
// TODO use config option or named constant?
|
|
104
|
+
10000);
|
|
105
|
+
rpcRemote.sendResponse(routingPath, closestNodes, dataEntries, noCloserNodesFound);
|
|
106
|
+
remoteCommunicator.destroy();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
doRouteRequest(routedMessage, excludedPeer) {
|
|
110
|
+
if (this.stopped) {
|
|
111
|
+
return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage, DhtRpc_1.RouteMessageError.STOPPED);
|
|
112
|
+
}
|
|
113
|
+
const targetId = (0, nodeId_1.getNodeIdFromBinary)(routedMessage.target);
|
|
114
|
+
const request = routedMessage.message.body.recursiveOperationRequest;
|
|
115
|
+
// TODO use config option or named constant?
|
|
116
|
+
const closestPeersToDestination = this.getClosestConnections(routedMessage.target, 5);
|
|
117
|
+
const dataEntries = (request.operation === DhtRpc_1.RecursiveOperation.FETCH_DATA)
|
|
118
|
+
? Array.from(this.config.localDataStore.getEntries((0, utils_1.hexToBinary)(targetId)).values())
|
|
119
|
+
: [];
|
|
120
|
+
if (request.operation === DhtRpc_1.RecursiveOperation.DELETE_DATA) {
|
|
121
|
+
this.config.localDataStore.markAsDeleted((0, utils_1.hexToBinary)(targetId), (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(routedMessage.sourcePeer));
|
|
122
|
+
}
|
|
123
|
+
if ((0, utils_1.areEqualBinaries)(this.config.localPeerDescriptor.nodeId, routedMessage.target)) {
|
|
124
|
+
// TODO this is also very similar case to what we do at line 255, could simplify the code paths?
|
|
125
|
+
this.sendResponse(routedMessage.routingPath, routedMessage.sourcePeer, request.sessionId, closestPeersToDestination, dataEntries, true);
|
|
126
|
+
return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const ack = this.config.router.doRouteMessage(routedMessage, RoutingSession_1.RoutingMode.RECURSIVE, excludedPeer);
|
|
130
|
+
if ((ack.error === undefined) || (ack.error === DhtRpc_1.RouteMessageError.NO_TARGETS)) {
|
|
131
|
+
const noCloserContactsFound = (ack.error === DhtRpc_1.RouteMessageError.NO_TARGETS) ||
|
|
132
|
+
(closestPeersToDestination.length > 0
|
|
133
|
+
&& (0, getPreviousPeer_1.getPreviousPeer)(routedMessage)
|
|
134
|
+
&& !this.isPeerCloserToIdThanSelf(closestPeersToDestination[0], targetId));
|
|
135
|
+
this.sendResponse(routedMessage.routingPath, routedMessage.sourcePeer, request.sessionId, closestPeersToDestination, dataEntries, noCloserContactsFound);
|
|
136
|
+
}
|
|
137
|
+
return ack;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
getClosestConnections(nodeId, limit) {
|
|
141
|
+
const connectedPeers = Array.from(this.config.connections.values());
|
|
142
|
+
const closestPeers = new SortedContactList_1.SortedContactList({
|
|
143
|
+
referenceId: (0, nodeId_1.getNodeIdFromBinary)(nodeId),
|
|
144
|
+
maxSize: limit,
|
|
145
|
+
allowToContainReferenceId: true,
|
|
146
|
+
emitEvents: false
|
|
147
|
+
});
|
|
148
|
+
closestPeers.addContacts(connectedPeers);
|
|
149
|
+
return closestPeers.getClosestContacts(limit).map((peer) => peer.getPeerDescriptor());
|
|
150
|
+
}
|
|
151
|
+
isPeerCloserToIdThanSelf(peer, compareToId) {
|
|
152
|
+
const distance1 = (0, PeerManager_1.getDistance)((0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(peer), compareToId);
|
|
153
|
+
const distance2 = (0, PeerManager_1.getDistance)((0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(this.config.localPeerDescriptor), compareToId);
|
|
154
|
+
return distance1 < distance2;
|
|
155
|
+
}
|
|
156
|
+
stop() {
|
|
157
|
+
this.stopped = true;
|
|
158
|
+
this.ongoingSessions.forEach((session, _id) => {
|
|
159
|
+
session.stop();
|
|
160
|
+
});
|
|
161
|
+
this.ongoingSessions.clear();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.RecursiveOperationManager = RecursiveOperationManager;
|
|
165
|
+
//# sourceMappingURL=RecursiveOperationManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecursiveOperationManager.js","sourceRoot":"","sources":["../../../../src/dht/recursive-operation/RecursiveOperationManager.ts"],"names":[],"mappings":";;;AAAA,mEAQ+C;AAE/C,8DAAuD;AACvD,qFAA6G;AAC7G,0CAAkG;AAElG,6FAAyF;AACzF,2EAAwG;AAIxG,uFAAmF;AACnF,iFAAkG;AAClG,oEAAgE;AAChE,gEAA4D;AAC5D,8DAAiE;AAEjE,6EAAyE;AACzE,iDAAkE;AAClE,gDAA4C;AAe5C,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAa,yBAAyB;IAMlC,YAAY,MAAuC;QAJ3C,oBAAe,GAA2C,IAAI,GAAG,EAAE,CAAA;QACnE,YAAO,GAAG,KAAK,CAAA;QAInB,IAAI,CAAC,MA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teMessageAck, RouteMessageWrapper } from '../../proto/packages/dht/protos/DhtRpc';
|
|
2
|
+
import { IRecursiveOperationRpc } from '../../proto/packages/dht/protos/DhtRpc.server';
|
|
3
|
+
interface RecursiveOperationRpcLocalConfig {
|
|
4
|
+
doRouteRequest: (routedMessage: RouteMessageWrapper) => RouteMessageAck;
|
|
5
|
+
addContact: (contact: PeerDescriptor, setActive?: boolean) => void;
|
|
6
|
+
isMostLikelyDuplicate: (requestId: string) => boolean;
|
|
7
|
+
addToDuplicateDetector: (requestId: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare class RecursiveOperationRpcLocal implements IRecursiveOperationRpc {
|
|
10
|
+
private readonly config;
|
|
11
|
+
constructor(config: RecursiveOperationRpcLocalConfig);
|
|
12
|
+
routeRequest(routedMessage: RouteMessageWrapper): Promise<RouteMessageAck>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
package/dist/src/dht/{find/FindRpcLocal.js → recursive-operation/RecursiveOperationRpcLocal.js}
RENAMED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RecursiveOperationRpcLocal = void 0;
|
|
4
4
|
const utils_1 = require("@streamr/utils");
|
|
5
5
|
const DhtRpc_1 = require("../../proto/packages/dht/protos/DhtRpc");
|
|
6
6
|
const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
|
|
7
7
|
const RouterRpcLocal_1 = require("../routing/RouterRpcLocal");
|
|
8
8
|
const getPreviousPeer_1 = require("../routing/getPreviousPeer");
|
|
9
9
|
const logger = new utils_1.Logger(module);
|
|
10
|
-
class
|
|
10
|
+
class RecursiveOperationRpcLocal {
|
|
11
11
|
constructor(config) {
|
|
12
12
|
this.config = config;
|
|
13
13
|
}
|
|
14
|
-
async
|
|
14
|
+
async routeRequest(routedMessage) {
|
|
15
15
|
if (this.config.isMostLikelyDuplicate(routedMessage.requestId)) {
|
|
16
16
|
return (0, RouterRpcLocal_1.createRouteMessageAck)(routedMessage, DhtRpc_1.RouteMessageError.DUPLICATE);
|
|
17
17
|
}
|
|
18
18
|
const senderId = (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)((0, getPreviousPeer_1.getPreviousPeer)(routedMessage) ?? routedMessage.sourcePeer);
|
|
19
|
-
logger.trace(`Received
|
|
19
|
+
logger.trace(`Received routeRequest call from ${senderId}`);
|
|
20
20
|
this.config.addContact(routedMessage.sourcePeer, true);
|
|
21
21
|
this.config.addToDuplicateDetector(routedMessage.requestId);
|
|
22
|
-
return this.config.
|
|
22
|
+
return this.config.doRouteRequest(routedMessage);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
exports.
|
|
26
|
-
//# sourceMappingURL=
|
|
25
|
+
exports.RecursiveOperationRpcLocal = RecursiveOperationRpcLocal;
|
|
26
|
+
//# sourceMappingURL=RecursiveOperationRpcLocal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecursiveOperationRpcLocal.js","sourceRoot":"","sources":["../../../../src/dht/recursive-operation/RecursiveOperationRpcLocal.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AACvC,mEAAgI;AAEhI,qFAAoF;AACpF,8DAAiE;AACjE,gEAA4D;AAE5D,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AASjC,MAAa,0BAA0B;IAInC,YAAY,MAAwC;QAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,aAAkC;QACjD,IAAI,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YAC5D,OAAO,IAAA,sCAAqB,EAAC,aAAa,EAAE,0BAAiB,CAAC,SAAS,CAAC,CAAA;SAC3E;QACD,MAAM,QAAQ,GAAG,IAAA,sDAA2B,EAAC,IAAA,iCAAe,EAAC,aAAa,CAAC,IAAI,aAAa,CAAC,UAAW,CAAC,CAAA;QACzG,MAAM,CAAC,KAAK,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAA;QAC3D,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,UAAW,EAAE,IAAI,CAAC,CAAA;QACvD,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAA;QAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,CAAA;IACpD,CAAC;CACJ;AAlBD,gEAkBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RouteMessageWrapper } from '../../proto/packages/dht/protos/DhtRpc';
|
|
2
|
+
import { RecursiveOperationRpcClient } from '../../proto/packages/dht/protos/DhtRpc.client';
|
|
3
|
+
import { RpcRemote } from '../contact/RpcRemote';
|
|
4
|
+
export declare class RecursiveOperationRpcRemote extends RpcRemote<RecursiveOperationRpcClient> {
|
|
5
|
+
routeRequest(params: RouteMessageWrapper): Promise<boolean>;
|
|
6
|
+
}
|
package/dist/src/dht/{routing/FindRpcRemote.js → recursive-operation/RecursiveOperationRpcRemote.js}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RecursiveOperationRpcRemote = void 0;
|
|
4
|
+
const utils_1 = require("@streamr/utils");
|
|
4
5
|
const uuid_1 = require("uuid");
|
|
5
6
|
const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
|
|
6
7
|
const RpcRemote_1 = require("../contact/RpcRemote");
|
|
7
|
-
const
|
|
8
|
-
const getPreviousPeer_1 = require("./getPreviousPeer");
|
|
8
|
+
const getPreviousPeer_1 = require("../routing/getPreviousPeer");
|
|
9
9
|
const logger = new utils_1.Logger(module);
|
|
10
|
-
class
|
|
11
|
-
async
|
|
10
|
+
class RecursiveOperationRpcRemote extends RpcRemote_1.RpcRemote {
|
|
11
|
+
async routeRequest(params) {
|
|
12
12
|
const message = {
|
|
13
|
-
|
|
13
|
+
target: params.target,
|
|
14
14
|
sourcePeer: params.sourcePeer,
|
|
15
15
|
message: params.message,
|
|
16
16
|
requestId: params.requestId ?? (0, uuid_1.v4)(),
|
|
@@ -18,10 +18,10 @@ class FindRpcRemote extends RpcRemote_1.RpcRemote {
|
|
|
18
18
|
routingPath: params.routingPath
|
|
19
19
|
};
|
|
20
20
|
const options = this.formDhtRpcOptions({
|
|
21
|
-
|
|
21
|
+
connect: false
|
|
22
22
|
});
|
|
23
23
|
try {
|
|
24
|
-
const ack = await this.getClient().
|
|
24
|
+
const ack = await this.getClient().routeRequest(message, options);
|
|
25
25
|
if (ack.error !== undefined) {
|
|
26
26
|
logger.trace('Next hop responded with error ' + ack.error);
|
|
27
27
|
return false;
|
|
@@ -33,11 +33,11 @@ class FindRpcRemote extends RpcRemote_1.RpcRemote {
|
|
|
33
33
|
? (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(previousPeer)
|
|
34
34
|
: (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(params.sourcePeer);
|
|
35
35
|
// eslint-disable-next-line max-len
|
|
36
|
-
logger.debug(`Failed to send
|
|
36
|
+
logger.debug(`Failed to send routeRequest message from ${fromNode} to ${(0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(this.getPeerDescriptor())} with: ${err}`);
|
|
37
37
|
return false;
|
|
38
38
|
}
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
exports.
|
|
43
|
-
//# sourceMappingURL=
|
|
42
|
+
exports.RecursiveOperationRpcRemote = RecursiveOperationRpcRemote;
|
|
43
|
+
//# sourceMappingURL=RecursiveOperationRpcRemote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Recursive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,KAAK,CAAC,4CAA4C,QAAQ,OAAO,IAAA,sDAA2B,EAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,CAAA;YAC7I,OAAO,KAAK,CAAA;SACf;QACD,OAAO,IAAI,CAAA;IACf,CAAC;CACJ;AA/BD,kEA+BC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { DataEntry, PeerDescriptor, RecursiveOperation, RouteMessageWrapper, RouteMessageAck } from '../../proto/packages/dht/protos/DhtRpc';
|
|
3
|
+
import { ITransport } from '../../transport/ITransport';
|
|
4
|
+
import { RecursiveOperationResult } from './RecursiveOperationManager';
|
|
5
|
+
import { ServiceID } from '../../types/ServiceID';
|
|
6
|
+
export interface RecursiveOperationSessionEvents {
|
|
7
|
+
completed: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface RecursiveOperationSessionConfig {
|
|
10
|
+
transport: ITransport;
|
|
11
|
+
targetId: Uint8Array;
|
|
12
|
+
localPeerDescriptor: PeerDescriptor;
|
|
13
|
+
waitedRoutingPathCompletions: number;
|
|
14
|
+
operation: RecursiveOperation;
|
|
15
|
+
doRouteRequest: (routedMessage: RouteMessageWrapper) => RouteMessageAck;
|
|
16
|
+
}
|
|
17
|
+
export declare class RecursiveOperationSession extends EventEmitter<RecursiveOperationSessionEvents> {
|
|
18
|
+
private readonly id;
|
|
19
|
+
private readonly rpcCommunicator;
|
|
20
|
+
private results;
|
|
21
|
+
private foundData;
|
|
22
|
+
private allKnownHops;
|
|
23
|
+
private reportedHops;
|
|
24
|
+
private timeoutTask?;
|
|
25
|
+
private completionEventEmitted;
|
|
26
|
+
private noCloserNodesReceivedCounter;
|
|
27
|
+
private readonly config;
|
|
28
|
+
constructor(config: RecursiveOperationSessionConfig);
|
|
29
|
+
private registerLocalRpcMethods;
|
|
30
|
+
start(serviceId: ServiceID): void;
|
|
31
|
+
private wrapRequest;
|
|
32
|
+
private isCompleted;
|
|
33
|
+
private hasNonStaleData;
|
|
34
|
+
onResponseReceived(routingPath: PeerDescriptor[], nodes: PeerDescriptor[], dataEntries: DataEntry[], noCloserNodesFound: boolean): void;
|
|
35
|
+
private addKnownHops;
|
|
36
|
+
private setHopAsReported;
|
|
37
|
+
private processFoundData;
|
|
38
|
+
private onNoCloserPeersFound;
|
|
39
|
+
getResults(): RecursiveOperationResult;
|
|
40
|
+
getId(): string;
|
|
41
|
+
stop(): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RecursiveOperationSession = void 0;
|
|
7
|
+
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
const DhtRpc_1 = require("../../proto/packages/dht/protos/DhtRpc");
|
|
10
|
+
const ListeningRpcCommunicator_1 = require("../../transport/ListeningRpcCommunicator");
|
|
11
|
+
const Contact_1 = require("../contact/Contact");
|
|
12
|
+
const SortedContactList_1 = require("../contact/SortedContactList");
|
|
13
|
+
const peerIdFromPeerDescriptor_1 = require("../../helpers/peerIdFromPeerDescriptor");
|
|
14
|
+
const RecursiveOperationSessionRpcLocal_1 = require("./RecursiveOperationSessionRpcLocal");
|
|
15
|
+
const nodeId_1 = require("../../helpers/nodeId");
|
|
16
|
+
class RecursiveOperationSession extends eventemitter3_1.default {
|
|
17
|
+
constructor(config) {
|
|
18
|
+
super();
|
|
19
|
+
this.id = (0, uuid_1.v4)();
|
|
20
|
+
this.foundData = new Map();
|
|
21
|
+
this.allKnownHops = new Set();
|
|
22
|
+
this.reportedHops = new Set();
|
|
23
|
+
this.completionEventEmitted = false;
|
|
24
|
+
this.noCloserNodesReceivedCounter = 0;
|
|
25
|
+
this.config = config;
|
|
26
|
+
this.results = new SortedContactList_1.SortedContactList({
|
|
27
|
+
referenceId: (0, nodeId_1.getNodeIdFromBinary)(config.targetId),
|
|
28
|
+
maxSize: 10,
|
|
29
|
+
allowToContainReferenceId: true,
|
|
30
|
+
emitEvents: false
|
|
31
|
+
});
|
|
32
|
+
this.rpcCommunicator = new ListeningRpcCommunicator_1.ListeningRpcCommunicator(this.id, config.transport, {
|
|
33
|
+
rpcRequestTimeout: 15000 // TODO use config option or named constant?
|
|
34
|
+
});
|
|
35
|
+
this.registerLocalRpcMethods();
|
|
36
|
+
}
|
|
37
|
+
registerLocalRpcMethods() {
|
|
38
|
+
const rpcLocal = new RecursiveOperationSessionRpcLocal_1.RecursiveOperationSessionRpcLocal({
|
|
39
|
+
onResponseReceived: (routingPath, nodes, dataEntries, noCloserNodesFound) => {
|
|
40
|
+
this.onResponseReceived(routingPath, nodes, dataEntries, noCloserNodesFound);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
this.rpcCommunicator.registerRpcNotification(DhtRpc_1.RecursiveOperationResponse, 'sendResponse', (req) => rpcLocal.sendResponse(req));
|
|
44
|
+
}
|
|
45
|
+
start(serviceId) {
|
|
46
|
+
const routeMessage = this.wrapRequest(serviceId);
|
|
47
|
+
this.config.doRouteRequest(routeMessage);
|
|
48
|
+
}
|
|
49
|
+
wrapRequest(serviceId) {
|
|
50
|
+
const request = {
|
|
51
|
+
sessionId: this.getId(),
|
|
52
|
+
operation: this.config.operation
|
|
53
|
+
};
|
|
54
|
+
const msg = {
|
|
55
|
+
messageType: DhtRpc_1.MessageType.RECURSIVE_OPERATION_REQUEST,
|
|
56
|
+
messageId: (0, uuid_1.v4)(),
|
|
57
|
+
serviceId,
|
|
58
|
+
body: {
|
|
59
|
+
oneofKind: 'recursiveOperationRequest',
|
|
60
|
+
recursiveOperationRequest: request
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const routeMessage = {
|
|
64
|
+
message: msg,
|
|
65
|
+
requestId: (0, uuid_1.v4)(),
|
|
66
|
+
target: this.config.targetId,
|
|
67
|
+
sourcePeer: this.config.localPeerDescriptor,
|
|
68
|
+
reachableThrough: [],
|
|
69
|
+
routingPath: []
|
|
70
|
+
};
|
|
71
|
+
return routeMessage;
|
|
72
|
+
}
|
|
73
|
+
isCompleted() {
|
|
74
|
+
const unreportedHops = new Set(this.allKnownHops);
|
|
75
|
+
this.reportedHops.forEach((id) => {
|
|
76
|
+
unreportedHops.delete(id);
|
|
77
|
+
});
|
|
78
|
+
if (this.noCloserNodesReceivedCounter >= 1 && unreportedHops.size === 0) {
|
|
79
|
+
if (this.config.operation === DhtRpc_1.RecursiveOperation.FETCH_DATA
|
|
80
|
+
&& (this.hasNonStaleData() || this.noCloserNodesReceivedCounter >= this.config.waitedRoutingPathCompletions)) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
else if (this.config.operation === DhtRpc_1.RecursiveOperation.FETCH_DATA) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
hasNonStaleData() {
|
|
91
|
+
return Array.from(this.foundData.values()).some((entry) => entry.stale === false);
|
|
92
|
+
}
|
|
93
|
+
onResponseReceived(routingPath, nodes, dataEntries, noCloserNodesFound) {
|
|
94
|
+
this.addKnownHops(routingPath);
|
|
95
|
+
if (routingPath.length >= 1) {
|
|
96
|
+
this.setHopAsReported(routingPath[routingPath.length - 1]);
|
|
97
|
+
}
|
|
98
|
+
nodes.forEach((descriptor) => {
|
|
99
|
+
this.results.addContact(new Contact_1.Contact(descriptor));
|
|
100
|
+
});
|
|
101
|
+
this.processFoundData(dataEntries);
|
|
102
|
+
if (noCloserNodesFound) {
|
|
103
|
+
this.onNoCloserPeersFound();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
addKnownHops(routingPath) {
|
|
107
|
+
const localNodeId = (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(this.config.localPeerDescriptor);
|
|
108
|
+
routingPath.forEach((desc) => {
|
|
109
|
+
const newNodeId = (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(desc);
|
|
110
|
+
if (!(0, nodeId_1.areEqualNodeIds)(localNodeId, newNodeId)) {
|
|
111
|
+
this.allKnownHops.add(newNodeId);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
setHopAsReported(desc) {
|
|
116
|
+
const localNodeId = (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(this.config.localPeerDescriptor);
|
|
117
|
+
const newNodeId = (0, peerIdFromPeerDescriptor_1.getNodeIdFromPeerDescriptor)(desc);
|
|
118
|
+
if (!(0, nodeId_1.areEqualNodeIds)(localNodeId, newNodeId)) {
|
|
119
|
+
this.reportedHops.add(newNodeId);
|
|
120
|
+
}
|
|
121
|
+
if (this.isCompleted()) {
|
|
122
|
+
if (!this.completionEventEmitted && this.isCompleted()) {
|
|
123
|
+
if (this.timeoutTask) {
|
|
124
|
+
clearTimeout(this.timeoutTask);
|
|
125
|
+
this.timeoutTask = undefined;
|
|
126
|
+
}
|
|
127
|
+
this.emit('completed');
|
|
128
|
+
this.completionEventEmitted = true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
processFoundData(dataEntries) {
|
|
133
|
+
dataEntries.forEach((entry) => {
|
|
134
|
+
const creatorNodeId = (0, nodeId_1.getNodeIdFromBinary)(entry.creator);
|
|
135
|
+
const existingEntry = this.foundData.get(creatorNodeId);
|
|
136
|
+
if (!existingEntry || existingEntry.createdAt < entry.createdAt
|
|
137
|
+
|| (existingEntry.createdAt <= entry.createdAt && entry.deleted)) {
|
|
138
|
+
this.foundData.set(creatorNodeId, entry);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
onNoCloserPeersFound() {
|
|
143
|
+
this.noCloserNodesReceivedCounter += 1;
|
|
144
|
+
if (this.isCompleted()) {
|
|
145
|
+
this.emit('completed');
|
|
146
|
+
this.completionEventEmitted = true;
|
|
147
|
+
if (this.timeoutTask) {
|
|
148
|
+
clearTimeout(this.timeoutTask);
|
|
149
|
+
this.timeoutTask = undefined;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
if (!this.timeoutTask && !this.completionEventEmitted) {
|
|
154
|
+
this.timeoutTask = setTimeout(() => {
|
|
155
|
+
if (!this.completionEventEmitted) {
|
|
156
|
+
this.emit('completed');
|
|
157
|
+
this.completionEventEmitted = true;
|
|
158
|
+
}
|
|
159
|
+
}, 4000); // TODO use config option or named constant?
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
getResults() {
|
|
164
|
+
return {
|
|
165
|
+
closestNodes: this.results.getAllContacts().map((contact) => contact.getPeerDescriptor()),
|
|
166
|
+
dataEntries: Array.from(this.foundData.values())
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
getId() {
|
|
170
|
+
return this.id;
|
|
171
|
+
}
|
|
172
|
+
stop() {
|
|
173
|
+
if (this.timeoutTask) {
|
|
174
|
+
clearTimeout(this.timeoutTask);
|
|
175
|
+
this.timeoutTask = undefined;
|
|
176
|
+
}
|
|
177
|
+
this.rpcCommunicator.destroy();
|
|
178
|
+
this.emit('completed');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.RecursiveOperationSession = RecursiveOperationSession;
|
|
182
|
+
//# sourceMappingURL=RecursiveOperationSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecursiveOperationSession.js","sourceRoot":"","sources":["../../../../src/dht/recursive-operation/RecursiveOperationSession.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AACxC,+BAAyB;AACzB,mEAU+C;AAE/C,uFAAmF;AACnF,gDAA4C;AAC5C,oEAAgE;AAEhE,qFAAoF;AAEpF,2FAA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Y,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YAC9B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;SAC/B;QACD,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAA;QAC9B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAC1B,CAAC;CACJ;AA3LD,8DA2LC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IRecursiveOperationSessionRpc } from '../../proto/packages/dht/protos/DhtRpc.server';
|
|
2
|
+
import { Empty } from '../../proto/google/protobuf/empty';
|
|
3
|
+
import { DataEntry, RecursiveOperationResponse, PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc';
|
|
4
|
+
interface RecursiveOperationSessionRpcLocalConfig {
|
|
5
|
+
onResponseReceived: (routingPath: PeerDescriptor[], nodes: PeerDescriptor[], dataEntries: DataEntry[], noCloserNodesFound: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare class RecursiveOperationSessionRpcLocal implements IRecursiveOperationSessionRpc {
|
|
8
|
+
private readonly config;
|
|
9
|
+
constructor(config: RecursiveOperationSessionRpcLocalConfig);
|
|
10
|
+
sendResponse(report: RecursiveOperationResponse): Promise<Empty>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecursiveOperationSessionRpcLocal = void 0;
|
|
4
|
+
const utils_1 = require("@streamr/utils");
|
|
5
|
+
const logger = new utils_1.Logger(module);
|
|
6
|
+
class RecursiveOperationSessionRpcLocal {
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
async sendResponse(report) {
|
|
11
|
+
logger.trace('RecursiveOperationResponse arrived: ' + JSON.stringify(report));
|
|
12
|
+
this.config.onResponseReceived(report.routingPath, report.closestConnectedPeers, report.dataEntries, report.noCloserNodesFound);
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.RecursiveOperationSessionRpcLocal = RecursiveOperationSessionRpcLocal;
|
|
17
|
+
//# sourceMappingURL=RecursiveOperationSessionRpcLocal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecursiveOperationSessionRpcLocal.js","sourceRoot":"","sources":["../../../../src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts"],"names":[],"mappings":";;;AAGA,0CAAuC;AAEvC,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAMjC,MAAa,iCAAiC;IAI1C,YAAY,MAA+C;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAAkC;QACjD,MAAM,CAAC,KAAK,CAAC,sCAAsC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;QAC7E,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAA;QAC/H,OAAO,EAAE,CAAA;IACb,CAAC;CACJ;AAbD,8EAaC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DataEntry, PeerDescriptor } from '../../proto/packages/dht/protos/DhtRpc';
|
|
2
|
+
import { RecursiveOperationSessionRpcClient } from '../../proto/packages/dht/protos/DhtRpc.client';
|
|
3
|
+
import { RpcRemote } from '../contact/RpcRemote';
|
|
4
|
+
export declare class RecursiveOperationSessionRpcRemote extends RpcRemote<RecursiveOperationSessionRpcClient> {
|
|
5
|
+
sendResponse(routingPath: PeerDescriptor[], closestNodes: PeerDescriptor[], dataEntries: DataEntry[], noCloserNodesFound: boolean): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecursiveOperationSessionRpcRemote = void 0;
|
|
4
|
+
const utils_1 = require("@streamr/utils");
|
|
5
|
+
const RpcRemote_1 = require("../contact/RpcRemote");
|
|
6
|
+
const logger = new utils_1.Logger(module);
|
|
7
|
+
class RecursiveOperationSessionRpcRemote extends RpcRemote_1.RpcRemote {
|
|
8
|
+
sendResponse(routingPath, closestNodes, dataEntries, noCloserNodesFound) {
|
|
9
|
+
const report = {
|
|
10
|
+
routingPath,
|
|
11
|
+
closestConnectedPeers: closestNodes,
|
|
12
|
+
dataEntries,
|
|
13
|
+
noCloserNodesFound
|
|
14
|
+
};
|
|
15
|
+
this.getClient().sendResponse(report, this.formDhtRpcOptions()).catch((_e) => {
|
|
16
|
+
logger.trace('Failed to send RecursiveOperationResponse');
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.RecursiveOperationSessionRpcRemote = RecursiveOperationSessionRpcRemote;
|
|
21
|
+
//# sourceMappingURL=RecursiveOperationSessionRpcRemote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecursiveOperationSessionRpcRemote.js","sourceRoot":"","sources":["../../../../src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.ts"],"names":[],"mappings":";;;AAAA,0CAAuC;AAOvC,oDAAgD;AAEhD,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAa,kCAAmC,SAAQ,qBAA6C;IAEjG,YAAY,CACR,WAA6B,EAC7B,YAA8B,EAC9B,WAAwB,EACxB,kBAA2B;QAE3B,MAAM,MAAM,GAA+B;YACvC,WAAW;YACX,qBAAqB,EAAE,YAAY;YACnC,WAAW;YACX,kBAAkB;SACrB,CAAA;QACD,IAAI,CAAC,SAAS,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE;YACzE,MAAM,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAA;QAC7D,CAAC,CAAC,CAAA;IACN,CAAC;CACJ;AAlBD,gFAkBC"}
|