@dxos/echo-pipeline 0.1.45 → 0.1.46-next.412561
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-2NGLSBL4.mjs → chunk-QCDWBDL4.mjs} +79 -43
- package/dist/lib/browser/chunk-QCDWBDL4.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/node/index.cjs +78 -42
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +115 -79
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/dbhost/snapshot-manager.d.ts.map +1 -1
- package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/dbhost/snapshot-manager.ts +8 -2
- package/src/space/data-pipeline.ts +3 -0
- package/src/space/space-manager.browser.test.ts +3 -2
- package/src/space/space-protocol.browser.test.ts +2 -1
- package/dist/lib/browser/chunk-2NGLSBL4.mjs.map +0 -7
|
@@ -193,6 +193,8 @@ var DatabaseHost = class {
|
|
|
193
193
|
|
|
194
194
|
// packages/core/echo/echo-pipeline/src/dbhost/snapshot-manager.ts
|
|
195
195
|
var import_async = require("@dxos/async");
|
|
196
|
+
var import_debug = require("@dxos/debug");
|
|
197
|
+
var import_log2 = require("@dxos/log");
|
|
196
198
|
var import_protocols = require("@dxos/protocols");
|
|
197
199
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
198
200
|
var __decorate = function(decorators, target, key, desc) {
|
|
@@ -212,6 +214,15 @@ var SnapshotManager = class SnapshotManager2 {
|
|
|
212
214
|
this._objectSync = new import_teleport_extension_object_sync.ObjectSync({
|
|
213
215
|
getObject: async (id) => {
|
|
214
216
|
const snapshot = await this._snapshotStore.loadSnapshot(id);
|
|
217
|
+
(0, import_log2.log)("getObject", {
|
|
218
|
+
id,
|
|
219
|
+
snapshot
|
|
220
|
+
}, {
|
|
221
|
+
file: "snapshot-manager.ts",
|
|
222
|
+
line: 30,
|
|
223
|
+
scope: this,
|
|
224
|
+
callSite: (f, a) => f(...a)
|
|
225
|
+
});
|
|
215
226
|
if (!snapshot) {
|
|
216
227
|
return void 0;
|
|
217
228
|
}
|
|
@@ -221,7 +232,15 @@ var SnapshotManager = class SnapshotManager2 {
|
|
|
221
232
|
};
|
|
222
233
|
},
|
|
223
234
|
setObject: async (data) => {
|
|
224
|
-
|
|
235
|
+
(0, import_log2.log)("setObject", {
|
|
236
|
+
data
|
|
237
|
+
}, {
|
|
238
|
+
file: "snapshot-manager.ts",
|
|
239
|
+
line: 40,
|
|
240
|
+
scope: this,
|
|
241
|
+
callSite: (f, a) => f(...a)
|
|
242
|
+
});
|
|
243
|
+
const snapshot = import_protocols.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(data.payload.value);
|
|
225
244
|
await this._snapshotStore.saveSnapshot(snapshot);
|
|
226
245
|
}
|
|
227
246
|
});
|
|
@@ -241,13 +260,16 @@ var SnapshotManager = class SnapshotManager2 {
|
|
|
241
260
|
return local;
|
|
242
261
|
}
|
|
243
262
|
const remote = await this._objectSync.download(id);
|
|
244
|
-
return import_protocols.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(remote.payload);
|
|
263
|
+
return import_protocols.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(remote.payload.value);
|
|
245
264
|
}
|
|
246
265
|
async store(snapshot) {
|
|
247
266
|
const id = await this._snapshotStore.saveSnapshot(snapshot);
|
|
248
267
|
return id;
|
|
249
268
|
}
|
|
250
269
|
};
|
|
270
|
+
__decorate([
|
|
271
|
+
(0, import_debug.timed)(1e4)
|
|
272
|
+
], SnapshotManager.prototype, "load", null);
|
|
251
273
|
SnapshotManager = __decorate([
|
|
252
274
|
(0, import_async.trackLeaks)("open", "close")
|
|
253
275
|
], SnapshotManager);
|
|
@@ -299,9 +321,9 @@ var SnapshotStore = class {
|
|
|
299
321
|
|
|
300
322
|
// packages/core/echo/echo-pipeline/src/dbhost/data-service.ts
|
|
301
323
|
var import_node_assert2 = __toESM(require("node:assert"));
|
|
302
|
-
var
|
|
324
|
+
var import_debug2 = require("@dxos/debug");
|
|
303
325
|
var import_keys = require("@dxos/keys");
|
|
304
|
-
var
|
|
326
|
+
var import_log3 = require("@dxos/log");
|
|
305
327
|
var import_util2 = require("@dxos/util");
|
|
306
328
|
var DataServiceSubscriptions = class {
|
|
307
329
|
constructor() {
|
|
@@ -311,7 +333,7 @@ var DataServiceSubscriptions = class {
|
|
|
311
333
|
this._spaces.clear();
|
|
312
334
|
}
|
|
313
335
|
registerSpace(spaceKey, host) {
|
|
314
|
-
(0,
|
|
336
|
+
(0, import_log3.log)("Registering space", {
|
|
315
337
|
spaceKey
|
|
316
338
|
}, {
|
|
317
339
|
file: "data-service.ts",
|
|
@@ -322,7 +344,7 @@ var DataServiceSubscriptions = class {
|
|
|
322
344
|
this._spaces.set(spaceKey, host);
|
|
323
345
|
}
|
|
324
346
|
unregisterSpace(spaceKey) {
|
|
325
|
-
(0,
|
|
347
|
+
(0, import_log3.log)("Unregistering space", {
|
|
326
348
|
spaceKey
|
|
327
349
|
}, {
|
|
328
350
|
file: "data-service.ts",
|
|
@@ -343,14 +365,14 @@ var DataServiceImpl = class {
|
|
|
343
365
|
subscribe(request) {
|
|
344
366
|
var _a;
|
|
345
367
|
(0, import_node_assert2.default)(request.spaceKey);
|
|
346
|
-
const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0,
|
|
368
|
+
const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug2.raise)(new Error(`space not found: ${request.spaceKey}`));
|
|
347
369
|
return host.subscribe();
|
|
348
370
|
}
|
|
349
371
|
write(request) {
|
|
350
372
|
var _a;
|
|
351
373
|
(0, import_node_assert2.default)(request.spaceKey);
|
|
352
374
|
(0, import_node_assert2.default)(request.batch);
|
|
353
|
-
const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0,
|
|
375
|
+
const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug2.raise)(new Error(`space not found: ${request.spaceKey}`));
|
|
354
376
|
return host.write(request);
|
|
355
377
|
}
|
|
356
378
|
};
|
|
@@ -360,7 +382,7 @@ var import_crc_32 = __toESM(require("crc-32"));
|
|
|
360
382
|
var import_node_assert3 = __toESM(require("node:assert"));
|
|
361
383
|
var import_async2 = require("@dxos/async");
|
|
362
384
|
var import_errors = require("@dxos/errors");
|
|
363
|
-
var
|
|
385
|
+
var import_log4 = require("@dxos/log");
|
|
364
386
|
var import_protocols3 = require("@dxos/protocols");
|
|
365
387
|
var __decorate2 = function(decorators, target, key, desc) {
|
|
366
388
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -409,7 +431,7 @@ var MetadataStore = class {
|
|
|
409
431
|
}
|
|
410
432
|
const dataSize = fromBytesInt32(await file.read(0, 4));
|
|
411
433
|
const checksum = fromBytesInt32(await file.read(4, 4));
|
|
412
|
-
(0,
|
|
434
|
+
(0, import_log4.log)("loaded", {
|
|
413
435
|
size: dataSize,
|
|
414
436
|
checksum
|
|
415
437
|
}, {
|
|
@@ -428,7 +450,7 @@ var MetadataStore = class {
|
|
|
428
450
|
}
|
|
429
451
|
this._metadata = import_protocols3.schema.getCodecForType("dxos.echo.metadata.EchoMetadata").decode(data);
|
|
430
452
|
} catch (err) {
|
|
431
|
-
|
|
453
|
+
import_log4.log.error("failed to load metadata", {
|
|
432
454
|
err
|
|
433
455
|
}, {
|
|
434
456
|
file: "metadata-store.ts",
|
|
@@ -458,7 +480,7 @@ var MetadataStore = class {
|
|
|
458
480
|
result.writeInt32LE(checksum, 4);
|
|
459
481
|
encoded.copy(result, 8);
|
|
460
482
|
await file.write(0, result);
|
|
461
|
-
(0,
|
|
483
|
+
(0, import_log4.log)("saved", {
|
|
462
484
|
size: encoded.length,
|
|
463
485
|
checksum
|
|
464
486
|
}, {
|
|
@@ -480,7 +502,7 @@ var MetadataStore = class {
|
|
|
480
502
|
* Clears storage - doesn't work for now.
|
|
481
503
|
*/
|
|
482
504
|
async clear() {
|
|
483
|
-
(0,
|
|
505
|
+
(0, import_log4.log)("clearing all metadata", {}, {
|
|
484
506
|
file: "metadata-store.ts",
|
|
485
507
|
line: 132,
|
|
486
508
|
scope: this,
|
|
@@ -530,7 +552,7 @@ var import_node_assert4 = __toESM(require("node:assert"));
|
|
|
530
552
|
var import_async3 = require("@dxos/async");
|
|
531
553
|
var import_context = require("@dxos/context");
|
|
532
554
|
var import_crypto2 = require("@dxos/crypto");
|
|
533
|
-
var
|
|
555
|
+
var import_log5 = require("@dxos/log");
|
|
534
556
|
var import_protocols4 = require("@dxos/protocols");
|
|
535
557
|
var import_teleport = require("@dxos/teleport");
|
|
536
558
|
var AuthExtension = class extends import_teleport.RpcExtension {
|
|
@@ -547,7 +569,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
547
569
|
this._authParams = _authParams;
|
|
548
570
|
this._ctx = new import_context.Context({
|
|
549
571
|
onError: (err) => {
|
|
550
|
-
|
|
572
|
+
import_log5.log.catch(err, {}, {
|
|
551
573
|
file: "auth.ts",
|
|
552
574
|
line: 29,
|
|
553
575
|
scope: this,
|
|
@@ -569,7 +591,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
569
591
|
credential
|
|
570
592
|
};
|
|
571
593
|
} catch (err) {
|
|
572
|
-
|
|
594
|
+
import_log5.log.error("failed to generate auth credentials", err, {
|
|
573
595
|
file: "auth.ts",
|
|
574
596
|
line: 56,
|
|
575
597
|
scope: this,
|
|
@@ -594,7 +616,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
594
616
|
(0, import_node_assert4.default)(success, "credential not verified");
|
|
595
617
|
(0, import_async3.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
|
|
596
618
|
} catch (err) {
|
|
597
|
-
|
|
619
|
+
import_log5.log.warn("auth failed", err, {
|
|
598
620
|
file: "auth.ts",
|
|
599
621
|
line: 75,
|
|
600
622
|
scope: this,
|
|
@@ -614,14 +636,14 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
614
636
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
615
637
|
var import_node_assert9 = __toESM(require("node:assert"));
|
|
616
638
|
var import_async7 = require("@dxos/async");
|
|
617
|
-
var
|
|
639
|
+
var import_log10 = require("@dxos/log");
|
|
618
640
|
var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
619
641
|
var import_util5 = require("@dxos/util");
|
|
620
642
|
|
|
621
643
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
622
644
|
var import_credentials = require("@dxos/credentials");
|
|
623
645
|
var import_keys3 = require("@dxos/keys");
|
|
624
|
-
var
|
|
646
|
+
var import_log8 = require("@dxos/log");
|
|
625
647
|
var import_credentials2 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
626
648
|
var import_util4 = require("@dxos/util");
|
|
627
649
|
|
|
@@ -629,10 +651,10 @@ var import_util4 = require("@dxos/util");
|
|
|
629
651
|
var import_node_assert7 = __toESM(require("node:assert"));
|
|
630
652
|
var import_async5 = require("@dxos/async");
|
|
631
653
|
var import_context2 = require("@dxos/context");
|
|
632
|
-
var
|
|
654
|
+
var import_debug5 = require("@dxos/debug");
|
|
633
655
|
var import_feed_store = require("@dxos/feed-store");
|
|
634
656
|
var import_keys2 = require("@dxos/keys");
|
|
635
|
-
var
|
|
657
|
+
var import_log7 = require("@dxos/log");
|
|
636
658
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
637
659
|
var import_util3 = require("@dxos/util");
|
|
638
660
|
|
|
@@ -653,9 +675,9 @@ var createMappedFeedWriter = (mapper, writer) => {
|
|
|
653
675
|
};
|
|
654
676
|
|
|
655
677
|
// packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
|
|
656
|
-
var
|
|
678
|
+
var import_debug3 = __toESM(require("debug"));
|
|
657
679
|
var import_node_assert6 = __toESM(require("node:assert"));
|
|
658
|
-
var
|
|
680
|
+
var log6 = (0, import_debug3.default)("dxos:echo-db:message-selector");
|
|
659
681
|
var createMessageSelector = (timeframeClock) => {
|
|
660
682
|
return (messages) => {
|
|
661
683
|
for (let i = 0; i < messages.length; i++) {
|
|
@@ -665,14 +687,14 @@ var createMessageSelector = (timeframeClock) => {
|
|
|
665
687
|
return i;
|
|
666
688
|
}
|
|
667
689
|
}
|
|
668
|
-
|
|
690
|
+
log6("Skipping...");
|
|
669
691
|
};
|
|
670
692
|
};
|
|
671
693
|
|
|
672
694
|
// packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts
|
|
673
695
|
var import_async4 = require("@dxos/async");
|
|
674
|
-
var
|
|
675
|
-
var
|
|
696
|
+
var import_debug4 = require("@dxos/debug");
|
|
697
|
+
var import_log6 = require("@dxos/log");
|
|
676
698
|
var import_timeframe = require("@dxos/timeframe");
|
|
677
699
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
678
700
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -734,7 +756,7 @@ var TimeframeClock = class {
|
|
|
734
756
|
return !gaps.isEmpty();
|
|
735
757
|
}
|
|
736
758
|
async waitUntilReached(target) {
|
|
737
|
-
(0,
|
|
759
|
+
(0, import_log6.log)("waitUntilReached", {
|
|
738
760
|
target,
|
|
739
761
|
current: this._timeframe
|
|
740
762
|
}, {
|
|
@@ -744,7 +766,7 @@ var TimeframeClock = class {
|
|
|
744
766
|
callSite: (f, a) => f(...a)
|
|
745
767
|
});
|
|
746
768
|
await this.update.waitForCondition(() => {
|
|
747
|
-
(0,
|
|
769
|
+
(0, import_log6.log)("check if reached", {
|
|
748
770
|
target,
|
|
749
771
|
current: this._timeframe,
|
|
750
772
|
deps: import_timeframe.Timeframe.dependencies(target, this._timeframe)
|
|
@@ -759,7 +781,7 @@ var TimeframeClock = class {
|
|
|
759
781
|
}
|
|
760
782
|
};
|
|
761
783
|
__decorate3([
|
|
762
|
-
(0,
|
|
784
|
+
(0, import_debug4.timed)(5e3)
|
|
763
785
|
], TimeframeClock.prototype, "waitUntilReached", null);
|
|
764
786
|
|
|
765
787
|
// packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
|
|
@@ -819,7 +841,7 @@ var PipelineState = class {
|
|
|
819
841
|
*/
|
|
820
842
|
async waitUntilReachedTargetTimeframe({ ctx = new import_context2.Context(), timeout, breakOnStall = true } = {}) {
|
|
821
843
|
var _a;
|
|
822
|
-
(0,
|
|
844
|
+
(0, import_log7.log)("waitUntilReachedTargetTimeframe", {
|
|
823
845
|
timeout,
|
|
824
846
|
current: this.timeframe,
|
|
825
847
|
target: this.targetTimeframe
|
|
@@ -848,7 +870,7 @@ var PipelineState = class {
|
|
|
848
870
|
if (done) {
|
|
849
871
|
return;
|
|
850
872
|
}
|
|
851
|
-
|
|
873
|
+
import_log7.log.warn("waitUntilReachedTargetTimeframe timed out", {
|
|
852
874
|
timeout,
|
|
853
875
|
current: this.timeframe,
|
|
854
876
|
target: this.targetTimeframe,
|
|
@@ -910,7 +932,7 @@ var Pipeline = class {
|
|
|
910
932
|
}), feed.createFeedWriter());
|
|
911
933
|
}
|
|
912
934
|
async start() {
|
|
913
|
-
(0,
|
|
935
|
+
(0, import_log7.log)("starting...", {}, {
|
|
914
936
|
file: "pipeline.ts",
|
|
915
937
|
line: 254,
|
|
916
938
|
scope: this,
|
|
@@ -918,7 +940,7 @@ var Pipeline = class {
|
|
|
918
940
|
});
|
|
919
941
|
await this._initIterator();
|
|
920
942
|
await this._feedSetIterator.open();
|
|
921
|
-
(0,
|
|
943
|
+
(0, import_log7.log)("started", {}, {
|
|
922
944
|
file: "pipeline.ts",
|
|
923
945
|
line: 257,
|
|
924
946
|
scope: this,
|
|
@@ -928,7 +950,7 @@ var Pipeline = class {
|
|
|
928
950
|
}
|
|
929
951
|
async stop() {
|
|
930
952
|
var _a;
|
|
931
|
-
(0,
|
|
953
|
+
(0, import_log7.log)("stopping...", {}, {
|
|
932
954
|
file: "pipeline.ts",
|
|
933
955
|
line: 263,
|
|
934
956
|
scope: this,
|
|
@@ -937,7 +959,7 @@ var Pipeline = class {
|
|
|
937
959
|
this._isStopping = true;
|
|
938
960
|
await ((_a = this._feedSetIterator) == null ? void 0 : _a.close());
|
|
939
961
|
await this._processingTrigger.wait();
|
|
940
|
-
(0,
|
|
962
|
+
(0, import_log7.log)("stopped", {}, {
|
|
941
963
|
file: "pipeline.ts",
|
|
942
964
|
line: 267,
|
|
943
965
|
scope: this,
|
|
@@ -996,7 +1018,7 @@ var Pipeline = class {
|
|
|
996
1018
|
if (done) {
|
|
997
1019
|
continue;
|
|
998
1020
|
}
|
|
999
|
-
const block = value != null ? value : (0,
|
|
1021
|
+
const block = value != null ? value : (0, import_debug5.failUndefined)();
|
|
1000
1022
|
this._processingTrigger.reset();
|
|
1001
1023
|
this._timeframeClock.updatePendingTimeframe(import_keys2.PublicKey.from(block.feedKey), block.seq);
|
|
1002
1024
|
yield block;
|
|
@@ -1011,7 +1033,7 @@ var Pipeline = class {
|
|
|
1011
1033
|
stallTimeout: 1e3
|
|
1012
1034
|
});
|
|
1013
1035
|
this._feedSetIterator.stalled.on((iterator) => {
|
|
1014
|
-
|
|
1036
|
+
import_log7.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, {}, {
|
|
1015
1037
|
file: "pipeline.ts",
|
|
1016
1038
|
line: 357,
|
|
1017
1039
|
scope: this,
|
|
@@ -1048,7 +1070,7 @@ var ControlPipeline = class {
|
|
|
1048
1070
|
void this._pipeline.addFeed(genesisFeed);
|
|
1049
1071
|
this._spaceStateMachine = new import_credentials.SpaceStateMachine(spaceKey);
|
|
1050
1072
|
this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
|
|
1051
|
-
(0,
|
|
1073
|
+
(0, import_log8.log)("feed admitted", {
|
|
1052
1074
|
key: info.key
|
|
1053
1075
|
}, {
|
|
1054
1076
|
file: "control-pipeline.ts",
|
|
@@ -1061,7 +1083,7 @@ var ControlPipeline = class {
|
|
|
1061
1083
|
const feed = await feedProvider(info.key);
|
|
1062
1084
|
await this._pipeline.addFeed(feed);
|
|
1063
1085
|
} catch (err) {
|
|
1064
|
-
|
|
1086
|
+
import_log8.log.catch(err, {}, {
|
|
1065
1087
|
file: "control-pipeline.ts",
|
|
1066
1088
|
line: 47,
|
|
1067
1089
|
scope: this,
|
|
@@ -1084,7 +1106,7 @@ var ControlPipeline = class {
|
|
|
1084
1106
|
this._pipeline.setWriteFeed(feed);
|
|
1085
1107
|
}
|
|
1086
1108
|
async start() {
|
|
1087
|
-
(0,
|
|
1109
|
+
(0, import_log8.log)("starting...", {}, {
|
|
1088
1110
|
file: "control-pipeline.ts",
|
|
1089
1111
|
line: 71,
|
|
1090
1112
|
scope: this,
|
|
@@ -1093,7 +1115,7 @@ var ControlPipeline = class {
|
|
|
1093
1115
|
setTimeout(async () => {
|
|
1094
1116
|
for await (const msg of this._pipeline.consume()) {
|
|
1095
1117
|
try {
|
|
1096
|
-
(0,
|
|
1118
|
+
(0, import_log8.log)("processing", {
|
|
1097
1119
|
key: msg.feedKey,
|
|
1098
1120
|
seq: msg.seq
|
|
1099
1121
|
}, {
|
|
@@ -1105,7 +1127,7 @@ var ControlPipeline = class {
|
|
|
1105
1127
|
if (msg.data.payload.credential) {
|
|
1106
1128
|
const result = await this._spaceStateMachine.process(msg.data.payload.credential.credential, import_keys3.PublicKey.from(msg.feedKey));
|
|
1107
1129
|
if (!result) {
|
|
1108
|
-
|
|
1130
|
+
import_log8.log.warn("processing failed", {
|
|
1109
1131
|
msg
|
|
1110
1132
|
}, {
|
|
1111
1133
|
file: "control-pipeline.ts",
|
|
@@ -1116,7 +1138,7 @@ var ControlPipeline = class {
|
|
|
1116
1138
|
}
|
|
1117
1139
|
}
|
|
1118
1140
|
} catch (err) {
|
|
1119
|
-
|
|
1141
|
+
import_log8.log.catch(err, {}, {
|
|
1120
1142
|
file: "control-pipeline.ts",
|
|
1121
1143
|
line: 87,
|
|
1122
1144
|
scope: this,
|
|
@@ -1126,7 +1148,7 @@ var ControlPipeline = class {
|
|
|
1126
1148
|
}
|
|
1127
1149
|
});
|
|
1128
1150
|
await this._pipeline.start();
|
|
1129
|
-
(0,
|
|
1151
|
+
(0, import_log8.log)("started", {}, {
|
|
1130
1152
|
file: "control-pipeline.ts",
|
|
1131
1153
|
line: 93,
|
|
1132
1154
|
scope: this,
|
|
@@ -1134,14 +1156,14 @@ var ControlPipeline = class {
|
|
|
1134
1156
|
});
|
|
1135
1157
|
}
|
|
1136
1158
|
async stop() {
|
|
1137
|
-
(0,
|
|
1159
|
+
(0, import_log8.log)("stopping...", {}, {
|
|
1138
1160
|
file: "control-pipeline.ts",
|
|
1139
1161
|
line: 97,
|
|
1140
1162
|
scope: this,
|
|
1141
1163
|
callSite: (f, a) => f(...a)
|
|
1142
1164
|
});
|
|
1143
1165
|
await this._pipeline.stop();
|
|
1144
|
-
(0,
|
|
1166
|
+
(0, import_log8.log)("stopped", {}, {
|
|
1145
1167
|
file: "control-pipeline.ts",
|
|
1146
1168
|
line: 99,
|
|
1147
1169
|
scope: this,
|
|
@@ -1156,7 +1178,7 @@ var import_async6 = require("@dxos/async");
|
|
|
1156
1178
|
var import_context3 = require("@dxos/context");
|
|
1157
1179
|
var import_credentials3 = require("@dxos/credentials");
|
|
1158
1180
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
1159
|
-
var
|
|
1181
|
+
var import_log9 = require("@dxos/log");
|
|
1160
1182
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
1161
1183
|
var __decorate5 = function(decorators, target, key, desc) {
|
|
1162
1184
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1203,7 +1225,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1203
1225
|
if (assertion["@type"] !== "dxos.halo.credentials.Epoch") {
|
|
1204
1226
|
return;
|
|
1205
1227
|
}
|
|
1206
|
-
(0,
|
|
1228
|
+
(0, import_log9.log)("new epoch", {
|
|
1207
1229
|
credential
|
|
1208
1230
|
}, {
|
|
1209
1231
|
file: "data-pipeline.ts",
|
|
@@ -1250,7 +1272,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1250
1272
|
if (!this._isOpen) {
|
|
1251
1273
|
return;
|
|
1252
1274
|
}
|
|
1253
|
-
(0,
|
|
1275
|
+
(0, import_log9.log)("close", {}, {
|
|
1254
1276
|
file: "data-pipeline.ts",
|
|
1255
1277
|
line: 162,
|
|
1256
1278
|
scope: this,
|
|
@@ -1265,7 +1287,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1265
1287
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1266
1288
|
}
|
|
1267
1289
|
} catch (err) {
|
|
1268
|
-
|
|
1290
|
+
import_log9.log.catch(err, {}, {
|
|
1269
1291
|
file: "data-pipeline.ts",
|
|
1270
1292
|
line: 175,
|
|
1271
1293
|
scope: this,
|
|
@@ -1280,7 +1302,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1280
1302
|
(0, import_node_assert8.default)(this._pipeline, "Pipeline is not initialized.");
|
|
1281
1303
|
for await (const msg of this._pipeline.consume()) {
|
|
1282
1304
|
const { feedKey, seq, data } = msg;
|
|
1283
|
-
(0,
|
|
1305
|
+
(0, import_log9.log)("processing message", {
|
|
1284
1306
|
feedKey,
|
|
1285
1307
|
seq
|
|
1286
1308
|
}, {
|
|
@@ -1293,7 +1315,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1293
1315
|
if (data.payload.data) {
|
|
1294
1316
|
const feedInfo = this._params.feedInfoProvider(feedKey);
|
|
1295
1317
|
if (!feedInfo) {
|
|
1296
|
-
|
|
1318
|
+
import_log9.log.error("Could not find feed.", {
|
|
1297
1319
|
feedKey
|
|
1298
1320
|
}, {
|
|
1299
1321
|
file: "data-pipeline.ts",
|
|
@@ -1315,7 +1337,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1315
1337
|
await this._noteTargetStateIfNeeded(this._pipeline.state.pendingTimeframe);
|
|
1316
1338
|
}
|
|
1317
1339
|
} catch (err) {
|
|
1318
|
-
|
|
1340
|
+
import_log9.log.catch(err, {}, {
|
|
1319
1341
|
file: "data-pipeline.ts",
|
|
1320
1342
|
line: 211,
|
|
1321
1343
|
scope: this,
|
|
@@ -1350,7 +1372,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1350
1372
|
cache.properties = (_a = (0, import_echo_db3.getStateMachineFromItem)(propertiesItem)) == null ? void 0 : _a.snapshot();
|
|
1351
1373
|
}
|
|
1352
1374
|
} catch (err) {
|
|
1353
|
-
|
|
1375
|
+
import_log9.log.warn("Failed to cache properties", err, {
|
|
1354
1376
|
file: "data-pipeline.ts",
|
|
1355
1377
|
line: 245,
|
|
1356
1378
|
scope: this,
|
|
@@ -1371,10 +1393,24 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1371
1393
|
async _processEpoch(epoch) {
|
|
1372
1394
|
(0, import_node_assert8.default)(this._isOpen);
|
|
1373
1395
|
(0, import_node_assert8.default)(this._pipeline);
|
|
1396
|
+
(0, import_log9.log)("Processing epoch", {
|
|
1397
|
+
epoch
|
|
1398
|
+
}, {
|
|
1399
|
+
file: "data-pipeline.ts",
|
|
1400
|
+
line: 274,
|
|
1401
|
+
scope: this,
|
|
1402
|
+
callSite: (f, a) => f(...a)
|
|
1403
|
+
});
|
|
1374
1404
|
if (epoch.snapshotCid) {
|
|
1375
1405
|
const snapshot = await this._params.snapshotManager.load(epoch.snapshotCid);
|
|
1376
1406
|
this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
|
|
1377
1407
|
}
|
|
1408
|
+
(0, import_log9.log)("restarting pipeline for epoch", {}, {
|
|
1409
|
+
file: "data-pipeline.ts",
|
|
1410
|
+
line: 282,
|
|
1411
|
+
scope: this,
|
|
1412
|
+
callSite: (f, a) => f(...a)
|
|
1413
|
+
});
|
|
1378
1414
|
await this._pipeline.pause();
|
|
1379
1415
|
await this._pipeline.setCursor(epoch.timeframe);
|
|
1380
1416
|
await this._pipeline.unpause();
|
|
@@ -1463,7 +1499,7 @@ var Space = class Space2 {
|
|
|
1463
1499
|
});
|
|
1464
1500
|
this._controlPipeline.onCredentialProcessed.set(async (credential) => {
|
|
1465
1501
|
await this.onCredentialProcessed.callIfSet(credential);
|
|
1466
|
-
(0,
|
|
1502
|
+
(0, import_log10.log)("onCredentialProcessed", {
|
|
1467
1503
|
credential
|
|
1468
1504
|
}, {
|
|
1469
1505
|
file: "space.ts",
|
|
@@ -1555,7 +1591,7 @@ var Space = class Space2 {
|
|
|
1555
1591
|
// return this._dataPipeline?.getFeeds();
|
|
1556
1592
|
// }
|
|
1557
1593
|
async open() {
|
|
1558
|
-
(0,
|
|
1594
|
+
(0, import_log10.log)("opening...", {}, {
|
|
1559
1595
|
file: "space.ts",
|
|
1560
1596
|
line: 208,
|
|
1561
1597
|
scope: this,
|
|
@@ -1568,7 +1604,7 @@ var Space = class Space2 {
|
|
|
1568
1604
|
await this.protocol.start();
|
|
1569
1605
|
this._dataPipelineCredentialConsumer = this._controlPipeline.spaceState.registerProcessor(this._dataPipeline.createCredentialProcessor());
|
|
1570
1606
|
this._isOpen = true;
|
|
1571
|
-
(0,
|
|
1607
|
+
(0, import_log10.log)("opened", {}, {
|
|
1572
1608
|
file: "space.ts",
|
|
1573
1609
|
line: 222,
|
|
1574
1610
|
scope: this,
|
|
@@ -1577,7 +1613,7 @@ var Space = class Space2 {
|
|
|
1577
1613
|
}
|
|
1578
1614
|
async close() {
|
|
1579
1615
|
var _a;
|
|
1580
|
-
(0,
|
|
1616
|
+
(0, import_log10.log)("closing...", {
|
|
1581
1617
|
key: this._key
|
|
1582
1618
|
}, {
|
|
1583
1619
|
file: "space.ts",
|
|
@@ -1594,7 +1630,7 @@ var Space = class Space2 {
|
|
|
1594
1630
|
await this.protocol.stop();
|
|
1595
1631
|
await this._controlPipeline.stop();
|
|
1596
1632
|
this._isOpen = false;
|
|
1597
|
-
(0,
|
|
1633
|
+
(0, import_log10.log)("closed", {}, {
|
|
1598
1634
|
file: "space.ts",
|
|
1599
1635
|
line: 241,
|
|
1600
1636
|
scope: this,
|
|
@@ -1602,7 +1638,7 @@ var Space = class Space2 {
|
|
|
1602
1638
|
});
|
|
1603
1639
|
}
|
|
1604
1640
|
async initializeDataPipeline() {
|
|
1605
|
-
|
|
1641
|
+
import_log10.log.info("initializeDataPipeline", {}, {
|
|
1606
1642
|
file: "space.ts",
|
|
1607
1643
|
line: 245,
|
|
1608
1644
|
scope: this,
|
|
@@ -1614,7 +1650,7 @@ var Space = class Space2 {
|
|
|
1614
1650
|
}
|
|
1615
1651
|
};
|
|
1616
1652
|
__decorate6([
|
|
1617
|
-
|
|
1653
|
+
import_log10.logInfo
|
|
1618
1654
|
], Space.prototype, "key", null);
|
|
1619
1655
|
__decorate6([
|
|
1620
1656
|
import_async7.synchronized
|
|
@@ -1628,16 +1664,16 @@ Space = __decorate6([
|
|
|
1628
1664
|
|
|
1629
1665
|
// packages/core/echo/echo-pipeline/src/space/space-manager.ts
|
|
1630
1666
|
var import_async8 = require("@dxos/async");
|
|
1631
|
-
var
|
|
1667
|
+
var import_debug6 = require("@dxos/debug");
|
|
1632
1668
|
var import_keys5 = require("@dxos/keys");
|
|
1633
|
-
var
|
|
1669
|
+
var import_log12 = require("@dxos/log");
|
|
1634
1670
|
var import_protocols6 = require("@dxos/protocols");
|
|
1635
1671
|
var import_util7 = require("@dxos/util");
|
|
1636
1672
|
|
|
1637
1673
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
1638
1674
|
var import_crypto3 = require("@dxos/crypto");
|
|
1639
1675
|
var import_keys4 = require("@dxos/keys");
|
|
1640
|
-
var
|
|
1676
|
+
var import_log11 = require("@dxos/log");
|
|
1641
1677
|
var import_network_manager = require("@dxos/network-manager");
|
|
1642
1678
|
var import_teleport2 = require("@dxos/teleport");
|
|
1643
1679
|
var import_teleport_extension_replicator = require("@dxos/teleport-extension-replicator");
|
|
@@ -1674,7 +1710,7 @@ var SpaceProtocol = class {
|
|
|
1674
1710
|
}
|
|
1675
1711
|
// TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
|
|
1676
1712
|
addFeed(feed) {
|
|
1677
|
-
(0,
|
|
1713
|
+
(0, import_log11.log)("addFeed", {
|
|
1678
1714
|
key: feed.key
|
|
1679
1715
|
}, {
|
|
1680
1716
|
file: "space-protocol.ts",
|
|
@@ -1697,7 +1733,7 @@ var SpaceProtocol = class {
|
|
|
1697
1733
|
maxPeers: 10,
|
|
1698
1734
|
sampleSize: 20
|
|
1699
1735
|
};
|
|
1700
|
-
(0,
|
|
1736
|
+
(0, import_log11.log)("starting...", {}, {
|
|
1701
1737
|
file: "space-protocol.ts",
|
|
1702
1738
|
line: 107,
|
|
1703
1739
|
scope: this,
|
|
@@ -1710,7 +1746,7 @@ var SpaceProtocol = class {
|
|
|
1710
1746
|
topology: new import_network_manager.MMSTTopology(topologyConfig),
|
|
1711
1747
|
label: `Protocol swarm: ${this._topic}`
|
|
1712
1748
|
});
|
|
1713
|
-
(0,
|
|
1749
|
+
(0, import_log11.log)("started", {}, {
|
|
1714
1750
|
file: "space-protocol.ts",
|
|
1715
1751
|
line: 116,
|
|
1716
1752
|
scope: this,
|
|
@@ -1719,14 +1755,14 @@ var SpaceProtocol = class {
|
|
|
1719
1755
|
}
|
|
1720
1756
|
async stop() {
|
|
1721
1757
|
if (this._connection) {
|
|
1722
|
-
(0,
|
|
1758
|
+
(0, import_log11.log)("stopping...", {}, {
|
|
1723
1759
|
file: "space-protocol.ts",
|
|
1724
1760
|
line: 121,
|
|
1725
1761
|
scope: this,
|
|
1726
1762
|
callSite: (f, a) => f(...a)
|
|
1727
1763
|
});
|
|
1728
1764
|
await this._connection.close();
|
|
1729
|
-
(0,
|
|
1765
|
+
(0, import_log11.log)("stopped", {}, {
|
|
1730
1766
|
file: "space-protocol.ts",
|
|
1731
1767
|
line: 123,
|
|
1732
1768
|
scope: this,
|
|
@@ -1750,10 +1786,10 @@ var SpaceProtocol = class {
|
|
|
1750
1786
|
}
|
|
1751
1787
|
};
|
|
1752
1788
|
__decorate7([
|
|
1753
|
-
|
|
1789
|
+
import_log11.logInfo
|
|
1754
1790
|
], SpaceProtocol.prototype, "_topic", void 0);
|
|
1755
1791
|
__decorate7([
|
|
1756
|
-
|
|
1792
|
+
import_log11.logInfo
|
|
1757
1793
|
], SpaceProtocol.prototype, "_ownPeerKey", null);
|
|
1758
1794
|
var AuthStatus;
|
|
1759
1795
|
(function(AuthStatus2) {
|
|
@@ -1788,7 +1824,7 @@ var SpaceProtocolSession = class {
|
|
|
1788
1824
|
onAuthSuccess: () => {
|
|
1789
1825
|
var _a;
|
|
1790
1826
|
this._authStatus = AuthStatus.SUCCESS;
|
|
1791
|
-
(0,
|
|
1827
|
+
(0, import_log11.log)("Peer authenticated", {}, {
|
|
1792
1828
|
file: "space-protocol.ts",
|
|
1793
1829
|
line: 206,
|
|
1794
1830
|
scope: this,
|
|
@@ -1797,7 +1833,7 @@ var SpaceProtocolSession = class {
|
|
|
1797
1833
|
(_a = this._onSessionAuth) == null ? void 0 : _a.call(this, this._teleport);
|
|
1798
1834
|
},
|
|
1799
1835
|
onAuthFailure: () => {
|
|
1800
|
-
|
|
1836
|
+
import_log11.log.warn("Auth failed", {}, {
|
|
1801
1837
|
file: "space-protocol.ts",
|
|
1802
1838
|
line: 211,
|
|
1803
1839
|
scope: this,
|
|
@@ -1813,10 +1849,10 @@ var SpaceProtocolSession = class {
|
|
|
1813
1849
|
}
|
|
1814
1850
|
};
|
|
1815
1851
|
__decorate7([
|
|
1816
|
-
|
|
1852
|
+
import_log11.logInfo
|
|
1817
1853
|
], SpaceProtocolSession.prototype, "_wireParams", void 0);
|
|
1818
1854
|
__decorate7([
|
|
1819
|
-
|
|
1855
|
+
import_log11.logInfo
|
|
1820
1856
|
], SpaceProtocolSession.prototype, "authStatus", null);
|
|
1821
1857
|
|
|
1822
1858
|
// packages/core/echo/echo-pipeline/src/space/space-manager.ts
|
|
@@ -1853,7 +1889,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
1853
1889
|
}
|
|
1854
1890
|
async constructSpace({ metadata, swarmIdentity, onNetworkConnection, memberKey }) {
|
|
1855
1891
|
var _a;
|
|
1856
|
-
|
|
1892
|
+
import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.begin({
|
|
1857
1893
|
id: this._instanceId
|
|
1858
1894
|
}), {
|
|
1859
1895
|
file: "space-manager.ts",
|
|
@@ -1861,7 +1897,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
1861
1897
|
scope: this,
|
|
1862
1898
|
callSite: (f, a) => f(...a)
|
|
1863
1899
|
});
|
|
1864
|
-
(0,
|
|
1900
|
+
(0, import_log12.log)("constructing space...", {
|
|
1865
1901
|
spaceKey: metadata.genesisFeedKey
|
|
1866
1902
|
}, {
|
|
1867
1903
|
file: "space-manager.ts",
|
|
@@ -1869,7 +1905,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
1869
1905
|
scope: this,
|
|
1870
1906
|
callSite: (f, a) => f(...a)
|
|
1871
1907
|
});
|
|
1872
|
-
const genesisFeed = await this._feedStore.openFeed((_a = metadata.genesisFeedKey) != null ? _a : (0,
|
|
1908
|
+
const genesisFeed = await this._feedStore.openFeed((_a = metadata.genesisFeedKey) != null ? _a : (0, import_debug6.failUndefined)());
|
|
1873
1909
|
const spaceKey = metadata.key;
|
|
1874
1910
|
const protocol = new SpaceProtocol({
|
|
1875
1911
|
topic: spaceKey,
|
|
@@ -1889,7 +1925,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
1889
1925
|
memberKey
|
|
1890
1926
|
});
|
|
1891
1927
|
this._spaces.set(space.key, space);
|
|
1892
|
-
|
|
1928
|
+
import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.end({
|
|
1893
1929
|
id: this._instanceId
|
|
1894
1930
|
}), {
|
|
1895
1931
|
file: "space-manager.ts",
|