@dxos/echo-pipeline 0.4.9-main.2d20855 → 0.4.9-main.2f03cf8
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-WAN2XUWE.mjs → chunk-RTEEJ723.mjs} +273 -1131
- package/dist/lib/browser/chunk-RTEEJ723.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +4 -60
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/{chunk-U6J2HC4T.cjs → chunk-7VZVCCNF.cjs} +310 -1166
- package/dist/lib/node/chunk-7VZVCCNF.cjs.map +7 -0
- package/dist/lib/node/index.cjs +22 -30
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +13 -68
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/db-host/data-service.d.ts +3 -13
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/index.d.ts +0 -2
- package/dist/types/src/db-host/index.d.ts.map +1 -1
- package/dist/types/src/space/index.d.ts +0 -1
- package/dist/types/src/space/index.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +1 -4
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +1 -7
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts +1 -3
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/package.json +30 -33
- package/src/automerge/automerge-host.ts +1 -1
- package/src/db-host/data-service.ts +10 -56
- package/src/db-host/index.ts +0 -2
- package/src/space/index.ts +0 -1
- package/src/space/space-manager.ts +1 -13
- package/src/space/space.test.ts +2 -112
- package/src/space/space.ts +2 -60
- package/src/testing/index.ts +0 -1
- package/src/testing/test-agent-builder.ts +3 -8
- package/dist/lib/browser/chunk-WAN2XUWE.mjs.map +0 -7
- package/dist/lib/node/chunk-U6J2HC4T.cjs.map +0 -7
- package/dist/types/src/db-host/data-service-host.d.ts +0 -38
- package/dist/types/src/db-host/data-service-host.d.ts.map +0 -1
- package/dist/types/src/db-host/database-host.d.ts +0 -27
- package/dist/types/src/db-host/database-host.d.ts.map +0 -1
- package/dist/types/src/space/data-pipeline.d.ts +0 -79
- package/dist/types/src/space/data-pipeline.d.ts.map +0 -1
- package/dist/types/src/space/data-pipeline.test.d.ts +0 -1
- package/dist/types/src/space/data-pipeline.test.d.ts.map +0 -1
- package/dist/types/src/testing/util.d.ts +0 -10
- package/dist/types/src/testing/util.d.ts.map +0 -1
- package/src/db-host/data-service-host.ts +0 -233
- package/src/db-host/database-host.ts +0 -63
- package/src/space/data-pipeline.test.ts +0 -3
- package/src/space/data-pipeline.ts +0 -425
- package/src/testing/util.ts +0 -61
|
@@ -40,257 +40,6 @@ var createMappedFeedWriter = (mapper, writer) => {
|
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
// packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts
|
|
44
|
-
import { UpdateScheduler } from "@dxos/async";
|
|
45
|
-
import { Stream } from "@dxos/codec-protobuf";
|
|
46
|
-
import { Context } from "@dxos/context";
|
|
47
|
-
import { tagMutationsInBatch, setMetadataOnObject } from "@dxos/echo-db";
|
|
48
|
-
import { invariant as invariant2 } from "@dxos/invariant";
|
|
49
|
-
import { log } from "@dxos/log";
|
|
50
|
-
import { EchoEvent } from "@dxos/protocols/proto/dxos/echo/service";
|
|
51
|
-
import { ComplexMap } from "@dxos/util";
|
|
52
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
|
|
53
|
-
var MUTATION_LIMIT_PER_OBJECT = 10;
|
|
54
|
-
var DataServiceHost = class {
|
|
55
|
-
constructor(_itemManager, _itemDemuxer, _flush, _writeStream, _opts = {}) {
|
|
56
|
-
this._itemManager = _itemManager;
|
|
57
|
-
this._itemDemuxer = _itemDemuxer;
|
|
58
|
-
this._flush = _flush;
|
|
59
|
-
this._writeStream = _writeStream;
|
|
60
|
-
this._opts = _opts;
|
|
61
|
-
this._ctx = new Context();
|
|
62
|
-
this._clientTagMap = new ComplexMap(([feedKey, seq]) => `${feedKey.toHex()}:${seq}`);
|
|
63
|
-
}
|
|
64
|
-
async open() {
|
|
65
|
-
}
|
|
66
|
-
async close() {
|
|
67
|
-
await this._ctx.dispose();
|
|
68
|
-
}
|
|
69
|
-
get _deferEvents() {
|
|
70
|
-
return this._opts.deferEvents ?? true;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Real-time subscription to data objects in a space.
|
|
74
|
-
*/
|
|
75
|
-
subscribe() {
|
|
76
|
-
return new Stream(({ next, close, ctx }) => {
|
|
77
|
-
ctx.onDispose(this._ctx.onDispose(close));
|
|
78
|
-
const objects = Array.from(this._itemManager.entities.values()).map((entity) => entity.createSnapshot());
|
|
79
|
-
next({
|
|
80
|
-
batch: {
|
|
81
|
-
objects
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
const updateScheduler = new UpdateScheduler(ctx, async () => {
|
|
85
|
-
flushPendingUpdate();
|
|
86
|
-
}, {
|
|
87
|
-
maxFrequency: 10
|
|
88
|
-
});
|
|
89
|
-
const pendingUpdates = [];
|
|
90
|
-
const mutationsPerObject = /* @__PURE__ */ new Map();
|
|
91
|
-
const clearPendingUpdates = () => {
|
|
92
|
-
pendingUpdates.length = 0;
|
|
93
|
-
mutationsPerObject.clear();
|
|
94
|
-
};
|
|
95
|
-
const flushPendingUpdate = () => {
|
|
96
|
-
const stagedEvents = [];
|
|
97
|
-
const objectsWithSnapshots = /* @__PURE__ */ new Set();
|
|
98
|
-
for (const [id, count] of mutationsPerObject) {
|
|
99
|
-
if (count >= MUTATION_LIMIT_PER_OBJECT) {
|
|
100
|
-
objectsWithSnapshots.add(id);
|
|
101
|
-
const entity = this._itemManager.entities.get(id);
|
|
102
|
-
if (entity) {
|
|
103
|
-
stagedEvents.push(entity.createSnapshot());
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
for (const obj of pendingUpdates) {
|
|
108
|
-
if (!objectsWithSnapshots.has(obj.objectId)) {
|
|
109
|
-
stagedEvents.push(obj);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
next({
|
|
113
|
-
batch: {
|
|
114
|
-
objects: stagedEvents
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
clearPendingUpdates();
|
|
118
|
-
};
|
|
119
|
-
this._itemDemuxer.snapshot.on(ctx, (snapshot) => {
|
|
120
|
-
clearPendingUpdates();
|
|
121
|
-
next({
|
|
122
|
-
action: EchoEvent.DatabaseAction.RESET,
|
|
123
|
-
batch: {
|
|
124
|
-
objects: snapshot.items
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
this._itemDemuxer.mutation.on(ctx, (message) => {
|
|
129
|
-
const { batch, meta } = message;
|
|
130
|
-
invariant2(!meta.clientTag, "Unexpected client tag in mutation message", {
|
|
131
|
-
F: __dxlog_file2,
|
|
132
|
-
L: 138,
|
|
133
|
-
S: this,
|
|
134
|
-
A: [
|
|
135
|
-
"!(meta as any).clientTag",
|
|
136
|
-
"'Unexpected client tag in mutation message'"
|
|
137
|
-
]
|
|
138
|
-
});
|
|
139
|
-
log("message", {
|
|
140
|
-
batch: batch.objects?.length,
|
|
141
|
-
meta
|
|
142
|
-
}, {
|
|
143
|
-
F: __dxlog_file2,
|
|
144
|
-
L: 139,
|
|
145
|
-
S: this,
|
|
146
|
-
C: (f, a) => f(...a)
|
|
147
|
-
});
|
|
148
|
-
const clientTag = this._clientTagMap.get([
|
|
149
|
-
message.meta.feedKey,
|
|
150
|
-
message.meta.seq
|
|
151
|
-
]);
|
|
152
|
-
batch.objects?.forEach((object) => {
|
|
153
|
-
setMetadataOnObject(object, {
|
|
154
|
-
...meta
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
if (clientTag) {
|
|
158
|
-
flushPendingUpdate();
|
|
159
|
-
tagMutationsInBatch(batch, clientTag, 0);
|
|
160
|
-
next({
|
|
161
|
-
clientTag,
|
|
162
|
-
feedKey: message.meta.feedKey,
|
|
163
|
-
seq: message.meta.seq,
|
|
164
|
-
batch
|
|
165
|
-
});
|
|
166
|
-
} else {
|
|
167
|
-
for (const obj of batch.objects ?? []) {
|
|
168
|
-
const newCount = (mutationsPerObject.get(obj.objectId) ?? 0) + 1;
|
|
169
|
-
mutationsPerObject.set(obj.objectId, newCount);
|
|
170
|
-
}
|
|
171
|
-
for (const obj of batch.objects ?? []) {
|
|
172
|
-
if ((mutationsPerObject.get(obj.objectId) ?? 0) < MUTATION_LIMIT_PER_OBJECT) {
|
|
173
|
-
pendingUpdates.push(obj);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (this._deferEvents) {
|
|
177
|
-
updateScheduler.trigger();
|
|
178
|
-
} else {
|
|
179
|
-
flushPendingUpdate();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
async write(request) {
|
|
186
|
-
invariant2(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
|
|
187
|
-
F: __dxlog_file2,
|
|
188
|
-
L: 184,
|
|
189
|
-
S: this,
|
|
190
|
-
A: [
|
|
191
|
-
"!this._ctx.disposed",
|
|
192
|
-
"'Cannot write to closed DataServiceHost'"
|
|
193
|
-
]
|
|
194
|
-
});
|
|
195
|
-
invariant2(this._writeStream, "Cannot write mutations in readonly mode", {
|
|
196
|
-
F: __dxlog_file2,
|
|
197
|
-
L: 185,
|
|
198
|
-
S: this,
|
|
199
|
-
A: [
|
|
200
|
-
"this._writeStream",
|
|
201
|
-
"'Cannot write mutations in readonly mode'"
|
|
202
|
-
]
|
|
203
|
-
});
|
|
204
|
-
log("write", {
|
|
205
|
-
clientTag: request.clientTag,
|
|
206
|
-
objectCount: request.batch.objects?.length ?? 0
|
|
207
|
-
}, {
|
|
208
|
-
F: __dxlog_file2,
|
|
209
|
-
L: 187,
|
|
210
|
-
S: this,
|
|
211
|
-
C: (f, a) => f(...a)
|
|
212
|
-
});
|
|
213
|
-
const message = createDataMessage(request.batch);
|
|
214
|
-
const receipt = await this._writeStream.write(message, {
|
|
215
|
-
afterWrite: async (receipt2) => {
|
|
216
|
-
if (request.clientTag) {
|
|
217
|
-
log("tag", {
|
|
218
|
-
clientTag: request.clientTag,
|
|
219
|
-
feedKey: receipt2.feedKey,
|
|
220
|
-
seq: receipt2.seq
|
|
221
|
-
}, {
|
|
222
|
-
F: __dxlog_file2,
|
|
223
|
-
L: 196,
|
|
224
|
-
S: this,
|
|
225
|
-
C: (f, a) => f(...a)
|
|
226
|
-
});
|
|
227
|
-
this._clientTagMap.set([
|
|
228
|
-
receipt2.feedKey,
|
|
229
|
-
receipt2.seq
|
|
230
|
-
], request.clientTag);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
return receipt;
|
|
235
|
-
}
|
|
236
|
-
async flush() {
|
|
237
|
-
await this._flush();
|
|
238
|
-
}
|
|
239
|
-
getHostInfo() {
|
|
240
|
-
throw new Error("Method not implemented.");
|
|
241
|
-
}
|
|
242
|
-
syncRepo(request) {
|
|
243
|
-
throw new Error("Method not implemented.");
|
|
244
|
-
}
|
|
245
|
-
sendSyncMessage(request) {
|
|
246
|
-
throw new Error("Method not implemented.");
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
var createDataMessage = (batch) => ({
|
|
250
|
-
batch: {
|
|
251
|
-
objects: batch.objects?.map((object) => ({
|
|
252
|
-
...object,
|
|
253
|
-
mutations: object.mutations?.map((mutation) => ({
|
|
254
|
-
...mutation,
|
|
255
|
-
meta: void 0
|
|
256
|
-
})),
|
|
257
|
-
meta: void 0
|
|
258
|
-
}))
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
// packages/core/echo/echo-pipeline/src/db-host/database-host.ts
|
|
263
|
-
import { ItemDemuxer } from "@dxos/echo-db";
|
|
264
|
-
var DatabaseHost = class {
|
|
265
|
-
constructor(_outboundStream, _flush) {
|
|
266
|
-
this._outboundStream = _outboundStream;
|
|
267
|
-
this._flush = _flush;
|
|
268
|
-
}
|
|
269
|
-
get isReadOnly() {
|
|
270
|
-
return !!this._outboundStream;
|
|
271
|
-
}
|
|
272
|
-
get echoProcessor() {
|
|
273
|
-
return this._echoProcessor;
|
|
274
|
-
}
|
|
275
|
-
async open(itemManager, modelFactory) {
|
|
276
|
-
this._itemManager = itemManager;
|
|
277
|
-
this._itemManager._debugLabel = "host";
|
|
278
|
-
this._itemDemuxer = new ItemDemuxer(itemManager, modelFactory);
|
|
279
|
-
this._echoProcessor = this._itemDemuxer.open();
|
|
280
|
-
}
|
|
281
|
-
async close() {
|
|
282
|
-
}
|
|
283
|
-
getWriteStream() {
|
|
284
|
-
return this._outboundStream;
|
|
285
|
-
}
|
|
286
|
-
createSnapshot() {
|
|
287
|
-
return this._itemDemuxer.createSnapshot();
|
|
288
|
-
}
|
|
289
|
-
createDataServiceHost(opts = {}) {
|
|
290
|
-
return new DataServiceHost(this._itemManager, this._itemDemuxer, this._flush, this._outboundStream ?? void 0, opts);
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
|
|
294
43
|
// packages/core/echo/echo-pipeline/src/db-host/snapshot-manager.ts
|
|
295
44
|
import { cancelWithContext } from "@dxos/context";
|
|
296
45
|
import { PublicKey } from "@dxos/keys";
|
|
@@ -373,109 +122,17 @@ var SnapshotStore = class {
|
|
|
373
122
|
};
|
|
374
123
|
|
|
375
124
|
// packages/core/echo/echo-pipeline/src/db-host/data-service.ts
|
|
376
|
-
import { raise } from "@dxos/debug";
|
|
377
|
-
import { invariant as invariant3 } from "@dxos/invariant";
|
|
378
|
-
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
379
|
-
import { log as log2 } from "@dxos/log";
|
|
380
|
-
import { ComplexMap as ComplexMap2 } from "@dxos/util";
|
|
381
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
|
|
382
|
-
var DataServiceSubscriptions = class {
|
|
383
|
-
constructor() {
|
|
384
|
-
this._spaces = new ComplexMap2(PublicKey2.hash);
|
|
385
|
-
}
|
|
386
|
-
clear() {
|
|
387
|
-
this._spaces.clear();
|
|
388
|
-
}
|
|
389
|
-
async registerSpace(spaceKey, host) {
|
|
390
|
-
log2("Registering space", {
|
|
391
|
-
spaceKey
|
|
392
|
-
}, {
|
|
393
|
-
F: __dxlog_file3,
|
|
394
|
-
L: 35,
|
|
395
|
-
S: this,
|
|
396
|
-
C: (f, a) => f(...a)
|
|
397
|
-
});
|
|
398
|
-
invariant3(!this._spaces.has(spaceKey), void 0, {
|
|
399
|
-
F: __dxlog_file3,
|
|
400
|
-
L: 36,
|
|
401
|
-
S: this,
|
|
402
|
-
A: [
|
|
403
|
-
"!this._spaces.has(spaceKey)",
|
|
404
|
-
""
|
|
405
|
-
]
|
|
406
|
-
});
|
|
407
|
-
await host.open();
|
|
408
|
-
this._spaces.set(spaceKey, host);
|
|
409
|
-
}
|
|
410
|
-
async unregisterSpace(spaceKey) {
|
|
411
|
-
log2("Unregistering space", {
|
|
412
|
-
spaceKey
|
|
413
|
-
}, {
|
|
414
|
-
F: __dxlog_file3,
|
|
415
|
-
L: 42,
|
|
416
|
-
S: this,
|
|
417
|
-
C: (f, a) => f(...a)
|
|
418
|
-
});
|
|
419
|
-
const host = this._spaces.get(spaceKey);
|
|
420
|
-
await host?.close();
|
|
421
|
-
this._spaces.delete(spaceKey);
|
|
422
|
-
}
|
|
423
|
-
getDataService(spaceKey) {
|
|
424
|
-
return this._spaces.get(spaceKey);
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
125
|
var DataServiceImpl = class {
|
|
428
|
-
constructor(
|
|
429
|
-
this._subscriptions = _subscriptions;
|
|
126
|
+
constructor(_automergeHost) {
|
|
430
127
|
this._automergeHost = _automergeHost;
|
|
431
128
|
}
|
|
432
129
|
subscribe(request) {
|
|
433
|
-
|
|
434
|
-
F: __dxlog_file3,
|
|
435
|
-
L: 64,
|
|
436
|
-
S: this,
|
|
437
|
-
A: [
|
|
438
|
-
"request.spaceKey",
|
|
439
|
-
""
|
|
440
|
-
]
|
|
441
|
-
});
|
|
442
|
-
const host = this._subscriptions.getDataService(request.spaceKey) ?? raise(new Error(`space not found: ${request.spaceKey}`));
|
|
443
|
-
return host.subscribe();
|
|
130
|
+
throw new Error("Deprecated.");
|
|
444
131
|
}
|
|
445
132
|
write(request) {
|
|
446
|
-
|
|
447
|
-
F: __dxlog_file3,
|
|
448
|
-
L: 71,
|
|
449
|
-
S: this,
|
|
450
|
-
A: [
|
|
451
|
-
"request.spaceKey",
|
|
452
|
-
""
|
|
453
|
-
]
|
|
454
|
-
});
|
|
455
|
-
invariant3(request.batch, void 0, {
|
|
456
|
-
F: __dxlog_file3,
|
|
457
|
-
L: 72,
|
|
458
|
-
S: this,
|
|
459
|
-
A: [
|
|
460
|
-
"request.batch",
|
|
461
|
-
""
|
|
462
|
-
]
|
|
463
|
-
});
|
|
464
|
-
const host = this._subscriptions.getDataService(request.spaceKey) ?? raise(new Error(`space not found: ${request.spaceKey}`));
|
|
465
|
-
return host.write(request);
|
|
133
|
+
throw new Error("Deprecated.");
|
|
466
134
|
}
|
|
467
|
-
flush(request) {
|
|
468
|
-
invariant3(request.spaceKey, void 0, {
|
|
469
|
-
F: __dxlog_file3,
|
|
470
|
-
L: 79,
|
|
471
|
-
S: this,
|
|
472
|
-
A: [
|
|
473
|
-
"request.spaceKey",
|
|
474
|
-
""
|
|
475
|
-
]
|
|
476
|
-
});
|
|
477
|
-
const host = this._subscriptions.getDataService(request.spaceKey) ?? raise(new Error(`space not found: ${request.spaceKey}`));
|
|
478
|
-
return host.flush();
|
|
135
|
+
async flush(request) {
|
|
479
136
|
}
|
|
480
137
|
// Automerge specific.
|
|
481
138
|
async getHostInfo(request) {
|
|
@@ -492,13 +149,13 @@ var DataServiceImpl = class {
|
|
|
492
149
|
// packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
|
|
493
150
|
import CRC32 from "crc-32";
|
|
494
151
|
import { Event, scheduleTaskInterval, synchronized } from "@dxos/async";
|
|
495
|
-
import { Context
|
|
496
|
-
import { invariant as
|
|
497
|
-
import { PublicKey as
|
|
498
|
-
import { log
|
|
152
|
+
import { Context } from "@dxos/context";
|
|
153
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
154
|
+
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
155
|
+
import { log } from "@dxos/log";
|
|
499
156
|
import { DataCorruptionError, STORAGE_VERSION, schema as schema4 } from "@dxos/protocols";
|
|
500
157
|
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
501
|
-
import { ComplexMap
|
|
158
|
+
import { ComplexMap, arrayToBuffer, forEachAsync, isNotNullOrUndefined } from "@dxos/util";
|
|
502
159
|
function _ts_decorate(decorators, target, key, desc) {
|
|
503
160
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
504
161
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -509,7 +166,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
509
166
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
510
167
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
511
168
|
}
|
|
512
|
-
var
|
|
169
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
|
|
513
170
|
var EXPIRED_INVITATION_CLEANUP_INTERVAL = 60 * 60 * 1e3;
|
|
514
171
|
var emptyEchoMetadata = () => ({
|
|
515
172
|
version: STORAGE_VERSION,
|
|
@@ -523,10 +180,10 @@ var LargeSpaceMetadata = schema4.getCodecForType("dxos.echo.metadata.LargeSpaceM
|
|
|
523
180
|
var MetadataStore = class {
|
|
524
181
|
constructor(directory) {
|
|
525
182
|
this._metadata = emptyEchoMetadata();
|
|
526
|
-
this._spaceLargeMetadata = new
|
|
183
|
+
this._spaceLargeMetadata = new ComplexMap(PublicKey2.hash);
|
|
527
184
|
this._metadataFile = void 0;
|
|
528
185
|
this.update = new Event();
|
|
529
|
-
this._invitationCleanupCtx = new
|
|
186
|
+
this._invitationCleanupCtx = new Context();
|
|
530
187
|
this._directory = directory;
|
|
531
188
|
}
|
|
532
189
|
get metadata() {
|
|
@@ -550,12 +207,12 @@ var MetadataStore = class {
|
|
|
550
207
|
}
|
|
551
208
|
const dataSize = fromBytesInt32(await file.read(0, 4));
|
|
552
209
|
const checksum = fromBytesInt32(await file.read(4, 4));
|
|
553
|
-
|
|
210
|
+
log("loaded", {
|
|
554
211
|
size: dataSize,
|
|
555
212
|
checksum,
|
|
556
213
|
name: file.filename
|
|
557
214
|
}, {
|
|
558
|
-
F:
|
|
215
|
+
F: __dxlog_file2,
|
|
559
216
|
L: 89,
|
|
560
217
|
S: this,
|
|
561
218
|
C: (f, a) => f(...a)
|
|
@@ -587,11 +244,11 @@ var MetadataStore = class {
|
|
|
587
244
|
result.writeInt32LE(checksum, 4);
|
|
588
245
|
encoded.copy(result, 8);
|
|
589
246
|
await file.write(0, result);
|
|
590
|
-
|
|
247
|
+
log("saved", {
|
|
591
248
|
size: encoded.length,
|
|
592
249
|
checksum
|
|
593
250
|
}, {
|
|
594
|
-
F:
|
|
251
|
+
F: __dxlog_file2,
|
|
595
252
|
L: 124,
|
|
596
253
|
S: this,
|
|
597
254
|
C: (f, a) => f(...a)
|
|
@@ -621,10 +278,10 @@ var MetadataStore = class {
|
|
|
621
278
|
space.state ??= SpaceState.ACTIVE;
|
|
622
279
|
});
|
|
623
280
|
} catch (err) {
|
|
624
|
-
|
|
281
|
+
log.error("failed to load metadata", {
|
|
625
282
|
err
|
|
626
283
|
}, {
|
|
627
|
-
F:
|
|
284
|
+
F: __dxlog_file2,
|
|
628
285
|
L: 156,
|
|
629
286
|
S: this,
|
|
630
287
|
C: (f, a) => f(...a)
|
|
@@ -638,10 +295,10 @@ var MetadataStore = class {
|
|
|
638
295
|
try {
|
|
639
296
|
await this._loadSpaceLargeMetadata(key);
|
|
640
297
|
} catch (err) {
|
|
641
|
-
|
|
298
|
+
log.error("failed to load space large metadata", {
|
|
642
299
|
err
|
|
643
300
|
}, {
|
|
644
|
-
F:
|
|
301
|
+
F: __dxlog_file2,
|
|
645
302
|
L: 168,
|
|
646
303
|
S: this,
|
|
647
304
|
C: (f, a) => f(...a)
|
|
@@ -675,10 +332,10 @@ var MetadataStore = class {
|
|
|
675
332
|
this._spaceLargeMetadata.set(key, metadata);
|
|
676
333
|
}
|
|
677
334
|
} catch (err) {
|
|
678
|
-
|
|
335
|
+
log.error("failed to load space large metadata", {
|
|
679
336
|
err
|
|
680
337
|
}, {
|
|
681
|
-
F:
|
|
338
|
+
F: __dxlog_file2,
|
|
682
339
|
L: 215,
|
|
683
340
|
S: this,
|
|
684
341
|
C: (f, a) => f(...a)
|
|
@@ -698,8 +355,8 @@ var MetadataStore = class {
|
|
|
698
355
|
return this._metadata.identity.haloSpace;
|
|
699
356
|
}
|
|
700
357
|
const space = this.spaces.find((space2) => space2.key === spaceKey);
|
|
701
|
-
|
|
702
|
-
F:
|
|
358
|
+
invariant2(space, "Space not found", {
|
|
359
|
+
F: __dxlog_file2,
|
|
703
360
|
L: 237,
|
|
704
361
|
S: this,
|
|
705
362
|
A: [
|
|
@@ -722,8 +379,8 @@ var MetadataStore = class {
|
|
|
722
379
|
* Clears storage - doesn't work for now.
|
|
723
380
|
*/
|
|
724
381
|
async clear() {
|
|
725
|
-
|
|
726
|
-
F:
|
|
382
|
+
log("clearing all metadata", void 0, {
|
|
383
|
+
F: __dxlog_file2,
|
|
727
384
|
L: 256,
|
|
728
385
|
S: this,
|
|
729
386
|
C: (f, a) => f(...a)
|
|
@@ -735,8 +392,8 @@ var MetadataStore = class {
|
|
|
735
392
|
return this._metadata.identity;
|
|
736
393
|
}
|
|
737
394
|
async setIdentityRecord(record) {
|
|
738
|
-
|
|
739
|
-
F:
|
|
395
|
+
invariant2(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
|
|
396
|
+
F: __dxlog_file2,
|
|
740
397
|
L: 266,
|
|
741
398
|
S: this,
|
|
742
399
|
A: [
|
|
@@ -765,8 +422,8 @@ var MetadataStore = class {
|
|
|
765
422
|
await this.flush();
|
|
766
423
|
}
|
|
767
424
|
async addSpace(record) {
|
|
768
|
-
|
|
769
|
-
F:
|
|
425
|
+
invariant2(!(this._metadata.spaces ?? []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
|
|
426
|
+
F: __dxlog_file2,
|
|
770
427
|
L: 294,
|
|
771
428
|
S: this,
|
|
772
429
|
A: [
|
|
@@ -826,7 +483,7 @@ var fromBytesInt32 = (buf) => buf.readInt32LE(0);
|
|
|
826
483
|
// packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts
|
|
827
484
|
import { Event as Event2 } from "@dxos/async";
|
|
828
485
|
import { timed } from "@dxos/debug";
|
|
829
|
-
import { log as
|
|
486
|
+
import { log as log2 } from "@dxos/log";
|
|
830
487
|
import { Timeframe } from "@dxos/timeframe";
|
|
831
488
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
832
489
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -838,7 +495,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
838
495
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
839
496
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
840
497
|
}
|
|
841
|
-
var
|
|
498
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
|
|
842
499
|
var mapTimeframeToFeedIndexes = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
|
|
843
500
|
feedKey,
|
|
844
501
|
index
|
|
@@ -892,22 +549,22 @@ var TimeframeClock = class {
|
|
|
892
549
|
return !gaps.isEmpty();
|
|
893
550
|
}
|
|
894
551
|
async waitUntilReached(target) {
|
|
895
|
-
|
|
552
|
+
log2("waitUntilReached", {
|
|
896
553
|
target,
|
|
897
554
|
current: this._timeframe
|
|
898
555
|
}, {
|
|
899
|
-
F:
|
|
556
|
+
F: __dxlog_file3,
|
|
900
557
|
L: 70,
|
|
901
558
|
S: this,
|
|
902
559
|
C: (f, a) => f(...a)
|
|
903
560
|
});
|
|
904
561
|
await this.update.waitForCondition(() => {
|
|
905
|
-
|
|
562
|
+
log2("check if reached", {
|
|
906
563
|
target,
|
|
907
564
|
current: this._timeframe,
|
|
908
565
|
deps: Timeframe.dependencies(target, this._timeframe)
|
|
909
566
|
}, {
|
|
910
|
-
F:
|
|
567
|
+
F: __dxlog_file3,
|
|
911
568
|
L: 72,
|
|
912
569
|
S: this,
|
|
913
570
|
C: (f, a) => f(...a)
|
|
@@ -922,25 +579,25 @@ _ts_decorate2([
|
|
|
922
579
|
|
|
923
580
|
// packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
|
|
924
581
|
import { Event as Event3, sleepWithContext, synchronized as synchronized2, Trigger } from "@dxos/async";
|
|
925
|
-
import { Context as
|
|
582
|
+
import { Context as Context2, rejectOnDispose } from "@dxos/context";
|
|
926
583
|
import { failUndefined } from "@dxos/debug";
|
|
927
584
|
import { FeedSetIterator } from "@dxos/feed-store";
|
|
928
|
-
import { invariant as
|
|
929
|
-
import { PublicKey as
|
|
930
|
-
import { log as
|
|
585
|
+
import { invariant as invariant4 } from "@dxos/invariant";
|
|
586
|
+
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
587
|
+
import { log as log4 } from "@dxos/log";
|
|
931
588
|
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
932
|
-
import { ComplexMap as
|
|
589
|
+
import { ComplexMap as ComplexMap2 } from "@dxos/util";
|
|
933
590
|
|
|
934
591
|
// packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
|
|
935
|
-
import { invariant as
|
|
936
|
-
import { log as
|
|
937
|
-
var
|
|
592
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
593
|
+
import { log as log3 } from "@dxos/log";
|
|
594
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
|
|
938
595
|
var createMessageSelector = (timeframeClock) => {
|
|
939
596
|
return (messages) => {
|
|
940
597
|
for (let i = 0; i < messages.length; i++) {
|
|
941
598
|
const { data: { timeframe } } = messages[i];
|
|
942
|
-
|
|
943
|
-
F:
|
|
599
|
+
invariant3(timeframe, void 0, {
|
|
600
|
+
F: __dxlog_file4,
|
|
944
601
|
L: 25,
|
|
945
602
|
S: void 0,
|
|
946
603
|
A: [
|
|
@@ -952,8 +609,8 @@ var createMessageSelector = (timeframeClock) => {
|
|
|
952
609
|
return i;
|
|
953
610
|
}
|
|
954
611
|
}
|
|
955
|
-
|
|
956
|
-
F:
|
|
612
|
+
log3("Skipping...", void 0, {
|
|
613
|
+
F: __dxlog_file4,
|
|
957
614
|
L: 33,
|
|
958
615
|
S: void 0,
|
|
959
616
|
C: (f, a) => f(...a)
|
|
@@ -972,12 +629,12 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
972
629
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
973
630
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
974
631
|
}
|
|
975
|
-
var
|
|
632
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
|
|
976
633
|
var PipelineState = class {
|
|
977
634
|
constructor(_feeds, _timeframeClock) {
|
|
978
635
|
this._feeds = _feeds;
|
|
979
636
|
this._timeframeClock = _timeframeClock;
|
|
980
|
-
this._ctx = new
|
|
637
|
+
this._ctx = new Context2();
|
|
981
638
|
this.timeframeUpdate = this._timeframeClock.update;
|
|
982
639
|
this.stalled = new Event3();
|
|
983
640
|
this._startTimeframe = new Timeframe2();
|
|
@@ -1025,13 +682,13 @@ var PipelineState = class {
|
|
|
1025
682
|
*
|
|
1026
683
|
* @param timeout Timeout in milliseconds to specify the maximum wait time.
|
|
1027
684
|
*/
|
|
1028
|
-
async waitUntilReachedTargetTimeframe({ ctx = new
|
|
1029
|
-
|
|
685
|
+
async waitUntilReachedTargetTimeframe({ ctx = new Context2(), timeout, breakOnStall = true } = {}) {
|
|
686
|
+
log4("waitUntilReachedTargetTimeframe", {
|
|
1030
687
|
timeout,
|
|
1031
688
|
current: this.timeframe,
|
|
1032
689
|
target: this.targetTimeframe
|
|
1033
690
|
}, {
|
|
1034
|
-
F:
|
|
691
|
+
F: __dxlog_file5,
|
|
1035
692
|
L: 133,
|
|
1036
693
|
S: this,
|
|
1037
694
|
C: (f, a) => f(...a)
|
|
@@ -1057,13 +714,13 @@ var PipelineState = class {
|
|
|
1057
714
|
if (done) {
|
|
1058
715
|
return;
|
|
1059
716
|
}
|
|
1060
|
-
|
|
717
|
+
log4.warn("waitUntilReachedTargetTimeframe timed out", {
|
|
1061
718
|
timeout,
|
|
1062
719
|
current: this.timeframe,
|
|
1063
720
|
target: this.targetTimeframe,
|
|
1064
721
|
dependencies: Timeframe2.dependencies(this.targetTimeframe, this.timeframe)
|
|
1065
722
|
}, {
|
|
1066
|
-
F:
|
|
723
|
+
F: __dxlog_file5,
|
|
1067
724
|
L: 161,
|
|
1068
725
|
S: this,
|
|
1069
726
|
C: (f, a) => f(...a)
|
|
@@ -1078,14 +735,14 @@ var PipelineState = class {
|
|
|
1078
735
|
var Pipeline = class {
|
|
1079
736
|
constructor() {
|
|
1080
737
|
this._timeframeClock = new TimeframeClock(new Timeframe2());
|
|
1081
|
-
this._feeds = new
|
|
738
|
+
this._feeds = new ComplexMap2(PublicKey3.hash);
|
|
1082
739
|
// External state accessor.
|
|
1083
740
|
this._state = new PipelineState(this._feeds, this._timeframeClock);
|
|
1084
741
|
// Waits for the message consumer to process the message and yield control back to the pipeline.
|
|
1085
742
|
this._processingTrigger = new Trigger().wake();
|
|
1086
743
|
this._pauseTrigger = new Trigger().wake();
|
|
1087
744
|
// Pending downloads.
|
|
1088
|
-
this._downloads = new
|
|
745
|
+
this._downloads = new ComplexMap2((value) => PublicKey3.hash(value.key));
|
|
1089
746
|
this._isStopping = false;
|
|
1090
747
|
this._isStarted = false;
|
|
1091
748
|
this._isBeingConsumed = false;
|
|
@@ -1095,8 +752,8 @@ var Pipeline = class {
|
|
|
1095
752
|
return this._state;
|
|
1096
753
|
}
|
|
1097
754
|
get writer() {
|
|
1098
|
-
|
|
1099
|
-
F:
|
|
755
|
+
invariant4(this._writer, "Writer not set.", {
|
|
756
|
+
F: __dxlog_file5,
|
|
1100
757
|
L: 242,
|
|
1101
758
|
S: this,
|
|
1102
759
|
A: [
|
|
@@ -1124,8 +781,8 @@ var Pipeline = class {
|
|
|
1124
781
|
}
|
|
1125
782
|
}
|
|
1126
783
|
setWriteFeed(feed) {
|
|
1127
|
-
|
|
1128
|
-
F:
|
|
784
|
+
invariant4(!this._writer, "Writer already set.", {
|
|
785
|
+
F: __dxlog_file5,
|
|
1129
786
|
L: 269,
|
|
1130
787
|
S: this,
|
|
1131
788
|
A: [
|
|
@@ -1133,8 +790,8 @@ var Pipeline = class {
|
|
|
1133
790
|
"'Writer already set.'"
|
|
1134
791
|
]
|
|
1135
792
|
});
|
|
1136
|
-
|
|
1137
|
-
F:
|
|
793
|
+
invariant4(feed.properties.writable, "Feed must be writable.", {
|
|
794
|
+
F: __dxlog_file5,
|
|
1138
795
|
L: 270,
|
|
1139
796
|
S: this,
|
|
1140
797
|
A: [
|
|
@@ -1148,8 +805,8 @@ var Pipeline = class {
|
|
|
1148
805
|
}), feed.createFeedWriter());
|
|
1149
806
|
}
|
|
1150
807
|
async start() {
|
|
1151
|
-
|
|
1152
|
-
F:
|
|
808
|
+
invariant4(!this._isStarted, "Pipeline is already started.", {
|
|
809
|
+
F: __dxlog_file5,
|
|
1153
810
|
L: 283,
|
|
1154
811
|
S: this,
|
|
1155
812
|
A: [
|
|
@@ -1157,8 +814,8 @@ var Pipeline = class {
|
|
|
1157
814
|
"'Pipeline is already started.'"
|
|
1158
815
|
]
|
|
1159
816
|
});
|
|
1160
|
-
|
|
1161
|
-
F:
|
|
817
|
+
log4("starting...", void 0, {
|
|
818
|
+
F: __dxlog_file5,
|
|
1162
819
|
L: 284,
|
|
1163
820
|
S: this,
|
|
1164
821
|
C: (f, a) => f(...a)
|
|
@@ -1166,8 +823,8 @@ var Pipeline = class {
|
|
|
1166
823
|
await this._initIterator();
|
|
1167
824
|
await this._feedSetIterator.open();
|
|
1168
825
|
this._isStarted = true;
|
|
1169
|
-
|
|
1170
|
-
F:
|
|
826
|
+
log4("started", void 0, {
|
|
827
|
+
F: __dxlog_file5,
|
|
1171
828
|
L: 288,
|
|
1172
829
|
S: this,
|
|
1173
830
|
C: (f, a) => f(...a)
|
|
@@ -1179,8 +836,8 @@ var Pipeline = class {
|
|
|
1179
836
|
}
|
|
1180
837
|
}
|
|
1181
838
|
async stop() {
|
|
1182
|
-
|
|
1183
|
-
F:
|
|
839
|
+
log4("stopping...", void 0, {
|
|
840
|
+
F: __dxlog_file5,
|
|
1184
841
|
L: 299,
|
|
1185
842
|
S: this,
|
|
1186
843
|
C: (f, a) => f(...a)
|
|
@@ -1193,12 +850,12 @@ var Pipeline = class {
|
|
|
1193
850
|
await this._feedSetIterator?.close();
|
|
1194
851
|
await this._processingTrigger.wait();
|
|
1195
852
|
await this._state._ctx.dispose();
|
|
1196
|
-
this._state._ctx = new
|
|
853
|
+
this._state._ctx = new Context2();
|
|
1197
854
|
this._state._reachedTargetPromise = void 0;
|
|
1198
855
|
this._state._reachedTarget = false;
|
|
1199
856
|
this._isStarted = false;
|
|
1200
|
-
|
|
1201
|
-
F:
|
|
857
|
+
log4("stopped", void 0, {
|
|
858
|
+
F: __dxlog_file5,
|
|
1202
859
|
L: 312,
|
|
1203
860
|
S: this,
|
|
1204
861
|
C: (f, a) => f(...a)
|
|
@@ -1209,8 +866,8 @@ var Pipeline = class {
|
|
|
1209
866
|
* The pipeline will start processing messages AFTER this timeframe.
|
|
1210
867
|
*/
|
|
1211
868
|
async setCursor(timeframe) {
|
|
1212
|
-
|
|
1213
|
-
F:
|
|
869
|
+
invariant4(!this._isStarted || this._isPaused, "Invalid state.", {
|
|
870
|
+
F: __dxlog_file5,
|
|
1214
871
|
L: 321,
|
|
1215
872
|
S: this,
|
|
1216
873
|
A: [
|
|
@@ -1238,8 +895,8 @@ var Pipeline = class {
|
|
|
1238
895
|
this._isPaused = true;
|
|
1239
896
|
}
|
|
1240
897
|
async unpause() {
|
|
1241
|
-
|
|
1242
|
-
F:
|
|
898
|
+
invariant4(this._isPaused, "Pipeline is not paused.", {
|
|
899
|
+
F: __dxlog_file5,
|
|
1243
900
|
L: 350,
|
|
1244
901
|
S: this,
|
|
1245
902
|
A: [
|
|
@@ -1258,8 +915,8 @@ var Pipeline = class {
|
|
|
1258
915
|
* Updates the timeframe clock after the message has bee processed.
|
|
1259
916
|
*/
|
|
1260
917
|
async *consume() {
|
|
1261
|
-
|
|
1262
|
-
F:
|
|
918
|
+
invariant4(!this._isBeingConsumed, "Pipeline is already being consumed.", {
|
|
919
|
+
F: __dxlog_file5,
|
|
1263
920
|
L: 365,
|
|
1264
921
|
S: this,
|
|
1265
922
|
A: [
|
|
@@ -1268,8 +925,8 @@ var Pipeline = class {
|
|
|
1268
925
|
]
|
|
1269
926
|
});
|
|
1270
927
|
this._isBeingConsumed = true;
|
|
1271
|
-
|
|
1272
|
-
F:
|
|
928
|
+
invariant4(this._feedSetIterator, "Iterator not initialized.", {
|
|
929
|
+
F: __dxlog_file5,
|
|
1273
930
|
L: 368,
|
|
1274
931
|
S: this,
|
|
1275
932
|
A: [
|
|
@@ -1282,8 +939,8 @@ var Pipeline = class {
|
|
|
1282
939
|
while (!this._isStopping) {
|
|
1283
940
|
await this._pauseTrigger.wait();
|
|
1284
941
|
if (lastFeedSetIterator !== this._feedSetIterator) {
|
|
1285
|
-
|
|
1286
|
-
F:
|
|
942
|
+
invariant4(this._feedSetIterator, "Iterator not initialized.", {
|
|
943
|
+
F: __dxlog_file5,
|
|
1287
944
|
L: 377,
|
|
1288
945
|
S: this,
|
|
1289
946
|
A: [
|
|
@@ -1298,7 +955,7 @@ var Pipeline = class {
|
|
|
1298
955
|
if (!done) {
|
|
1299
956
|
const block = value ?? failUndefined();
|
|
1300
957
|
this._processingTrigger.reset();
|
|
1301
|
-
this._timeframeClock.updatePendingTimeframe(
|
|
958
|
+
this._timeframeClock.updatePendingTimeframe(PublicKey3.from(block.feedKey), block.seq);
|
|
1302
959
|
yield block;
|
|
1303
960
|
this._processingTrigger.wake();
|
|
1304
961
|
this._timeframeClock.updateTimeframe();
|
|
@@ -1313,12 +970,12 @@ var Pipeline = class {
|
|
|
1313
970
|
}
|
|
1314
971
|
const timeframe = this._state._startTimeframe;
|
|
1315
972
|
const seq = timeframe.get(feed.key) ?? -1;
|
|
1316
|
-
|
|
973
|
+
log4("download", {
|
|
1317
974
|
feed: feed.key.truncate(),
|
|
1318
975
|
seq,
|
|
1319
976
|
length: feed.length
|
|
1320
977
|
}, {
|
|
1321
|
-
F:
|
|
978
|
+
F: __dxlog_file5,
|
|
1322
979
|
L: 406,
|
|
1323
980
|
S: this,
|
|
1324
981
|
C: (f, a) => f(...a)
|
|
@@ -1329,10 +986,10 @@ var Pipeline = class {
|
|
|
1329
986
|
}, (err, data) => {
|
|
1330
987
|
if (err) {
|
|
1331
988
|
} else {
|
|
1332
|
-
|
|
989
|
+
log4.info("downloaded", {
|
|
1333
990
|
data
|
|
1334
991
|
}, {
|
|
1335
|
-
F:
|
|
992
|
+
F: __dxlog_file5,
|
|
1336
993
|
L: 411,
|
|
1337
994
|
S: this,
|
|
1338
995
|
C: (f, a) => f(...a)
|
|
@@ -1347,8 +1004,8 @@ var Pipeline = class {
|
|
|
1347
1004
|
stallTimeout: 1e3
|
|
1348
1005
|
});
|
|
1349
1006
|
this._feedSetIterator.stalled.on((iterator) => {
|
|
1350
|
-
|
|
1351
|
-
F:
|
|
1007
|
+
log4.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
|
|
1008
|
+
F: __dxlog_file5,
|
|
1352
1009
|
L: 425,
|
|
1353
1010
|
S: this,
|
|
1354
1011
|
C: (f, a) => f(...a)
|
|
@@ -1378,13 +1035,13 @@ _ts_decorate3([
|
|
|
1378
1035
|
|
|
1379
1036
|
// packages/core/echo/echo-pipeline/src/space/auth.ts
|
|
1380
1037
|
import { runInContext, scheduleTask } from "@dxos/async";
|
|
1381
|
-
import { Context as
|
|
1038
|
+
import { Context as Context3 } from "@dxos/context";
|
|
1382
1039
|
import { randomBytes } from "@dxos/crypto";
|
|
1383
|
-
import { invariant as
|
|
1384
|
-
import { log as
|
|
1040
|
+
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1041
|
+
import { log as log5 } from "@dxos/log";
|
|
1385
1042
|
import { schema as schema5 } from "@dxos/protocols";
|
|
1386
1043
|
import { RpcExtension } from "@dxos/teleport";
|
|
1387
|
-
var
|
|
1044
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
|
|
1388
1045
|
var AuthExtension = class extends RpcExtension {
|
|
1389
1046
|
constructor(_authParams) {
|
|
1390
1047
|
super({
|
|
@@ -1397,10 +1054,10 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1397
1054
|
timeout: 60 * 1e3
|
|
1398
1055
|
});
|
|
1399
1056
|
this._authParams = _authParams;
|
|
1400
|
-
this._ctx = new
|
|
1057
|
+
this._ctx = new Context3({
|
|
1401
1058
|
onError: (err) => {
|
|
1402
|
-
|
|
1403
|
-
F:
|
|
1059
|
+
log5.catch(err, void 0, {
|
|
1060
|
+
F: __dxlog_file6,
|
|
1404
1061
|
L: 28,
|
|
1405
1062
|
S: this,
|
|
1406
1063
|
C: (f, a) => f(...a)
|
|
@@ -1421,8 +1078,8 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1421
1078
|
credential
|
|
1422
1079
|
};
|
|
1423
1080
|
} catch (err) {
|
|
1424
|
-
|
|
1425
|
-
F:
|
|
1081
|
+
log5.error("failed to generate auth credentials", err, {
|
|
1082
|
+
F: __dxlog_file6,
|
|
1426
1083
|
L: 55,
|
|
1427
1084
|
S: this,
|
|
1428
1085
|
C: (f, a) => f(...a)
|
|
@@ -1441,8 +1098,8 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1441
1098
|
const { credential } = await this.rpc.AuthService.authenticate({
|
|
1442
1099
|
challenge
|
|
1443
1100
|
});
|
|
1444
|
-
|
|
1445
|
-
F:
|
|
1101
|
+
invariant5(credential?.length > 0, "invalid credential", {
|
|
1102
|
+
F: __dxlog_file6,
|
|
1446
1103
|
L: 69,
|
|
1447
1104
|
S: this,
|
|
1448
1105
|
A: [
|
|
@@ -1451,8 +1108,8 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1451
1108
|
]
|
|
1452
1109
|
});
|
|
1453
1110
|
const success = await this._authParams.verifier(challenge, credential);
|
|
1454
|
-
|
|
1455
|
-
F:
|
|
1111
|
+
invariant5(success, "credential not verified", {
|
|
1112
|
+
F: __dxlog_file6,
|
|
1456
1113
|
L: 71,
|
|
1457
1114
|
S: this,
|
|
1458
1115
|
A: [
|
|
@@ -1462,8 +1119,8 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1462
1119
|
});
|
|
1463
1120
|
runInContext(this._ctx, () => this._authParams.onAuthSuccess());
|
|
1464
1121
|
} catch (err) {
|
|
1465
|
-
|
|
1466
|
-
F:
|
|
1122
|
+
log5("auth failed", err, {
|
|
1123
|
+
F: __dxlog_file6,
|
|
1467
1124
|
L: 74,
|
|
1468
1125
|
S: this,
|
|
1469
1126
|
C: (f, a) => f(...a)
|
|
@@ -1483,17 +1140,24 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1483
1140
|
}
|
|
1484
1141
|
};
|
|
1485
1142
|
|
|
1486
|
-
// packages/core/echo/echo-pipeline/src/space/
|
|
1487
|
-
import { Event as Event4,
|
|
1488
|
-
import {
|
|
1489
|
-
import {
|
|
1490
|
-
import {
|
|
1491
|
-
import {
|
|
1492
|
-
import {
|
|
1493
|
-
|
|
1143
|
+
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
1144
|
+
import { Event as Event4, Mutex, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1145
|
+
import { invariant as invariant6 } from "@dxos/invariant";
|
|
1146
|
+
import { log as log7, logInfo } from "@dxos/log";
|
|
1147
|
+
import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1148
|
+
import { trace as trace2 } from "@dxos/tracing";
|
|
1149
|
+
import { Callback as Callback2 } from "@dxos/util";
|
|
1150
|
+
|
|
1151
|
+
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
1152
|
+
import { DeferredTask, sleepWithContext as sleepWithContext2, trackLeaks } from "@dxos/async";
|
|
1153
|
+
import { Context as Context4 } from "@dxos/context";
|
|
1154
|
+
import { SpaceStateMachine } from "@dxos/credentials";
|
|
1155
|
+
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1156
|
+
import { log as log6 } from "@dxos/log";
|
|
1157
|
+
import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1494
1158
|
import { Timeframe as Timeframe3 } from "@dxos/timeframe";
|
|
1495
1159
|
import { TimeSeriesCounter, TimeUsageCounter, trace } from "@dxos/tracing";
|
|
1496
|
-
import { tracer } from "@dxos/util";
|
|
1160
|
+
import { Callback, tracer } from "@dxos/util";
|
|
1497
1161
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
1498
1162
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1499
1163
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1504,467 +1168,17 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
1504
1168
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1505
1169
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1506
1170
|
}
|
|
1507
|
-
var
|
|
1508
|
-
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL =
|
|
1509
|
-
var
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
this.
|
|
1514
|
-
this.
|
|
1515
|
-
this.
|
|
1516
|
-
this._isOpen = false;
|
|
1517
|
-
this._lastTimeframeSaveTime = 0;
|
|
1518
|
-
this._lastSnapshotSaveTime = 0;
|
|
1519
|
-
this._lastProcessedEpoch = -1;
|
|
1171
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
|
|
1172
|
+
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
|
|
1173
|
+
var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
|
|
1174
|
+
var USE_SNAPSHOTS = true;
|
|
1175
|
+
var ControlPipeline = class {
|
|
1176
|
+
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
1177
|
+
this._ctx = new Context4();
|
|
1178
|
+
this._lastTimeframeSaveTime = Date.now();
|
|
1179
|
+
this.onFeedAdmitted = new Callback();
|
|
1520
1180
|
this._usage = new TimeUsageCounter();
|
|
1521
1181
|
this._mutations = new TimeSeriesCounter();
|
|
1522
|
-
this.currentEpoch = void 0;
|
|
1523
|
-
this.appliedEpoch = void 0;
|
|
1524
|
-
this.onNewEpoch = new Event4();
|
|
1525
|
-
}
|
|
1526
|
-
get isOpen() {
|
|
1527
|
-
return this._isOpen;
|
|
1528
|
-
}
|
|
1529
|
-
get pipeline() {
|
|
1530
|
-
return this._pipeline;
|
|
1531
|
-
}
|
|
1532
|
-
get pipelineState() {
|
|
1533
|
-
return this._pipeline?.state;
|
|
1534
|
-
}
|
|
1535
|
-
setTargetTimeframe(timeframe) {
|
|
1536
|
-
this._targetTimeframe = timeframe;
|
|
1537
|
-
this._pipeline?.state.setTargetTimeframe(timeframe);
|
|
1538
|
-
}
|
|
1539
|
-
async processCredential(credential) {
|
|
1540
|
-
if (!checkCredentialType(credential, "dxos.halo.credentials.Epoch")) {
|
|
1541
|
-
return;
|
|
1542
|
-
}
|
|
1543
|
-
this.currentEpoch = credential;
|
|
1544
|
-
if (this._isOpen) {
|
|
1545
|
-
await this._processEpochInSeparateTask(credential);
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
async open() {
|
|
1549
|
-
if (this._isOpen) {
|
|
1550
|
-
return;
|
|
1551
|
-
}
|
|
1552
|
-
this._pipeline = new Pipeline();
|
|
1553
|
-
await this._params.onPipelineCreated(this._pipeline);
|
|
1554
|
-
await this._pipeline.pause();
|
|
1555
|
-
await this._pipeline.start();
|
|
1556
|
-
if (this._targetTimeframe) {
|
|
1557
|
-
this._pipeline.state.setTargetTimeframe(this._targetTimeframe);
|
|
1558
|
-
}
|
|
1559
|
-
const feedWriter = {
|
|
1560
|
-
write: (data, options) => {
|
|
1561
|
-
invariant8(this._pipeline, "Pipeline is not initialized.", {
|
|
1562
|
-
F: __dxlog_file9,
|
|
1563
|
-
L: 152,
|
|
1564
|
-
S: this,
|
|
1565
|
-
A: [
|
|
1566
|
-
"this._pipeline",
|
|
1567
|
-
"'Pipeline is not initialized.'"
|
|
1568
|
-
]
|
|
1569
|
-
});
|
|
1570
|
-
invariant8(this.currentEpoch, "Epoch is not initialized.", {
|
|
1571
|
-
F: __dxlog_file9,
|
|
1572
|
-
L: 153,
|
|
1573
|
-
S: this,
|
|
1574
|
-
A: [
|
|
1575
|
-
"this.currentEpoch",
|
|
1576
|
-
"'Epoch is not initialized.'"
|
|
1577
|
-
]
|
|
1578
|
-
});
|
|
1579
|
-
return this._pipeline.writer.write({
|
|
1580
|
-
data
|
|
1581
|
-
}, options);
|
|
1582
|
-
}
|
|
1583
|
-
};
|
|
1584
|
-
this.databaseHost = new DatabaseHost(feedWriter, () => this._flush());
|
|
1585
|
-
this.itemManager = new ItemManager(this._params.modelFactory);
|
|
1586
|
-
await this.databaseHost.open(this.itemManager, this._params.modelFactory);
|
|
1587
|
-
scheduleTask2(this._ctx, async () => {
|
|
1588
|
-
await this._consumePipeline();
|
|
1589
|
-
});
|
|
1590
|
-
this._isOpen = true;
|
|
1591
|
-
}
|
|
1592
|
-
async close() {
|
|
1593
|
-
if (!this._isOpen) {
|
|
1594
|
-
return;
|
|
1595
|
-
}
|
|
1596
|
-
log8("close", void 0, {
|
|
1597
|
-
F: __dxlog_file9,
|
|
1598
|
-
L: 177,
|
|
1599
|
-
S: this,
|
|
1600
|
-
C: (f, a) => f(...a)
|
|
1601
|
-
});
|
|
1602
|
-
this._isOpen = false;
|
|
1603
|
-
await this._ctx.dispose();
|
|
1604
|
-
await this._pipeline?.stop();
|
|
1605
|
-
try {
|
|
1606
|
-
if (this._pipeline) {
|
|
1607
|
-
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1608
|
-
}
|
|
1609
|
-
} catch (err) {
|
|
1610
|
-
log8.catch(err, void 0, {
|
|
1611
|
-
F: __dxlog_file9,
|
|
1612
|
-
L: 189,
|
|
1613
|
-
S: this,
|
|
1614
|
-
C: (f, a) => f(...a)
|
|
1615
|
-
});
|
|
1616
|
-
}
|
|
1617
|
-
await this.databaseHost?.close();
|
|
1618
|
-
await this.itemManager?.destroy();
|
|
1619
|
-
this._ctx = new Context5();
|
|
1620
|
-
this._pipeline = void 0;
|
|
1621
|
-
this._targetTimeframe = void 0;
|
|
1622
|
-
this._lastAutomaticSnapshotTimeframe = new Timeframe3();
|
|
1623
|
-
this.currentEpoch = void 0;
|
|
1624
|
-
this.appliedEpoch = void 0;
|
|
1625
|
-
this._lastProcessedEpoch = -1;
|
|
1626
|
-
this._epochCtx = void 0;
|
|
1627
|
-
}
|
|
1628
|
-
async _consumePipeline() {
|
|
1629
|
-
const pipeline = this._pipeline;
|
|
1630
|
-
if (this.currentEpoch) {
|
|
1631
|
-
const waitForOneEpoch = this.onNewEpoch.waitForCount(1);
|
|
1632
|
-
await this._processEpochInSeparateTask(this.currentEpoch);
|
|
1633
|
-
await waitForOneEpoch;
|
|
1634
|
-
}
|
|
1635
|
-
let messageCounter = 0;
|
|
1636
|
-
invariant8(pipeline, "Pipeline is not initialized.", {
|
|
1637
|
-
F: __dxlog_file9,
|
|
1638
|
-
L: 216,
|
|
1639
|
-
S: this,
|
|
1640
|
-
A: [
|
|
1641
|
-
"pipeline",
|
|
1642
|
-
"'Pipeline is not initialized.'"
|
|
1643
|
-
]
|
|
1644
|
-
});
|
|
1645
|
-
for await (const msg of pipeline.consume()) {
|
|
1646
|
-
const span = this._usage.beginRecording();
|
|
1647
|
-
this._mutations.inc();
|
|
1648
|
-
const { feedKey, seq, data } = msg;
|
|
1649
|
-
log8("processing message", {
|
|
1650
|
-
feedKey,
|
|
1651
|
-
seq
|
|
1652
|
-
}, {
|
|
1653
|
-
F: __dxlog_file9,
|
|
1654
|
-
L: 222,
|
|
1655
|
-
S: this,
|
|
1656
|
-
C: (f, a) => f(...a)
|
|
1657
|
-
});
|
|
1658
|
-
try {
|
|
1659
|
-
if (data.payload.data) {
|
|
1660
|
-
const feedInfo = this._params.feedInfoProvider(feedKey);
|
|
1661
|
-
if (!feedInfo) {
|
|
1662
|
-
log8.warn("Could not find feed", {
|
|
1663
|
-
feedKey
|
|
1664
|
-
}, {
|
|
1665
|
-
F: __dxlog_file9,
|
|
1666
|
-
L: 228,
|
|
1667
|
-
S: this,
|
|
1668
|
-
C: (f, a) => f(...a)
|
|
1669
|
-
});
|
|
1670
|
-
continue;
|
|
1671
|
-
}
|
|
1672
|
-
const timer = tracer.mark("dxos.echo.pipeline.data");
|
|
1673
|
-
this.databaseHost.echoProcessor({
|
|
1674
|
-
batch: data.payload.data.batch,
|
|
1675
|
-
meta: {
|
|
1676
|
-
feedKey,
|
|
1677
|
-
seq,
|
|
1678
|
-
timeframe: data.timeframe,
|
|
1679
|
-
memberKey: feedInfo.assertion.identityKey
|
|
1680
|
-
}
|
|
1681
|
-
});
|
|
1682
|
-
timer.end();
|
|
1683
|
-
log8.trace("dxos.echo.data-pipeline.processed", {
|
|
1684
|
-
feedKey: feedKey.toHex(),
|
|
1685
|
-
seq,
|
|
1686
|
-
spaceKey: this._params.spaceKey.toHex()
|
|
1687
|
-
}, {
|
|
1688
|
-
F: __dxlog_file9,
|
|
1689
|
-
L: 245,
|
|
1690
|
-
S: this,
|
|
1691
|
-
C: (f, a) => f(...a)
|
|
1692
|
-
});
|
|
1693
|
-
await this._noteTargetStateIfNeeded(pipeline.state.pendingTimeframe);
|
|
1694
|
-
}
|
|
1695
|
-
} catch (err) {
|
|
1696
|
-
log8.catch(err, void 0, {
|
|
1697
|
-
F: __dxlog_file9,
|
|
1698
|
-
L: 255,
|
|
1699
|
-
S: this,
|
|
1700
|
-
C: (f, a) => f(...a)
|
|
1701
|
-
});
|
|
1702
|
-
}
|
|
1703
|
-
span.end();
|
|
1704
|
-
if (++messageCounter > 100) {
|
|
1705
|
-
messageCounter = 0;
|
|
1706
|
-
await idle(1e3);
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
_createSnapshot() {
|
|
1711
|
-
invariant8(this.databaseHost, "Database backend is not initialized.", {
|
|
1712
|
-
F: __dxlog_file9,
|
|
1713
|
-
L: 269,
|
|
1714
|
-
S: this,
|
|
1715
|
-
A: [
|
|
1716
|
-
"this.databaseHost",
|
|
1717
|
-
"'Database backend is not initialized.'"
|
|
1718
|
-
]
|
|
1719
|
-
});
|
|
1720
|
-
return {
|
|
1721
|
-
spaceKey: this._params.spaceKey.asUint8Array(),
|
|
1722
|
-
timeframe: this._pipeline.state.timeframe,
|
|
1723
|
-
database: this.databaseHost.createSnapshot()
|
|
1724
|
-
};
|
|
1725
|
-
}
|
|
1726
|
-
async _saveTargetTimeframe(timeframe) {
|
|
1727
|
-
const newTimeframe = Timeframe3.merge(this._targetTimeframe ?? new Timeframe3(), timeframe);
|
|
1728
|
-
await this._params.metadataStore.setSpaceDataLatestTimeframe(this._params.spaceKey, newTimeframe);
|
|
1729
|
-
this._targetTimeframe = newTimeframe;
|
|
1730
|
-
}
|
|
1731
|
-
async _noteTargetStateIfNeeded(timeframe) {
|
|
1732
|
-
if (!this._pipeline?.state.reachedTarget) {
|
|
1733
|
-
return;
|
|
1734
|
-
}
|
|
1735
|
-
if (Date.now() - this._lastTimeframeSaveTime > TIMEFRAME_SAVE_DEBOUNCE_INTERVAL) {
|
|
1736
|
-
this._lastTimeframeSaveTime = Date.now();
|
|
1737
|
-
await this._saveTargetTimeframe(timeframe);
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
async _processEpochInSeparateTask(epoch) {
|
|
1741
|
-
if (epoch.subject.assertion.number <= this._lastProcessedEpoch) {
|
|
1742
|
-
return;
|
|
1743
|
-
}
|
|
1744
|
-
await this._epochCtx?.dispose();
|
|
1745
|
-
const ctx = new Context5({
|
|
1746
|
-
onError: (err) => {
|
|
1747
|
-
if (err instanceof CancelledError) {
|
|
1748
|
-
log8("Epoch processing cancelled.", void 0, {
|
|
1749
|
-
F: __dxlog_file9,
|
|
1750
|
-
L: 305,
|
|
1751
|
-
S: this,
|
|
1752
|
-
C: (f, a) => f(...a)
|
|
1753
|
-
});
|
|
1754
|
-
} else {
|
|
1755
|
-
log8.catch(err, void 0, {
|
|
1756
|
-
F: __dxlog_file9,
|
|
1757
|
-
L: 307,
|
|
1758
|
-
S: this,
|
|
1759
|
-
C: (f, a) => f(...a)
|
|
1760
|
-
});
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
});
|
|
1764
|
-
this._epochCtx = ctx;
|
|
1765
|
-
scheduleTask2(ctx, async () => {
|
|
1766
|
-
if (!this._isOpen) {
|
|
1767
|
-
return;
|
|
1768
|
-
}
|
|
1769
|
-
await this._processEpoch(ctx, epoch.subject.assertion);
|
|
1770
|
-
if (epoch.subject.assertion.snapshotCid === void 0) {
|
|
1771
|
-
epoch.subject.assertion.snapshotCid = this.appliedEpoch?.subject.assertion.snapshotCid;
|
|
1772
|
-
}
|
|
1773
|
-
this.appliedEpoch = epoch;
|
|
1774
|
-
this.onNewEpoch.emit(epoch);
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
async _processEpoch(ctx, epoch) {
|
|
1778
|
-
invariant8(this._isOpen, "Space is closed.", {
|
|
1779
|
-
F: __dxlog_file9,
|
|
1780
|
-
L: 331,
|
|
1781
|
-
S: this,
|
|
1782
|
-
A: [
|
|
1783
|
-
"this._isOpen",
|
|
1784
|
-
"'Space is closed.'"
|
|
1785
|
-
]
|
|
1786
|
-
});
|
|
1787
|
-
invariant8(this._pipeline, void 0, {
|
|
1788
|
-
F: __dxlog_file9,
|
|
1789
|
-
L: 332,
|
|
1790
|
-
S: this,
|
|
1791
|
-
A: [
|
|
1792
|
-
"this._pipeline",
|
|
1793
|
-
""
|
|
1794
|
-
]
|
|
1795
|
-
});
|
|
1796
|
-
this._lastProcessedEpoch = epoch.number;
|
|
1797
|
-
log8("processing", {
|
|
1798
|
-
epoch: omit(epoch, "proof")
|
|
1799
|
-
}, {
|
|
1800
|
-
F: __dxlog_file9,
|
|
1801
|
-
L: 335,
|
|
1802
|
-
S: this,
|
|
1803
|
-
C: (f, a) => f(...a)
|
|
1804
|
-
});
|
|
1805
|
-
if (epoch.snapshotCid) {
|
|
1806
|
-
const snapshot = await this._params.snapshotManager.load(ctx, epoch.snapshotCid);
|
|
1807
|
-
this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
|
|
1808
|
-
}
|
|
1809
|
-
log8("restarting pipeline from epoch", void 0, {
|
|
1810
|
-
F: __dxlog_file9,
|
|
1811
|
-
L: 341,
|
|
1812
|
-
S: this,
|
|
1813
|
-
C: (f, a) => f(...a)
|
|
1814
|
-
});
|
|
1815
|
-
await this._pipeline.pause();
|
|
1816
|
-
await this._pipeline.setCursor(epoch.timeframe);
|
|
1817
|
-
await this._pipeline.unpause();
|
|
1818
|
-
}
|
|
1819
|
-
async waitUntilTimeframe(timeframe) {
|
|
1820
|
-
invariant8(this._pipeline, "Pipeline is not initialized.", {
|
|
1821
|
-
F: __dxlog_file9,
|
|
1822
|
-
L: 348,
|
|
1823
|
-
S: this,
|
|
1824
|
-
A: [
|
|
1825
|
-
"this._pipeline",
|
|
1826
|
-
"'Pipeline is not initialized.'"
|
|
1827
|
-
]
|
|
1828
|
-
});
|
|
1829
|
-
await this._pipeline.state.waitUntilTimeframe(timeframe);
|
|
1830
|
-
}
|
|
1831
|
-
async createEpoch() {
|
|
1832
|
-
invariant8(this._pipeline, void 0, {
|
|
1833
|
-
F: __dxlog_file9,
|
|
1834
|
-
L: 354,
|
|
1835
|
-
S: this,
|
|
1836
|
-
A: [
|
|
1837
|
-
"this._pipeline",
|
|
1838
|
-
""
|
|
1839
|
-
]
|
|
1840
|
-
});
|
|
1841
|
-
invariant8(this.currentEpoch, void 0, {
|
|
1842
|
-
F: __dxlog_file9,
|
|
1843
|
-
L: 355,
|
|
1844
|
-
S: this,
|
|
1845
|
-
A: [
|
|
1846
|
-
"this.currentEpoch",
|
|
1847
|
-
""
|
|
1848
|
-
]
|
|
1849
|
-
});
|
|
1850
|
-
await this._pipeline.pause();
|
|
1851
|
-
const snapshot = await this._createSnapshot();
|
|
1852
|
-
const snapshotCid = await this._params.snapshotManager.store(snapshot);
|
|
1853
|
-
const epoch = {
|
|
1854
|
-
previousId: this.currentEpoch.id,
|
|
1855
|
-
timeframe: this._pipeline.state.timeframe,
|
|
1856
|
-
number: this.currentEpoch.subject.assertion.number + 1,
|
|
1857
|
-
snapshotCid
|
|
1858
|
-
};
|
|
1859
|
-
await this._pipeline.unpause();
|
|
1860
|
-
return epoch;
|
|
1861
|
-
}
|
|
1862
|
-
async ensureEpochInitialized() {
|
|
1863
|
-
await this.onNewEpoch.waitForCondition(() => !!this.currentEpoch);
|
|
1864
|
-
}
|
|
1865
|
-
async _flush() {
|
|
1866
|
-
try {
|
|
1867
|
-
if (this._pipeline) {
|
|
1868
|
-
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1869
|
-
}
|
|
1870
|
-
} catch (err) {
|
|
1871
|
-
log8.catch(err, void 0, {
|
|
1872
|
-
F: __dxlog_file9,
|
|
1873
|
-
L: 384,
|
|
1874
|
-
S: this,
|
|
1875
|
-
C: (f, a) => f(...a)
|
|
1876
|
-
});
|
|
1877
|
-
}
|
|
1878
|
-
await this._params.metadataStore.flush();
|
|
1879
|
-
}
|
|
1880
|
-
};
|
|
1881
|
-
_ts_decorate4([
|
|
1882
|
-
trace.metricsCounter()
|
|
1883
|
-
], DataPipeline.prototype, "_usage", void 0);
|
|
1884
|
-
_ts_decorate4([
|
|
1885
|
-
trace.metricsCounter()
|
|
1886
|
-
], DataPipeline.prototype, "_mutations", void 0);
|
|
1887
|
-
_ts_decorate4([
|
|
1888
|
-
synchronized3
|
|
1889
|
-
], DataPipeline.prototype, "open", null);
|
|
1890
|
-
_ts_decorate4([
|
|
1891
|
-
synchronized3
|
|
1892
|
-
], DataPipeline.prototype, "close", null);
|
|
1893
|
-
_ts_decorate4([
|
|
1894
|
-
synchronized3
|
|
1895
|
-
], DataPipeline.prototype, "_processEpoch", null);
|
|
1896
|
-
_ts_decorate4([
|
|
1897
|
-
synchronized3
|
|
1898
|
-
], DataPipeline.prototype, "createEpoch", null);
|
|
1899
|
-
DataPipeline = _ts_decorate4([
|
|
1900
|
-
trackLeaks("open", "close"),
|
|
1901
|
-
trace.resource()
|
|
1902
|
-
], DataPipeline);
|
|
1903
|
-
var idle = async (timeout) => {
|
|
1904
|
-
if (!("scheduler" in globalThis && typeof globalThis.scheduler.postTask === "function")) {
|
|
1905
|
-
await sleep(1);
|
|
1906
|
-
return;
|
|
1907
|
-
}
|
|
1908
|
-
await new Promise((resolve) => {
|
|
1909
|
-
const cleanup = () => {
|
|
1910
|
-
clearTimeout(timer);
|
|
1911
|
-
controller.abort();
|
|
1912
|
-
};
|
|
1913
|
-
const controller = new AbortController();
|
|
1914
|
-
void globalThis.scheduler.postTask(() => {
|
|
1915
|
-
cleanup();
|
|
1916
|
-
resolve();
|
|
1917
|
-
}, {
|
|
1918
|
-
priority: "background",
|
|
1919
|
-
signal: controller.signal
|
|
1920
|
-
}).catch(() => {
|
|
1921
|
-
});
|
|
1922
|
-
const timer = setTimeout(() => {
|
|
1923
|
-
cleanup();
|
|
1924
|
-
resolve();
|
|
1925
|
-
}, timeout);
|
|
1926
|
-
});
|
|
1927
|
-
};
|
|
1928
|
-
|
|
1929
|
-
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
1930
|
-
import { Event as Event5, synchronized as synchronized4, trackLeaks as trackLeaks3, Mutex } from "@dxos/async";
|
|
1931
|
-
import { invariant as invariant9 } from "@dxos/invariant";
|
|
1932
|
-
import { log as log10, logInfo } from "@dxos/log";
|
|
1933
|
-
import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1934
|
-
import { trace as trace3 } from "@dxos/tracing";
|
|
1935
|
-
import { Callback as Callback2 } from "@dxos/util";
|
|
1936
|
-
|
|
1937
|
-
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
1938
|
-
import { DeferredTask, sleepWithContext as sleepWithContext2, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1939
|
-
import { Context as Context6 } from "@dxos/context";
|
|
1940
|
-
import { SpaceStateMachine } from "@dxos/credentials";
|
|
1941
|
-
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1942
|
-
import { log as log9 } from "@dxos/log";
|
|
1943
|
-
import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1944
|
-
import { Timeframe as Timeframe4 } from "@dxos/timeframe";
|
|
1945
|
-
import { TimeSeriesCounter as TimeSeriesCounter2, TimeUsageCounter as TimeUsageCounter2, trace as trace2 } from "@dxos/tracing";
|
|
1946
|
-
import { Callback, tracer as tracer2 } from "@dxos/util";
|
|
1947
|
-
function _ts_decorate5(decorators, target, key, desc) {
|
|
1948
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1949
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1950
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
1951
|
-
else
|
|
1952
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1953
|
-
if (d = decorators[i])
|
|
1954
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1955
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1956
|
-
}
|
|
1957
|
-
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
|
|
1958
|
-
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2 = 500;
|
|
1959
|
-
var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
|
|
1960
|
-
var USE_SNAPSHOTS = true;
|
|
1961
|
-
var ControlPipeline = class {
|
|
1962
|
-
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
1963
|
-
this._ctx = new Context6();
|
|
1964
|
-
this._lastTimeframeSaveTime = Date.now();
|
|
1965
|
-
this.onFeedAdmitted = new Callback();
|
|
1966
|
-
this._usage = new TimeUsageCounter2();
|
|
1967
|
-
this._mutations = new TimeSeriesCounter2();
|
|
1968
1182
|
this._snapshotTask = new DeferredTask(this._ctx, async () => {
|
|
1969
1183
|
await sleepWithContext2(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
|
|
1970
1184
|
await this._saveSnapshot();
|
|
@@ -1975,10 +1189,10 @@ var ControlPipeline = class {
|
|
|
1975
1189
|
void this._pipeline.addFeed(genesisFeed);
|
|
1976
1190
|
this._spaceStateMachine = new SpaceStateMachine(spaceKey);
|
|
1977
1191
|
this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
|
|
1978
|
-
|
|
1192
|
+
log6("feed admitted", {
|
|
1979
1193
|
key: info.key
|
|
1980
1194
|
}, {
|
|
1981
|
-
F:
|
|
1195
|
+
F: __dxlog_file7,
|
|
1982
1196
|
L: 74,
|
|
1983
1197
|
S: this,
|
|
1984
1198
|
C: (f, a) => f(...a)
|
|
@@ -1991,8 +1205,8 @@ var ControlPipeline = class {
|
|
|
1991
1205
|
await this._pipeline.addFeed(feed);
|
|
1992
1206
|
}
|
|
1993
1207
|
} catch (err) {
|
|
1994
|
-
|
|
1995
|
-
F:
|
|
1208
|
+
log6.catch(err, void 0, {
|
|
1209
|
+
F: __dxlog_file7,
|
|
1996
1210
|
L: 85,
|
|
1997
1211
|
S: this,
|
|
1998
1212
|
C: (f, a) => f(...a)
|
|
@@ -2017,12 +1231,12 @@ var ControlPipeline = class {
|
|
|
2017
1231
|
}
|
|
2018
1232
|
async start() {
|
|
2019
1233
|
const snapshot = this._metadata.getSpaceControlPipelineSnapshot(this._spaceKey);
|
|
2020
|
-
|
|
1234
|
+
log6("load snapshot", {
|
|
2021
1235
|
key: this._spaceKey,
|
|
2022
1236
|
present: !!snapshot,
|
|
2023
1237
|
tf: snapshot?.timeframe
|
|
2024
1238
|
}, {
|
|
2025
|
-
F:
|
|
1239
|
+
F: __dxlog_file7,
|
|
2026
1240
|
L: 113,
|
|
2027
1241
|
S: this,
|
|
2028
1242
|
C: (f, a) => f(...a)
|
|
@@ -2030,18 +1244,18 @@ var ControlPipeline = class {
|
|
|
2030
1244
|
if (USE_SNAPSHOTS && snapshot) {
|
|
2031
1245
|
await this._processSnapshot(snapshot);
|
|
2032
1246
|
}
|
|
2033
|
-
|
|
2034
|
-
F:
|
|
1247
|
+
log6("starting...", void 0, {
|
|
1248
|
+
F: __dxlog_file7,
|
|
2035
1249
|
L: 118,
|
|
2036
1250
|
S: this,
|
|
2037
1251
|
C: (f, a) => f(...a)
|
|
2038
1252
|
});
|
|
2039
1253
|
setTimeout(async () => {
|
|
2040
|
-
void this._consumePipeline(new
|
|
1254
|
+
void this._consumePipeline(new Context4());
|
|
2041
1255
|
});
|
|
2042
1256
|
await this._pipeline.start();
|
|
2043
|
-
|
|
2044
|
-
F:
|
|
1257
|
+
log6("started", void 0, {
|
|
1258
|
+
F: __dxlog_file7,
|
|
2045
1259
|
L: 124,
|
|
2046
1260
|
S: this,
|
|
2047
1261
|
C: (f, a) => f(...a)
|
|
@@ -2055,10 +1269,10 @@ var ControlPipeline = class {
|
|
|
2055
1269
|
skipVerification: true
|
|
2056
1270
|
});
|
|
2057
1271
|
if (!result) {
|
|
2058
|
-
|
|
1272
|
+
log6.warn("credential processing failed from snapshot", {
|
|
2059
1273
|
message
|
|
2060
1274
|
}, {
|
|
2061
|
-
F:
|
|
1275
|
+
F: __dxlog_file7,
|
|
2062
1276
|
L: 137,
|
|
2063
1277
|
S: this,
|
|
2064
1278
|
C: (f, a) => f(...a)
|
|
@@ -2076,11 +1290,11 @@ var ControlPipeline = class {
|
|
|
2076
1290
|
}))
|
|
2077
1291
|
};
|
|
2078
1292
|
await this._pipeline.unpause();
|
|
2079
|
-
|
|
1293
|
+
log6("save snapshot", {
|
|
2080
1294
|
key: this._spaceKey,
|
|
2081
1295
|
snapshot
|
|
2082
1296
|
}, {
|
|
2083
|
-
F:
|
|
1297
|
+
F: __dxlog_file7,
|
|
2084
1298
|
L: 153,
|
|
2085
1299
|
S: this,
|
|
2086
1300
|
C: (f, a) => f(...a)
|
|
@@ -2094,8 +1308,8 @@ var ControlPipeline = class {
|
|
|
2094
1308
|
try {
|
|
2095
1309
|
await this._processMessage(ctx, msg);
|
|
2096
1310
|
} catch (err) {
|
|
2097
|
-
|
|
2098
|
-
F:
|
|
1311
|
+
log6.catch(err, void 0, {
|
|
1312
|
+
F: __dxlog_file7,
|
|
2099
1313
|
L: 166,
|
|
2100
1314
|
S: this,
|
|
2101
1315
|
C: (f, a) => f(...a)
|
|
@@ -2105,26 +1319,26 @@ var ControlPipeline = class {
|
|
|
2105
1319
|
}
|
|
2106
1320
|
}
|
|
2107
1321
|
async _processMessage(ctx, msg) {
|
|
2108
|
-
|
|
1322
|
+
log6("processing", {
|
|
2109
1323
|
key: msg.feedKey,
|
|
2110
1324
|
seq: msg.seq
|
|
2111
1325
|
}, {
|
|
2112
|
-
F:
|
|
1326
|
+
F: __dxlog_file7,
|
|
2113
1327
|
L: 176,
|
|
2114
1328
|
S: this,
|
|
2115
1329
|
C: (f, a) => f(...a)
|
|
2116
1330
|
});
|
|
2117
1331
|
if (msg.data.payload.credential) {
|
|
2118
|
-
const timer =
|
|
1332
|
+
const timer = tracer.mark("dxos.echo.pipeline.control");
|
|
2119
1333
|
const result = await this._spaceStateMachine.process(msg.data.payload.credential.credential, {
|
|
2120
|
-
sourceFeed:
|
|
1334
|
+
sourceFeed: PublicKey4.from(msg.feedKey)
|
|
2121
1335
|
});
|
|
2122
1336
|
timer.end();
|
|
2123
1337
|
if (!result) {
|
|
2124
|
-
|
|
1338
|
+
log6.warn("processing failed", {
|
|
2125
1339
|
msg
|
|
2126
1340
|
}, {
|
|
2127
|
-
F:
|
|
1341
|
+
F: __dxlog_file7,
|
|
2128
1342
|
L: 185,
|
|
2129
1343
|
S: this,
|
|
2130
1344
|
C: (f, a) => f(...a)
|
|
@@ -2136,14 +1350,14 @@ var ControlPipeline = class {
|
|
|
2136
1350
|
}
|
|
2137
1351
|
}
|
|
2138
1352
|
async _noteTargetStateIfNeeded(timeframe) {
|
|
2139
|
-
if (Date.now() - this._lastTimeframeSaveTime >
|
|
1353
|
+
if (Date.now() - this._lastTimeframeSaveTime > TIMEFRAME_SAVE_DEBOUNCE_INTERVAL) {
|
|
2140
1354
|
this._lastTimeframeSaveTime = Date.now();
|
|
2141
1355
|
await this._saveTargetTimeframe(timeframe);
|
|
2142
1356
|
}
|
|
2143
1357
|
}
|
|
2144
1358
|
async stop() {
|
|
2145
|
-
|
|
2146
|
-
F:
|
|
1359
|
+
log6("stopping...", void 0, {
|
|
1360
|
+
F: __dxlog_file7,
|
|
2147
1361
|
L: 205,
|
|
2148
1362
|
S: this,
|
|
2149
1363
|
C: (f, a) => f(...a)
|
|
@@ -2151,8 +1365,8 @@ var ControlPipeline = class {
|
|
|
2151
1365
|
await this._ctx.dispose();
|
|
2152
1366
|
await this._pipeline.stop();
|
|
2153
1367
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
2154
|
-
|
|
2155
|
-
F:
|
|
1368
|
+
log6("stopped", void 0, {
|
|
1369
|
+
F: __dxlog_file7,
|
|
2156
1370
|
L: 209,
|
|
2157
1371
|
S: this,
|
|
2158
1372
|
C: (f, a) => f(...a)
|
|
@@ -2160,12 +1374,12 @@ var ControlPipeline = class {
|
|
|
2160
1374
|
}
|
|
2161
1375
|
async _saveTargetTimeframe(timeframe) {
|
|
2162
1376
|
try {
|
|
2163
|
-
const newTimeframe =
|
|
1377
|
+
const newTimeframe = Timeframe3.merge(this._targetTimeframe ?? new Timeframe3(), timeframe);
|
|
2164
1378
|
await this._metadata.setSpaceControlLatestTimeframe(this._spaceKey, newTimeframe);
|
|
2165
1379
|
this._targetTimeframe = newTimeframe;
|
|
2166
1380
|
} catch (err) {
|
|
2167
|
-
|
|
2168
|
-
F:
|
|
1381
|
+
log6(err, void 0, {
|
|
1382
|
+
F: __dxlog_file7,
|
|
2169
1383
|
L: 218,
|
|
2170
1384
|
S: this,
|
|
2171
1385
|
C: (f, a) => f(...a)
|
|
@@ -2173,30 +1387,30 @@ var ControlPipeline = class {
|
|
|
2173
1387
|
}
|
|
2174
1388
|
}
|
|
2175
1389
|
};
|
|
2176
|
-
|
|
2177
|
-
|
|
1390
|
+
_ts_decorate4([
|
|
1391
|
+
trace.metricsCounter()
|
|
2178
1392
|
], ControlPipeline.prototype, "_usage", void 0);
|
|
2179
|
-
|
|
2180
|
-
|
|
1393
|
+
_ts_decorate4([
|
|
1394
|
+
trace.metricsCounter()
|
|
2181
1395
|
], ControlPipeline.prototype, "_mutations", void 0);
|
|
2182
|
-
|
|
2183
|
-
|
|
1396
|
+
_ts_decorate4([
|
|
1397
|
+
trace.span({
|
|
2184
1398
|
showInBrowserTimeline: true
|
|
2185
1399
|
})
|
|
2186
1400
|
], ControlPipeline.prototype, "start", null);
|
|
2187
|
-
|
|
2188
|
-
|
|
1401
|
+
_ts_decorate4([
|
|
1402
|
+
trace.span()
|
|
2189
1403
|
], ControlPipeline.prototype, "_consumePipeline", null);
|
|
2190
|
-
|
|
2191
|
-
|
|
1404
|
+
_ts_decorate4([
|
|
1405
|
+
trace.span()
|
|
2192
1406
|
], ControlPipeline.prototype, "_processMessage", null);
|
|
2193
|
-
ControlPipeline =
|
|
2194
|
-
|
|
2195
|
-
|
|
1407
|
+
ControlPipeline = _ts_decorate4([
|
|
1408
|
+
trace.resource(),
|
|
1409
|
+
trackLeaks("start", "stop")
|
|
2196
1410
|
], ControlPipeline);
|
|
2197
1411
|
|
|
2198
1412
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
2199
|
-
function
|
|
1413
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
2200
1414
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2201
1415
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2202
1416
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2206,16 +1420,16 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
2206
1420
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2207
1421
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2208
1422
|
}
|
|
2209
|
-
var
|
|
1423
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
|
|
2210
1424
|
var Space = class {
|
|
2211
1425
|
constructor(params) {
|
|
2212
1426
|
this._addFeedMutex = new Mutex();
|
|
2213
1427
|
this.onCredentialProcessed = new Callback2();
|
|
2214
|
-
this.stateUpdate = new
|
|
1428
|
+
this.stateUpdate = new Event4();
|
|
2215
1429
|
this._isOpen = false;
|
|
2216
|
-
|
|
2217
|
-
F:
|
|
2218
|
-
L:
|
|
1430
|
+
invariant6(params.spaceKey && params.feedProvider, void 0, {
|
|
1431
|
+
F: __dxlog_file8,
|
|
1432
|
+
L: 72,
|
|
2219
1433
|
S: this,
|
|
2220
1434
|
A: [
|
|
2221
1435
|
"params.spaceKey && params.feedProvider",
|
|
@@ -2234,17 +1448,6 @@ var Space = class {
|
|
|
2234
1448
|
});
|
|
2235
1449
|
this._controlPipeline.onFeedAdmitted.set(async (info) => {
|
|
2236
1450
|
const sparse = info.assertion.designation === AdmittedFeed2.Designation.DATA;
|
|
2237
|
-
if (info.assertion.designation === AdmittedFeed2.Designation.DATA) {
|
|
2238
|
-
queueMicrotask(async () => {
|
|
2239
|
-
if (this._dataPipeline.pipeline) {
|
|
2240
|
-
if (!this._dataPipeline.pipeline.hasFeed(info.key)) {
|
|
2241
|
-
return this._dataPipeline.pipeline.addFeed(await this._feedProvider(info.key, {
|
|
2242
|
-
sparse
|
|
2243
|
-
}));
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
});
|
|
2247
|
-
}
|
|
2248
1451
|
if (!info.key.equals(params.genesisFeed.key)) {
|
|
2249
1452
|
queueMicrotask(async () => {
|
|
2250
1453
|
this.protocol.addFeed(await params.feedProvider(info.key, {
|
|
@@ -2255,11 +1458,11 @@ var Space = class {
|
|
|
2255
1458
|
});
|
|
2256
1459
|
this._controlPipeline.onCredentialProcessed.set(async (credential) => {
|
|
2257
1460
|
await this.onCredentialProcessed.callIfSet(credential);
|
|
2258
|
-
|
|
1461
|
+
log7("onCredentialProcessed", {
|
|
2259
1462
|
credential
|
|
2260
1463
|
}, {
|
|
2261
|
-
F:
|
|
2262
|
-
L:
|
|
1464
|
+
F: __dxlog_file8,
|
|
1465
|
+
L: 99,
|
|
2263
1466
|
S: this,
|
|
2264
1467
|
C: (f, a) => f(...a)
|
|
2265
1468
|
});
|
|
@@ -2267,29 +1470,6 @@ var Space = class {
|
|
|
2267
1470
|
});
|
|
2268
1471
|
this.protocol = params.protocol;
|
|
2269
1472
|
this.protocol.addFeed(params.genesisFeed);
|
|
2270
|
-
this._dataPipeline = new DataPipeline({
|
|
2271
|
-
modelFactory: params.modelFactory,
|
|
2272
|
-
metadataStore: params.metadataStore,
|
|
2273
|
-
snapshotManager: params.snapshotManager,
|
|
2274
|
-
memberKey: params.memberKey,
|
|
2275
|
-
spaceKey: this._key,
|
|
2276
|
-
feedInfoProvider: (feedKey) => this._controlPipeline.spaceState.feeds.get(feedKey),
|
|
2277
|
-
snapshotId: params.snapshotId,
|
|
2278
|
-
onPipelineCreated: async (pipeline) => {
|
|
2279
|
-
if (this._dataFeed) {
|
|
2280
|
-
pipeline.setWriteFeed(this._dataFeed);
|
|
2281
|
-
}
|
|
2282
|
-
await this._addFeedMutex.executeSynchronized(async () => {
|
|
2283
|
-
for (const feed of this._controlPipeline.spaceState.feeds.values()) {
|
|
2284
|
-
if (feed.assertion.designation === AdmittedFeed2.Designation.DATA && !pipeline.hasFeed(feed.key)) {
|
|
2285
|
-
await pipeline.addFeed(await this._feedProvider(feed.key, {
|
|
2286
|
-
sparse: true
|
|
2287
|
-
}));
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
});
|
|
2291
|
-
}
|
|
2292
|
-
});
|
|
2293
1473
|
}
|
|
2294
1474
|
get key() {
|
|
2295
1475
|
return this._key;
|
|
@@ -2315,16 +1495,13 @@ var Space = class {
|
|
|
2315
1495
|
get controlPipeline() {
|
|
2316
1496
|
return this._controlPipeline.pipeline;
|
|
2317
1497
|
}
|
|
2318
|
-
get dataPipeline() {
|
|
2319
|
-
return this._dataPipeline;
|
|
2320
|
-
}
|
|
2321
1498
|
get snapshotManager() {
|
|
2322
1499
|
return this._snapshotManager;
|
|
2323
1500
|
}
|
|
2324
1501
|
async setControlFeed(feed) {
|
|
2325
|
-
|
|
2326
|
-
F:
|
|
2327
|
-
L:
|
|
1502
|
+
invariant6(!this._controlFeed, "Control feed already set.", {
|
|
1503
|
+
F: __dxlog_file8,
|
|
1504
|
+
L: 146,
|
|
2328
1505
|
S: this,
|
|
2329
1506
|
A: [
|
|
2330
1507
|
"!this._controlFeed",
|
|
@@ -2336,9 +1513,9 @@ var Space = class {
|
|
|
2336
1513
|
return this;
|
|
2337
1514
|
}
|
|
2338
1515
|
async setDataFeed(feed) {
|
|
2339
|
-
|
|
2340
|
-
F:
|
|
2341
|
-
L:
|
|
1516
|
+
invariant6(!this._dataFeed, "Data feed already set.", {
|
|
1517
|
+
F: __dxlog_file8,
|
|
1518
|
+
L: 153,
|
|
2342
1519
|
S: this,
|
|
2343
1520
|
A: [
|
|
2344
1521
|
"!this._dataFeed",
|
|
@@ -2346,8 +1523,6 @@ var Space = class {
|
|
|
2346
1523
|
]
|
|
2347
1524
|
});
|
|
2348
1525
|
this._dataFeed = feed;
|
|
2349
|
-
await this._dataPipeline.pipeline?.addFeed(feed);
|
|
2350
|
-
this._dataPipeline.pipeline?.setWriteFeed(feed);
|
|
2351
1526
|
return this;
|
|
2352
1527
|
}
|
|
2353
1528
|
/**
|
|
@@ -2363,9 +1538,9 @@ var Space = class {
|
|
|
2363
1538
|
// return this._dataPipeline?.getFeeds();
|
|
2364
1539
|
// }
|
|
2365
1540
|
async open(ctx) {
|
|
2366
|
-
|
|
2367
|
-
F:
|
|
2368
|
-
L:
|
|
1541
|
+
log7("opening...", void 0, {
|
|
1542
|
+
F: __dxlog_file8,
|
|
1543
|
+
L: 174,
|
|
2369
1544
|
S: this,
|
|
2370
1545
|
C: (f, a) => f(...a)
|
|
2371
1546
|
});
|
|
@@ -2374,97 +1549,70 @@ var Space = class {
|
|
|
2374
1549
|
}
|
|
2375
1550
|
await this._controlPipeline.start();
|
|
2376
1551
|
await this.protocol.start();
|
|
2377
|
-
await this._controlPipeline.spaceState.addCredentialProcessor(this._dataPipeline);
|
|
2378
1552
|
this._isOpen = true;
|
|
2379
|
-
|
|
2380
|
-
F:
|
|
2381
|
-
L:
|
|
1553
|
+
log7("opened", void 0, {
|
|
1554
|
+
F: __dxlog_file8,
|
|
1555
|
+
L: 184,
|
|
2382
1556
|
S: this,
|
|
2383
1557
|
C: (f, a) => f(...a)
|
|
2384
1558
|
});
|
|
2385
1559
|
}
|
|
2386
1560
|
async close() {
|
|
2387
|
-
|
|
1561
|
+
log7("closing...", {
|
|
2388
1562
|
key: this._key
|
|
2389
1563
|
}, {
|
|
2390
|
-
F:
|
|
2391
|
-
L:
|
|
1564
|
+
F: __dxlog_file8,
|
|
1565
|
+
L: 189,
|
|
2392
1566
|
S: this,
|
|
2393
1567
|
C: (f, a) => f(...a)
|
|
2394
1568
|
});
|
|
2395
1569
|
if (!this._isOpen) {
|
|
2396
1570
|
return;
|
|
2397
1571
|
}
|
|
2398
|
-
await this._controlPipeline.spaceState.removeCredentialProcessor(this._dataPipeline);
|
|
2399
|
-
await this._dataPipeline.close();
|
|
2400
1572
|
await this.protocol.stop();
|
|
2401
1573
|
await this._controlPipeline.stop();
|
|
2402
1574
|
this._isOpen = false;
|
|
2403
|
-
|
|
2404
|
-
F:
|
|
2405
|
-
L:
|
|
1575
|
+
log7("closed", void 0, {
|
|
1576
|
+
F: __dxlog_file8,
|
|
1577
|
+
L: 199,
|
|
2406
1578
|
S: this,
|
|
2407
1579
|
C: (f, a) => f(...a)
|
|
2408
1580
|
});
|
|
2409
1581
|
}
|
|
2410
|
-
async initializeDataPipeline() {
|
|
2411
|
-
log10("initializeDataPipeline", void 0, {
|
|
2412
|
-
F: __dxlog_file11,
|
|
2413
|
-
L: 255,
|
|
2414
|
-
S: this,
|
|
2415
|
-
C: (f, a) => f(...a)
|
|
2416
|
-
});
|
|
2417
|
-
invariant9(this._isOpen, "Space must be open to initialize data pipeline.", {
|
|
2418
|
-
F: __dxlog_file11,
|
|
2419
|
-
L: 256,
|
|
2420
|
-
S: this,
|
|
2421
|
-
A: [
|
|
2422
|
-
"this._isOpen",
|
|
2423
|
-
"'Space must be open to initialize data pipeline.'"
|
|
2424
|
-
]
|
|
2425
|
-
});
|
|
2426
|
-
await this._dataPipeline.open();
|
|
2427
|
-
}
|
|
2428
1582
|
};
|
|
2429
|
-
|
|
2430
|
-
|
|
1583
|
+
_ts_decorate5([
|
|
1584
|
+
trace2.info()
|
|
2431
1585
|
], Space.prototype, "protocol", void 0);
|
|
2432
|
-
|
|
2433
|
-
|
|
1586
|
+
_ts_decorate5([
|
|
1587
|
+
trace2.info()
|
|
2434
1588
|
], Space.prototype, "_controlPipeline", void 0);
|
|
2435
|
-
|
|
2436
|
-
trace3.info()
|
|
2437
|
-
], Space.prototype, "_dataPipeline", void 0);
|
|
2438
|
-
_ts_decorate6([
|
|
1589
|
+
_ts_decorate5([
|
|
2439
1590
|
logInfo,
|
|
2440
|
-
|
|
1591
|
+
trace2.info()
|
|
2441
1592
|
], Space.prototype, "key", null);
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
1593
|
+
_ts_decorate5([
|
|
1594
|
+
synchronized3,
|
|
1595
|
+
trace2.span()
|
|
2445
1596
|
], Space.prototype, "open", null);
|
|
2446
|
-
|
|
2447
|
-
|
|
1597
|
+
_ts_decorate5([
|
|
1598
|
+
synchronized3
|
|
2448
1599
|
], Space.prototype, "close", null);
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
Space = _ts_decorate6([
|
|
2453
|
-
trackLeaks3("open", "close"),
|
|
2454
|
-
trace3.resource()
|
|
1600
|
+
Space = _ts_decorate5([
|
|
1601
|
+
trackLeaks2("open", "close"),
|
|
1602
|
+
trace2.resource()
|
|
2455
1603
|
], Space);
|
|
2456
1604
|
|
|
2457
1605
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
2458
1606
|
import { discoveryKey, subtleCrypto as subtleCrypto2 } from "@dxos/crypto";
|
|
2459
|
-
import { PublicKey as
|
|
2460
|
-
import { log as
|
|
1607
|
+
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1608
|
+
import { log as log8, logInfo as logInfo2 } from "@dxos/log";
|
|
2461
1609
|
import { MMSTTopology } from "@dxos/network-manager";
|
|
2462
1610
|
import { Teleport } from "@dxos/teleport";
|
|
2463
1611
|
import { BlobSync } from "@dxos/teleport-extension-object-sync";
|
|
2464
1612
|
import { ReplicatorExtension } from "@dxos/teleport-extension-replicator";
|
|
2465
|
-
import { trace as
|
|
2466
|
-
import { ComplexMap as
|
|
2467
|
-
function
|
|
1613
|
+
import { trace as trace3 } from "@dxos/tracing";
|
|
1614
|
+
import { ComplexMap as ComplexMap3 } from "@dxos/util";
|
|
1615
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
2468
1616
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2469
1617
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2470
1618
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2474,13 +1622,13 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
2474
1622
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2475
1623
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2476
1624
|
}
|
|
2477
|
-
var
|
|
1625
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
|
|
2478
1626
|
var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
|
|
2479
1627
|
var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
2480
1628
|
var SpaceProtocol = class {
|
|
2481
1629
|
constructor({ topic, swarmIdentity, networkManager, onSessionAuth, onAuthFailure, blobStore }) {
|
|
2482
1630
|
this._feeds = /* @__PURE__ */ new Set();
|
|
2483
|
-
this._sessions = new
|
|
1631
|
+
this._sessions = new ComplexMap3(PublicKey5.hash);
|
|
2484
1632
|
this._spaceKey = topic;
|
|
2485
1633
|
this._networkManager = networkManager;
|
|
2486
1634
|
this._swarmIdentity = swarmIdentity;
|
|
@@ -2489,7 +1637,7 @@ var SpaceProtocol = class {
|
|
|
2489
1637
|
this.blobSync = new BlobSync({
|
|
2490
1638
|
blobStore
|
|
2491
1639
|
});
|
|
2492
|
-
this._topic = subtleCrypto2.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(
|
|
1640
|
+
this._topic = subtleCrypto2.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(PublicKey5.from);
|
|
2493
1641
|
}
|
|
2494
1642
|
get sessions() {
|
|
2495
1643
|
return this._sessions;
|
|
@@ -2502,10 +1650,10 @@ var SpaceProtocol = class {
|
|
|
2502
1650
|
}
|
|
2503
1651
|
// TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
|
|
2504
1652
|
addFeed(feed) {
|
|
2505
|
-
|
|
1653
|
+
log8("addFeed", {
|
|
2506
1654
|
key: feed.key
|
|
2507
1655
|
}, {
|
|
2508
|
-
F:
|
|
1656
|
+
F: __dxlog_file9,
|
|
2509
1657
|
L: 103,
|
|
2510
1658
|
S: this,
|
|
2511
1659
|
C: (f, a) => f(...a)
|
|
@@ -2527,8 +1675,8 @@ var SpaceProtocol = class {
|
|
|
2527
1675
|
sampleSize: 20
|
|
2528
1676
|
};
|
|
2529
1677
|
await this.blobSync.open();
|
|
2530
|
-
|
|
2531
|
-
F:
|
|
1678
|
+
log8("starting...", void 0, {
|
|
1679
|
+
F: __dxlog_file9,
|
|
2532
1680
|
L: 129,
|
|
2533
1681
|
S: this,
|
|
2534
1682
|
C: (f, a) => f(...a)
|
|
@@ -2541,8 +1689,8 @@ var SpaceProtocol = class {
|
|
|
2541
1689
|
topology: new MMSTTopology(topologyConfig),
|
|
2542
1690
|
label: `swarm ${topic.truncate()} for space ${this._spaceKey.truncate()}`
|
|
2543
1691
|
});
|
|
2544
|
-
|
|
2545
|
-
F:
|
|
1692
|
+
log8("started", void 0, {
|
|
1693
|
+
F: __dxlog_file9,
|
|
2546
1694
|
L: 139,
|
|
2547
1695
|
S: this,
|
|
2548
1696
|
C: (f, a) => f(...a)
|
|
@@ -2551,15 +1699,15 @@ var SpaceProtocol = class {
|
|
|
2551
1699
|
async stop() {
|
|
2552
1700
|
await this.blobSync.close();
|
|
2553
1701
|
if (this._connection) {
|
|
2554
|
-
|
|
2555
|
-
F:
|
|
1702
|
+
log8("stopping...", void 0, {
|
|
1703
|
+
F: __dxlog_file9,
|
|
2556
1704
|
L: 146,
|
|
2557
1705
|
S: this,
|
|
2558
1706
|
C: (f, a) => f(...a)
|
|
2559
1707
|
});
|
|
2560
1708
|
await this._connection.close();
|
|
2561
|
-
|
|
2562
|
-
F:
|
|
1709
|
+
log8("stopped", void 0, {
|
|
1710
|
+
F: __dxlog_file9,
|
|
2563
1711
|
L: 148,
|
|
2564
1712
|
S: this,
|
|
2565
1713
|
C: (f, a) => f(...a)
|
|
@@ -2583,18 +1731,18 @@ var SpaceProtocol = class {
|
|
|
2583
1731
|
};
|
|
2584
1732
|
}
|
|
2585
1733
|
};
|
|
2586
|
-
|
|
1734
|
+
_ts_decorate6([
|
|
2587
1735
|
logInfo2,
|
|
2588
|
-
|
|
1736
|
+
trace3.info()
|
|
2589
1737
|
], SpaceProtocol.prototype, "_topic", void 0);
|
|
2590
|
-
|
|
2591
|
-
|
|
1738
|
+
_ts_decorate6([
|
|
1739
|
+
trace3.info()
|
|
2592
1740
|
], SpaceProtocol.prototype, "_spaceKey", void 0);
|
|
2593
|
-
|
|
1741
|
+
_ts_decorate6([
|
|
2594
1742
|
logInfo2
|
|
2595
1743
|
], SpaceProtocol.prototype, "_ownPeerKey", null);
|
|
2596
|
-
SpaceProtocol =
|
|
2597
|
-
|
|
1744
|
+
SpaceProtocol = _ts_decorate6([
|
|
1745
|
+
trace3.resource()
|
|
2598
1746
|
], SpaceProtocol);
|
|
2599
1747
|
var AuthStatus;
|
|
2600
1748
|
(function(AuthStatus2) {
|
|
@@ -2632,8 +1780,8 @@ var SpaceProtocolSession = class {
|
|
|
2632
1780
|
provider: this._swarmIdentity.credentialProvider,
|
|
2633
1781
|
verifier: this._swarmIdentity.credentialAuthenticator,
|
|
2634
1782
|
onAuthSuccess: () => {
|
|
2635
|
-
|
|
2636
|
-
F:
|
|
1783
|
+
log8("Peer authenticated", void 0, {
|
|
1784
|
+
F: __dxlog_file9,
|
|
2637
1785
|
L: 245,
|
|
2638
1786
|
S: this,
|
|
2639
1787
|
C: (f, a) => f(...a)
|
|
@@ -2650,8 +1798,8 @@ var SpaceProtocolSession = class {
|
|
|
2650
1798
|
this._teleport.addExtension("dxos.mesh.teleport.blobsync", this._blobSync.createExtension());
|
|
2651
1799
|
}
|
|
2652
1800
|
async close() {
|
|
2653
|
-
|
|
2654
|
-
F:
|
|
1801
|
+
log8("close", void 0, {
|
|
1802
|
+
F: __dxlog_file9,
|
|
2655
1803
|
L: 261,
|
|
2656
1804
|
S: this,
|
|
2657
1805
|
C: (f, a) => f(...a)
|
|
@@ -2662,21 +1810,21 @@ var SpaceProtocolSession = class {
|
|
|
2662
1810
|
await this._teleport.abort();
|
|
2663
1811
|
}
|
|
2664
1812
|
};
|
|
2665
|
-
|
|
1813
|
+
_ts_decorate6([
|
|
2666
1814
|
logInfo2
|
|
2667
1815
|
], SpaceProtocolSession.prototype, "_wireParams", void 0);
|
|
2668
|
-
|
|
1816
|
+
_ts_decorate6([
|
|
2669
1817
|
logInfo2
|
|
2670
1818
|
], SpaceProtocolSession.prototype, "authStatus", null);
|
|
2671
1819
|
|
|
2672
1820
|
// packages/core/echo/echo-pipeline/src/space/space-manager.ts
|
|
2673
|
-
import { synchronized as
|
|
1821
|
+
import { synchronized as synchronized4, trackLeaks as trackLeaks3 } from "@dxos/async";
|
|
2674
1822
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
2675
|
-
import { PublicKey as
|
|
2676
|
-
import { log as
|
|
2677
|
-
import { trace as
|
|
2678
|
-
import { ComplexMap as
|
|
2679
|
-
function
|
|
1823
|
+
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
1824
|
+
import { log as log9 } from "@dxos/log";
|
|
1825
|
+
import { trace as trace4 } from "@dxos/protocols";
|
|
1826
|
+
import { ComplexMap as ComplexMap4 } from "@dxos/util";
|
|
1827
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
2680
1828
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2681
1829
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2682
1830
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2686,14 +1834,13 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
2686
1834
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2687
1835
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2688
1836
|
}
|
|
2689
|
-
var
|
|
1837
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
2690
1838
|
var SpaceManager = class {
|
|
2691
|
-
constructor({ feedStore, networkManager,
|
|
2692
|
-
this._spaces = new
|
|
2693
|
-
this._instanceId =
|
|
1839
|
+
constructor({ feedStore, networkManager, metadataStore, snapshotStore, blobStore }) {
|
|
1840
|
+
this._spaces = new ComplexMap4(PublicKey6.hash);
|
|
1841
|
+
this._instanceId = PublicKey6.random().toHex();
|
|
2694
1842
|
this._feedStore = feedStore;
|
|
2695
1843
|
this._networkManager = networkManager;
|
|
2696
|
-
this._modelFactory = modelFactory;
|
|
2697
1844
|
this._metadataStore = metadataStore;
|
|
2698
1845
|
this._snapshotStore = snapshotStore;
|
|
2699
1846
|
this._blobStore = blobStore;
|
|
@@ -2710,19 +1857,19 @@ var SpaceManager = class {
|
|
|
2710
1857
|
].map((space) => space.close()));
|
|
2711
1858
|
}
|
|
2712
1859
|
async constructSpace({ metadata, swarmIdentity, onAuthorizedConnection, onAuthFailure, memberKey }) {
|
|
2713
|
-
|
|
1860
|
+
log9.trace("dxos.echo.space-manager.construct-space", trace4.begin({
|
|
2714
1861
|
id: this._instanceId
|
|
2715
1862
|
}), {
|
|
2716
|
-
F:
|
|
2717
|
-
L:
|
|
1863
|
+
F: __dxlog_file10,
|
|
1864
|
+
L: 89,
|
|
2718
1865
|
S: this,
|
|
2719
1866
|
C: (f, a) => f(...a)
|
|
2720
1867
|
});
|
|
2721
|
-
|
|
1868
|
+
log9("constructing space...", {
|
|
2722
1869
|
spaceKey: metadata.genesisFeedKey
|
|
2723
1870
|
}, {
|
|
2724
|
-
F:
|
|
2725
|
-
L:
|
|
1871
|
+
F: __dxlog_file10,
|
|
1872
|
+
L: 90,
|
|
2726
1873
|
S: this,
|
|
2727
1874
|
C: (f, a) => f(...a)
|
|
2728
1875
|
});
|
|
@@ -2742,42 +1889,38 @@ var SpaceManager = class {
|
|
|
2742
1889
|
protocol,
|
|
2743
1890
|
genesisFeed,
|
|
2744
1891
|
feedProvider: (feedKey, opts) => this._feedStore.openFeed(feedKey, opts),
|
|
2745
|
-
modelFactory: this._modelFactory,
|
|
2746
1892
|
metadataStore: this._metadataStore,
|
|
2747
1893
|
snapshotManager,
|
|
2748
1894
|
memberKey
|
|
2749
1895
|
});
|
|
2750
1896
|
this._spaces.set(space.key, space);
|
|
2751
|
-
|
|
1897
|
+
log9.trace("dxos.echo.space-manager.construct-space", trace4.end({
|
|
2752
1898
|
id: this._instanceId
|
|
2753
1899
|
}), {
|
|
2754
|
-
F:
|
|
2755
|
-
L:
|
|
1900
|
+
F: __dxlog_file10,
|
|
1901
|
+
L: 117,
|
|
2756
1902
|
S: this,
|
|
2757
1903
|
C: (f, a) => f(...a)
|
|
2758
1904
|
});
|
|
2759
1905
|
return space;
|
|
2760
1906
|
}
|
|
2761
1907
|
};
|
|
2762
|
-
|
|
2763
|
-
|
|
1908
|
+
_ts_decorate7([
|
|
1909
|
+
synchronized4
|
|
2764
1910
|
], SpaceManager.prototype, "open", null);
|
|
2765
|
-
|
|
2766
|
-
|
|
1911
|
+
_ts_decorate7([
|
|
1912
|
+
synchronized4
|
|
2767
1913
|
], SpaceManager.prototype, "close", null);
|
|
2768
|
-
SpaceManager =
|
|
2769
|
-
|
|
1914
|
+
SpaceManager = _ts_decorate7([
|
|
1915
|
+
trackLeaks3("open", "close")
|
|
2770
1916
|
], SpaceManager);
|
|
2771
1917
|
|
|
2772
1918
|
export {
|
|
2773
1919
|
codec,
|
|
2774
1920
|
valueEncoding,
|
|
2775
1921
|
createMappedFeedWriter,
|
|
2776
|
-
DataServiceHost,
|
|
2777
|
-
DatabaseHost,
|
|
2778
1922
|
SnapshotManager,
|
|
2779
1923
|
SnapshotStore,
|
|
2780
|
-
DataServiceSubscriptions,
|
|
2781
1924
|
DataServiceImpl,
|
|
2782
1925
|
MetadataStore,
|
|
2783
1926
|
mapTimeframeToFeedIndexes,
|
|
@@ -2786,7 +1929,6 @@ export {
|
|
|
2786
1929
|
TimeframeClock,
|
|
2787
1930
|
Pipeline,
|
|
2788
1931
|
AuthExtension,
|
|
2789
|
-
DataPipeline,
|
|
2790
1932
|
Space,
|
|
2791
1933
|
MOCK_AUTH_PROVIDER,
|
|
2792
1934
|
MOCK_AUTH_VERIFIER,
|
|
@@ -2795,4 +1937,4 @@ export {
|
|
|
2795
1937
|
SpaceProtocolSession,
|
|
2796
1938
|
SpaceManager
|
|
2797
1939
|
};
|
|
2798
|
-
//# sourceMappingURL=chunk-
|
|
1940
|
+
//# sourceMappingURL=chunk-RTEEJ723.mjs.map
|