@dxos/echo-pipeline 0.1.55-main.ff36828 → 0.1.55
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/lib/browser/{chunk-OJGL5427.mjs → chunk-4VJRJ4SY.mjs} +877 -872
- package/dist/lib/browser/chunk-4VJRJ4SY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/browser/testing/index.mjs.map +1 -1
- package/dist/lib/node/index.cjs +787 -784
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +78 -73
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/db-host/data-service-host.d.ts.map +1 -0
- package/dist/types/src/db-host/data-service.d.ts.map +1 -0
- package/dist/types/src/db-host/database-host.d.ts.map +1 -0
- package/dist/types/src/db-host/index.d.ts.map +1 -0
- package/dist/types/src/db-host/snapshot-manager.d.ts.map +1 -0
- package/dist/types/src/db-host/snapshot-store.d.ts.map +1 -0
- package/dist/types/src/db-host/snapshot-store.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/pipeline/pipeline.d.ts +3 -2
- package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/data-pipeline.d.ts +4 -4
- package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +1 -1
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +2 -3
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +1 -1
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/database-test-rig.d.ts +1 -1
- package/dist/types/src/testing/database-test-rig.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts +1 -1
- package/dist/types/src/testing/util.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/{dbhost → db-host}/database-host.ts +0 -2
- package/src/index.ts +2 -2
- package/src/pipeline/pipeline.ts +19 -26
- package/src/space/control-pipeline.ts +4 -1
- package/src/space/data-pipeline.ts +12 -9
- package/src/space/space-manager.ts +1 -1
- package/src/space/space-protocol.ts +2 -3
- package/src/space/space.ts +1 -1
- package/src/testing/database-test-rig.ts +1 -1
- package/src/testing/test-agent-builder.ts +1 -1
- package/src/testing/util.ts +1 -1
- package/src/tests/database.test.ts +1 -1
- package/dist/lib/browser/chunk-OJGL5427.mjs.map +0 -7
- package/dist/types/src/dbhost/data-service-host.d.ts.map +0 -1
- package/dist/types/src/dbhost/data-service.d.ts.map +0 -1
- package/dist/types/src/dbhost/database-host.d.ts.map +0 -1
- package/dist/types/src/dbhost/index.d.ts.map +0 -1
- package/dist/types/src/dbhost/snapshot-manager.d.ts.map +0 -1
- package/dist/types/src/dbhost/snapshot-store.d.ts.map +0 -1
- package/dist/types/src/dbhost/snapshot-store.test.d.ts.map +0 -1
- /package/dist/types/src/{dbhost → db-host}/data-service-host.d.ts +0 -0
- /package/dist/types/src/{dbhost → db-host}/data-service.d.ts +0 -0
- /package/dist/types/src/{dbhost → db-host}/database-host.d.ts +0 -0
- /package/dist/types/src/{dbhost → db-host}/index.d.ts +0 -0
- /package/dist/types/src/{dbhost → db-host}/snapshot-manager.d.ts +0 -0
- /package/dist/types/src/{dbhost → db-host}/snapshot-store.d.ts +0 -0
- /package/dist/types/src/{dbhost → db-host}/snapshot-store.test.d.ts +0 -0
- /package/src/{dbhost → db-host}/data-service-host.ts +0 -0
- /package/src/{dbhost → db-host}/data-service.ts +0 -0
- /package/src/{dbhost → db-host}/index.ts +0 -0
- /package/src/{dbhost → db-host}/snapshot-manager.ts +0 -0
- /package/src/{dbhost → db-host}/snapshot-store.test.ts +0 -0
- /package/src/{dbhost → db-host}/snapshot-store.ts +0 -0
|
@@ -52,16 +52,16 @@ var import_credentials6 = require("@dxos/protocols/proto/dxos/halo/credentials")
|
|
|
52
52
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
53
53
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
54
54
|
var import_teleport_extension_object_sync2 = require("@dxos/teleport-extension-object-sync");
|
|
55
|
-
var
|
|
55
|
+
var import_util10 = require("@dxos/util");
|
|
56
56
|
|
|
57
|
-
// packages/core/echo/echo-pipeline/src/
|
|
57
|
+
// packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts
|
|
58
58
|
var import_tiny_invariant = __toESM(require("tiny-invariant"));
|
|
59
59
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
60
60
|
var import_context = require("@dxos/context");
|
|
61
61
|
var import_echo_db = require("@dxos/echo-db");
|
|
62
62
|
var import_log = require("@dxos/log");
|
|
63
63
|
var import_util = require("@dxos/util");
|
|
64
|
-
var __dxlog_file = "/
|
|
64
|
+
var __dxlog_file = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
|
|
65
65
|
var DataServiceHost = class {
|
|
66
66
|
constructor(_itemManager, _itemDemuxer, _writeStream) {
|
|
67
67
|
this._itemManager = _itemManager;
|
|
@@ -177,7 +177,7 @@ var createDataMessage = (batch) => {
|
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
// packages/core/echo/echo-pipeline/src/
|
|
180
|
+
// packages/core/echo/echo-pipeline/src/db-host/database-host.ts
|
|
181
181
|
var import_echo_db2 = require("@dxos/echo-db");
|
|
182
182
|
var DatabaseHost = class {
|
|
183
183
|
constructor(_outboundStream) {
|
|
@@ -209,7 +209,7 @@ var DatabaseHost = class {
|
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
211
|
|
|
212
|
-
// packages/core/echo/echo-pipeline/src/
|
|
212
|
+
// packages/core/echo/echo-pipeline/src/db-host/snapshot-manager.ts
|
|
213
213
|
var import_async = require("@dxos/async");
|
|
214
214
|
var import_context2 = require("@dxos/context");
|
|
215
215
|
var import_debug = require("@dxos/debug");
|
|
@@ -264,7 +264,7 @@ SnapshotManager = _ts_decorate([
|
|
|
264
264
|
(0, import_async.trackLeaks)("open", "close")
|
|
265
265
|
], SnapshotManager);
|
|
266
266
|
|
|
267
|
-
// packages/core/echo/echo-pipeline/src/
|
|
267
|
+
// packages/core/echo/echo-pipeline/src/db-host/snapshot-store.ts
|
|
268
268
|
var import_crypto = require("@dxos/crypto");
|
|
269
269
|
var import_protocols2 = require("@dxos/protocols");
|
|
270
270
|
var SpaceSnapshot2 = import_protocols2.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot");
|
|
@@ -310,13 +310,13 @@ var SnapshotStore = class {
|
|
|
310
310
|
}
|
|
311
311
|
};
|
|
312
312
|
|
|
313
|
-
// packages/core/echo/echo-pipeline/src/
|
|
313
|
+
// packages/core/echo/echo-pipeline/src/db-host/data-service.ts
|
|
314
314
|
var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
|
|
315
315
|
var import_debug2 = require("@dxos/debug");
|
|
316
316
|
var import_keys2 = require("@dxos/keys");
|
|
317
317
|
var import_log2 = require("@dxos/log");
|
|
318
318
|
var import_util2 = require("@dxos/util");
|
|
319
|
-
var __dxlog_file2 = "/
|
|
319
|
+
var __dxlog_file2 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
|
|
320
320
|
var DataServiceSubscriptions = class {
|
|
321
321
|
constructor() {
|
|
322
322
|
this._spaces = new import_util2.ComplexMap(import_keys2.PublicKey.hash);
|
|
@@ -392,7 +392,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
392
392
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
393
393
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
394
394
|
}
|
|
395
|
-
var __dxlog_file3 = "/
|
|
395
|
+
var __dxlog_file3 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
|
|
396
396
|
var emptyEchoMetadata = () => ({
|
|
397
397
|
version: import_protocols3.STORAGE_VERSION,
|
|
398
398
|
spaces: [],
|
|
@@ -577,7 +577,7 @@ var import_crypto2 = require("@dxos/crypto");
|
|
|
577
577
|
var import_log4 = require("@dxos/log");
|
|
578
578
|
var import_protocols4 = require("@dxos/protocols");
|
|
579
579
|
var import_teleport = require("@dxos/teleport");
|
|
580
|
-
var __dxlog_file4 = "/
|
|
580
|
+
var __dxlog_file4 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/auth.ts";
|
|
581
581
|
var AuthExtension = class extends import_teleport.RpcExtension {
|
|
582
582
|
constructor(_authParams) {
|
|
583
583
|
super({
|
|
@@ -661,7 +661,7 @@ var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
|
|
|
661
661
|
var import_async7 = require("@dxos/async");
|
|
662
662
|
var import_log10 = require("@dxos/log");
|
|
663
663
|
var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
664
|
-
var
|
|
664
|
+
var import_util7 = require("@dxos/util");
|
|
665
665
|
|
|
666
666
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
667
667
|
var import_credentials = require("@dxos/credentials");
|
|
@@ -701,7 +701,7 @@ var createMappedFeedWriter = (mapper, writer) => {
|
|
|
701
701
|
// packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
|
|
702
702
|
var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
|
|
703
703
|
var import_log5 = require("@dxos/log");
|
|
704
|
-
var __dxlog_file5 = "/
|
|
704
|
+
var __dxlog_file5 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
|
|
705
705
|
var createMessageSelector = (timeframeClock) => {
|
|
706
706
|
return (messages) => {
|
|
707
707
|
for (let i = 0; i < messages.length; i++) {
|
|
@@ -735,7 +735,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
735
735
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
736
736
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
737
737
|
}
|
|
738
|
-
var __dxlog_file6 = "/
|
|
738
|
+
var __dxlog_file6 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
|
|
739
739
|
var mapFeedIndexesToTimeframe = (indexes) => new import_timeframe.Timeframe(indexes.map(({ feedKey, index }) => [
|
|
740
740
|
feedKey,
|
|
741
741
|
index
|
|
@@ -825,7 +825,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
825
825
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
826
826
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
827
827
|
}
|
|
828
|
-
var __dxlog_file7 = "/
|
|
828
|
+
var __dxlog_file7 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
|
|
829
829
|
var PipelineState = class {
|
|
830
830
|
// prettier-ignore
|
|
831
831
|
constructor(_feeds, _timeframeClock) {
|
|
@@ -946,6 +946,9 @@ var Pipeline = class {
|
|
|
946
946
|
(0, import_tiny_invariant7.default)(this._writer, "Writer not set.");
|
|
947
947
|
return this._writer;
|
|
948
948
|
}
|
|
949
|
+
hasFeed(feedKey) {
|
|
950
|
+
return this._feeds.has(feedKey);
|
|
951
|
+
}
|
|
949
952
|
getFeeds() {
|
|
950
953
|
return this._feedSetIterator.feeds;
|
|
951
954
|
}
|
|
@@ -958,9 +961,6 @@ var Pipeline = class {
|
|
|
958
961
|
}
|
|
959
962
|
this._setFeedDownloadState(feed);
|
|
960
963
|
}
|
|
961
|
-
hasFeed(feedKey) {
|
|
962
|
-
return this._feeds.has(feedKey);
|
|
963
|
-
}
|
|
964
964
|
setWriteFeed(feed) {
|
|
965
965
|
(0, import_tiny_invariant7.default)(!this._writer, "Writer already set.");
|
|
966
966
|
(0, import_tiny_invariant7.default)(feed.properties.writable, "Feed must be writable.");
|
|
@@ -970,27 +970,27 @@ var Pipeline = class {
|
|
|
970
970
|
}), feed.createFeedWriter());
|
|
971
971
|
}
|
|
972
972
|
async start() {
|
|
973
|
-
(0, import_log7.log)("starting...",
|
|
973
|
+
(0, import_log7.log)("starting...", void 0, {
|
|
974
974
|
F: __dxlog_file7,
|
|
975
|
-
L:
|
|
975
|
+
L: 268,
|
|
976
976
|
S: this,
|
|
977
977
|
C: (f, a) => f(...a)
|
|
978
978
|
});
|
|
979
979
|
await this._initIterator();
|
|
980
980
|
await this._feedSetIterator.open();
|
|
981
|
+
this._isStarted = true;
|
|
981
982
|
(0, import_log7.log)("started", void 0, {
|
|
982
983
|
F: __dxlog_file7,
|
|
983
|
-
L:
|
|
984
|
+
L: 272,
|
|
984
985
|
S: this,
|
|
985
986
|
C: (f, a) => f(...a)
|
|
986
987
|
});
|
|
987
|
-
this._isStarted = true;
|
|
988
988
|
}
|
|
989
989
|
async stop() {
|
|
990
990
|
var _a;
|
|
991
|
-
(0, import_log7.log)("stopping...",
|
|
991
|
+
(0, import_log7.log)("stopping...", void 0, {
|
|
992
992
|
F: __dxlog_file7,
|
|
993
|
-
L:
|
|
993
|
+
L: 277,
|
|
994
994
|
S: this,
|
|
995
995
|
C: (f, a) => f(...a)
|
|
996
996
|
});
|
|
@@ -1000,16 +1000,17 @@ var Pipeline = class {
|
|
|
1000
1000
|
await this._state._ctx.dispose();
|
|
1001
1001
|
this._state._ctx = new import_context4.Context();
|
|
1002
1002
|
this._state._reachedTargetPromise = void 0;
|
|
1003
|
+
this._isStarted = false;
|
|
1003
1004
|
(0, import_log7.log)("stopped", void 0, {
|
|
1004
1005
|
F: __dxlog_file7,
|
|
1005
|
-
L:
|
|
1006
|
+
L: 285,
|
|
1006
1007
|
S: this,
|
|
1007
1008
|
C: (f, a) => f(...a)
|
|
1008
1009
|
});
|
|
1009
|
-
this._isStarted = false;
|
|
1010
1010
|
}
|
|
1011
1011
|
/**
|
|
1012
|
-
* @param timeframe Timeframe of already processed messages.
|
|
1012
|
+
* @param timeframe Timeframe of already processed messages.
|
|
1013
|
+
* The pipeline will start processing messages AFTER this timeframe.
|
|
1013
1014
|
*/
|
|
1014
1015
|
async setCursor(timeframe) {
|
|
1015
1016
|
(0, import_tiny_invariant7.default)(!this._isStarted || this._isPaused, "Invalid state.");
|
|
@@ -1060,15 +1061,14 @@ var Pipeline = class {
|
|
|
1060
1061
|
iterable = lastFeedSetIterator[Symbol.asyncIterator]();
|
|
1061
1062
|
}
|
|
1062
1063
|
const { done, value } = await iterable.next();
|
|
1063
|
-
if (done) {
|
|
1064
|
-
|
|
1064
|
+
if (!done) {
|
|
1065
|
+
const block = value != null ? value : (0, import_debug4.failUndefined)();
|
|
1066
|
+
this._processingTrigger.reset();
|
|
1067
|
+
this._timeframeClock.updatePendingTimeframe(import_keys3.PublicKey.from(block.feedKey), block.seq);
|
|
1068
|
+
yield block;
|
|
1069
|
+
this._processingTrigger.wake();
|
|
1070
|
+
this._timeframeClock.updateTimeframe();
|
|
1065
1071
|
}
|
|
1066
|
-
const block = value != null ? value : (0, import_debug4.failUndefined)();
|
|
1067
|
-
this._processingTrigger.reset();
|
|
1068
|
-
this._timeframeClock.updatePendingTimeframe(import_keys3.PublicKey.from(block.feedKey), block.seq);
|
|
1069
|
-
yield block;
|
|
1070
|
-
this._processingTrigger.wake();
|
|
1071
|
-
this._timeframeClock.updateTimeframe();
|
|
1072
1072
|
}
|
|
1073
1073
|
this._isOpen = false;
|
|
1074
1074
|
}
|
|
@@ -1077,9 +1077,9 @@ var Pipeline = class {
|
|
|
1077
1077
|
const timeframe = this._state._startTimeframe;
|
|
1078
1078
|
const seq = (_a = timeframe.get(feed.key)) != null ? _a : 0;
|
|
1079
1079
|
feed.undownload({
|
|
1080
|
-
callback: () => (0, import_log7.log)("
|
|
1080
|
+
callback: () => (0, import_log7.log)("undownload", void 0, {
|
|
1081
1081
|
F: __dxlog_file7,
|
|
1082
|
-
L:
|
|
1082
|
+
L: 376,
|
|
1083
1083
|
S: this,
|
|
1084
1084
|
C: (f, a) => f(...a)
|
|
1085
1085
|
})
|
|
@@ -1092,7 +1092,7 @@ var Pipeline = class {
|
|
|
1092
1092
|
err
|
|
1093
1093
|
}, {
|
|
1094
1094
|
F: __dxlog_file7,
|
|
1095
|
-
L:
|
|
1095
|
+
L: 378,
|
|
1096
1096
|
S: this,
|
|
1097
1097
|
C: (f, a) => f(...a)
|
|
1098
1098
|
});
|
|
@@ -1106,7 +1106,7 @@ var Pipeline = class {
|
|
|
1106
1106
|
this._feedSetIterator.stalled.on((iterator) => {
|
|
1107
1107
|
import_log7.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
|
|
1108
1108
|
F: __dxlog_file7,
|
|
1109
|
-
L:
|
|
1109
|
+
L: 389,
|
|
1110
1110
|
S: this,
|
|
1111
1111
|
C: (f, a) => f(...a)
|
|
1112
1112
|
});
|
|
@@ -1134,7 +1134,7 @@ _ts_decorate4([
|
|
|
1134
1134
|
], Pipeline.prototype, "unpause", null);
|
|
1135
1135
|
|
|
1136
1136
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
1137
|
-
var __dxlog_file8 = "/
|
|
1137
|
+
var __dxlog_file8 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
|
|
1138
1138
|
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
|
|
1139
1139
|
var ControlPipeline = class {
|
|
1140
1140
|
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
@@ -1201,13 +1201,15 @@ var ControlPipeline = class {
|
|
|
1201
1201
|
C: (f, a) => f(...a)
|
|
1202
1202
|
});
|
|
1203
1203
|
if (msg.data.payload.credential) {
|
|
1204
|
+
const timer = import_util5.tracer.mark("dxos.echo.pipeline.control");
|
|
1204
1205
|
const result = await this._spaceStateMachine.process(msg.data.payload.credential.credential, import_keys4.PublicKey.from(msg.feedKey));
|
|
1206
|
+
timer.end();
|
|
1205
1207
|
if (!result) {
|
|
1206
1208
|
import_log8.log.warn("processing failed", {
|
|
1207
1209
|
msg
|
|
1208
1210
|
}, {
|
|
1209
1211
|
F: __dxlog_file8,
|
|
1210
|
-
L:
|
|
1212
|
+
L: 98,
|
|
1211
1213
|
S: this,
|
|
1212
1214
|
C: (f, a) => f(...a)
|
|
1213
1215
|
});
|
|
@@ -1218,7 +1220,7 @@ var ControlPipeline = class {
|
|
|
1218
1220
|
} catch (err) {
|
|
1219
1221
|
import_log8.log.catch(err, void 0, {
|
|
1220
1222
|
F: __dxlog_file8,
|
|
1221
|
-
L:
|
|
1223
|
+
L: 104,
|
|
1222
1224
|
S: this,
|
|
1223
1225
|
C: (f, a) => f(...a)
|
|
1224
1226
|
});
|
|
@@ -1228,7 +1230,7 @@ var ControlPipeline = class {
|
|
|
1228
1230
|
await this._pipeline.start();
|
|
1229
1231
|
(0, import_log8.log)("started", void 0, {
|
|
1230
1232
|
F: __dxlog_file8,
|
|
1231
|
-
L:
|
|
1233
|
+
L: 110,
|
|
1232
1234
|
S: this,
|
|
1233
1235
|
C: (f, a) => f(...a)
|
|
1234
1236
|
});
|
|
@@ -1242,7 +1244,7 @@ var ControlPipeline = class {
|
|
|
1242
1244
|
async stop() {
|
|
1243
1245
|
(0, import_log8.log)("stopping...", void 0, {
|
|
1244
1246
|
F: __dxlog_file8,
|
|
1245
|
-
L:
|
|
1247
|
+
L: 124,
|
|
1246
1248
|
S: this,
|
|
1247
1249
|
C: (f, a) => f(...a)
|
|
1248
1250
|
});
|
|
@@ -1250,7 +1252,7 @@ var ControlPipeline = class {
|
|
|
1250
1252
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1251
1253
|
(0, import_log8.log)("stopped", void 0, {
|
|
1252
1254
|
F: __dxlog_file8,
|
|
1253
|
-
L:
|
|
1255
|
+
L: 127,
|
|
1254
1256
|
S: this,
|
|
1255
1257
|
C: (f, a) => f(...a)
|
|
1256
1258
|
});
|
|
@@ -1264,7 +1266,7 @@ var ControlPipeline = class {
|
|
|
1264
1266
|
} catch (err) {
|
|
1265
1267
|
(0, import_log8.log)(err, void 0, {
|
|
1266
1268
|
F: __dxlog_file8,
|
|
1267
|
-
L:
|
|
1269
|
+
L: 136,
|
|
1268
1270
|
S: this,
|
|
1269
1271
|
C: (f, a) => f(...a)
|
|
1270
1272
|
});
|
|
@@ -1281,6 +1283,7 @@ var import_echo_db3 = require("@dxos/echo-db");
|
|
|
1281
1283
|
var import_errors2 = require("@dxos/errors");
|
|
1282
1284
|
var import_log9 = require("@dxos/log");
|
|
1283
1285
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
1286
|
+
var import_util6 = require("@dxos/util");
|
|
1284
1287
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
1285
1288
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1286
1289
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1291,7 +1294,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1291
1294
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1292
1295
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1293
1296
|
}
|
|
1294
|
-
var __dxlog_file9 = "/
|
|
1297
|
+
var __dxlog_file9 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
|
|
1295
1298
|
var MESSAGES_PER_SNAPSHOT = 10;
|
|
1296
1299
|
var AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL = 5e3;
|
|
1297
1300
|
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2 = 500;
|
|
@@ -1305,9 +1308,9 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1305
1308
|
this._isOpen = false;
|
|
1306
1309
|
this._lastTimeframeSaveTime = 0;
|
|
1307
1310
|
this._lastSnapshotSaveTime = 0;
|
|
1311
|
+
this._lastProcessedEpoch = -1;
|
|
1308
1312
|
this.currentEpoch = void 0;
|
|
1309
1313
|
this.appliedEpoch = void 0;
|
|
1310
|
-
this._lastProcessedEpoch = -1;
|
|
1311
1314
|
this.onNewEpoch = new import_async6.Event();
|
|
1312
1315
|
}
|
|
1313
1316
|
get isOpen() {
|
|
@@ -1422,7 +1425,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1422
1425
|
if (data.payload.data) {
|
|
1423
1426
|
const feedInfo = this._params.feedInfoProvider(feedKey);
|
|
1424
1427
|
if (!feedInfo) {
|
|
1425
|
-
import_log9.log.
|
|
1428
|
+
import_log9.log.warn("Could not find feed", {
|
|
1426
1429
|
feedKey
|
|
1427
1430
|
}, {
|
|
1428
1431
|
F: __dxlog_file9,
|
|
@@ -1432,7 +1435,8 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1432
1435
|
});
|
|
1433
1436
|
continue;
|
|
1434
1437
|
}
|
|
1435
|
-
|
|
1438
|
+
const timer = import_util6.tracer.mark("dxos.echo.pipeline.data");
|
|
1439
|
+
this.databaseHost.echoProcessor({
|
|
1436
1440
|
batch: data.payload.data.batch,
|
|
1437
1441
|
meta: {
|
|
1438
1442
|
feedKey,
|
|
@@ -1441,13 +1445,14 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1441
1445
|
memberKey: feedInfo.assertion.identityKey
|
|
1442
1446
|
}
|
|
1443
1447
|
});
|
|
1448
|
+
timer.end();
|
|
1444
1449
|
import_log9.log.trace("dxos.echo.data-pipeline.processed", {
|
|
1445
1450
|
feedKey: feedKey.toHex(),
|
|
1446
1451
|
seq,
|
|
1447
1452
|
spaceKey: this._params.spaceKey.toHex()
|
|
1448
1453
|
}, {
|
|
1449
1454
|
F: __dxlog_file9,
|
|
1450
|
-
L:
|
|
1455
|
+
L: 233,
|
|
1451
1456
|
S: this,
|
|
1452
1457
|
C: (f, a) => f(...a)
|
|
1453
1458
|
});
|
|
@@ -1456,7 +1461,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1456
1461
|
} catch (err) {
|
|
1457
1462
|
import_log9.log.catch(err, void 0, {
|
|
1458
1463
|
F: __dxlog_file9,
|
|
1459
|
-
L:
|
|
1464
|
+
L: 243,
|
|
1460
1465
|
S: this,
|
|
1461
1466
|
C: (f, a) => f(...a)
|
|
1462
1467
|
});
|
|
@@ -1491,7 +1496,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1491
1496
|
} catch (err) {
|
|
1492
1497
|
import_log9.log.warn("Failed to cache properties", err, {
|
|
1493
1498
|
F: __dxlog_file9,
|
|
1494
|
-
L:
|
|
1499
|
+
L: 278,
|
|
1495
1500
|
S: this,
|
|
1496
1501
|
C: (f, a) => f(...a)
|
|
1497
1502
|
});
|
|
@@ -1518,14 +1523,14 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1518
1523
|
if (err instanceof import_errors2.CancelledError) {
|
|
1519
1524
|
(0, import_log9.log)("Epoch processing cancelled.", void 0, {
|
|
1520
1525
|
F: __dxlog_file9,
|
|
1521
|
-
L:
|
|
1526
|
+
L: 310,
|
|
1522
1527
|
S: this,
|
|
1523
1528
|
C: (f, a) => f(...a)
|
|
1524
1529
|
});
|
|
1525
1530
|
} else {
|
|
1526
1531
|
import_log9.log.catch(err, void 0, {
|
|
1527
1532
|
F: __dxlog_file9,
|
|
1528
|
-
L:
|
|
1533
|
+
L: 312,
|
|
1529
1534
|
S: this,
|
|
1530
1535
|
C: (f, a) => f(...a)
|
|
1531
1536
|
});
|
|
@@ -1541,7 +1546,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1541
1546
|
epoch
|
|
1542
1547
|
}, {
|
|
1543
1548
|
F: __dxlog_file9,
|
|
1544
|
-
L:
|
|
1549
|
+
L: 322,
|
|
1545
1550
|
S: this,
|
|
1546
1551
|
C: (f, a) => f(...a)
|
|
1547
1552
|
});
|
|
@@ -1558,7 +1563,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1558
1563
|
epoch
|
|
1559
1564
|
}, {
|
|
1560
1565
|
F: __dxlog_file9,
|
|
1561
|
-
L:
|
|
1566
|
+
L: 336,
|
|
1562
1567
|
S: this,
|
|
1563
1568
|
C: (f, a) => f(...a)
|
|
1564
1569
|
});
|
|
@@ -1568,7 +1573,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1568
1573
|
}
|
|
1569
1574
|
(0, import_log9.log)("restarting pipeline for epoch", void 0, {
|
|
1570
1575
|
F: __dxlog_file9,
|
|
1571
|
-
L:
|
|
1576
|
+
L: 344,
|
|
1572
1577
|
S: this,
|
|
1573
1578
|
C: (f, a) => f(...a)
|
|
1574
1579
|
});
|
|
@@ -1626,11 +1631,11 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
1626
1631
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1627
1632
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1628
1633
|
}
|
|
1629
|
-
var __dxlog_file10 = "/
|
|
1634
|
+
var __dxlog_file10 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space.ts";
|
|
1630
1635
|
var Space = class Space2 {
|
|
1631
1636
|
constructor(params) {
|
|
1632
1637
|
this._addFeedLock = new import_async7.Lock();
|
|
1633
|
-
this.onCredentialProcessed = new
|
|
1638
|
+
this.onCredentialProcessed = new import_util7.Callback();
|
|
1634
1639
|
this.stateUpdate = new import_async7.Event();
|
|
1635
1640
|
this._isOpen = false;
|
|
1636
1641
|
(0, import_tiny_invariant9.default)(params.spaceKey && params.feedProvider);
|
|
@@ -1836,7 +1841,7 @@ var import_debug5 = require("@dxos/debug");
|
|
|
1836
1841
|
var import_keys6 = require("@dxos/keys");
|
|
1837
1842
|
var import_log12 = require("@dxos/log");
|
|
1838
1843
|
var import_protocols6 = require("@dxos/protocols");
|
|
1839
|
-
var
|
|
1844
|
+
var import_util9 = require("@dxos/util");
|
|
1840
1845
|
|
|
1841
1846
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
1842
1847
|
var import_crypto3 = require("@dxos/crypto");
|
|
@@ -1846,7 +1851,7 @@ var import_network_manager = require("@dxos/network-manager");
|
|
|
1846
1851
|
var import_teleport2 = require("@dxos/teleport");
|
|
1847
1852
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
1848
1853
|
var import_teleport_extension_replicator = require("@dxos/teleport-extension-replicator");
|
|
1849
|
-
var
|
|
1854
|
+
var import_util8 = require("@dxos/util");
|
|
1850
1855
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
1851
1856
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1852
1857
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1857,13 +1862,13 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
1857
1862
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1858
1863
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1859
1864
|
}
|
|
1860
|
-
var __dxlog_file11 = "/
|
|
1865
|
+
var __dxlog_file11 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
|
|
1861
1866
|
var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
|
|
1862
1867
|
var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
1863
1868
|
var SpaceProtocol = class {
|
|
1864
1869
|
constructor({ topic, swarmIdentity, networkManager, onSessionAuth, onAuthFailure, blobStore }) {
|
|
1865
1870
|
this._feeds = /* @__PURE__ */ new Set();
|
|
1866
|
-
this._sessions = new
|
|
1871
|
+
this._sessions = new import_util8.ComplexMap(import_keys5.PublicKey.hash);
|
|
1867
1872
|
this._networkManager = networkManager;
|
|
1868
1873
|
this._swarmIdentity = swarmIdentity;
|
|
1869
1874
|
this._onSessionAuth = onSessionAuth;
|
|
@@ -1888,7 +1893,7 @@ var SpaceProtocol = class {
|
|
|
1888
1893
|
key: feed.key
|
|
1889
1894
|
}, {
|
|
1890
1895
|
F: __dxlog_file11,
|
|
1891
|
-
L:
|
|
1896
|
+
L: 95,
|
|
1892
1897
|
S: this,
|
|
1893
1898
|
C: (f, a) => f(...a)
|
|
1894
1899
|
});
|
|
@@ -1910,7 +1915,7 @@ var SpaceProtocol = class {
|
|
|
1910
1915
|
await this.blobSync.open();
|
|
1911
1916
|
(0, import_log11.log)("starting...", void 0, {
|
|
1912
1917
|
F: __dxlog_file11,
|
|
1913
|
-
L:
|
|
1918
|
+
L: 120,
|
|
1914
1919
|
S: this,
|
|
1915
1920
|
C: (f, a) => f(...a)
|
|
1916
1921
|
});
|
|
@@ -1923,7 +1928,7 @@ var SpaceProtocol = class {
|
|
|
1923
1928
|
});
|
|
1924
1929
|
(0, import_log11.log)("started", void 0, {
|
|
1925
1930
|
F: __dxlog_file11,
|
|
1926
|
-
L:
|
|
1931
|
+
L: 129,
|
|
1927
1932
|
S: this,
|
|
1928
1933
|
C: (f, a) => f(...a)
|
|
1929
1934
|
});
|
|
@@ -1933,14 +1938,14 @@ var SpaceProtocol = class {
|
|
|
1933
1938
|
if (this._connection) {
|
|
1934
1939
|
(0, import_log11.log)("stopping...", void 0, {
|
|
1935
1940
|
F: __dxlog_file11,
|
|
1936
|
-
L:
|
|
1941
|
+
L: 136,
|
|
1937
1942
|
S: this,
|
|
1938
1943
|
C: (f, a) => f(...a)
|
|
1939
1944
|
});
|
|
1940
1945
|
await this._connection.close();
|
|
1941
1946
|
(0, import_log11.log)("stopped", void 0, {
|
|
1942
1947
|
F: __dxlog_file11,
|
|
1943
|
-
L:
|
|
1948
|
+
L: 138,
|
|
1944
1949
|
S: this,
|
|
1945
1950
|
C: (f, a) => f(...a)
|
|
1946
1951
|
});
|
|
@@ -2008,7 +2013,7 @@ var SpaceProtocolSession = class {
|
|
|
2008
2013
|
var _a;
|
|
2009
2014
|
(0, import_log11.log)("Peer authenticated", void 0, {
|
|
2010
2015
|
F: __dxlog_file11,
|
|
2011
|
-
L:
|
|
2016
|
+
L: 235,
|
|
2012
2017
|
S: this,
|
|
2013
2018
|
C: (f, a) => f(...a)
|
|
2014
2019
|
});
|
|
@@ -2046,10 +2051,10 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
2046
2051
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2047
2052
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2048
2053
|
}
|
|
2049
|
-
var __dxlog_file12 = "/
|
|
2054
|
+
var __dxlog_file12 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
2050
2055
|
var SpaceManager = class SpaceManager2 {
|
|
2051
2056
|
constructor({ feedStore, networkManager, modelFactory, metadataStore, snapshotStore, blobStore }) {
|
|
2052
|
-
this._spaces = new
|
|
2057
|
+
this._spaces = new import_util9.ComplexMap(import_keys6.PublicKey.hash);
|
|
2053
2058
|
this._instanceId = import_keys6.PublicKey.random().toHex();
|
|
2054
2059
|
this._feedStore = feedStore;
|
|
2055
2060
|
this._networkManager = networkManager;
|
|
@@ -2155,7 +2160,7 @@ var WebsocketNetworkManagerProvider = (signalUrl) => () => new import_network_ma
|
|
|
2155
2160
|
});
|
|
2156
2161
|
var TestAgentBuilder = class {
|
|
2157
2162
|
constructor({ storage, networkManagerProvider } = {}) {
|
|
2158
|
-
this._agents = new
|
|
2163
|
+
this._agents = new import_util10.ComplexMap(import_keys7.PublicKey.hash);
|
|
2159
2164
|
this._storage = storage != null ? storage : (0, import_random_access_storage.createStorage)({
|
|
2160
2165
|
type: import_random_access_storage.StorageType.RAM
|
|
2161
2166
|
});
|
|
@@ -2197,7 +2202,7 @@ var TestAgent = class {
|
|
|
2197
2202
|
this._feedBuilder = _feedBuilder;
|
|
2198
2203
|
this.identityKey = identityKey;
|
|
2199
2204
|
this.deviceKey = deviceKey;
|
|
2200
|
-
this._spaces = new
|
|
2205
|
+
this._spaces = new import_util10.ComplexMap(import_keys7.PublicKey.hash);
|
|
2201
2206
|
this.modelFactory = new import_model_factory.ModelFactory().registerModel(import_document_model.DocumentModel);
|
|
2202
2207
|
this.storage = this._feedBuilder.storage;
|
|
2203
2208
|
this.keyring = this._feedBuilder.keyring;
|