@dxos/echo-pipeline 0.3.3-main.f2ca85a → 0.3.3-main.f990aad
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-7IXNAFKL.mjs → chunk-KD6OVLI6.mjs} +74 -16
- package/dist/lib/browser/chunk-KD6OVLI6.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 +4 -2
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +118 -60
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +126 -66
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/db-host/data-service-host.d.ts +10 -2
- package/dist/types/src/db-host/data-service-host.d.ts.map +1 -1
- package/dist/types/src/db-host/database-host.d.ts +2 -2
- package/dist/types/src/db-host/database-host.d.ts.map +1 -1
- package/package.json +31 -31
- package/src/db-host/data-service-host.ts +90 -9
- package/src/db-host/database-host.ts +9 -3
- package/src/testing/database-test-rig.ts +1 -1
- package/dist/lib/browser/chunk-7IXNAFKL.mjs.map +0 -7
|
@@ -103,6 +103,7 @@ var TestFeedBuilder = class extends import_testing.TestBuilder {
|
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
// packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts
|
|
106
|
+
var import_async = require("@dxos/async");
|
|
106
107
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
107
108
|
var import_context = require("@dxos/context");
|
|
108
109
|
var import_echo_db = require("@dxos/echo-db");
|
|
@@ -111,12 +112,14 @@ var import_log = require("@dxos/log");
|
|
|
111
112
|
var import_service = require("@dxos/protocols/proto/dxos/echo/service");
|
|
112
113
|
var import_util = require("@dxos/util");
|
|
113
114
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
|
|
115
|
+
var MUTATION_LIMIT_PER_OBJECT = 10;
|
|
114
116
|
var DataServiceHost = class {
|
|
115
|
-
constructor(_itemManager, _itemDemuxer, _flush, _writeStream) {
|
|
117
|
+
constructor(_itemManager, _itemDemuxer, _flush, _writeStream, _opts = {}) {
|
|
116
118
|
this._itemManager = _itemManager;
|
|
117
119
|
this._itemDemuxer = _itemDemuxer;
|
|
118
120
|
this._flush = _flush;
|
|
119
121
|
this._writeStream = _writeStream;
|
|
122
|
+
this._opts = _opts;
|
|
120
123
|
this._ctx = new import_context.Context();
|
|
121
124
|
this._clientTagMap = new import_util.ComplexMap(([feedKey, seq]) => `${feedKey.toHex()}:${seq}`);
|
|
122
125
|
}
|
|
@@ -125,6 +128,9 @@ var DataServiceHost = class {
|
|
|
125
128
|
async close() {
|
|
126
129
|
await this._ctx.dispose();
|
|
127
130
|
}
|
|
131
|
+
get _deferEvents() {
|
|
132
|
+
return this._opts.deferEvents ?? true;
|
|
133
|
+
}
|
|
128
134
|
/**
|
|
129
135
|
* Real-time subscription to data objects in a space.
|
|
130
136
|
*/
|
|
@@ -137,7 +143,43 @@ var DataServiceHost = class {
|
|
|
137
143
|
objects
|
|
138
144
|
}
|
|
139
145
|
});
|
|
146
|
+
const updateScheduler = new import_async.UpdateScheduler(ctx, async () => {
|
|
147
|
+
flushPendingUpdate();
|
|
148
|
+
}, {
|
|
149
|
+
maxFrequency: 10
|
|
150
|
+
});
|
|
151
|
+
const pendingUpdates = [];
|
|
152
|
+
const mutationsPerObject = /* @__PURE__ */ new Map();
|
|
153
|
+
const clearPendingUpdates = () => {
|
|
154
|
+
pendingUpdates.length = 0;
|
|
155
|
+
mutationsPerObject.clear();
|
|
156
|
+
};
|
|
157
|
+
const flushPendingUpdate = () => {
|
|
158
|
+
const stagedEvents = [];
|
|
159
|
+
const objectsWithSnapshots = /* @__PURE__ */ new Set();
|
|
160
|
+
for (const [id, count] of mutationsPerObject) {
|
|
161
|
+
if (count >= MUTATION_LIMIT_PER_OBJECT) {
|
|
162
|
+
objectsWithSnapshots.add(id);
|
|
163
|
+
const entity = this._itemManager.entities.get(id);
|
|
164
|
+
if (entity) {
|
|
165
|
+
stagedEvents.push(entity.createSnapshot());
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
for (const obj of pendingUpdates) {
|
|
170
|
+
if (!objectsWithSnapshots.has(obj.objectId)) {
|
|
171
|
+
stagedEvents.push(obj);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
next({
|
|
175
|
+
batch: {
|
|
176
|
+
objects: stagedEvents
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
clearPendingUpdates();
|
|
180
|
+
};
|
|
140
181
|
this._itemDemuxer.snapshot.on(ctx, (snapshot) => {
|
|
182
|
+
clearPendingUpdates();
|
|
141
183
|
next({
|
|
142
184
|
action: import_service.EchoEvent.DatabaseAction.RESET,
|
|
143
185
|
batch: {
|
|
@@ -149,7 +191,7 @@ var DataServiceHost = class {
|
|
|
149
191
|
const { batch, meta } = message;
|
|
150
192
|
(0, import_invariant2.invariant)(!meta.clientTag, "Unexpected client tag in mutation message", {
|
|
151
193
|
F: __dxlog_file2,
|
|
152
|
-
L:
|
|
194
|
+
L: 131,
|
|
153
195
|
S: this,
|
|
154
196
|
A: [
|
|
155
197
|
"!(meta as any).clientTag",
|
|
@@ -161,7 +203,7 @@ var DataServiceHost = class {
|
|
|
161
203
|
meta
|
|
162
204
|
}, {
|
|
163
205
|
F: __dxlog_file2,
|
|
164
|
-
L:
|
|
206
|
+
L: 132,
|
|
165
207
|
S: this,
|
|
166
208
|
C: (f, a) => f(...a)
|
|
167
209
|
});
|
|
@@ -175,21 +217,37 @@ var DataServiceHost = class {
|
|
|
175
217
|
});
|
|
176
218
|
});
|
|
177
219
|
if (clientTag) {
|
|
220
|
+
flushPendingUpdate();
|
|
178
221
|
(0, import_echo_db.tagMutationsInBatch)(batch, clientTag, 0);
|
|
222
|
+
next({
|
|
223
|
+
clientTag,
|
|
224
|
+
feedKey: message.meta.feedKey,
|
|
225
|
+
seq: message.meta.seq,
|
|
226
|
+
batch
|
|
227
|
+
});
|
|
228
|
+
} else {
|
|
229
|
+
for (const obj of batch.objects ?? []) {
|
|
230
|
+
const newCount = (mutationsPerObject.get(obj.objectId) ?? 0) + 1;
|
|
231
|
+
mutationsPerObject.set(obj.objectId, newCount);
|
|
232
|
+
}
|
|
233
|
+
for (const obj of batch.objects ?? []) {
|
|
234
|
+
if ((mutationsPerObject.get(obj.objectId) ?? 0) < MUTATION_LIMIT_PER_OBJECT) {
|
|
235
|
+
pendingUpdates.push(obj);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (this._deferEvents) {
|
|
239
|
+
updateScheduler.trigger();
|
|
240
|
+
} else {
|
|
241
|
+
flushPendingUpdate();
|
|
242
|
+
}
|
|
179
243
|
}
|
|
180
|
-
next({
|
|
181
|
-
clientTag,
|
|
182
|
-
feedKey: message.meta.feedKey,
|
|
183
|
-
seq: message.meta.seq,
|
|
184
|
-
batch
|
|
185
|
-
});
|
|
186
244
|
});
|
|
187
245
|
});
|
|
188
246
|
}
|
|
189
247
|
async write(request) {
|
|
190
248
|
(0, import_invariant2.invariant)(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
|
|
191
249
|
F: __dxlog_file2,
|
|
192
|
-
L:
|
|
250
|
+
L: 177,
|
|
193
251
|
S: this,
|
|
194
252
|
A: [
|
|
195
253
|
"!this._ctx.disposed",
|
|
@@ -198,7 +256,7 @@ var DataServiceHost = class {
|
|
|
198
256
|
});
|
|
199
257
|
(0, import_invariant2.invariant)(this._writeStream, "Cannot write mutations in readonly mode", {
|
|
200
258
|
F: __dxlog_file2,
|
|
201
|
-
L:
|
|
259
|
+
L: 178,
|
|
202
260
|
S: this,
|
|
203
261
|
A: [
|
|
204
262
|
"this._writeStream",
|
|
@@ -210,7 +268,7 @@ var DataServiceHost = class {
|
|
|
210
268
|
objectCount: request.batch.objects?.length ?? 0
|
|
211
269
|
}, {
|
|
212
270
|
F: __dxlog_file2,
|
|
213
|
-
L:
|
|
271
|
+
L: 180,
|
|
214
272
|
S: this,
|
|
215
273
|
C: (f, a) => f(...a)
|
|
216
274
|
});
|
|
@@ -224,7 +282,7 @@ var DataServiceHost = class {
|
|
|
224
282
|
seq: receipt2.seq
|
|
225
283
|
}, {
|
|
226
284
|
F: __dxlog_file2,
|
|
227
|
-
L:
|
|
285
|
+
L: 189,
|
|
228
286
|
S: this,
|
|
229
287
|
C: (f, a) => f(...a)
|
|
230
288
|
});
|
|
@@ -281,8 +339,8 @@ var DatabaseHost = class {
|
|
|
281
339
|
createSnapshot() {
|
|
282
340
|
return this._itemDemuxer.createSnapshot();
|
|
283
341
|
}
|
|
284
|
-
createDataServiceHost() {
|
|
285
|
-
return new DataServiceHost(this._itemManager, this._itemDemuxer, this._flush, this._outboundStream ?? void 0);
|
|
342
|
+
createDataServiceHost(opts = {}) {
|
|
343
|
+
return new DataServiceHost(this._itemManager, this._itemDemuxer, this._flush, this._outboundStream ?? void 0, opts);
|
|
286
344
|
}
|
|
287
345
|
};
|
|
288
346
|
|
|
@@ -475,7 +533,7 @@ var DataServiceImpl = class {
|
|
|
475
533
|
|
|
476
534
|
// packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
|
|
477
535
|
var import_crc_32 = __toESM(require("crc-32"));
|
|
478
|
-
var
|
|
536
|
+
var import_async2 = require("@dxos/async");
|
|
479
537
|
var import_invariant4 = require("@dxos/invariant");
|
|
480
538
|
var import_keys3 = require("@dxos/keys");
|
|
481
539
|
var import_log3 = require("@dxos/log");
|
|
@@ -508,7 +566,7 @@ var MetadataStore = class {
|
|
|
508
566
|
this._metadata = emptyEchoMetadata();
|
|
509
567
|
this._spaceLargeMetadata = new import_util3.ComplexMap(import_keys3.PublicKey.hash);
|
|
510
568
|
this._metadataFile = void 0;
|
|
511
|
-
this.update = new
|
|
569
|
+
this.update = new import_async2.Event();
|
|
512
570
|
}
|
|
513
571
|
get metadata() {
|
|
514
572
|
return this._metadata;
|
|
@@ -767,18 +825,18 @@ var MetadataStore = class {
|
|
|
767
825
|
}
|
|
768
826
|
};
|
|
769
827
|
_ts_decorate([
|
|
770
|
-
|
|
828
|
+
import_async2.synchronized
|
|
771
829
|
], MetadataStore.prototype, "load", null);
|
|
772
830
|
_ts_decorate([
|
|
773
|
-
|
|
831
|
+
import_async2.synchronized
|
|
774
832
|
], MetadataStore.prototype, "_save", null);
|
|
775
833
|
_ts_decorate([
|
|
776
|
-
|
|
834
|
+
import_async2.synchronized
|
|
777
835
|
], MetadataStore.prototype, "_saveSpaceLargeMetadata", null);
|
|
778
836
|
var fromBytesInt32 = (buf) => buf.readInt32LE(0);
|
|
779
837
|
|
|
780
838
|
// packages/core/echo/echo-pipeline/src/space/auth.ts
|
|
781
|
-
var
|
|
839
|
+
var import_async3 = require("@dxos/async");
|
|
782
840
|
var import_context3 = require("@dxos/context");
|
|
783
841
|
var import_crypto2 = require("@dxos/crypto");
|
|
784
842
|
var import_invariant5 = require("@dxos/invariant");
|
|
@@ -836,7 +894,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
836
894
|
}
|
|
837
895
|
async onOpen(context) {
|
|
838
896
|
await super.onOpen(context);
|
|
839
|
-
(0,
|
|
897
|
+
(0, import_async3.scheduleTask)(this._ctx, async () => {
|
|
840
898
|
try {
|
|
841
899
|
const challenge = (0, import_crypto2.randomBytes)(32);
|
|
842
900
|
const { credential } = await this.rpc.AuthService.authenticate({
|
|
@@ -861,7 +919,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
861
919
|
"'credential not verified'"
|
|
862
920
|
]
|
|
863
921
|
});
|
|
864
|
-
(0,
|
|
922
|
+
(0, import_async3.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
|
|
865
923
|
} catch (err) {
|
|
866
924
|
(0, import_log4.log)("auth failed", err, {
|
|
867
925
|
F: __dxlog_file5,
|
|
@@ -885,7 +943,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
885
943
|
};
|
|
886
944
|
|
|
887
945
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
888
|
-
var
|
|
946
|
+
var import_async8 = require("@dxos/async");
|
|
889
947
|
var import_invariant9 = require("@dxos/invariant");
|
|
890
948
|
var import_log10 = require("@dxos/log");
|
|
891
949
|
var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
@@ -893,7 +951,7 @@ var import_tracing3 = require("@dxos/tracing");
|
|
|
893
951
|
var import_util7 = require("@dxos/util");
|
|
894
952
|
|
|
895
953
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
896
|
-
var
|
|
954
|
+
var import_async6 = require("@dxos/async");
|
|
897
955
|
var import_context5 = require("@dxos/context");
|
|
898
956
|
var import_credentials = require("@dxos/credentials");
|
|
899
957
|
var import_keys5 = require("@dxos/keys");
|
|
@@ -904,7 +962,7 @@ var import_tracing = require("@dxos/tracing");
|
|
|
904
962
|
var import_util5 = require("@dxos/util");
|
|
905
963
|
|
|
906
964
|
// packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
|
|
907
|
-
var
|
|
965
|
+
var import_async5 = require("@dxos/async");
|
|
908
966
|
var import_context4 = require("@dxos/context");
|
|
909
967
|
var import_debug3 = require("@dxos/debug");
|
|
910
968
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -945,7 +1003,7 @@ var createMessageSelector = (timeframeClock) => {
|
|
|
945
1003
|
};
|
|
946
1004
|
|
|
947
1005
|
// packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts
|
|
948
|
-
var
|
|
1006
|
+
var import_async4 = require("@dxos/async");
|
|
949
1007
|
var import_debug2 = require("@dxos/debug");
|
|
950
1008
|
var import_log6 = require("@dxos/log");
|
|
951
1009
|
var import_timeframe = require("@dxos/timeframe");
|
|
@@ -971,7 +1029,7 @@ var startAfter = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
|
|
|
971
1029
|
var TimeframeClock = class {
|
|
972
1030
|
constructor(_timeframe = new import_timeframe.Timeframe()) {
|
|
973
1031
|
this._timeframe = _timeframe;
|
|
974
|
-
this.update = new
|
|
1032
|
+
this.update = new import_async4.Event();
|
|
975
1033
|
this._pendingTimeframe = _timeframe;
|
|
976
1034
|
}
|
|
977
1035
|
/**
|
|
@@ -1055,7 +1113,7 @@ var PipelineState = class {
|
|
|
1055
1113
|
this._timeframeClock = _timeframeClock;
|
|
1056
1114
|
this._ctx = new import_context4.Context();
|
|
1057
1115
|
this.timeframeUpdate = this._timeframeClock.update;
|
|
1058
|
-
this.stalled = new
|
|
1116
|
+
this.stalled = new import_async5.Event();
|
|
1059
1117
|
this._startTimeframe = new import_timeframe2.Timeframe();
|
|
1060
1118
|
this._reachedTarget = false;
|
|
1061
1119
|
}
|
|
@@ -1129,7 +1187,7 @@ var PipelineState = class {
|
|
|
1129
1187
|
done = true;
|
|
1130
1188
|
this._reachedTarget = true;
|
|
1131
1189
|
}),
|
|
1132
|
-
(0,
|
|
1190
|
+
(0, import_async5.sleepWithContext)(this._ctx, timeout).then(() => {
|
|
1133
1191
|
if (done) {
|
|
1134
1192
|
return;
|
|
1135
1193
|
}
|
|
@@ -1158,8 +1216,8 @@ var Pipeline = class {
|
|
|
1158
1216
|
// External state accessor.
|
|
1159
1217
|
this._state = new PipelineState(this._feeds, this._timeframeClock);
|
|
1160
1218
|
// Waits for the message consumer to process the message and yield control back to the pipeline.
|
|
1161
|
-
this._processingTrigger = new
|
|
1162
|
-
this._pauseTrigger = new
|
|
1219
|
+
this._processingTrigger = new import_async5.Trigger().wake();
|
|
1220
|
+
this._pauseTrigger = new import_async5.Trigger().wake();
|
|
1163
1221
|
// Pending downloads.
|
|
1164
1222
|
this._downloads = new import_util4.ComplexMap((value) => import_keys4.PublicKey.hash(value.key));
|
|
1165
1223
|
this._isStopping = false;
|
|
@@ -1437,19 +1495,19 @@ var Pipeline = class {
|
|
|
1437
1495
|
}
|
|
1438
1496
|
};
|
|
1439
1497
|
_ts_decorate3([
|
|
1440
|
-
|
|
1498
|
+
import_async5.synchronized
|
|
1441
1499
|
], Pipeline.prototype, "start", null);
|
|
1442
1500
|
_ts_decorate3([
|
|
1443
|
-
|
|
1501
|
+
import_async5.synchronized
|
|
1444
1502
|
], Pipeline.prototype, "stop", null);
|
|
1445
1503
|
_ts_decorate3([
|
|
1446
|
-
|
|
1504
|
+
import_async5.synchronized
|
|
1447
1505
|
], Pipeline.prototype, "setCursor", null);
|
|
1448
1506
|
_ts_decorate3([
|
|
1449
|
-
|
|
1507
|
+
import_async5.synchronized
|
|
1450
1508
|
], Pipeline.prototype, "pause", null);
|
|
1451
1509
|
_ts_decorate3([
|
|
1452
|
-
|
|
1510
|
+
import_async5.synchronized
|
|
1453
1511
|
], Pipeline.prototype, "unpause", null);
|
|
1454
1512
|
|
|
1455
1513
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
@@ -1474,8 +1532,8 @@ var ControlPipeline = class ControlPipeline2 {
|
|
|
1474
1532
|
this.onFeedAdmitted = new import_util5.Callback();
|
|
1475
1533
|
this._usage = new import_tracing.TimeUsageCounter();
|
|
1476
1534
|
this._mutations = new import_tracing.TimeSeriesCounter();
|
|
1477
|
-
this._snapshotTask = new
|
|
1478
|
-
await (0,
|
|
1535
|
+
this._snapshotTask = new import_async6.DeferredTask(this._ctx, async () => {
|
|
1536
|
+
await (0, import_async6.sleepWithContext)(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
|
|
1479
1537
|
await this._saveSnapshot();
|
|
1480
1538
|
});
|
|
1481
1539
|
this._spaceKey = spaceKey;
|
|
@@ -1698,11 +1756,11 @@ _ts_decorate4([
|
|
|
1698
1756
|
], ControlPipeline.prototype, "_processMessage", null);
|
|
1699
1757
|
ControlPipeline = _ts_decorate4([
|
|
1700
1758
|
import_tracing.trace.resource(),
|
|
1701
|
-
(0,
|
|
1759
|
+
(0, import_async6.trackLeaks)("start", "stop")
|
|
1702
1760
|
], ControlPipeline);
|
|
1703
1761
|
|
|
1704
1762
|
// packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
|
|
1705
|
-
var
|
|
1763
|
+
var import_async7 = require("@dxos/async");
|
|
1706
1764
|
var import_context6 = require("@dxos/context");
|
|
1707
1765
|
var import_credentials3 = require("@dxos/credentials");
|
|
1708
1766
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
@@ -1741,7 +1799,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1741
1799
|
this._mutations = new import_tracing2.TimeSeriesCounter();
|
|
1742
1800
|
this.currentEpoch = void 0;
|
|
1743
1801
|
this.appliedEpoch = void 0;
|
|
1744
|
-
this.onNewEpoch = new
|
|
1802
|
+
this.onNewEpoch = new import_async7.Event();
|
|
1745
1803
|
}
|
|
1746
1804
|
get isOpen() {
|
|
1747
1805
|
return this._isOpen;
|
|
@@ -1804,7 +1862,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1804
1862
|
this.databaseHost = new DatabaseHost(feedWriter, () => this._flush());
|
|
1805
1863
|
this.itemManager = new import_echo_db3.ItemManager(this._params.modelFactory);
|
|
1806
1864
|
await this.databaseHost.open(this.itemManager, this._params.modelFactory);
|
|
1807
|
-
(0,
|
|
1865
|
+
(0, import_async7.scheduleTask)(this._ctx, async () => {
|
|
1808
1866
|
await this._consumePipeline();
|
|
1809
1867
|
});
|
|
1810
1868
|
this._isOpen = true;
|
|
@@ -1923,7 +1981,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1923
1981
|
span.end();
|
|
1924
1982
|
if (++messageCounter > 1e3) {
|
|
1925
1983
|
messageCounter = 0;
|
|
1926
|
-
await (0,
|
|
1984
|
+
await (0, import_async7.sleep)(1);
|
|
1927
1985
|
}
|
|
1928
1986
|
}
|
|
1929
1987
|
}
|
|
@@ -2003,7 +2061,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
2003
2061
|
}
|
|
2004
2062
|
});
|
|
2005
2063
|
this._epochCtx = ctx;
|
|
2006
|
-
(0,
|
|
2064
|
+
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
2007
2065
|
if (!this._isOpen) {
|
|
2008
2066
|
return;
|
|
2009
2067
|
}
|
|
@@ -2124,19 +2182,19 @@ _ts_decorate5([
|
|
|
2124
2182
|
import_tracing2.trace.metricsCounter()
|
|
2125
2183
|
], DataPipeline.prototype, "_mutations", void 0);
|
|
2126
2184
|
_ts_decorate5([
|
|
2127
|
-
|
|
2185
|
+
import_async7.synchronized
|
|
2128
2186
|
], DataPipeline.prototype, "open", null);
|
|
2129
2187
|
_ts_decorate5([
|
|
2130
|
-
|
|
2188
|
+
import_async7.synchronized
|
|
2131
2189
|
], DataPipeline.prototype, "close", null);
|
|
2132
2190
|
_ts_decorate5([
|
|
2133
|
-
|
|
2191
|
+
import_async7.synchronized
|
|
2134
2192
|
], DataPipeline.prototype, "_processEpoch", null);
|
|
2135
2193
|
_ts_decorate5([
|
|
2136
|
-
|
|
2194
|
+
import_async7.synchronized
|
|
2137
2195
|
], DataPipeline.prototype, "createEpoch", null);
|
|
2138
2196
|
DataPipeline = _ts_decorate5([
|
|
2139
|
-
(0,
|
|
2197
|
+
(0, import_async7.trackLeaks)("open", "close"),
|
|
2140
2198
|
import_tracing2.trace.resource()
|
|
2141
2199
|
], DataPipeline);
|
|
2142
2200
|
|
|
@@ -2154,9 +2212,9 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
2154
2212
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
|
|
2155
2213
|
var Space = class Space2 {
|
|
2156
2214
|
constructor(params) {
|
|
2157
|
-
this._addFeedLock = new
|
|
2215
|
+
this._addFeedLock = new import_async8.Lock();
|
|
2158
2216
|
this.onCredentialProcessed = new import_util7.Callback();
|
|
2159
|
-
this.stateUpdate = new
|
|
2217
|
+
this.stateUpdate = new import_async8.Event();
|
|
2160
2218
|
this._isOpen = false;
|
|
2161
2219
|
(0, import_invariant9.invariant)(params.spaceKey && params.feedProvider, void 0, {
|
|
2162
2220
|
F: __dxlog_file11,
|
|
@@ -2375,22 +2433,22 @@ _ts_decorate6([
|
|
|
2375
2433
|
import_tracing3.trace.info()
|
|
2376
2434
|
], Space.prototype, "key", null);
|
|
2377
2435
|
_ts_decorate6([
|
|
2378
|
-
|
|
2436
|
+
import_async8.synchronized,
|
|
2379
2437
|
import_tracing3.trace.span()
|
|
2380
2438
|
], Space.prototype, "open", null);
|
|
2381
2439
|
_ts_decorate6([
|
|
2382
|
-
|
|
2440
|
+
import_async8.synchronized
|
|
2383
2441
|
], Space.prototype, "close", null);
|
|
2384
2442
|
_ts_decorate6([
|
|
2385
|
-
|
|
2443
|
+
import_async8.synchronized
|
|
2386
2444
|
], Space.prototype, "initializeDataPipeline", null);
|
|
2387
2445
|
Space = _ts_decorate6([
|
|
2388
|
-
(0,
|
|
2446
|
+
(0, import_async8.trackLeaks)("open", "close"),
|
|
2389
2447
|
import_tracing3.trace.resource()
|
|
2390
2448
|
], Space);
|
|
2391
2449
|
|
|
2392
2450
|
// packages/core/echo/echo-pipeline/src/space/space-manager.ts
|
|
2393
|
-
var
|
|
2451
|
+
var import_async9 = require("@dxos/async");
|
|
2394
2452
|
var import_debug4 = require("@dxos/debug");
|
|
2395
2453
|
var import_keys7 = require("@dxos/keys");
|
|
2396
2454
|
var import_log12 = require("@dxos/log");
|
|
@@ -2688,13 +2746,13 @@ var SpaceManager = class SpaceManager2 {
|
|
|
2688
2746
|
}
|
|
2689
2747
|
};
|
|
2690
2748
|
_ts_decorate8([
|
|
2691
|
-
|
|
2749
|
+
import_async9.synchronized
|
|
2692
2750
|
], SpaceManager.prototype, "open", null);
|
|
2693
2751
|
_ts_decorate8([
|
|
2694
|
-
|
|
2752
|
+
import_async9.synchronized
|
|
2695
2753
|
], SpaceManager.prototype, "close", null);
|
|
2696
2754
|
SpaceManager = _ts_decorate8([
|
|
2697
|
-
(0,
|
|
2755
|
+
(0, import_async9.trackLeaks)("open", "close")
|
|
2698
2756
|
], SpaceManager);
|
|
2699
2757
|
|
|
2700
2758
|
// packages/core/echo/echo-pipeline/src/testing/test-agent-builder.ts
|
|
@@ -2871,7 +2929,7 @@ var TestAgent = class {
|
|
|
2871
2929
|
};
|
|
2872
2930
|
|
|
2873
2931
|
// packages/core/echo/echo-pipeline/src/testing/util.ts
|
|
2874
|
-
var
|
|
2932
|
+
var import_async10 = require("@dxos/async");
|
|
2875
2933
|
var import_document_model2 = require("@dxos/document-model");
|
|
2876
2934
|
var import_echo_db4 = require("@dxos/echo-db");
|
|
2877
2935
|
var import_testing2 = require("@dxos/feed-store/testing");
|
|
@@ -2933,11 +2991,11 @@ var testLocalDatabase = async (create, check = create) => {
|
|
|
2933
2991
|
]
|
|
2934
2992
|
}
|
|
2935
2993
|
});
|
|
2936
|
-
await (0,
|
|
2994
|
+
await (0, import_async10.asyncTimeout)(check.databaseHost._itemDemuxer.mutation.waitForCondition(() => check.itemManager.entities.has(objectId)), 2e3);
|
|
2937
2995
|
};
|
|
2938
2996
|
|
|
2939
2997
|
// packages/core/echo/echo-pipeline/src/testing/database-test-rig.ts
|
|
2940
|
-
var
|
|
2998
|
+
var import_async11 = require("@dxos/async");
|
|
2941
2999
|
var import_document_model3 = require("@dxos/document-model");
|
|
2942
3000
|
var import_echo_db5 = require("@dxos/echo-db");
|
|
2943
3001
|
var import_invariant10 = require("@dxos/invariant");
|
|
@@ -2970,7 +3028,7 @@ var DatabaseTestPeer = class {
|
|
|
2970
3028
|
this.snapshots = /* @__PURE__ */ new Map();
|
|
2971
3029
|
this.confirmed = -1;
|
|
2972
3030
|
this.timeframe = new import_timeframe6.Timeframe();
|
|
2973
|
-
this._onConfirm = new
|
|
3031
|
+
this._onConfirm = new import_async11.Event();
|
|
2974
3032
|
this._writes = /* @__PURE__ */ new Set();
|
|
2975
3033
|
}
|
|
2976
3034
|
async open() {
|
|
@@ -2991,7 +3049,7 @@ var DatabaseTestPeer = class {
|
|
|
2991
3049
|
options: {
|
|
2992
3050
|
afterWrite
|
|
2993
3051
|
},
|
|
2994
|
-
trigger: new
|
|
3052
|
+
trigger: new import_async11.Trigger()
|
|
2995
3053
|
};
|
|
2996
3054
|
this._writes.add(request);
|
|
2997
3055
|
await request.trigger.wait();
|
|
@@ -3005,7 +3063,9 @@ var DatabaseTestPeer = class {
|
|
|
3005
3063
|
}
|
|
3006
3064
|
this.items = new import_echo_db5.ItemManager(this.modelFactory);
|
|
3007
3065
|
this.proxy = new import_echo_db5.DatabaseProxy({
|
|
3008
|
-
service: this.host.createDataServiceHost(
|
|
3066
|
+
service: this.host.createDataServiceHost({
|
|
3067
|
+
deferEvents: false
|
|
3068
|
+
}),
|
|
3009
3069
|
itemManager: this.items,
|
|
3010
3070
|
spaceKey: this.spaceKey
|
|
3011
3071
|
});
|