@dxos/echo-pipeline 0.1.31 → 0.1.32-next.77d513e
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-QMDRF3NL.mjs → chunk-EM5HSJ7J.mjs} +121 -86
- package/dist/lib/browser/chunk-EM5HSJ7J.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -5
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +12 -4
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +121 -87
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +126 -76
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/metadata/metadata-store.d.ts +1 -2
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/pipeline/pipeline.d.ts +10 -1
- package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/types/src/space/{data-pipeline-controller.d.ts → data-pipeline.d.ts} +10 -18
- package/dist/types/src/space/data-pipeline.d.ts.map +1 -0
- package/dist/types/src/space/index.d.ts +1 -1
- package/dist/types/src/space/index.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +6 -4
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts +2 -2
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts +2 -2
- package/dist/types/src/testing/util.d.ts.map +1 -1
- package/package.json +29 -29
- package/src/metadata/metadata-store.ts +1 -2
- package/src/pipeline/pipeline.ts +18 -3
- package/src/space/{data-pipeline-controller.ts → data-pipeline.ts} +61 -38
- package/src/space/index.ts +1 -1
- package/src/space/space.ts +22 -23
- package/src/testing/test-agent-builder.ts +10 -4
- package/src/testing/util.ts +2 -5
- package/dist/lib/browser/chunk-QMDRF3NL.mjs.map +0 -7
- package/dist/types/src/space/data-pipeline-controller.d.ts.map +0 -1
|
@@ -379,7 +379,7 @@ var MetadataStore = class {
|
|
|
379
379
|
size: dataSize
|
|
380
380
|
}, {
|
|
381
381
|
file: "metadata-store.ts",
|
|
382
|
-
line:
|
|
382
|
+
line: 67,
|
|
383
383
|
scope: this,
|
|
384
384
|
callSite: (f, a) => f(...a)
|
|
385
385
|
});
|
|
@@ -395,7 +395,7 @@ var MetadataStore = class {
|
|
|
395
395
|
err
|
|
396
396
|
}, {
|
|
397
397
|
file: "metadata-store.ts",
|
|
398
|
-
line:
|
|
398
|
+
line: 79,
|
|
399
399
|
scope: this,
|
|
400
400
|
callSite: (f, a) => f(...a)
|
|
401
401
|
});
|
|
@@ -420,7 +420,7 @@ var MetadataStore = class {
|
|
|
420
420
|
size: encoded.length
|
|
421
421
|
}, {
|
|
422
422
|
file: "metadata-store.ts",
|
|
423
|
-
line:
|
|
423
|
+
line: 102,
|
|
424
424
|
scope: this,
|
|
425
425
|
callSite: (f, a) => f(...a)
|
|
426
426
|
});
|
|
@@ -435,7 +435,7 @@ var MetadataStore = class {
|
|
|
435
435
|
async clear() {
|
|
436
436
|
(0, import_log3.log)("clearing all metadata", {}, {
|
|
437
437
|
file: "metadata-store.ts",
|
|
438
|
-
line:
|
|
438
|
+
line: 115,
|
|
439
439
|
scope: this,
|
|
440
440
|
callSite: (f, a) => f(...a)
|
|
441
441
|
});
|
|
@@ -585,6 +585,7 @@ var import_util4 = require("@dxos/util");
|
|
|
585
585
|
// packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
|
|
586
586
|
var import_node_assert7 = __toESM(require("node:assert"));
|
|
587
587
|
var import_async5 = require("@dxos/async");
|
|
588
|
+
var import_context2 = require("@dxos/context");
|
|
588
589
|
var import_feed_store = require("@dxos/feed-store");
|
|
589
590
|
var import_keys2 = require("@dxos/keys");
|
|
590
591
|
var import_log6 = require("@dxos/log");
|
|
@@ -719,7 +720,7 @@ var PipelineState = class {
|
|
|
719
720
|
return this._timeframeClock.timeframe;
|
|
720
721
|
}
|
|
721
722
|
get targetTimeframe() {
|
|
722
|
-
return this._targetTimeframe ?
|
|
723
|
+
return this._targetTimeframe ? this._targetTimeframe : new import_timeframe2.Timeframe();
|
|
723
724
|
}
|
|
724
725
|
async waitUntilTimeframe(target) {
|
|
725
726
|
await this._timeframeClock.waitUntilReached(target);
|
|
@@ -734,7 +735,7 @@ var PipelineState = class {
|
|
|
734
735
|
*
|
|
735
736
|
* @param timeout Timeout in milliseconds to specify the maximum wait time.
|
|
736
737
|
*/
|
|
737
|
-
async waitUntilReachedTargetTimeframe({ timeout } = {}) {
|
|
738
|
+
async waitUntilReachedTargetTimeframe({ ctx = new import_context2.Context(), timeout, breakOnStall = true } = {}) {
|
|
738
739
|
var _a;
|
|
739
740
|
(0, import_log6.log)("waitUntilReachedTargetTimeframe", {
|
|
740
741
|
timeout,
|
|
@@ -742,7 +743,7 @@ var PipelineState = class {
|
|
|
742
743
|
target: this.targetTimeframe
|
|
743
744
|
}, {
|
|
744
745
|
file: "pipeline.ts",
|
|
745
|
-
line:
|
|
746
|
+
line: 96,
|
|
746
747
|
scope: this,
|
|
747
748
|
callSite: (f, a) => f(...a)
|
|
748
749
|
});
|
|
@@ -750,11 +751,14 @@ var PipelineState = class {
|
|
|
750
751
|
this._timeframeClock.update.waitForCondition(() => {
|
|
751
752
|
return import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe).isEmpty();
|
|
752
753
|
}),
|
|
753
|
-
|
|
754
|
+
...breakOnStall ? [
|
|
755
|
+
this._iterator.stalled.discardParameter().waitForCount(1)
|
|
756
|
+
] : []
|
|
754
757
|
]);
|
|
755
758
|
let done = false;
|
|
756
759
|
if (timeout) {
|
|
757
760
|
return Promise.race([
|
|
761
|
+
(0, import_context2.rejectOnDispose)(ctx),
|
|
758
762
|
this._reachedTargetPromise.then(() => {
|
|
759
763
|
done = true;
|
|
760
764
|
}),
|
|
@@ -769,7 +773,7 @@ var PipelineState = class {
|
|
|
769
773
|
dependencies: import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe)
|
|
770
774
|
}, {
|
|
771
775
|
file: "pipeline.ts",
|
|
772
|
-
line:
|
|
776
|
+
line: 122,
|
|
773
777
|
scope: this,
|
|
774
778
|
callSite: (f, a) => f(...a)
|
|
775
779
|
});
|
|
@@ -795,7 +799,7 @@ var Pipeline = class {
|
|
|
795
799
|
this._feedSetIterator.stalled.on((iterator) => {
|
|
796
800
|
import_log6.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, {}, {
|
|
797
801
|
file: "pipeline.ts",
|
|
798
|
-
line:
|
|
802
|
+
line: 198,
|
|
799
803
|
scope: this,
|
|
800
804
|
callSite: (f, a) => f(...a)
|
|
801
805
|
});
|
|
@@ -825,14 +829,14 @@ var Pipeline = class {
|
|
|
825
829
|
async start() {
|
|
826
830
|
(0, import_log6.log)("starting...", {}, {
|
|
827
831
|
file: "pipeline.ts",
|
|
828
|
-
line:
|
|
832
|
+
line: 233,
|
|
829
833
|
scope: this,
|
|
830
834
|
callSite: (f, a) => f(...a)
|
|
831
835
|
});
|
|
832
836
|
await this._feedSetIterator.open();
|
|
833
837
|
(0, import_log6.log)("started", {}, {
|
|
834
838
|
file: "pipeline.ts",
|
|
835
|
-
line:
|
|
839
|
+
line: 235,
|
|
836
840
|
scope: this,
|
|
837
841
|
callSite: (f, a) => f(...a)
|
|
838
842
|
});
|
|
@@ -840,7 +844,7 @@ var Pipeline = class {
|
|
|
840
844
|
async stop() {
|
|
841
845
|
(0, import_log6.log)("stopping...", {}, {
|
|
842
846
|
file: "pipeline.ts",
|
|
843
|
-
line:
|
|
847
|
+
line: 239,
|
|
844
848
|
scope: this,
|
|
845
849
|
callSite: (f, a) => f(...a)
|
|
846
850
|
});
|
|
@@ -848,7 +852,7 @@ var Pipeline = class {
|
|
|
848
852
|
await this._processingTrigger.wait();
|
|
849
853
|
(0, import_log6.log)("stopped", {}, {
|
|
850
854
|
file: "pipeline.ts",
|
|
851
|
-
line:
|
|
855
|
+
line: 242,
|
|
852
856
|
scope: this,
|
|
853
857
|
callSite: (f, a) => f(...a)
|
|
854
858
|
});
|
|
@@ -1026,7 +1030,7 @@ var Space = class Space2 {
|
|
|
1026
1030
|
credential
|
|
1027
1031
|
}, {
|
|
1028
1032
|
file: "space.ts",
|
|
1029
|
-
line:
|
|
1033
|
+
line: 79,
|
|
1030
1034
|
scope: this,
|
|
1031
1035
|
callSite: (f, a) => f(...a)
|
|
1032
1036
|
});
|
|
@@ -1089,7 +1093,7 @@ var Space = class Space2 {
|
|
|
1089
1093
|
async open() {
|
|
1090
1094
|
(0, import_log8.log)("opening...", {}, {
|
|
1091
1095
|
file: "space.ts",
|
|
1092
|
-
line:
|
|
1096
|
+
line: 149,
|
|
1093
1097
|
scope: this,
|
|
1094
1098
|
callSite: (f, a) => f(...a)
|
|
1095
1099
|
});
|
|
@@ -1101,18 +1105,17 @@ var Space = class Space2 {
|
|
|
1101
1105
|
this._isOpen = true;
|
|
1102
1106
|
(0, import_log8.log)("opened", {}, {
|
|
1103
1107
|
file: "space.ts",
|
|
1104
|
-
line:
|
|
1108
|
+
line: 159,
|
|
1105
1109
|
scope: this,
|
|
1106
1110
|
callSite: (f, a) => f(...a)
|
|
1107
1111
|
});
|
|
1108
1112
|
}
|
|
1109
1113
|
async close() {
|
|
1110
|
-
var _a;
|
|
1111
1114
|
(0, import_log8.log)("closing...", {
|
|
1112
1115
|
key: this._key
|
|
1113
1116
|
}, {
|
|
1114
1117
|
file: "space.ts",
|
|
1115
|
-
line:
|
|
1118
|
+
line: 164,
|
|
1116
1119
|
scope: this,
|
|
1117
1120
|
callSite: (f, a) => f(...a)
|
|
1118
1121
|
});
|
|
@@ -1120,37 +1123,30 @@ var Space = class Space2 {
|
|
|
1120
1123
|
return;
|
|
1121
1124
|
}
|
|
1122
1125
|
await this.protocol.stop();
|
|
1123
|
-
await ((_a = this._dataPipelineController) == null ? void 0 : _a.close());
|
|
1124
1126
|
await this._controlPipeline.stop();
|
|
1125
1127
|
this._isOpen = false;
|
|
1126
1128
|
(0, import_log8.log)("closed", {}, {
|
|
1127
1129
|
file: "space.ts",
|
|
1128
|
-
line:
|
|
1130
|
+
line: 174,
|
|
1129
1131
|
scope: this,
|
|
1130
1132
|
callSite: (f, a) => f(...a)
|
|
1131
1133
|
});
|
|
1132
1134
|
}
|
|
1133
|
-
|
|
1135
|
+
// TODO(dmaretskyi): Make reusable.
|
|
1136
|
+
async createDataPipeline({ start }) {
|
|
1134
1137
|
(0, import_node_assert8.default)(this._isOpen, "Space must be open to initialize data pipeline.");
|
|
1135
|
-
(0, import_node_assert8.default)(!this._dataPipelineController, "Data pipeline already initialized.");
|
|
1136
1138
|
(0, import_node_assert8.default)(!this._dataPipeline, "Data pipeline already initialized.");
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
for (const feed of this._controlPipeline.spaceState.feeds.values()) {
|
|
1146
|
-
if (feed.assertion.designation === import_credentials3.AdmittedFeed.Designation.DATA) {
|
|
1147
|
-
await this._dataPipeline.addFeed(await this._feedProvider(feed.key));
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
await this._dataPipeline.start();
|
|
1151
|
-
return this._dataPipeline;
|
|
1139
|
+
const pipeline = new Pipeline(start);
|
|
1140
|
+
if (this._dataFeed) {
|
|
1141
|
+
pipeline.setWriteFeed(this._dataFeed);
|
|
1142
|
+
}
|
|
1143
|
+
this._dataPipeline = pipeline;
|
|
1144
|
+
for (const feed of this._controlPipeline.spaceState.feeds.values()) {
|
|
1145
|
+
if (feed.assertion.designation === import_credentials3.AdmittedFeed.Designation.DATA) {
|
|
1146
|
+
await pipeline.addFeed(await this._feedProvider(feed.key));
|
|
1152
1147
|
}
|
|
1153
|
-
}
|
|
1148
|
+
}
|
|
1149
|
+
return pipeline;
|
|
1154
1150
|
}
|
|
1155
1151
|
};
|
|
1156
1152
|
__decorate4([
|
|
@@ -1429,10 +1425,10 @@ var import_credentials4 = require("@dxos/credentials");
|
|
|
1429
1425
|
var import_debug5 = require("@dxos/debug");
|
|
1430
1426
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
1431
1427
|
|
|
1432
|
-
// packages/core/echo/echo-pipeline/src/space/data-pipeline
|
|
1428
|
+
// packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
|
|
1433
1429
|
var import_node_assert9 = __toESM(require("node:assert"));
|
|
1434
1430
|
var import_async8 = require("@dxos/async");
|
|
1435
|
-
var
|
|
1431
|
+
var import_context3 = require("@dxos/context");
|
|
1436
1432
|
var import_debug6 = require("@dxos/debug");
|
|
1437
1433
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
1438
1434
|
var import_log11 = require("@dxos/log");
|
|
@@ -1450,13 +1446,18 @@ var __decorate7 = function(decorators, target, key, desc) {
|
|
|
1450
1446
|
var MESSAGES_PER_SNAPSHOT = 10;
|
|
1451
1447
|
var AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL = 5e3;
|
|
1452
1448
|
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
|
|
1453
|
-
var
|
|
1449
|
+
var DISABLE_SNAPSHOT_CACHE = false;
|
|
1450
|
+
var DataPipeline = class DataPipeline2 {
|
|
1454
1451
|
constructor(_params) {
|
|
1455
1452
|
this._params = _params;
|
|
1456
|
-
this._ctx = new
|
|
1453
|
+
this._ctx = new import_context3.Context();
|
|
1457
1454
|
this._lastAutomaticSnapshotTimeframe = new import_timeframe3.Timeframe();
|
|
1455
|
+
this._isOpen = false;
|
|
1458
1456
|
this.onTimeframeReached = new import_async8.Event();
|
|
1459
1457
|
}
|
|
1458
|
+
get isOpen() {
|
|
1459
|
+
return this._isOpen;
|
|
1460
|
+
}
|
|
1460
1461
|
get pipelineState() {
|
|
1461
1462
|
var _a;
|
|
1462
1463
|
return (_a = this._pipeline) == null ? void 0 : _a.state;
|
|
@@ -1469,14 +1470,25 @@ var DataPipelineControllerImpl = class DataPipelineControllerImpl2 {
|
|
|
1469
1470
|
var _a;
|
|
1470
1471
|
return snapshotTimeframeToStartingTimeframe((_a = this.snapshotTimeframe) != null ? _a : new import_timeframe3.Timeframe());
|
|
1471
1472
|
}
|
|
1473
|
+
setTargetTimeframe(timeframe) {
|
|
1474
|
+
var _a;
|
|
1475
|
+
this._targetTimeframe = timeframe;
|
|
1476
|
+
(_a = this._pipeline) == null ? void 0 : _a.state.setTargetTimeframe(timeframe);
|
|
1477
|
+
}
|
|
1472
1478
|
async open(spaceContext) {
|
|
1473
1479
|
var _a, _b, _c, _d;
|
|
1480
|
+
if (this._isOpen) {
|
|
1481
|
+
return;
|
|
1482
|
+
}
|
|
1474
1483
|
this._spaceContext = spaceContext;
|
|
1475
1484
|
if (this._params.snapshotId) {
|
|
1476
1485
|
this._snapshot = await this._params.snapshotManager.load(this._params.snapshotId);
|
|
1477
1486
|
this._lastAutomaticSnapshotTimeframe = (_b = (_a = this._snapshot) == null ? void 0 : _a.timeframe) != null ? _b : new import_timeframe3.Timeframe();
|
|
1478
1487
|
}
|
|
1479
1488
|
this._pipeline = await this._spaceContext.openPipeline(this.getStartTimeframe());
|
|
1489
|
+
if (this._targetTimeframe) {
|
|
1490
|
+
this._pipeline.state.setTargetTimeframe(this._targetTimeframe);
|
|
1491
|
+
}
|
|
1480
1492
|
const feedWriter = createMappedFeedWriter((data) => ({
|
|
1481
1493
|
data
|
|
1482
1494
|
}), (_c = this._pipeline.writer) != null ? _c : (0, import_debug6.failUndefined)());
|
|
@@ -1487,30 +1499,33 @@ var DataPipelineControllerImpl = class DataPipelineControllerImpl2 {
|
|
|
1487
1499
|
await this._consumePipeline();
|
|
1488
1500
|
});
|
|
1489
1501
|
this._createPeriodicSnapshots();
|
|
1502
|
+
this._isOpen = true;
|
|
1490
1503
|
}
|
|
1491
1504
|
_createPeriodicSnapshots() {
|
|
1492
1505
|
this.onTimeframeReached.debounce(TIMEFRAME_SAVE_DEBOUNCE_INTERVAL).on(this._ctx, async () => {
|
|
1493
1506
|
await this._saveLatestTimeframe();
|
|
1494
1507
|
});
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1508
|
+
if (!DISABLE_SNAPSHOT_CACHE) {
|
|
1509
|
+
this.onTimeframeReached.debounce(AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL).on(this._ctx, async () => {
|
|
1510
|
+
var _a, _b;
|
|
1511
|
+
const latestTimeframe = (_a = this._pipeline) == null ? void 0 : _a.state.timeframe;
|
|
1512
|
+
if (!latestTimeframe) {
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
if (latestTimeframe.totalMessages() - this._lastAutomaticSnapshotTimeframe.totalMessages() > MESSAGES_PER_SNAPSHOT) {
|
|
1516
|
+
const snapshot = await this._saveSnapshot();
|
|
1517
|
+
this._lastAutomaticSnapshotTimeframe = (_b = snapshot.timeframe) != null ? _b : (0, import_debug6.failUndefined)();
|
|
1518
|
+
(0, import_log11.log)("save", {
|
|
1519
|
+
snapshot
|
|
1520
|
+
}, {
|
|
1521
|
+
file: "data-pipeline.ts",
|
|
1522
|
+
line: 161,
|
|
1523
|
+
scope: this,
|
|
1524
|
+
callSite: (f, a) => f(...a)
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1514
1529
|
}
|
|
1515
1530
|
async _saveSnapshot() {
|
|
1516
1531
|
const snapshot = await this.createSnapshot();
|
|
@@ -1519,21 +1534,41 @@ var DataPipelineControllerImpl = class DataPipelineControllerImpl2 {
|
|
|
1519
1534
|
return snapshot;
|
|
1520
1535
|
}
|
|
1521
1536
|
async _saveLatestTimeframe() {
|
|
1522
|
-
var _a;
|
|
1537
|
+
var _a, _b;
|
|
1523
1538
|
const latestTimeframe = (_a = this._pipeline) == null ? void 0 : _a.state.timeframe;
|
|
1539
|
+
(0, import_log11.log)("save latest timeframe", {
|
|
1540
|
+
latestTimeframe,
|
|
1541
|
+
spaceKey: this._params.spaceKey
|
|
1542
|
+
}, {
|
|
1543
|
+
file: "data-pipeline.ts",
|
|
1544
|
+
line: 176,
|
|
1545
|
+
scope: this,
|
|
1546
|
+
callSite: (f, a) => f(...a)
|
|
1547
|
+
});
|
|
1524
1548
|
if (latestTimeframe) {
|
|
1525
|
-
|
|
1549
|
+
const newTimeframe = import_timeframe3.Timeframe.merge((_b = this._targetTimeframe) != null ? _b : new import_timeframe3.Timeframe(), latestTimeframe);
|
|
1550
|
+
await this._params.metadataStore.setSpaceLatestTimeframe(this._params.spaceKey, newTimeframe);
|
|
1526
1551
|
}
|
|
1527
1552
|
}
|
|
1528
1553
|
async close() {
|
|
1529
1554
|
var _a, _b, _c;
|
|
1555
|
+
if (!this._isOpen) {
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
(0, import_log11.log)("close", {}, {
|
|
1559
|
+
file: "data-pipeline.ts",
|
|
1560
|
+
line: 188,
|
|
1561
|
+
scope: this,
|
|
1562
|
+
callSite: (f, a) => f(...a)
|
|
1563
|
+
});
|
|
1564
|
+
this._isOpen = false;
|
|
1530
1565
|
try {
|
|
1531
1566
|
await this._saveLatestTimeframe();
|
|
1532
1567
|
await this._saveSnapshot();
|
|
1533
1568
|
} catch (err) {
|
|
1534
1569
|
import_log11.log.catch(err, {}, {
|
|
1535
|
-
file: "data-pipeline
|
|
1536
|
-
line:
|
|
1570
|
+
file: "data-pipeline.ts",
|
|
1571
|
+
line: 195,
|
|
1537
1572
|
scope: this,
|
|
1538
1573
|
callSite: (f, a) => f(...a)
|
|
1539
1574
|
});
|
|
@@ -1546,6 +1581,7 @@ var DataPipelineControllerImpl = class DataPipelineControllerImpl2 {
|
|
|
1546
1581
|
}
|
|
1547
1582
|
createSnapshot() {
|
|
1548
1583
|
var _a, _b;
|
|
1584
|
+
(0, import_node_assert9.default)(this.databaseBackend, "Database backend is not initialized.");
|
|
1549
1585
|
return {
|
|
1550
1586
|
spaceKey: this._params.spaceKey.asUint8Array(),
|
|
1551
1587
|
timeframe: (_b = (_a = this._pipeline) == null ? void 0 : _a.state.timeframe) != null ? _b : new import_timeframe3.Timeframe(),
|
|
@@ -1559,8 +1595,8 @@ var DataPipelineControllerImpl = class DataPipelineControllerImpl2 {
|
|
|
1559
1595
|
(0, import_log11.log)("processing message", {
|
|
1560
1596
|
msg
|
|
1561
1597
|
}, {
|
|
1562
|
-
file: "data-pipeline
|
|
1563
|
-
line:
|
|
1598
|
+
file: "data-pipeline.ts",
|
|
1599
|
+
line: 217,
|
|
1564
1600
|
scope: this,
|
|
1565
1601
|
callSite: (f, a) => f(...a)
|
|
1566
1602
|
});
|
|
@@ -1571,8 +1607,8 @@ var DataPipelineControllerImpl = class DataPipelineControllerImpl2 {
|
|
|
1571
1607
|
import_log11.log.error("Could not find feed.", {
|
|
1572
1608
|
feedKey
|
|
1573
1609
|
}, {
|
|
1574
|
-
file: "data-pipeline
|
|
1575
|
-
line:
|
|
1610
|
+
file: "data-pipeline.ts",
|
|
1611
|
+
line: 223,
|
|
1576
1612
|
scope: this,
|
|
1577
1613
|
callSite: (f, a) => f(...a)
|
|
1578
1614
|
});
|
|
@@ -1591,8 +1627,8 @@ var DataPipelineControllerImpl = class DataPipelineControllerImpl2 {
|
|
|
1591
1627
|
}
|
|
1592
1628
|
} catch (err) {
|
|
1593
1629
|
import_log11.log.catch(err, {}, {
|
|
1594
|
-
file: "data-pipeline
|
|
1595
|
-
line:
|
|
1630
|
+
file: "data-pipeline.ts",
|
|
1631
|
+
line: 239,
|
|
1596
1632
|
scope: this,
|
|
1597
1633
|
callSite: (f, a) => f(...a)
|
|
1598
1634
|
});
|
|
@@ -1604,9 +1640,15 @@ var DataPipelineControllerImpl = class DataPipelineControllerImpl2 {
|
|
|
1604
1640
|
await this._pipeline.state.waitUntilTimeframe(timeframe);
|
|
1605
1641
|
}
|
|
1606
1642
|
};
|
|
1607
|
-
|
|
1643
|
+
__decorate7([
|
|
1644
|
+
import_async8.synchronized
|
|
1645
|
+
], DataPipeline.prototype, "open", null);
|
|
1646
|
+
__decorate7([
|
|
1647
|
+
import_async8.synchronized
|
|
1648
|
+
], DataPipeline.prototype, "close", null);
|
|
1649
|
+
DataPipeline = __decorate7([
|
|
1608
1650
|
(0, import_async8.trackLeaks)("open", "close")
|
|
1609
|
-
],
|
|
1651
|
+
], DataPipeline);
|
|
1610
1652
|
var snapshotTimeframeToStartingTimeframe = (snapshotTimeframe) => {
|
|
1611
1653
|
return snapshotTimeframe.map(([key, seq]) => [
|
|
1612
1654
|
key,
|
|
@@ -1706,7 +1748,7 @@ var TestAgent = class {
|
|
|
1706
1748
|
await metadataStore.addSpace({
|
|
1707
1749
|
key: spaceKey
|
|
1708
1750
|
});
|
|
1709
|
-
const dataPipelineController = new
|
|
1751
|
+
const dataPipelineController = new DataPipeline({
|
|
1710
1752
|
modelFactory: new import_model_factory.ModelFactory().registerModel(import_document_model.DocumentModel),
|
|
1711
1753
|
metadataStore,
|
|
1712
1754
|
snapshotManager,
|
|
@@ -1722,7 +1764,15 @@ var TestAgent = class {
|
|
|
1722
1764
|
feedProvider: (feedKey) => this.feedStore.openFeed(feedKey)
|
|
1723
1765
|
}).setControlFeed(controlFeed).setDataFeed(dataFeed);
|
|
1724
1766
|
await space.open();
|
|
1725
|
-
await
|
|
1767
|
+
await dataPipelineController.open({
|
|
1768
|
+
openPipeline: async (start) => {
|
|
1769
|
+
const pipeline = await space.createDataPipeline({
|
|
1770
|
+
start
|
|
1771
|
+
});
|
|
1772
|
+
await pipeline.start();
|
|
1773
|
+
return pipeline;
|
|
1774
|
+
}
|
|
1775
|
+
});
|
|
1726
1776
|
this._spaces.set(spaceKey, space);
|
|
1727
1777
|
return [
|
|
1728
1778
|
space,
|