@streamr/dht 103.1.2 → 103.2.0-experiment.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/exports-browser.cjs +7636 -0
- package/dist/exports-browser.cjs.map +1 -0
- package/dist/exports-browser.d.ts +1321 -0
- package/dist/exports-browser.js +7611 -0
- package/dist/exports-browser.js.map +1 -0
- package/dist/exports-nodejs.cjs +7833 -0
- package/dist/exports-nodejs.cjs.map +1 -0
- package/dist/exports-nodejs.d.ts +1321 -0
- package/dist/exports-nodejs.js +7808 -0
- package/dist/exports-nodejs.js.map +1 -0
- package/package.json +41 -25
- package/dist/generated/google/protobuf/any.d.ts +0 -180
- package/dist/generated/google/protobuf/any.js +0 -155
- package/dist/generated/google/protobuf/any.js.map +0 -1
- package/dist/generated/google/protobuf/empty.d.ts +0 -31
- package/dist/generated/google/protobuf/empty.js +0 -45
- package/dist/generated/google/protobuf/empty.js.map +0 -1
- package/dist/generated/google/protobuf/timestamp.d.ts +0 -156
- package/dist/generated/google/protobuf/timestamp.js +0 -136
- package/dist/generated/google/protobuf/timestamp.js.map +0 -1
- package/dist/generated/packages/dht/protos/DhtRpc.client.d.ts +0 -371
- package/dist/generated/packages/dht/protos/DhtRpc.client.js +0 -292
- package/dist/generated/packages/dht/protos/DhtRpc.client.js.map +0 -1
- package/dist/generated/packages/dht/protos/DhtRpc.d.ts +0 -1031
- package/dist/generated/packages/dht/protos/DhtRpc.js +0 -702
- package/dist/generated/packages/dht/protos/DhtRpc.js.map +0 -1
- package/dist/generated/packages/dht/protos/DhtRpc.server.d.ts +0 -168
- package/dist/generated/packages/dht/protos/DhtRpc.server.js +0 -3
- package/dist/generated/packages/dht/protos/DhtRpc.server.js.map +0 -1
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.d.ts +0 -87
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.js +0 -66
- package/dist/generated/packages/proto-rpc/protos/ProtoRpc.js.map +0 -1
- package/dist/package.json +0 -61
- package/dist/src/connection/Connection.d.ts +0 -12
- package/dist/src/connection/Connection.js +0 -30
- package/dist/src/connection/Connection.js.map +0 -1
- package/dist/src/connection/ConnectionLockRpcLocal.d.ts +0 -22
- package/dist/src/connection/ConnectionLockRpcLocal.js +0 -54
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +0 -1
- package/dist/src/connection/ConnectionLockRpcRemote.d.ts +0 -10
- package/dist/src/connection/ConnectionLockRpcRemote.js +0 -61
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +0 -1
- package/dist/src/connection/ConnectionLockStates.d.ts +0 -27
- package/dist/src/connection/ConnectionLockStates.js +0 -114
- package/dist/src/connection/ConnectionLockStates.js.map +0 -1
- package/dist/src/connection/ConnectionManager.d.ts +0 -85
- package/dist/src/connection/ConnectionManager.js +0 -569
- package/dist/src/connection/ConnectionManager.js.map +0 -1
- package/dist/src/connection/ConnectionsView.d.ts +0 -7
- package/dist/src/connection/ConnectionsView.js +0 -3
- package/dist/src/connection/ConnectionsView.js.map +0 -1
- package/dist/src/connection/ConnectorFacade.d.ts +0 -58
- package/dist/src/connection/ConnectorFacade.js +0 -154
- package/dist/src/connection/ConnectorFacade.js.map +0 -1
- package/dist/src/connection/Handshaker.d.ts +0 -27
- package/dist/src/connection/Handshaker.js +0 -179
- package/dist/src/connection/Handshaker.js.map +0 -1
- package/dist/src/connection/IConnection.d.ts +0 -32
- package/dist/src/connection/IConnection.js +0 -12
- package/dist/src/connection/IConnection.js.map +0 -1
- package/dist/src/connection/ManagedConnection.d.ts +0 -30
- package/dist/src/connection/ManagedConnection.js +0 -129
- package/dist/src/connection/ManagedConnection.js.map +0 -1
- package/dist/src/connection/OutputBuffer.d.ts +0 -9
- package/dist/src/connection/OutputBuffer.js +0 -26
- package/dist/src/connection/OutputBuffer.js.map +0 -1
- package/dist/src/connection/PendingConnection.d.ts +0 -19
- package/dist/src/connection/PendingConnection.js +0 -59
- package/dist/src/connection/PendingConnection.js.map +0 -1
- package/dist/src/connection/connectivityChecker.d.ts +0 -9
- package/dist/src/connection/connectivityChecker.js +0 -138
- package/dist/src/connection/connectivityChecker.js.map +0 -1
- package/dist/src/connection/connectivityRequestHandler.d.ts +0 -4
- package/dist/src/connection/connectivityRequestHandler.js +0 -108
- package/dist/src/connection/connectivityRequestHandler.js.map +0 -1
- package/dist/src/connection/simulator/Simulator.d.ts +0 -36
- package/dist/src/connection/simulator/Simulator.js +0 -290
- package/dist/src/connection/simulator/Simulator.js.map +0 -1
- package/dist/src/connection/simulator/SimulatorConnection.d.ts +0 -18
- package/dist/src/connection/simulator/SimulatorConnection.js +0 -123
- package/dist/src/connection/simulator/SimulatorConnection.js.map +0 -1
- package/dist/src/connection/simulator/SimulatorConnector.d.ts +0 -16
- package/dist/src/connection/simulator/SimulatorConnector.js +0 -80
- package/dist/src/connection/simulator/SimulatorConnector.js.map +0 -1
- package/dist/src/connection/simulator/SimulatorTransport.d.ts +0 -6
- package/dist/src/connection/simulator/SimulatorTransport.js +0 -17
- package/dist/src/connection/simulator/SimulatorTransport.js.map +0 -1
- package/dist/src/connection/simulator/pings.d.ts +0 -21
- package/dist/src/connection/simulator/pings.js +0 -61
- package/dist/src/connection/simulator/pings.js.map +0 -1
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.d.ts +0 -37
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.js +0 -229
- package/dist/src/connection/webrtc/BrowserWebrtcConnection.js.map +0 -1
- package/dist/src/connection/webrtc/IWebrtcConnection.d.ts +0 -21
- package/dist/src/connection/webrtc/IWebrtcConnection.js +0 -9
- package/dist/src/connection/webrtc/IWebrtcConnection.js.map +0 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.d.ts +0 -45
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js +0 -229
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +0 -1
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -43
- package/dist/src/connection/webrtc/WebrtcConnector.js +0 -208
- package/dist/src/connection/webrtc/WebrtcConnector.js.map +0 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +0 -26
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +0 -82
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +0 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +0 -8
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js +0 -50
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +0 -1
- package/dist/src/connection/webrtc/iceServerAsString.d.ts +0 -2
- package/dist/src/connection/webrtc/iceServerAsString.js +0 -17
- package/dist/src/connection/webrtc/iceServerAsString.js.map +0 -1
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.d.ts +0 -27
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.js +0 -107
- package/dist/src/connection/websocket/AbstractWebsocketClientConnection.js.map +0 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +0 -26
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +0 -39
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +0 -1
- package/dist/src/connection/websocket/BrowserWebsocketClientConnection.d.ts +0 -7
- package/dist/src/connection/websocket/BrowserWebsocketClientConnection.js +0 -44
- package/dist/src/connection/websocket/BrowserWebsocketClientConnection.js.map +0 -1
- package/dist/src/connection/websocket/NodeWebsocketClientConnection.d.ts +0 -7
- package/dist/src/connection/websocket/NodeWebsocketClientConnection.js +0 -39
- package/dist/src/connection/websocket/NodeWebsocketClientConnection.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnector.d.ts +0 -26
- package/dist/src/connection/websocket/WebsocketClientConnector.js +0 -86
- package/dist/src/connection/websocket/WebsocketClientConnector.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.d.ts +0 -18
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js +0 -23
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcLocal.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.d.ts +0 -5
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.js +0 -17
- package/dist/src/connection/websocket/WebsocketClientConnectorRpcRemote.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketServer.d.ts +0 -25
- package/dist/src/connection/websocket/WebsocketServer.js +0 -146
- package/dist/src/connection/websocket/WebsocketServer.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketServerConnection.d.ts +0 -22
- package/dist/src/connection/websocket/WebsocketServerConnection.js +0 -101
- package/dist/src/connection/websocket/WebsocketServerConnection.js.map +0 -1
- package/dist/src/connection/websocket/WebsocketServerConnector.d.ts +0 -44
- package/dist/src/connection/websocket/WebsocketServerConnector.js +0 -279
- package/dist/src/connection/websocket/WebsocketServerConnector.js.map +0 -1
- package/dist/src/dht/DhtNode.d.ts +0 -119
- package/dist/src/dht/DhtNode.js +0 -500
- package/dist/src/dht/DhtNode.js.map +0 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +0 -23
- package/dist/src/dht/DhtNodeRpcLocal.js +0 -54
- package/dist/src/dht/DhtNodeRpcLocal.js.map +0 -1
- package/dist/src/dht/DhtNodeRpcRemote.d.ts +0 -25
- package/dist/src/dht/DhtNodeRpcRemote.js +0 -83
- package/dist/src/dht/DhtNodeRpcRemote.js.map +0 -1
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +0 -18
- package/dist/src/dht/ExternalApiRpcLocal.js +0 -32
- package/dist/src/dht/ExternalApiRpcLocal.js.map +0 -1
- package/dist/src/dht/ExternalApiRpcRemote.d.ts +0 -10
- package/dist/src/dht/ExternalApiRpcRemote.js +0 -58
- package/dist/src/dht/ExternalApiRpcRemote.js.map +0 -1
- package/dist/src/dht/PeerManager.d.ts +0 -63
- package/dist/src/dht/PeerManager.js +0 -251
- package/dist/src/dht/PeerManager.js.map +0 -1
- package/dist/src/dht/contact/Contact.d.ts +0 -8
- package/dist/src/dht/contact/Contact.js +0 -18
- package/dist/src/dht/contact/Contact.js.map +0 -1
- package/dist/src/dht/contact/ContactList.d.ts +0 -19
- package/dist/src/dht/contact/ContactList.js +0 -35
- package/dist/src/dht/contact/ContactList.js.map +0 -1
- package/dist/src/dht/contact/RandomContactList.d.ts +0 -11
- package/dist/src/dht/contact/RandomContactList.js +0 -47
- package/dist/src/dht/contact/RandomContactList.js.map +0 -1
- package/dist/src/dht/contact/RingContactList.d.ts +0 -28
- package/dist/src/dht/contact/RingContactList.js +0 -126
- package/dist/src/dht/contact/RingContactList.js.map +0 -1
- package/dist/src/dht/contact/RpcRemote.d.ts +0 -19
- package/dist/src/dht/contact/RpcRemote.js +0 -61
- package/dist/src/dht/contact/RpcRemote.js.map +0 -1
- package/dist/src/dht/contact/SortedContactList.d.ts +0 -37
- package/dist/src/dht/contact/SortedContactList.js +0 -134
- package/dist/src/dht/contact/SortedContactList.js.map +0 -1
- package/dist/src/dht/contact/getClosestNodes.d.ts +0 -6
- package/dist/src/dht/contact/getClosestNodes.js +0 -19
- package/dist/src/dht/contact/getClosestNodes.js.map +0 -1
- package/dist/src/dht/contact/ringIdentifiers.d.ts +0 -16
- package/dist/src/dht/contact/ringIdentifiers.js +0 -54
- package/dist/src/dht/contact/ringIdentifiers.js.map +0 -1
- package/dist/src/dht/discovery/DiscoverySession.d.ts +0 -29
- package/dist/src/dht/discovery/DiscoverySession.js +0 -102
- package/dist/src/dht/discovery/DiscoverySession.js.map +0 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +0 -42
- package/dist/src/dht/discovery/PeerDiscovery.js +0 -193
- package/dist/src/dht/discovery/PeerDiscovery.js.map +0 -1
- package/dist/src/dht/discovery/RingDiscoverySession.d.ts +0 -28
- package/dist/src/dht/discovery/RingDiscoverySession.js +0 -116
- package/dist/src/dht/discovery/RingDiscoverySession.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +0 -38
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +0 -165
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +0 -14
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js +0 -26
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.d.ts +0 -6
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js +0 -44
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +0 -45
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +0 -185
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +0 -14
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +0 -20
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +0 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.d.ts +0 -6
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js +0 -21
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js.map +0 -1
- package/dist/src/dht/routing/DuplicateDetector.d.ts +0 -10
- package/dist/src/dht/routing/DuplicateDetector.js +0 -31
- package/dist/src/dht/routing/DuplicateDetector.js.map +0 -1
- package/dist/src/dht/routing/Router.d.ts +0 -35
- package/dist/src/dht/routing/Router.js +0 -204
- package/dist/src/dht/routing/Router.js.map +0 -1
- package/dist/src/dht/routing/RouterRpcLocal.d.ts +0 -20
- package/dist/src/dht/routing/RouterRpcLocal.js +0 -67
- package/dist/src/dht/routing/RouterRpcLocal.js.map +0 -1
- package/dist/src/dht/routing/RouterRpcRemote.d.ts +0 -8
- package/dist/src/dht/routing/RouterRpcRemote.js +0 -81
- package/dist/src/dht/routing/RouterRpcRemote.js.map +0 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +0 -56
- package/dist/src/dht/routing/RoutingSession.js +0 -201
- package/dist/src/dht/routing/RoutingSession.js.map +0 -1
- package/dist/src/dht/routing/RoutingTablesCache.d.ts +0 -24
- package/dist/src/dht/routing/RoutingTablesCache.js +0 -46
- package/dist/src/dht/routing/RoutingTablesCache.js.map +0 -1
- package/dist/src/dht/routing/getPreviousPeer.d.ts +0 -2
- package/dist/src/dht/routing/getPreviousPeer.js +0 -12
- package/dist/src/dht/routing/getPreviousPeer.js.map +0 -1
- package/dist/src/dht/store/LocalDataStore.d.ts +0 -14
- package/dist/src/dht/store/LocalDataStore.js +0 -78
- package/dist/src/dht/store/LocalDataStore.js.map +0 -1
- package/dist/src/dht/store/StoreManager.d.ts +0 -32
- package/dist/src/dht/store/StoreManager.js +0 -126
- package/dist/src/dht/store/StoreManager.js.map +0 -1
- package/dist/src/dht/store/StoreRpcLocal.d.ts +0 -21
- package/dist/src/dht/store/StoreRpcLocal.js +0 -65
- package/dist/src/dht/store/StoreRpcLocal.js.map +0 -1
- package/dist/src/dht/store/StoreRpcRemote.d.ts +0 -7
- package/dist/src/dht/store/StoreRpcRemote.js +0 -29
- package/dist/src/dht/store/StoreRpcRemote.js.map +0 -1
- package/dist/src/exports.d.ts +0 -25
- package/dist/src/exports.js +0 -48
- package/dist/src/exports.js.map +0 -1
- package/dist/src/helpers/AddressTools.d.ts +0 -2
- package/dist/src/helpers/AddressTools.js +0 -32
- package/dist/src/helpers/AddressTools.js.map +0 -1
- package/dist/src/helpers/Connectivity.d.ts +0 -4
- package/dist/src/helpers/Connectivity.js +0 -24
- package/dist/src/helpers/Connectivity.js.map +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment.d.ts +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment.js +0 -6
- package/dist/src/helpers/browser/isBrowserEnvironment.js.map +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment_override.d.ts +0 -1
- package/dist/src/helpers/browser/isBrowserEnvironment_override.js +0 -7
- package/dist/src/helpers/browser/isBrowserEnvironment_override.js.map +0 -1
- package/dist/src/helpers/createPeerDescriptor.d.ts +0 -3
- package/dist/src/helpers/createPeerDescriptor.js +0 -58
- package/dist/src/helpers/createPeerDescriptor.js.map +0 -1
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.d.ts +0 -2
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js +0 -30
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js.map +0 -1
- package/dist/src/helpers/debugHelpers.d.ts +0 -3
- package/dist/src/helpers/debugHelpers.js +0 -11
- package/dist/src/helpers/debugHelpers.js.map +0 -1
- package/dist/src/helpers/errors.d.ts +0 -72
- package/dist/src/helpers/errors.js +0 -97
- package/dist/src/helpers/errors.js.map +0 -1
- package/dist/src/helpers/offering.d.ts +0 -4
- package/dist/src/helpers/offering.js +0 -18
- package/dist/src/helpers/offering.js.map +0 -1
- package/dist/src/helpers/protoClasses.d.ts +0 -2
- package/dist/src/helpers/protoClasses.js +0 -32
- package/dist/src/helpers/protoClasses.js.map +0 -1
- package/dist/src/helpers/protoToString.d.ts +0 -2
- package/dist/src/helpers/protoToString.js +0 -19
- package/dist/src/helpers/protoToString.js.map +0 -1
- package/dist/src/helpers/version.d.ts +0 -6
- package/dist/src/helpers/version.js +0 -38
- package/dist/src/helpers/version.js.map +0 -1
- package/dist/src/identifiers.d.ts +0 -10
- package/dist/src/identifiers.js +0 -31
- package/dist/src/identifiers.js.map +0 -1
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +0 -12
- package/dist/src/rpc-protocol/DhtCallContext.js +0 -17
- package/dist/src/rpc-protocol/DhtCallContext.js.map +0 -1
- package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +0 -10
- package/dist/src/rpc-protocol/DhtRpcOptions.js +0 -3
- package/dist/src/rpc-protocol/DhtRpcOptions.js.map +0 -1
- package/dist/src/transport/ITransport.d.ts +0 -31
- package/dist/src/transport/ITransport.js +0 -9
- package/dist/src/transport/ITransport.js.map +0 -1
- package/dist/src/transport/ListeningRpcCommunicator.d.ts +0 -11
- package/dist/src/transport/ListeningRpcCommunicator.js +0 -31
- package/dist/src/transport/ListeningRpcCommunicator.js.map +0 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +0 -10
- package/dist/src/transport/RoutingRpcCommunicator.js +0 -60
- package/dist/src/transport/RoutingRpcCommunicator.js.map +0 -1
- package/dist/src/types/ServiceID.d.ts +0 -1
- package/dist/src/types/ServiceID.js +0 -3
- package/dist/src/types/ServiceID.js.map +0 -1
|
@@ -1,201 +0,0 @@
|
|
|
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.RoutingSession = exports.RoutingMode = exports.RoutingRemoteContact = void 0;
|
|
7
|
-
const SortedContactList_1 = require("../contact/SortedContactList");
|
|
8
|
-
const utils_1 = require("@streamr/utils");
|
|
9
|
-
const eventemitter3_1 = __importDefault(require("eventemitter3"));
|
|
10
|
-
const uuid_1 = require("uuid");
|
|
11
|
-
const RouterRpcRemote_1 = require("./RouterRpcRemote");
|
|
12
|
-
const DhtRpc_client_1 = require("../../../generated/packages/dht/protos/DhtRpc.client");
|
|
13
|
-
const Contact_1 = require("../contact/Contact");
|
|
14
|
-
const RecursiveOperationRpcRemote_1 = require("../recursive-operation/RecursiveOperationRpcRemote");
|
|
15
|
-
const getPreviousPeer_1 = require("./getPreviousPeer");
|
|
16
|
-
const identifiers_1 = require("../../identifiers");
|
|
17
|
-
const pull_1 = __importDefault(require("lodash/pull"));
|
|
18
|
-
const logger = new utils_1.Logger(module);
|
|
19
|
-
const MAX_FAILED_HOPS = 2;
|
|
20
|
-
const ROUTING_TABLE_MAX_SIZE = 5;
|
|
21
|
-
class RoutingRemoteContact extends Contact_1.Contact {
|
|
22
|
-
routerRpcRemote;
|
|
23
|
-
recursiveOperationRpcRemote;
|
|
24
|
-
constructor(peer, localPeerDescriptor, rpcCommunicator) {
|
|
25
|
-
super(peer);
|
|
26
|
-
this.routerRpcRemote = new RouterRpcRemote_1.RouterRpcRemote(localPeerDescriptor, peer, rpcCommunicator, DhtRpc_client_1.RouterRpcClient, RouterRpcRemote_1.ROUTING_TIMEOUT);
|
|
27
|
-
this.recursiveOperationRpcRemote = new RecursiveOperationRpcRemote_1.RecursiveOperationRpcRemote(localPeerDescriptor, peer, rpcCommunicator, DhtRpc_client_1.RecursiveOperationRpcClient, RouterRpcRemote_1.ROUTING_TIMEOUT);
|
|
28
|
-
}
|
|
29
|
-
getRouterRpcRemote() {
|
|
30
|
-
return this.routerRpcRemote;
|
|
31
|
-
}
|
|
32
|
-
getRecursiveOperationRpcRemote() {
|
|
33
|
-
return this.recursiveOperationRpcRemote;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.RoutingRemoteContact = RoutingRemoteContact;
|
|
37
|
-
var RoutingMode;
|
|
38
|
-
(function (RoutingMode) {
|
|
39
|
-
RoutingMode[RoutingMode["ROUTE"] = 0] = "ROUTE";
|
|
40
|
-
RoutingMode[RoutingMode["FORWARD"] = 1] = "FORWARD";
|
|
41
|
-
RoutingMode[RoutingMode["RECURSIVE"] = 2] = "RECURSIVE";
|
|
42
|
-
})(RoutingMode || (exports.RoutingMode = RoutingMode = {}));
|
|
43
|
-
class RoutingSession extends eventemitter3_1.default {
|
|
44
|
-
sessionId = (0, uuid_1.v4)();
|
|
45
|
-
ongoingRequests = new Set();
|
|
46
|
-
contactedPeers = new Set();
|
|
47
|
-
failedHopCounter = 0;
|
|
48
|
-
successfulHopCounter = 0;
|
|
49
|
-
stopped = false;
|
|
50
|
-
options;
|
|
51
|
-
constructor(options) {
|
|
52
|
-
super();
|
|
53
|
-
this.options = options;
|
|
54
|
-
}
|
|
55
|
-
onRequestFailed(nodeId) {
|
|
56
|
-
logger.trace('onRequestFailed() sessionId: ' + this.sessionId);
|
|
57
|
-
if (this.stopped) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (this.ongoingRequests.has(nodeId)) {
|
|
61
|
-
this.ongoingRequests.delete(nodeId);
|
|
62
|
-
}
|
|
63
|
-
this.deleteParallelRootIfSource(nodeId);
|
|
64
|
-
this.failedHopCounter += 1;
|
|
65
|
-
if (this.failedHopCounter >= MAX_FAILED_HOPS) {
|
|
66
|
-
logger.trace(`Stopping routing after ${MAX_FAILED_HOPS} failed attempts for sessionId: ${this.sessionId}`);
|
|
67
|
-
this.emitFailure();
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const contacts = this.updateAndGetRoutablePeers();
|
|
71
|
-
if (contacts.length === 0 && this.ongoingRequests.size === 0) {
|
|
72
|
-
logger.trace('routing failed, emitting routingFailed sessionId: ' + this.sessionId);
|
|
73
|
-
this.emitFailure();
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
logger.trace('routing failed, retrying to route sessionId: ' + this.sessionId + ' failedHopCounter: ' + this.failedHopCounter);
|
|
77
|
-
this.sendMoreRequests(contacts);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
emitFailure() {
|
|
81
|
-
if (this.successfulHopCounter >= 1) {
|
|
82
|
-
this.emit('partialSuccess');
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
this.emit('routingFailed');
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
onRequestSucceeded() {
|
|
89
|
-
logger.trace('onRequestSucceeded() sessionId: ' + this.sessionId);
|
|
90
|
-
if (this.stopped) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
this.successfulHopCounter += 1;
|
|
94
|
-
if (this.successfulHopCounter >= this.options.parallelism) {
|
|
95
|
-
this.emit('routingSucceeded');
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const contacts = this.updateAndGetRoutablePeers();
|
|
99
|
-
if (contacts.length === 0) {
|
|
100
|
-
this.emit('routingSucceeded');
|
|
101
|
-
}
|
|
102
|
-
else if (contacts.length > 0 && this.ongoingRequests.size === 0) {
|
|
103
|
-
this.sendMoreRequests(contacts);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
async sendRouteMessageRequest(contact) {
|
|
107
|
-
if (this.stopped) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
const msg = {
|
|
111
|
-
...this.options.routedMessage,
|
|
112
|
-
routingPath: this.options.routedMessage.routingPath.concat([this.options.localPeerDescriptor])
|
|
113
|
-
};
|
|
114
|
-
if (this.options.mode === RoutingMode.FORWARD) {
|
|
115
|
-
return contact.getRouterRpcRemote().forwardMessage(msg);
|
|
116
|
-
}
|
|
117
|
-
else if (this.options.mode === RoutingMode.RECURSIVE) {
|
|
118
|
-
return contact.getRecursiveOperationRpcRemote().routeRequest(msg);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
return contact.getRouterRpcRemote().routeMessage(msg);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
updateAndGetRoutablePeers() {
|
|
125
|
-
logger.trace('getRoutablePeers() sessionId: ' + this.sessionId);
|
|
126
|
-
const previousPeer = (0, getPreviousPeer_1.getPreviousPeer)(this.options.routedMessage);
|
|
127
|
-
const previousId = previousPeer ? (0, identifiers_1.toNodeId)(previousPeer) : undefined;
|
|
128
|
-
const targetId = (0, identifiers_1.toDhtAddress)(this.options.routedMessage.target);
|
|
129
|
-
let routingTable;
|
|
130
|
-
if (this.options.routingTablesCache.has(targetId, previousId) && this.options.routingTablesCache.get(targetId, previousId).getSize() > 0) {
|
|
131
|
-
routingTable = this.options.routingTablesCache.get(targetId, previousId);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
routingTable = new SortedContactList_1.SortedContactList({
|
|
135
|
-
referenceId: (0, identifiers_1.toDhtAddress)(this.options.routedMessage.target),
|
|
136
|
-
maxSize: ROUTING_TABLE_MAX_SIZE,
|
|
137
|
-
allowToContainReferenceId: true,
|
|
138
|
-
nodeIdDistanceLimit: previousId
|
|
139
|
-
});
|
|
140
|
-
const contacts = this.options.getConnections()
|
|
141
|
-
.map((peer) => new RoutingRemoteContact(peer, this.options.localPeerDescriptor, this.options.rpcCommunicator));
|
|
142
|
-
routingTable.addContacts(contacts);
|
|
143
|
-
this.options.routingTablesCache.set(targetId, routingTable, previousId);
|
|
144
|
-
}
|
|
145
|
-
return routingTable.getClosestContacts()
|
|
146
|
-
.filter((contact) => !this.contactedPeers.has(contact.getNodeId()) && !this.options.excludedNodeIds.has(contact.getNodeId()));
|
|
147
|
-
}
|
|
148
|
-
sendMoreRequests(uncontacted) {
|
|
149
|
-
logger.trace('sendMoreRequests() sessionId: ' + this.sessionId);
|
|
150
|
-
if (this.stopped) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
if (uncontacted.length === 0) {
|
|
154
|
-
this.emitFailure();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
while ((this.ongoingRequests.size < this.options.parallelism) && (uncontacted.length > 0) && !this.stopped) {
|
|
158
|
-
const nextPeer = uncontacted.shift();
|
|
159
|
-
logger.trace(`Sending routeMessage request to contact: ${(0, identifiers_1.toNodeId)(nextPeer.getPeerDescriptor())} (sessionId=${this.sessionId})`);
|
|
160
|
-
this.contactedPeers.add(nextPeer.getNodeId());
|
|
161
|
-
this.ongoingRequests.add(nextPeer.getNodeId());
|
|
162
|
-
this.addParallelRootIfSource(nextPeer.getNodeId());
|
|
163
|
-
setImmediate(async () => {
|
|
164
|
-
try {
|
|
165
|
-
const succeeded = await this.sendRouteMessageRequest(nextPeer);
|
|
166
|
-
if (succeeded) {
|
|
167
|
-
this.onRequestSucceeded();
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
this.onRequestFailed(nextPeer.getNodeId());
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
catch (err) {
|
|
174
|
-
logger.debug('Unable to route message ', { err });
|
|
175
|
-
}
|
|
176
|
-
finally {
|
|
177
|
-
logger.trace('sendRouteMessageRequest returned');
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
addParallelRootIfSource(nodeId) {
|
|
183
|
-
if (this.options.mode === RoutingMode.RECURSIVE
|
|
184
|
-
&& (0, identifiers_1.areEqualPeerDescriptors)(this.options.localPeerDescriptor, this.options.routedMessage.sourcePeer)) {
|
|
185
|
-
this.options.routedMessage.parallelRootNodeIds.push(nodeId);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
deleteParallelRootIfSource(nodeId) {
|
|
189
|
-
if (this.options.mode === RoutingMode.RECURSIVE
|
|
190
|
-
&& (0, identifiers_1.areEqualPeerDescriptors)(this.options.localPeerDescriptor, this.options.routedMessage.sourcePeer)) {
|
|
191
|
-
(0, pull_1.default)(this.options.routedMessage.parallelRootNodeIds, nodeId);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
stop() {
|
|
195
|
-
this.stopped = true;
|
|
196
|
-
this.emit('stopped');
|
|
197
|
-
this.removeAllListeners();
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
exports.RoutingSession = RoutingSession;
|
|
201
|
-
//# sourceMappingURL=RoutingSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RoutingSession.js","sourceRoot":"","sources":["../../../../src/dht/routing/RoutingSession.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAgE;AAChE,0CAAuC;AACvC,kEAAwC;AACxC,+BAAyB;AAEzB,uDAAoE;AAEpE,wFAAmH;AACnH,gDAA4C;AAC5C,oGAAgG;AAChG,uDAAmD;AACnD,mDAA+F;AAC/F,uDAA8B;AAG9B,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAM,eAA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,IAAI,KAAK,WAAW,CAAC,SAAS;eACxC,IAAA,qCAAuB,EAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAW,CAAC,EACtG,CAAC;YACC,IAAA,cAAI,EAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAA;QAChE,CAAC;IACL,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACpB,IAAI,CAAC,kBAAkB,EAAE,CAAA;IAC7B,CAAC;CACJ;AAtKD,wCAsKC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { DhtAddress } from '../../identifiers';
|
|
2
|
-
import { SortedContactList } from '../contact/SortedContactList';
|
|
3
|
-
import { RoutingRemoteContact } from './RoutingSession';
|
|
4
|
-
export type RoutingTable = Pick<SortedContactList<RoutingRemoteContact>, 'getClosestContacts' | 'addContacts' | 'addContact' | 'removeContact' | 'stop' | 'getSize'>;
|
|
5
|
-
/**
|
|
6
|
-
* RoutingTablesCache is a cache for routing tables.
|
|
7
|
-
* It is used to store the routing tables for a specific targetId and previousId.
|
|
8
|
-
* Storing the previousId is important as it is used as a minimum distance for the contacts in the table.
|
|
9
|
-
* Calculating a RoutingTable from scratch is an O(n log n) operation (n = number of connections of a node)
|
|
10
|
-
* However,
|
|
11
|
-
* - Adding a contact to a RoutingTable is an O(log n) operation.
|
|
12
|
-
* - Deleting a contact from a RoutingTable is an O(1) operation.
|
|
13
|
-
* Thus, holding the most frequently used routing tables in memory to be updated on
|
|
14
|
-
* connections and disconnections is hugely beneficial in terms of performance.
|
|
15
|
-
*/
|
|
16
|
-
export declare class RoutingTablesCache {
|
|
17
|
-
private readonly tables;
|
|
18
|
-
get(targetId: DhtAddress, previousId?: DhtAddress): RoutingTable | undefined;
|
|
19
|
-
set(targetId: DhtAddress, table: RoutingTable, previousId?: DhtAddress): void;
|
|
20
|
-
has(targetId: DhtAddress, previousId?: DhtAddress): boolean;
|
|
21
|
-
onNodeDisconnected(nodeId: DhtAddress): void;
|
|
22
|
-
onNodeConnected(remote: RoutingRemoteContact): void;
|
|
23
|
-
reset(): void;
|
|
24
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RoutingTablesCache = void 0;
|
|
4
|
-
const lru_cache_1 = require("lru-cache");
|
|
5
|
-
const createRoutingTableId = (targetId, previousId) => {
|
|
6
|
-
return targetId + (previousId ?? '');
|
|
7
|
-
};
|
|
8
|
-
const DEFAULT_LRU_OPTIONS = {
|
|
9
|
-
max: 1000,
|
|
10
|
-
maxAge: 15 * 1000
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* RoutingTablesCache is a cache for routing tables.
|
|
14
|
-
* It is used to store the routing tables for a specific targetId and previousId.
|
|
15
|
-
* Storing the previousId is important as it is used as a minimum distance for the contacts in the table.
|
|
16
|
-
* Calculating a RoutingTable from scratch is an O(n log n) operation (n = number of connections of a node)
|
|
17
|
-
* However,
|
|
18
|
-
* - Adding a contact to a RoutingTable is an O(log n) operation.
|
|
19
|
-
* - Deleting a contact from a RoutingTable is an O(1) operation.
|
|
20
|
-
* Thus, holding the most frequently used routing tables in memory to be updated on
|
|
21
|
-
* connections and disconnections is hugely beneficial in terms of performance.
|
|
22
|
-
*/
|
|
23
|
-
class RoutingTablesCache {
|
|
24
|
-
tables = new lru_cache_1.LRUCache(DEFAULT_LRU_OPTIONS);
|
|
25
|
-
get(targetId, previousId) {
|
|
26
|
-
return this.tables.get(createRoutingTableId(targetId, previousId));
|
|
27
|
-
}
|
|
28
|
-
set(targetId, table, previousId) {
|
|
29
|
-
this.tables.set(createRoutingTableId(targetId, previousId), table);
|
|
30
|
-
}
|
|
31
|
-
has(targetId, previousId) {
|
|
32
|
-
return this.tables.has(createRoutingTableId(targetId, previousId));
|
|
33
|
-
}
|
|
34
|
-
onNodeDisconnected(nodeId) {
|
|
35
|
-
this.tables.forEach((table) => table.removeContact(nodeId));
|
|
36
|
-
}
|
|
37
|
-
onNodeConnected(remote) {
|
|
38
|
-
this.tables.forEach((table) => table.addContact(remote));
|
|
39
|
-
}
|
|
40
|
-
reset() {
|
|
41
|
-
this.tables.forEach((table) => table.stop());
|
|
42
|
-
this.tables.clear();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.RoutingTablesCache = RoutingTablesCache;
|
|
46
|
-
//# sourceMappingURL=RoutingTablesCache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RoutingTablesCache.js","sourceRoot":"","sources":["../../../../src/dht/routing/RoutingTablesCache.ts"],"names":[],"mappings":";;;AAGA,yCAAoC;AAOpC,MAAM,oBAAoB,GAAG,CAAC,QAAoB,EAAE,UAAuB,EAAkB,EAAE;IAC3F,OAAO,QAAQ,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAA;AACxC,CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG;IACxB,GAAG,EAAE,IAAI;IACT,MAAM,EAAE,EAAE,GAAG,IAAI;CACpB,CAAA;AAED;;;;;;;;;;EAUE;AAEF,MAAa,kBAAkB;IAEV,MAAM,GAA2C,IAAI,oBAAQ,CAAC,mBAAmB,CAAC,CAAA;IAEnG,GAAG,CAAC,QAAoB,EAAE,UAAuB;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;IACtE,CAAC;IAED,GAAG,CAAC,QAAoB,EAAE,KAAmB,EAAE,UAAuB;QAClE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,KAAK,CAAC,CAAA;IACtE,CAAC;IAED,GAAG,CAAC,QAAoB,EAAE,UAAuB;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;IACtE,CAAC;IAED,kBAAkB,CAAC,MAAkB;QACjC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/D,CAAC;IAED,eAAe,CAAC,MAA4B;QACxC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5D,CAAC;IAED,KAAK;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;QAC5C,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;CACJ;AA5BD,gDA4BC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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.getPreviousPeer = void 0;
|
|
7
|
-
const last_1 = __importDefault(require("lodash/last"));
|
|
8
|
-
const getPreviousPeer = (routeMessage) => {
|
|
9
|
-
return (0, last_1.default)(routeMessage.routingPath);
|
|
10
|
-
};
|
|
11
|
-
exports.getPreviousPeer = getPreviousPeer;
|
|
12
|
-
//# sourceMappingURL=getPreviousPeer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPreviousPeer.js","sourceRoot":"","sources":["../../../../src/dht/routing/getPreviousPeer.ts"],"names":[],"mappings":";;;;;;AAAA,uDAA8B;AAGvB,MAAM,eAAe,GAAG,CAAC,YAAiC,EAA8B,EAAE;IAC7F,OAAO,IAAA,cAAI,EAAC,YAAY,CAAC,WAAW,CAAC,CAAA;AACzC,CAAC,CAAA;AAFY,QAAA,eAAe,mBAE3B"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DataEntry } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
2
|
-
import { DhtAddress } from '../../identifiers';
|
|
3
|
-
export declare class LocalDataStore {
|
|
4
|
-
private readonly maxTtl;
|
|
5
|
-
constructor(maxTtl: number);
|
|
6
|
-
private store;
|
|
7
|
-
storeEntry(dataEntry: DataEntry): boolean;
|
|
8
|
-
markAsDeleted(key: DhtAddress, creator: DhtAddress): boolean;
|
|
9
|
-
values(key?: DhtAddress): IterableIterator<DataEntry>;
|
|
10
|
-
keys(): IterableIterator<DhtAddress>;
|
|
11
|
-
setAllEntriesAsStale(key: DhtAddress): void;
|
|
12
|
-
deleteEntry(key: DhtAddress, creator: DhtAddress): void;
|
|
13
|
-
clear(): void;
|
|
14
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocalDataStore = void 0;
|
|
4
|
-
const identifiers_1 = require("../../identifiers");
|
|
5
|
-
const utils_1 = require("@streamr/utils");
|
|
6
|
-
class LocalDataStore {
|
|
7
|
-
maxTtl;
|
|
8
|
-
constructor(maxTtl) {
|
|
9
|
-
this.maxTtl = maxTtl;
|
|
10
|
-
}
|
|
11
|
-
// A map into which each node can store one value per data key
|
|
12
|
-
// The first key is the key of the data, the second key is the
|
|
13
|
-
// DhtAddress of the creator of the data
|
|
14
|
-
store = new Map();
|
|
15
|
-
storeEntry(dataEntry) {
|
|
16
|
-
const key = (0, identifiers_1.toDhtAddress)(dataEntry.key);
|
|
17
|
-
const creatorNodeId = (0, identifiers_1.toDhtAddress)(dataEntry.creator);
|
|
18
|
-
if (!this.store.has(key)) {
|
|
19
|
-
this.store.set(key, new utils_1.MapWithTtl((e) => Math.min(e.ttl, this.maxTtl)));
|
|
20
|
-
}
|
|
21
|
-
if (this.store.get(key).has(creatorNodeId)) {
|
|
22
|
-
const storedMillis = (dataEntry.createdAt.seconds * 1000) + (dataEntry.createdAt.nanos / 1000000);
|
|
23
|
-
const oldLocalEntry = this.store.get(key).get(creatorNodeId);
|
|
24
|
-
const oldStoredMillis = (oldLocalEntry.createdAt.seconds * 1000) + (oldLocalEntry.createdAt.nanos / 1000000);
|
|
25
|
-
// do nothing if old entry is newer than the one being replicated
|
|
26
|
-
if (oldStoredMillis >= storedMillis) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
this.store.get(key).set(creatorNodeId, dataEntry);
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
markAsDeleted(key, creator) {
|
|
34
|
-
const item = this.store.get(key);
|
|
35
|
-
if (!item?.has(creator)) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
const storedEntry = item.get(creator);
|
|
39
|
-
storedEntry.deleted = true;
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
*values(key) {
|
|
43
|
-
if (key !== undefined) {
|
|
44
|
-
const map = this.store.get(key);
|
|
45
|
-
if (map !== undefined) {
|
|
46
|
-
yield* map.values();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
for (const v of this.store.values()) {
|
|
51
|
-
yield* v.values();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
keys() {
|
|
56
|
-
return this.store.keys();
|
|
57
|
-
}
|
|
58
|
-
setAllEntriesAsStale(key) {
|
|
59
|
-
this.store.get(key)?.forEach((value) => {
|
|
60
|
-
value.stale = true;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
deleteEntry(key, creator) {
|
|
64
|
-
const storedEntry = this.store.get(key)?.get(creator);
|
|
65
|
-
if (storedEntry) {
|
|
66
|
-
this.store.get(key)?.delete(creator);
|
|
67
|
-
if (this.store.get(key)?.size() === 0) {
|
|
68
|
-
this.store.delete(key);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
clear() {
|
|
73
|
-
this.store.forEach((value) => value.clear());
|
|
74
|
-
this.store.clear();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.LocalDataStore = LocalDataStore;
|
|
78
|
-
//# sourceMappingURL=LocalDataStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocalDataStore.js","sourceRoot":"","sources":["../../../../src/dht/store/LocalDataStore.ts"],"names":[],"mappings":";;;AACA,mDAA4D;AAC5D,0CAA2C;AAE3C,MAAa,cAAc;IAEN,MAAM,CAAQ;IAE/B,YAAY,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACxB,CAAC;IAED,8DAA8D;IAC9D,8DAA8D;IAC9D,wCAAwC;IAChC,KAAK,GAAuD,IAAI,GAAG,EAAE,CAAA;IAEtE,UAAU,CAAC,SAAoB;QAClC,MAAM,GAAG,GAAG,IAAA,0BAAY,EAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QACvC,MAAM,aAAa,GAAG,IAAA,0BAAY,EAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,kBAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC5E,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE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ifiers';
|
|
2
|
-
import { Any } from '../../../generated/google/protobuf/any';
|
|
3
|
-
import { PeerDescriptor } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
4
|
-
import { RoutingRpcCommunicator } from '../../transport/RoutingRpcCommunicator';
|
|
5
|
-
import { ServiceID } from '../../types/ServiceID';
|
|
6
|
-
import { RecursiveOperationManager } from '../recursive-operation/RecursiveOperationManager';
|
|
7
|
-
import { LocalDataStore } from './LocalDataStore';
|
|
8
|
-
import { StoreRpcRemote } from './StoreRpcRemote';
|
|
9
|
-
interface StoreManagerOptions {
|
|
10
|
-
rpcCommunicator: RoutingRpcCommunicator;
|
|
11
|
-
recursiveOperationManager: RecursiveOperationManager;
|
|
12
|
-
localPeerDescriptor: PeerDescriptor;
|
|
13
|
-
localDataStore: LocalDataStore;
|
|
14
|
-
serviceId: ServiceID;
|
|
15
|
-
highestTtl: number;
|
|
16
|
-
redundancyFactor: number;
|
|
17
|
-
getNeighbors: () => readonly PeerDescriptor[];
|
|
18
|
-
createRpcRemote: (contact: PeerDescriptor) => StoreRpcRemote;
|
|
19
|
-
}
|
|
20
|
-
export declare class StoreManager {
|
|
21
|
-
private readonly options;
|
|
22
|
-
constructor(options: StoreManagerOptions);
|
|
23
|
-
private registerLocalRpcMethods;
|
|
24
|
-
onContactAdded(peerDescriptor: PeerDescriptor): void;
|
|
25
|
-
private replicateAndUpdateStaleState;
|
|
26
|
-
private replicateDataToContact;
|
|
27
|
-
storeDataToDht(key: DhtAddress, data: Any, creator: DhtAddress): Promise<PeerDescriptor[]>;
|
|
28
|
-
private replicateDataToClosestNodes;
|
|
29
|
-
private getStorers;
|
|
30
|
-
destroy(): Promise<void>;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StoreManager = void 0;
|
|
4
|
-
const utils_1 = require("@streamr/utils");
|
|
5
|
-
const identifiers_1 = require("../../identifiers");
|
|
6
|
-
const timestamp_1 = require("../../../generated/google/protobuf/timestamp");
|
|
7
|
-
const DhtRpc_1 = require("../../../generated/packages/dht/protos/DhtRpc");
|
|
8
|
-
const getClosestNodes_1 = require("../contact/getClosestNodes");
|
|
9
|
-
const StoreRpcLocal_1 = require("./StoreRpcLocal");
|
|
10
|
-
const logger = new utils_1.Logger(module);
|
|
11
|
-
class StoreManager {
|
|
12
|
-
options;
|
|
13
|
-
constructor(options) {
|
|
14
|
-
this.options = options;
|
|
15
|
-
this.registerLocalRpcMethods();
|
|
16
|
-
}
|
|
17
|
-
registerLocalRpcMethods() {
|
|
18
|
-
const rpcLocal = new StoreRpcLocal_1.StoreRpcLocal({
|
|
19
|
-
localPeerDescriptor: this.options.localPeerDescriptor,
|
|
20
|
-
localDataStore: this.options.localDataStore,
|
|
21
|
-
replicateDataToContact: (dataEntry, contact) => this.replicateDataToContact(dataEntry, contact),
|
|
22
|
-
getStorers: (dataKey) => this.getStorers(dataKey)
|
|
23
|
-
});
|
|
24
|
-
this.options.rpcCommunicator.registerRpcMethod(DhtRpc_1.StoreDataRequest, DhtRpc_1.StoreDataResponse, 'storeData', (request) => rpcLocal.storeData(request));
|
|
25
|
-
this.options.rpcCommunicator.registerRpcNotification(DhtRpc_1.ReplicateDataRequest, 'replicateData', (request, context) => rpcLocal.replicateData(request, context));
|
|
26
|
-
}
|
|
27
|
-
onContactAdded(peerDescriptor) {
|
|
28
|
-
for (const key of this.options.localDataStore.keys()) {
|
|
29
|
-
this.replicateAndUpdateStaleState(key, peerDescriptor);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
replicateAndUpdateStaleState(dataKey, newNode) {
|
|
33
|
-
const storers = this.getStorers(dataKey);
|
|
34
|
-
const storersBeforeContactAdded = storers.filter((p) => !(0, identifiers_1.areEqualPeerDescriptors)(p, newNode));
|
|
35
|
-
const selfWasPrimaryStorer = (0, identifiers_1.areEqualPeerDescriptors)(storersBeforeContactAdded[0], this.options.localPeerDescriptor);
|
|
36
|
-
if (selfWasPrimaryStorer) {
|
|
37
|
-
if (storers.some((p) => (0, identifiers_1.areEqualPeerDescriptors)(p, newNode))) {
|
|
38
|
-
setImmediate(async () => {
|
|
39
|
-
const dataEntries = Array.from(this.options.localDataStore.values(dataKey));
|
|
40
|
-
await Promise.all(dataEntries.map(async (dataEntry) => this.replicateDataToContact(dataEntry, newNode)));
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else if (!storers.some((p) => (0, identifiers_1.areEqualPeerDescriptors)(p, this.options.localPeerDescriptor))) {
|
|
45
|
-
this.options.localDataStore.setAllEntriesAsStale(dataKey);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async replicateDataToContact(dataEntry, contact) {
|
|
49
|
-
const rpcRemote = this.options.createRpcRemote(contact);
|
|
50
|
-
try {
|
|
51
|
-
await rpcRemote.replicateData({ entry: dataEntry }, true);
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
logger.trace('replicateData() threw an exception ' + e);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async storeDataToDht(key, data, creator) {
|
|
58
|
-
logger.debug(`Storing data to DHT ${this.options.serviceId}`);
|
|
59
|
-
const result = await this.options.recursiveOperationManager.execute(key, DhtRpc_1.RecursiveOperation.FIND_CLOSEST_NODES);
|
|
60
|
-
const closestNodes = result.closestNodes;
|
|
61
|
-
const successfulNodes = [];
|
|
62
|
-
const ttl = this.options.highestTtl; // ToDo: make TTL decrease according to some nice curve
|
|
63
|
-
const createdAt = timestamp_1.Timestamp.now();
|
|
64
|
-
for (let i = 0; i < closestNodes.length && successfulNodes.length < this.options.redundancyFactor; i++) {
|
|
65
|
-
const keyRaw = (0, identifiers_1.toDhtAddressRaw)(key);
|
|
66
|
-
const creatorRaw = (0, identifiers_1.toDhtAddressRaw)(creator);
|
|
67
|
-
if ((0, identifiers_1.areEqualPeerDescriptors)(this.options.localPeerDescriptor, closestNodes[i])) {
|
|
68
|
-
this.options.localDataStore.storeEntry({
|
|
69
|
-
key: keyRaw,
|
|
70
|
-
data,
|
|
71
|
-
creator: creatorRaw,
|
|
72
|
-
createdAt,
|
|
73
|
-
storedAt: timestamp_1.Timestamp.now(),
|
|
74
|
-
ttl,
|
|
75
|
-
stale: false,
|
|
76
|
-
deleted: false,
|
|
77
|
-
});
|
|
78
|
-
successfulNodes.push(closestNodes[i]);
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
const rpcRemote = this.options.createRpcRemote(closestNodes[i]);
|
|
82
|
-
try {
|
|
83
|
-
await rpcRemote.storeData({
|
|
84
|
-
key: keyRaw,
|
|
85
|
-
data,
|
|
86
|
-
creator: creatorRaw,
|
|
87
|
-
createdAt,
|
|
88
|
-
ttl
|
|
89
|
-
});
|
|
90
|
-
successfulNodes.push(closestNodes[i]);
|
|
91
|
-
logger.trace('remote.storeData() success');
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
logger.trace('remote.storeData() threw an exception ' + e);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return successfulNodes;
|
|
98
|
-
}
|
|
99
|
-
async replicateDataToClosestNodes() {
|
|
100
|
-
const dataEntries = Array.from(this.options.localDataStore.values());
|
|
101
|
-
await Promise.all(dataEntries.map(async (dataEntry) => {
|
|
102
|
-
const dataKey = (0, identifiers_1.toDhtAddress)(dataEntry.key);
|
|
103
|
-
const neighbors = (0, getClosestNodes_1.getClosestNodes)(dataKey, this.options.getNeighbors(), { maxCount: this.options.redundancyFactor });
|
|
104
|
-
await Promise.all(neighbors.map(async (neighbor) => {
|
|
105
|
-
const rpcRemote = this.options.createRpcRemote(neighbor);
|
|
106
|
-
try {
|
|
107
|
-
await rpcRemote.replicateData({ entry: dataEntry }, false);
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
logger.trace('Failed to replicate data in replicateDataToClosestNodes', { err });
|
|
111
|
-
}
|
|
112
|
-
}));
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
getStorers(dataKey, excludedNode) {
|
|
116
|
-
return (0, getClosestNodes_1.getClosestNodes)(dataKey, [...this.options.getNeighbors(), this.options.localPeerDescriptor], {
|
|
117
|
-
maxCount: this.options.redundancyFactor,
|
|
118
|
-
excludedNodeIds: excludedNode !== undefined ? new Set([(0, identifiers_1.toNodeId)(excludedNode)]) : undefined
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
async destroy() {
|
|
122
|
-
await this.replicateDataToClosestNodes();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.StoreManager = StoreManager;
|
|
126
|
-
//# sourceMappingURL=StoreManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StoreManager.js","sourceRoot":"","sources":["../../../../src/dht/store/StoreManager.ts"],"names":[],"mappings":";;;AACA,0CAAuC;AACvC,mDAM0B;AAE1B,4EAAwE;AACxE,0EAMsD;AAGtD,gEAA4D;AAG5D,mDAA+C;AAe/C,MAAM,MAAM,GAAG,IAAI,cAAM,CAAC,MAAM,CAAC,CAAA;AAEjC,MAAa,YAAY;IAEJ,OAAO,CAAqB;IAE7C,YAAY,OAA4B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,uBAAuB,EAAE,CAAA;IAClC,CAAC;IAEO,uBAAuB;QAC3B,MAAM,QAAQ,GAAG,IAAI,6BAAa,CAAC;YAC/B,mBAAmB,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB;YACrD,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;YAC3C,sBAAsB,EAAE,CAAC,SAAoB,EAAE,OAAuB,EAAE,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC;YAC1H,UAAU,EAAE,CAAC,OAAmB,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;S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AAO,IAAA,iCAAe,EAClB,OAAO,EACP,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAClE;YACI,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB;YACvC,eAAe,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAA,sBAAQ,EAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;SAC9F,CACJ,CAAA;IACL,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,CAAC,2BAA2B,EAAE,CAAA;IAC5C,CAAC;CACJ;AAjID,oCAiIC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ServerCallContext } from '@protobuf-ts/runtime-rpc';
|
|
2
|
-
import { Empty } from '../../../generated/google/protobuf/empty';
|
|
3
|
-
import { DataEntry, PeerDescriptor, ReplicateDataRequest, StoreDataRequest, StoreDataResponse } from '../../../generated/packages/dht/protos/DhtRpc';
|
|
4
|
-
import { IStoreRpc } from '../../../generated/packages/dht/protos/DhtRpc.server';
|
|
5
|
-
import { LocalDataStore } from './LocalDataStore';
|
|
6
|
-
import { DhtAddress } from '../../identifiers';
|
|
7
|
-
interface StoreRpcLocalOptions {
|
|
8
|
-
localDataStore: LocalDataStore;
|
|
9
|
-
localPeerDescriptor: PeerDescriptor;
|
|
10
|
-
replicateDataToContact: (dataEntry: DataEntry, contact: PeerDescriptor) => Promise<void>;
|
|
11
|
-
getStorers: (key: DhtAddress) => readonly PeerDescriptor[];
|
|
12
|
-
}
|
|
13
|
-
export declare class StoreRpcLocal implements IStoreRpc {
|
|
14
|
-
private readonly options;
|
|
15
|
-
constructor(options: StoreRpcLocalOptions);
|
|
16
|
-
storeData(request: StoreDataRequest): Promise<StoreDataResponse>;
|
|
17
|
-
replicateData(request: ReplicateDataRequest, context: ServerCallContext): Promise<Empty>;
|
|
18
|
-
private isLocalNodeStorer;
|
|
19
|
-
private replicateDataToNeighbors;
|
|
20
|
-
}
|
|
21
|
-
export {};
|