@dxos/echo-pipeline 0.8.4-main.b97322e → 0.8.4-main.bcb3aa67d6
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-GBFX5J5B.mjs → neutral/chunk-DN4YBAWV.mjs} +287 -206
- package/dist/lib/neutral/chunk-DN4YBAWV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-IMPFMBJK.mjs +241 -0
- package/dist/lib/neutral/chunk-IMPFMBJK.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/filter/index.mjs +3 -2
- package/dist/lib/{browser → neutral}/index.mjs +3276 -1143
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/{browser → neutral}/testing/index.mjs +64 -215
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/automerge/automerge-host.d.ts +56 -45
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts.map +1 -1
- package/dist/types/src/automerge/collection-synchronizer.d.ts +6 -4
- package/dist/types/src/automerge/collection-synchronizer.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +23 -10
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-replicator.d.ts +37 -14
- package/dist/types/src/automerge/echo-replicator.d.ts.map +1 -1
- package/dist/types/src/automerge/heads-store.d.ts +9 -2
- package/dist/types/src/automerge/heads-store.d.ts.map +1 -1
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts +5 -5
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts +9 -8
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts +6 -5
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts.map +1 -1
- package/dist/types/src/common/codec.d.ts +1 -1
- package/dist/types/src/common/codec.d.ts.map +1 -1
- package/dist/types/src/db-host/automerge-data-source.d.ts +35 -0
- package/dist/types/src/db-host/automerge-data-source.d.ts.map +1 -0
- package/dist/types/src/db-host/automerge-data-source.test.d.ts +2 -0
- package/dist/types/src/db-host/automerge-data-source.test.d.ts.map +1 -0
- package/dist/types/src/db-host/data-service.d.ts +5 -4
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/database-root.d.ts.map +1 -1
- package/dist/types/src/db-host/documents-synchronizer.d.ts +8 -7
- package/dist/types/src/db-host/documents-synchronizer.d.ts.map +1 -1
- package/dist/types/src/db-host/echo-host.d.ts +58 -28
- package/dist/types/src/db-host/echo-host.d.ts.map +1 -1
- package/dist/types/src/db-host/index.d.ts +1 -0
- package/dist/types/src/db-host/index.d.ts.map +1 -1
- package/dist/types/src/db-host/local-queue-service.d.ts +18 -0
- package/dist/types/src/db-host/local-queue-service.d.ts.map +1 -0
- package/dist/types/src/db-host/query-service.d.ts +14 -9
- package/dist/types/src/db-host/query-service.d.ts.map +1 -1
- package/dist/types/src/db-host/queue-data-source.d.ts +38 -0
- package/dist/types/src/db-host/queue-data-source.d.ts.map +1 -0
- package/dist/types/src/db-host/queue-service.test.d.ts +2 -0
- package/dist/types/src/db-host/queue-service.test.d.ts.map +1 -0
- package/dist/types/src/db-host/space-state-manager.d.ts +2 -1
- package/dist/types/src/db-host/space-state-manager.d.ts.map +1 -1
- package/dist/types/src/db-host/stub.d.ts +11 -0
- package/dist/types/src/db-host/stub.d.ts.map +1 -0
- package/dist/types/src/edge/echo-edge-replicator.d.ts +10 -7
- package/dist/types/src/edge/echo-edge-replicator.d.ts.map +1 -1
- package/dist/types/src/filter/filter-match.d.ts +4 -1
- package/dist/types/src/filter/filter-match.d.ts.map +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/pipeline/pipeline.d.ts +3 -3
- package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/types/src/query/errors.d.ts +18 -18
- package/dist/types/src/query/errors.d.ts.map +1 -1
- package/dist/types/src/query/plan.d.ts +66 -8
- package/dist/types/src/query/plan.d.ts.map +1 -1
- package/dist/types/src/query/query-executor.d.ts +58 -10
- package/dist/types/src/query/query-executor.d.ts.map +1 -1
- package/dist/types/src/query/query-planner.d.ts +12 -1
- package/dist/types/src/query/query-planner.d.ts.map +1 -1
- package/dist/types/src/space/admission-discovery-extension.d.ts.map +1 -1
- package/dist/types/src/space/auth.d.ts +3 -3
- package/dist/types/src/space/auth.d.ts.map +1 -1
- package/dist/types/src/space/control-pipeline.d.ts +5 -4
- package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +8 -7
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +9 -8
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +6 -6
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts +2 -2
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/dist/types/src/testing/test-network-adapter.d.ts +1 -1
- package/dist/types/src/testing/test-network-adapter.d.ts.map +1 -1
- package/dist/types/src/testing/test-replicator.d.ts +14 -13
- package/dist/types/src/testing/test-replicator.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -47
- package/src/automerge/automerge-host.test.ts +58 -27
- package/src/automerge/automerge-host.ts +411 -135
- package/src/automerge/automerge-repo.test.ts +216 -47
- package/src/automerge/collection-synchronizer.test.ts +22 -15
- package/src/automerge/collection-synchronizer.ts +57 -22
- package/src/automerge/echo-data-monitor.ts +1 -1
- package/src/automerge/echo-network-adapter.test.ts +5 -4
- package/src/automerge/echo-network-adapter.ts +73 -29
- package/src/automerge/echo-replicator.ts +39 -14
- package/src/automerge/heads-store.ts +42 -3
- package/src/automerge/leveldb-storage-adapter.ts +11 -11
- package/src/automerge/mesh-echo-replicator-connection.ts +12 -8
- package/src/automerge/mesh-echo-replicator.ts +16 -11
- package/src/automerge/storage-adapter.test.ts +1 -1
- package/src/common/space-id.ts +1 -1
- package/src/db-host/automerge-data-source.test.ts +300 -0
- package/src/db-host/automerge-data-source.ts +187 -0
- package/src/db-host/data-service.ts +23 -23
- package/src/db-host/database-root.ts +2 -2
- package/src/db-host/documents-synchronizer.test.ts +73 -13
- package/src/db-host/documents-synchronizer.ts +58 -45
- package/src/db-host/echo-host.ts +242 -93
- package/src/db-host/index.ts +1 -0
- package/src/db-host/local-queue-service.ts +126 -0
- package/src/db-host/query-service.ts +31 -104
- package/src/db-host/queue-data-source.ts +159 -0
- package/src/db-host/queue-service.test.ts +145 -0
- package/src/db-host/space-state-manager.ts +7 -3
- package/src/db-host/stub.ts +33 -0
- package/src/edge/echo-edge-replicator.test.ts +13 -10
- package/src/edge/echo-edge-replicator.ts +105 -38
- package/src/filter/filter-match.test.ts +68 -32
- package/src/filter/filter-match.ts +176 -20
- package/src/metadata/metadata-store.ts +11 -8
- package/src/pipeline/pipeline-stress.test.ts +4 -2
- package/src/pipeline/pipeline.test.ts +3 -2
- package/src/pipeline/pipeline.ts +10 -7
- package/src/query/errors.ts +3 -1
- package/src/query/plan.ts +82 -8
- package/src/query/query-executor.ts +951 -163
- package/src/query/query-planner.test.ts +993 -81
- package/src/query/query-planner.ts +424 -27
- package/src/space/admission-discovery-extension.ts +3 -3
- package/src/space/auth.ts +6 -6
- package/src/space/control-pipeline.test.ts +6 -4
- package/src/space/control-pipeline.ts +13 -11
- package/src/space/space-manager.browser.test.ts +1 -1
- package/src/space/space-manager.ts +17 -12
- package/src/space/space-protocol.browser.test.ts +15 -14
- package/src/space/space-protocol.test.ts +16 -14
- package/src/space/space-protocol.ts +22 -18
- package/src/space/space.test.ts +3 -3
- package/src/space/space.ts +11 -10
- package/src/testing/index.ts +0 -2
- package/src/testing/test-agent-builder.ts +4 -3
- package/src/testing/test-network-adapter.ts +16 -3
- package/src/testing/test-replicator.ts +23 -18
- package/src/util.ts +7 -3
- package/dist/lib/browser/chunk-ANZAS5CC.mjs +0 -126
- package/dist/lib/browser/chunk-ANZAS5CC.mjs.map +0 -7
- package/dist/lib/browser/chunk-CGS2ULMK.mjs +0 -11
- package/dist/lib/browser/chunk-CGS2ULMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-GBFX5J5B.mjs.map +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2SAZ7CCF.mjs +0 -126
- package/dist/lib/node-esm/chunk-2SAZ7CCF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FQFKWA3X.mjs +0 -2067
- package/dist/lib/node-esm/chunk-FQFKWA3X.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/filter/index.mjs +0 -11
- package/dist/lib/node-esm/filter/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -4812
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -742
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/db-host/documents-iterator.d.ts +0 -7
- package/dist/types/src/db-host/documents-iterator.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -18
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-schema.d.ts +0 -37
- package/dist/types/src/testing/test-schema.d.ts.map +0 -1
- package/src/db-host/documents-iterator.ts +0 -74
- package/src/testing/test-data.ts +0 -127
- package/src/testing/test-schema.ts +0 -53
- /package/dist/lib/{browser → neutral}/filter/index.mjs.map +0 -0
|
@@ -79,15 +79,19 @@ var emptyLargeSpaceMetadata = () => ({});
|
|
|
79
79
|
var EchoMetadata = schema2.getCodecForType("dxos.echo.metadata.EchoMetadata");
|
|
80
80
|
var LargeSpaceMetadata = schema2.getCodecForType("dxos.echo.metadata.LargeSpaceMetadata");
|
|
81
81
|
var MetadataStore = class {
|
|
82
|
+
_metadata = emptyEchoMetadata();
|
|
83
|
+
_spaceLargeMetadata = new ComplexMap2(PublicKey2.hash);
|
|
84
|
+
_metadataFile = void 0;
|
|
85
|
+
update = new Event();
|
|
86
|
+
_invitationCleanupCtx = new Context(void 0, {
|
|
87
|
+
F: __dxlog_file2,
|
|
88
|
+
L: 55
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
_directory;
|
|
82
94
|
constructor(directory) {
|
|
83
|
-
this._metadata = emptyEchoMetadata();
|
|
84
|
-
this._spaceLargeMetadata = new ComplexMap2(PublicKey2.hash);
|
|
85
|
-
this._metadataFile = void 0;
|
|
86
|
-
this.update = new Event();
|
|
87
|
-
this._invitationCleanupCtx = new Context(void 0, {
|
|
88
|
-
F: __dxlog_file2,
|
|
89
|
-
L: 55
|
|
90
|
-
});
|
|
91
95
|
this._directory = directory;
|
|
92
96
|
}
|
|
93
97
|
get metadata() {
|
|
@@ -122,15 +126,20 @@ var MetadataStore = class {
|
|
|
122
126
|
C: (f, a) => f(...a)
|
|
123
127
|
});
|
|
124
128
|
if (fileLength < dataSize + 8) {
|
|
125
|
-
throw new DataCorruptionError(
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
throw new DataCorruptionError({
|
|
130
|
+
message: "Metadata size is smaller than expected.",
|
|
131
|
+
context: {
|
|
132
|
+
fileLength,
|
|
133
|
+
dataSize
|
|
134
|
+
}
|
|
128
135
|
});
|
|
129
136
|
}
|
|
130
137
|
const data = await file.read(8, dataSize);
|
|
131
138
|
const calculatedChecksum = CRC32.buf(data);
|
|
132
139
|
if (calculatedChecksum !== checksum) {
|
|
133
|
-
throw new DataCorruptionError(
|
|
140
|
+
throw new DataCorruptionError({
|
|
141
|
+
message: "Metadata checksum is invalid."
|
|
142
|
+
});
|
|
134
143
|
}
|
|
135
144
|
return codec2.decode(data);
|
|
136
145
|
} finally {
|
|
@@ -153,7 +162,7 @@ var MetadataStore = class {
|
|
|
153
162
|
checksum
|
|
154
163
|
}, {
|
|
155
164
|
F: __dxlog_file2,
|
|
156
|
-
L:
|
|
165
|
+
L: 129,
|
|
157
166
|
S: this,
|
|
158
167
|
C: (f, a) => f(...a)
|
|
159
168
|
});
|
|
@@ -186,7 +195,7 @@ var MetadataStore = class {
|
|
|
186
195
|
err
|
|
187
196
|
}, {
|
|
188
197
|
F: __dxlog_file2,
|
|
189
|
-
L:
|
|
198
|
+
L: 161,
|
|
190
199
|
S: this,
|
|
191
200
|
C: (f, a) => f(...a)
|
|
192
201
|
});
|
|
@@ -203,7 +212,7 @@ var MetadataStore = class {
|
|
|
203
212
|
err
|
|
204
213
|
}, {
|
|
205
214
|
F: __dxlog_file2,
|
|
206
|
-
L:
|
|
215
|
+
L: 173,
|
|
207
216
|
S: this,
|
|
208
217
|
C: (f, a) => f(...a)
|
|
209
218
|
});
|
|
@@ -240,7 +249,7 @@ var MetadataStore = class {
|
|
|
240
249
|
err
|
|
241
250
|
}, {
|
|
242
251
|
F: __dxlog_file2,
|
|
243
|
-
L:
|
|
252
|
+
L: 215,
|
|
244
253
|
S: this,
|
|
245
254
|
C: (f, a) => f(...a)
|
|
246
255
|
});
|
|
@@ -261,7 +270,7 @@ var MetadataStore = class {
|
|
|
261
270
|
const space = this.spaces.find((space2) => space2.key.equals(spaceKey));
|
|
262
271
|
invariant2(space, "Space not found", {
|
|
263
272
|
F: __dxlog_file2,
|
|
264
|
-
L:
|
|
273
|
+
L: 237,
|
|
265
274
|
S: this,
|
|
266
275
|
A: [
|
|
267
276
|
"space",
|
|
@@ -291,7 +300,7 @@ var MetadataStore = class {
|
|
|
291
300
|
async clear() {
|
|
292
301
|
log("clearing all metadata", void 0, {
|
|
293
302
|
F: __dxlog_file2,
|
|
294
|
-
L:
|
|
303
|
+
L: 265,
|
|
295
304
|
S: this,
|
|
296
305
|
C: (f, a) => f(...a)
|
|
297
306
|
});
|
|
@@ -304,7 +313,7 @@ var MetadataStore = class {
|
|
|
304
313
|
async setIdentityRecord(record) {
|
|
305
314
|
invariant2(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
|
|
306
315
|
F: __dxlog_file2,
|
|
307
|
-
L:
|
|
316
|
+
L: 275,
|
|
308
317
|
S: this,
|
|
309
318
|
A: [
|
|
310
319
|
"!this._metadata.identity",
|
|
@@ -334,7 +343,7 @@ var MetadataStore = class {
|
|
|
334
343
|
async addSpace(record) {
|
|
335
344
|
invariant2(!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key)), "Cannot overwrite existing space in metadata", {
|
|
336
345
|
F: __dxlog_file2,
|
|
337
|
-
L:
|
|
346
|
+
L: 303,
|
|
338
347
|
S: this,
|
|
339
348
|
A: [
|
|
340
349
|
"!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key))",
|
|
@@ -429,9 +438,11 @@ var startAfter = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
|
|
|
429
438
|
index: index + 1
|
|
430
439
|
}));
|
|
431
440
|
var TimeframeClock = class {
|
|
441
|
+
_timeframe;
|
|
442
|
+
update = new Event2();
|
|
443
|
+
_pendingTimeframe;
|
|
432
444
|
constructor(_timeframe = new Timeframe()) {
|
|
433
445
|
this._timeframe = _timeframe;
|
|
434
|
-
this.update = new Event2();
|
|
435
446
|
this._pendingTimeframe = _timeframe;
|
|
436
447
|
}
|
|
437
448
|
/**
|
|
@@ -498,7 +509,7 @@ _ts_decorate2([
|
|
|
498
509
|
], TimeframeClock.prototype, "waitUntilReached", null);
|
|
499
510
|
|
|
500
511
|
// src/pipeline/pipeline.ts
|
|
501
|
-
import { Event as Event3, sleepWithContext, synchronized as synchronized2
|
|
512
|
+
import { Event as Event3, Trigger, sleepWithContext, synchronized as synchronized2 } from "@dxos/async";
|
|
502
513
|
import { Context as Context2, rejectOnDispose } from "@dxos/context";
|
|
503
514
|
import { failUndefined } from "@dxos/debug";
|
|
504
515
|
import { FeedSetIterator } from "@dxos/feed-store";
|
|
@@ -547,17 +558,39 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
547
558
|
}
|
|
548
559
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
|
|
549
560
|
var PipelineState = class {
|
|
561
|
+
_feeds;
|
|
562
|
+
_timeframeClock;
|
|
563
|
+
/**
|
|
564
|
+
* @internal
|
|
565
|
+
*/
|
|
566
|
+
_ctx = new Context2(void 0, {
|
|
567
|
+
F: __dxlog_file5,
|
|
568
|
+
L: 42
|
|
569
|
+
});
|
|
570
|
+
// TODO(dmaretskyi): Remove?. Avoid accessing `_timeframeClock` before constructor initialization.
|
|
571
|
+
get timeframeUpdate() {
|
|
572
|
+
return this._timeframeClock.update;
|
|
573
|
+
}
|
|
574
|
+
stalled = new Event3();
|
|
575
|
+
/**
|
|
576
|
+
* @internal
|
|
577
|
+
*/
|
|
578
|
+
_startTimeframe = new Timeframe2();
|
|
579
|
+
/**
|
|
580
|
+
* Target timeframe we are waiting to reach.
|
|
581
|
+
*/
|
|
582
|
+
_targetTimeframe;
|
|
583
|
+
/**
|
|
584
|
+
* @internal
|
|
585
|
+
*/
|
|
586
|
+
_reachedTargetPromise;
|
|
587
|
+
/**
|
|
588
|
+
* @internal
|
|
589
|
+
*/
|
|
590
|
+
_reachedTarget = false;
|
|
550
591
|
constructor(_feeds, _timeframeClock) {
|
|
551
592
|
this._feeds = _feeds;
|
|
552
593
|
this._timeframeClock = _timeframeClock;
|
|
553
|
-
this._ctx = new Context2(void 0, {
|
|
554
|
-
F: __dxlog_file5,
|
|
555
|
-
L: 41
|
|
556
|
-
});
|
|
557
|
-
this.timeframeUpdate = this._timeframeClock.update;
|
|
558
|
-
this.stalled = new Event3();
|
|
559
|
-
this._startTimeframe = new Timeframe2();
|
|
560
|
-
this._reachedTarget = false;
|
|
561
594
|
}
|
|
562
595
|
/**
|
|
563
596
|
* Latest theoretical timeframe based on the last mutation in each feed.
|
|
@@ -603,7 +636,7 @@ var PipelineState = class {
|
|
|
603
636
|
*/
|
|
604
637
|
async waitUntilReachedTargetTimeframe({ ctx = new Context2(void 0, {
|
|
605
638
|
F: __dxlog_file5,
|
|
606
|
-
L:
|
|
639
|
+
L: 132
|
|
607
640
|
}), timeout, breakOnStall = true } = {}) {
|
|
608
641
|
log4("waitUntilReachedTargetTimeframe", {
|
|
609
642
|
timeout,
|
|
@@ -611,7 +644,7 @@ var PipelineState = class {
|
|
|
611
644
|
target: this.targetTimeframe
|
|
612
645
|
}, {
|
|
613
646
|
F: __dxlog_file5,
|
|
614
|
-
L:
|
|
647
|
+
L: 136,
|
|
615
648
|
S: this,
|
|
616
649
|
C: (f, a) => f(...a)
|
|
617
650
|
});
|
|
@@ -643,7 +676,7 @@ var PipelineState = class {
|
|
|
643
676
|
dependencies: Timeframe2.dependencies(this.targetTimeframe, this.timeframe)
|
|
644
677
|
}, {
|
|
645
678
|
F: __dxlog_file5,
|
|
646
|
-
L:
|
|
679
|
+
L: 164,
|
|
647
680
|
S: this,
|
|
648
681
|
C: (f, a) => f(...a)
|
|
649
682
|
});
|
|
@@ -655,28 +688,30 @@ var PipelineState = class {
|
|
|
655
688
|
}
|
|
656
689
|
};
|
|
657
690
|
var Pipeline = class {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
691
|
+
_timeframeClock = new TimeframeClock(new Timeframe2());
|
|
692
|
+
_feeds = new ComplexMap3(PublicKey3.hash);
|
|
693
|
+
// External state accessor.
|
|
694
|
+
_state = new PipelineState(this._feeds, this._timeframeClock);
|
|
695
|
+
// Waits for the message consumer to process the message and yield control back to the pipeline.
|
|
696
|
+
_processingTrigger = new Trigger().wake();
|
|
697
|
+
_pauseTrigger = new Trigger().wake();
|
|
698
|
+
// Pending downloads.
|
|
699
|
+
_downloads = new ComplexMap3((value) => PublicKey3.hash(value.key));
|
|
700
|
+
// Inbound feed stream.
|
|
701
|
+
_feedSetIterator;
|
|
702
|
+
// Outbound feed writer.
|
|
703
|
+
_writer;
|
|
704
|
+
_isStopping = false;
|
|
705
|
+
_isStarted = false;
|
|
706
|
+
_isBeingConsumed = false;
|
|
707
|
+
_isPaused = false;
|
|
673
708
|
get state() {
|
|
674
709
|
return this._state;
|
|
675
710
|
}
|
|
676
711
|
get writer() {
|
|
677
712
|
invariant4(this._writer, "Writer not set.", {
|
|
678
713
|
F: __dxlog_file5,
|
|
679
|
-
L:
|
|
714
|
+
L: 246,
|
|
680
715
|
S: this,
|
|
681
716
|
A: [
|
|
682
717
|
"this._writer",
|
|
@@ -705,7 +740,7 @@ var Pipeline = class {
|
|
|
705
740
|
setWriteFeed(feed) {
|
|
706
741
|
invariant4(!this._writer, "Writer already set.", {
|
|
707
742
|
F: __dxlog_file5,
|
|
708
|
-
L:
|
|
743
|
+
L: 273,
|
|
709
744
|
S: this,
|
|
710
745
|
A: [
|
|
711
746
|
"!this._writer",
|
|
@@ -714,7 +749,7 @@ var Pipeline = class {
|
|
|
714
749
|
});
|
|
715
750
|
invariant4(feed.properties.writable, "Feed must be writable.", {
|
|
716
751
|
F: __dxlog_file5,
|
|
717
|
-
L:
|
|
752
|
+
L: 274,
|
|
718
753
|
S: this,
|
|
719
754
|
A: [
|
|
720
755
|
"feed.properties.writable",
|
|
@@ -729,7 +764,7 @@ var Pipeline = class {
|
|
|
729
764
|
async start() {
|
|
730
765
|
invariant4(!this._isStarted, "Pipeline is already started.", {
|
|
731
766
|
F: __dxlog_file5,
|
|
732
|
-
L:
|
|
767
|
+
L: 287,
|
|
733
768
|
S: this,
|
|
734
769
|
A: [
|
|
735
770
|
"!this._isStarted",
|
|
@@ -738,7 +773,7 @@ var Pipeline = class {
|
|
|
738
773
|
});
|
|
739
774
|
log4("starting...", void 0, {
|
|
740
775
|
F: __dxlog_file5,
|
|
741
|
-
L:
|
|
776
|
+
L: 288,
|
|
742
777
|
S: this,
|
|
743
778
|
C: (f, a) => f(...a)
|
|
744
779
|
});
|
|
@@ -747,7 +782,7 @@ var Pipeline = class {
|
|
|
747
782
|
this._isStarted = true;
|
|
748
783
|
log4("started", void 0, {
|
|
749
784
|
F: __dxlog_file5,
|
|
750
|
-
L:
|
|
785
|
+
L: 292,
|
|
751
786
|
S: this,
|
|
752
787
|
C: (f, a) => f(...a)
|
|
753
788
|
});
|
|
@@ -760,7 +795,7 @@ var Pipeline = class {
|
|
|
760
795
|
async stop() {
|
|
761
796
|
log4("stopping...", void 0, {
|
|
762
797
|
F: __dxlog_file5,
|
|
763
|
-
L:
|
|
798
|
+
L: 303,
|
|
764
799
|
S: this,
|
|
765
800
|
C: (f, a) => f(...a)
|
|
766
801
|
});
|
|
@@ -774,14 +809,14 @@ var Pipeline = class {
|
|
|
774
809
|
await this._state._ctx.dispose();
|
|
775
810
|
this._state._ctx = new Context2(void 0, {
|
|
776
811
|
F: __dxlog_file5,
|
|
777
|
-
L:
|
|
812
|
+
L: 312
|
|
778
813
|
});
|
|
779
814
|
this._state._reachedTargetPromise = void 0;
|
|
780
815
|
this._state._reachedTarget = false;
|
|
781
816
|
this._isStarted = false;
|
|
782
817
|
log4("stopped", void 0, {
|
|
783
818
|
F: __dxlog_file5,
|
|
784
|
-
L:
|
|
819
|
+
L: 316,
|
|
785
820
|
S: this,
|
|
786
821
|
C: (f, a) => f(...a)
|
|
787
822
|
});
|
|
@@ -793,7 +828,7 @@ var Pipeline = class {
|
|
|
793
828
|
async setCursor(timeframe) {
|
|
794
829
|
invariant4(!this._isStarted || this._isPaused, "Invalid state.", {
|
|
795
830
|
F: __dxlog_file5,
|
|
796
|
-
L:
|
|
831
|
+
L: 325,
|
|
797
832
|
S: this,
|
|
798
833
|
A: [
|
|
799
834
|
"!this._isStarted || this._isPaused",
|
|
@@ -822,7 +857,7 @@ var Pipeline = class {
|
|
|
822
857
|
async unpause() {
|
|
823
858
|
invariant4(this._isPaused, "Pipeline is not paused.", {
|
|
824
859
|
F: __dxlog_file5,
|
|
825
|
-
L:
|
|
860
|
+
L: 354,
|
|
826
861
|
S: this,
|
|
827
862
|
A: [
|
|
828
863
|
"this._isPaused",
|
|
@@ -842,7 +877,7 @@ var Pipeline = class {
|
|
|
842
877
|
async *consume() {
|
|
843
878
|
invariant4(!this._isBeingConsumed, "Pipeline is already being consumed.", {
|
|
844
879
|
F: __dxlog_file5,
|
|
845
|
-
L:
|
|
880
|
+
L: 369,
|
|
846
881
|
S: this,
|
|
847
882
|
A: [
|
|
848
883
|
"!this._isBeingConsumed",
|
|
@@ -852,7 +887,7 @@ var Pipeline = class {
|
|
|
852
887
|
this._isBeingConsumed = true;
|
|
853
888
|
invariant4(this._feedSetIterator, "Iterator not initialized.", {
|
|
854
889
|
F: __dxlog_file5,
|
|
855
|
-
L:
|
|
890
|
+
L: 372,
|
|
856
891
|
S: this,
|
|
857
892
|
A: [
|
|
858
893
|
"this._feedSetIterator",
|
|
@@ -866,7 +901,7 @@ var Pipeline = class {
|
|
|
866
901
|
if (lastFeedSetIterator !== this._feedSetIterator) {
|
|
867
902
|
invariant4(this._feedSetIterator, "Iterator not initialized.", {
|
|
868
903
|
F: __dxlog_file5,
|
|
869
|
-
L:
|
|
904
|
+
L: 381,
|
|
870
905
|
S: this,
|
|
871
906
|
A: [
|
|
872
907
|
"this._feedSetIterator",
|
|
@@ -901,7 +936,7 @@ var Pipeline = class {
|
|
|
901
936
|
length: feed.length
|
|
902
937
|
}, {
|
|
903
938
|
F: __dxlog_file5,
|
|
904
|
-
L:
|
|
939
|
+
L: 410,
|
|
905
940
|
S: this,
|
|
906
941
|
C: (f, a) => f(...a)
|
|
907
942
|
});
|
|
@@ -915,7 +950,7 @@ var Pipeline = class {
|
|
|
915
950
|
data
|
|
916
951
|
}, {
|
|
917
952
|
F: __dxlog_file5,
|
|
918
|
-
L:
|
|
953
|
+
L: 415,
|
|
919
954
|
S: this,
|
|
920
955
|
C: (f, a) => f(...a)
|
|
921
956
|
});
|
|
@@ -934,7 +969,7 @@ var Pipeline = class {
|
|
|
934
969
|
targetTimeframe: this._state.targetTimeframe
|
|
935
970
|
}, {
|
|
936
971
|
F: __dxlog_file5,
|
|
937
|
-
L:
|
|
972
|
+
L: 429,
|
|
938
973
|
S: this,
|
|
939
974
|
C: (f, a) => f(...a)
|
|
940
975
|
});
|
|
@@ -971,7 +1006,21 @@ import { schema as schema3 } from "@dxos/protocols/proto";
|
|
|
971
1006
|
import { RpcExtension } from "@dxos/teleport";
|
|
972
1007
|
var __dxlog_file6 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
|
|
973
1008
|
var AuthExtension = class extends RpcExtension {
|
|
974
|
-
|
|
1009
|
+
_authProps;
|
|
1010
|
+
_ctx = new Context3({
|
|
1011
|
+
onError: (err) => {
|
|
1012
|
+
log5.catch(err, void 0, {
|
|
1013
|
+
F: __dxlog_file6,
|
|
1014
|
+
L: 28,
|
|
1015
|
+
S: this,
|
|
1016
|
+
C: (f, a) => f(...a)
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
}, {
|
|
1020
|
+
F: __dxlog_file6,
|
|
1021
|
+
L: 26
|
|
1022
|
+
});
|
|
1023
|
+
constructor(_authProps) {
|
|
975
1024
|
super({
|
|
976
1025
|
requested: {
|
|
977
1026
|
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
@@ -980,26 +1029,14 @@ var AuthExtension = class extends RpcExtension {
|
|
|
980
1029
|
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
981
1030
|
},
|
|
982
1031
|
timeout: 60 * 1e3
|
|
983
|
-
}), this.
|
|
984
|
-
onError: (err) => {
|
|
985
|
-
log5.catch(err, void 0, {
|
|
986
|
-
F: __dxlog_file6,
|
|
987
|
-
L: 28,
|
|
988
|
-
S: this,
|
|
989
|
-
C: (f, a) => f(...a)
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
}, {
|
|
993
|
-
F: __dxlog_file6,
|
|
994
|
-
L: 26
|
|
995
|
-
});
|
|
1032
|
+
}), this._authProps = _authProps;
|
|
996
1033
|
}
|
|
997
1034
|
async getHandlers() {
|
|
998
1035
|
return {
|
|
999
1036
|
AuthService: {
|
|
1000
1037
|
authenticate: async ({ challenge }) => {
|
|
1001
1038
|
try {
|
|
1002
|
-
const credential = await this.
|
|
1039
|
+
const credential = await this._authProps.provider(challenge);
|
|
1003
1040
|
if (!credential) {
|
|
1004
1041
|
throw new Error("auth rejected");
|
|
1005
1042
|
}
|
|
@@ -1036,7 +1073,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1036
1073
|
"'invalid credential'"
|
|
1037
1074
|
]
|
|
1038
1075
|
});
|
|
1039
|
-
const success = await this.
|
|
1076
|
+
const success = await this._authProps.verifier(challenge, credential);
|
|
1040
1077
|
invariant5(success, "credential not verified", {
|
|
1041
1078
|
F: __dxlog_file6,
|
|
1042
1079
|
L: 71,
|
|
@@ -1046,7 +1083,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1046
1083
|
"'credential not verified'"
|
|
1047
1084
|
]
|
|
1048
1085
|
});
|
|
1049
|
-
runInContext(this._ctx, () => this.
|
|
1086
|
+
runInContext(this._ctx, () => this._authProps.onAuthSuccess());
|
|
1050
1087
|
} catch (err) {
|
|
1051
1088
|
log5("auth failed", err, {
|
|
1052
1089
|
F: __dxlog_file6,
|
|
@@ -1055,7 +1092,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1055
1092
|
C: (f, a) => f(...a)
|
|
1056
1093
|
});
|
|
1057
1094
|
this.close();
|
|
1058
|
-
this.
|
|
1095
|
+
this._authProps.onAuthFailure();
|
|
1059
1096
|
}
|
|
1060
1097
|
});
|
|
1061
1098
|
}
|
|
@@ -1070,7 +1107,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1070
1107
|
};
|
|
1071
1108
|
|
|
1072
1109
|
// src/space/space.ts
|
|
1073
|
-
import { Event as Event4, scheduleMicroTask, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1110
|
+
import { Event as Event4, scheduleMicroTask as scheduleMicroTask2, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1074
1111
|
import { Resource } from "@dxos/context";
|
|
1075
1112
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
1076
1113
|
import { log as log7, logInfo } from "@dxos/log";
|
|
@@ -1079,7 +1116,7 @@ import { trace as trace2 } from "@dxos/tracing";
|
|
|
1079
1116
|
import { Callback as Callback2 } from "@dxos/util";
|
|
1080
1117
|
|
|
1081
1118
|
// src/space/control-pipeline.ts
|
|
1082
|
-
import { DeferredTask, sleepWithContext as sleepWithContext2, trackLeaks } from "@dxos/async";
|
|
1119
|
+
import { DeferredTask, scheduleMicroTask, sleepWithContext as sleepWithContext2, trackLeaks } from "@dxos/async";
|
|
1083
1120
|
import { Context as Context4 } from "@dxos/context";
|
|
1084
1121
|
import { SpaceStateMachine } from "@dxos/credentials";
|
|
1085
1122
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
@@ -1099,19 +1136,28 @@ var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
|
|
|
1099
1136
|
var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
|
|
1100
1137
|
var USE_SNAPSHOTS = true;
|
|
1101
1138
|
var ControlPipeline = class {
|
|
1139
|
+
_ctx = new Context4(void 0, {
|
|
1140
|
+
F: __dxlog_file7,
|
|
1141
|
+
L: 47
|
|
1142
|
+
});
|
|
1143
|
+
_pipeline;
|
|
1144
|
+
_spaceStateMachine;
|
|
1145
|
+
_spaceKey;
|
|
1146
|
+
_metadata;
|
|
1147
|
+
_targetTimeframe;
|
|
1148
|
+
_lastTimeframeSaveTime = Date.now();
|
|
1149
|
+
onFeedAdmitted = new Callback();
|
|
1150
|
+
onMemberRoleChanged;
|
|
1151
|
+
onCredentialProcessed;
|
|
1152
|
+
onDelegatedInvitation;
|
|
1153
|
+
onDelegatedInvitationRemoved;
|
|
1154
|
+
_usage = new TimeUsageCounter();
|
|
1155
|
+
_mutations = new TimeSeriesCounter();
|
|
1156
|
+
_snapshotTask = new DeferredTask(this._ctx, async () => {
|
|
1157
|
+
await sleepWithContext2(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
|
|
1158
|
+
await this._saveSnapshot();
|
|
1159
|
+
});
|
|
1102
1160
|
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
1103
|
-
this._ctx = new Context4(void 0, {
|
|
1104
|
-
F: __dxlog_file7,
|
|
1105
|
-
L: 47
|
|
1106
|
-
});
|
|
1107
|
-
this._lastTimeframeSaveTime = Date.now();
|
|
1108
|
-
this.onFeedAdmitted = new Callback();
|
|
1109
|
-
this._usage = new TimeUsageCounter();
|
|
1110
|
-
this._mutations = new TimeSeriesCounter();
|
|
1111
|
-
this._snapshotTask = new DeferredTask(this._ctx, async () => {
|
|
1112
|
-
await sleepWithContext2(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
|
|
1113
|
-
await this._saveSnapshot();
|
|
1114
|
-
});
|
|
1115
1161
|
this._spaceKey = spaceKey;
|
|
1116
1162
|
this._metadata = metadataStore;
|
|
1117
1163
|
this._pipeline = new Pipeline();
|
|
@@ -1127,16 +1173,19 @@ var ControlPipeline = class {
|
|
|
1127
1173
|
C: (f, a) => f(...a)
|
|
1128
1174
|
});
|
|
1129
1175
|
if (info.assertion.designation === AdmittedFeed.Designation.CONTROL && !info.key.equals(genesisFeed.key)) {
|
|
1130
|
-
|
|
1176
|
+
scheduleMicroTask(this._ctx, async () => {
|
|
1131
1177
|
try {
|
|
1132
1178
|
const feed = await feedProvider(info.key);
|
|
1179
|
+
if (this._ctx.disposed) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1133
1182
|
if (!this._pipeline.hasFeed(feed.key)) {
|
|
1134
1183
|
await this._pipeline.addFeed(feed);
|
|
1135
1184
|
}
|
|
1136
1185
|
} catch (err) {
|
|
1137
1186
|
log6.catch(err, void 0, {
|
|
1138
1187
|
F: __dxlog_file7,
|
|
1139
|
-
L:
|
|
1188
|
+
L: 96,
|
|
1140
1189
|
S: this,
|
|
1141
1190
|
C: (f, a) => f(...a)
|
|
1142
1191
|
});
|
|
@@ -1160,7 +1209,7 @@ var ControlPipeline = class {
|
|
|
1160
1209
|
await this._pipeline.addFeed(feed);
|
|
1161
1210
|
this._pipeline.setWriteFeed(feed);
|
|
1162
1211
|
}
|
|
1163
|
-
async start() {
|
|
1212
|
+
async start(ctx) {
|
|
1164
1213
|
const snapshot = this._metadata.getSpaceControlPipelineSnapshot(this._spaceKey);
|
|
1165
1214
|
log6("load snapshot", {
|
|
1166
1215
|
key: this._spaceKey,
|
|
@@ -1168,7 +1217,7 @@ var ControlPipeline = class {
|
|
|
1168
1217
|
tf: snapshot?.timeframe
|
|
1169
1218
|
}, {
|
|
1170
1219
|
F: __dxlog_file7,
|
|
1171
|
-
L:
|
|
1220
|
+
L: 126,
|
|
1172
1221
|
S: this,
|
|
1173
1222
|
C: (f, a) => f(...a)
|
|
1174
1223
|
});
|
|
@@ -1177,20 +1226,17 @@ var ControlPipeline = class {
|
|
|
1177
1226
|
}
|
|
1178
1227
|
log6("starting...", void 0, {
|
|
1179
1228
|
F: __dxlog_file7,
|
|
1180
|
-
L:
|
|
1229
|
+
L: 131,
|
|
1181
1230
|
S: this,
|
|
1182
1231
|
C: (f, a) => f(...a)
|
|
1183
1232
|
});
|
|
1184
1233
|
setTimeout(async () => {
|
|
1185
|
-
void this._consumePipeline(
|
|
1186
|
-
F: __dxlog_file7,
|
|
1187
|
-
L: 130
|
|
1188
|
-
}));
|
|
1234
|
+
void this._consumePipeline(ctx);
|
|
1189
1235
|
});
|
|
1190
1236
|
await this._pipeline.start();
|
|
1191
1237
|
log6("started", void 0, {
|
|
1192
1238
|
F: __dxlog_file7,
|
|
1193
|
-
L:
|
|
1239
|
+
L: 137,
|
|
1194
1240
|
S: this,
|
|
1195
1241
|
C: (f, a) => f(...a)
|
|
1196
1242
|
});
|
|
@@ -1207,7 +1253,7 @@ var ControlPipeline = class {
|
|
|
1207
1253
|
message
|
|
1208
1254
|
}, {
|
|
1209
1255
|
F: __dxlog_file7,
|
|
1210
|
-
L:
|
|
1256
|
+
L: 150,
|
|
1211
1257
|
S: this,
|
|
1212
1258
|
C: (f, a) => f(...a)
|
|
1213
1259
|
});
|
|
@@ -1229,7 +1275,7 @@ var ControlPipeline = class {
|
|
|
1229
1275
|
snapshot: getSnapshotLoggerContext(snapshot)
|
|
1230
1276
|
}, {
|
|
1231
1277
|
F: __dxlog_file7,
|
|
1232
|
-
L:
|
|
1278
|
+
L: 166,
|
|
1233
1279
|
S: this,
|
|
1234
1280
|
C: (f, a) => f(...a)
|
|
1235
1281
|
});
|
|
@@ -1244,7 +1290,7 @@ var ControlPipeline = class {
|
|
|
1244
1290
|
} catch (err) {
|
|
1245
1291
|
log6.catch(err, void 0, {
|
|
1246
1292
|
F: __dxlog_file7,
|
|
1247
|
-
L:
|
|
1293
|
+
L: 178,
|
|
1248
1294
|
S: this,
|
|
1249
1295
|
C: (f, a) => f(...a)
|
|
1250
1296
|
});
|
|
@@ -1258,7 +1304,7 @@ var ControlPipeline = class {
|
|
|
1258
1304
|
seq: msg.seq
|
|
1259
1305
|
}, {
|
|
1260
1306
|
F: __dxlog_file7,
|
|
1261
|
-
L:
|
|
1307
|
+
L: 187,
|
|
1262
1308
|
S: this,
|
|
1263
1309
|
C: (f, a) => f(...a)
|
|
1264
1310
|
});
|
|
@@ -1273,7 +1319,7 @@ var ControlPipeline = class {
|
|
|
1273
1319
|
msg
|
|
1274
1320
|
}, {
|
|
1275
1321
|
F: __dxlog_file7,
|
|
1276
|
-
L:
|
|
1322
|
+
L: 196,
|
|
1277
1323
|
S: this,
|
|
1278
1324
|
C: (f, a) => f(...a)
|
|
1279
1325
|
});
|
|
@@ -1292,7 +1338,7 @@ var ControlPipeline = class {
|
|
|
1292
1338
|
async stop() {
|
|
1293
1339
|
log6("stopping...", void 0, {
|
|
1294
1340
|
F: __dxlog_file7,
|
|
1295
|
-
L:
|
|
1341
|
+
L: 216,
|
|
1296
1342
|
S: this,
|
|
1297
1343
|
C: (f, a) => f(...a)
|
|
1298
1344
|
});
|
|
@@ -1301,7 +1347,7 @@ var ControlPipeline = class {
|
|
|
1301
1347
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1302
1348
|
log6("stopped", void 0, {
|
|
1303
1349
|
F: __dxlog_file7,
|
|
1304
|
-
L:
|
|
1350
|
+
L: 220,
|
|
1305
1351
|
S: this,
|
|
1306
1352
|
C: (f, a) => f(...a)
|
|
1307
1353
|
});
|
|
@@ -1314,7 +1360,7 @@ var ControlPipeline = class {
|
|
|
1314
1360
|
} catch (err) {
|
|
1315
1361
|
log6(err, void 0, {
|
|
1316
1362
|
F: __dxlog_file7,
|
|
1317
|
-
L:
|
|
1363
|
+
L: 229,
|
|
1318
1364
|
S: this,
|
|
1319
1365
|
C: (f, a) => f(...a)
|
|
1320
1366
|
});
|
|
@@ -1332,9 +1378,6 @@ _ts_decorate4([
|
|
|
1332
1378
|
showInBrowserTimeline: true
|
|
1333
1379
|
})
|
|
1334
1380
|
], ControlPipeline.prototype, "start", null);
|
|
1335
|
-
_ts_decorate4([
|
|
1336
|
-
trace.span()
|
|
1337
|
-
], ControlPipeline.prototype, "_consumePipeline", null);
|
|
1338
1381
|
_ts_decorate4([
|
|
1339
1382
|
trace.span()
|
|
1340
1383
|
], ControlPipeline.prototype, "_processMessage", null);
|
|
@@ -1364,13 +1407,21 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1364
1407
|
}
|
|
1365
1408
|
var __dxlog_file8 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
|
|
1366
1409
|
var Space = class extends Resource {
|
|
1410
|
+
onCredentialProcessed = new Callback2();
|
|
1411
|
+
stateUpdate = new Event4();
|
|
1412
|
+
protocol;
|
|
1413
|
+
_id;
|
|
1414
|
+
_key;
|
|
1415
|
+
_genesisFeedKey;
|
|
1416
|
+
_feedProvider;
|
|
1417
|
+
_controlPipeline;
|
|
1418
|
+
_controlFeed;
|
|
1419
|
+
_dataFeed;
|
|
1367
1420
|
constructor(params) {
|
|
1368
1421
|
super();
|
|
1369
|
-
this.onCredentialProcessed = new Callback2();
|
|
1370
|
-
this.stateUpdate = new Event4();
|
|
1371
1422
|
invariant6(params.spaceKey && params.feedProvider, void 0, {
|
|
1372
1423
|
F: __dxlog_file8,
|
|
1373
|
-
L:
|
|
1424
|
+
L: 73,
|
|
1374
1425
|
S: this,
|
|
1375
1426
|
A: [
|
|
1376
1427
|
"params.spaceKey && params.feedProvider",
|
|
@@ -1390,7 +1441,7 @@ var Space = class extends Resource {
|
|
|
1390
1441
|
this._controlPipeline.onFeedAdmitted.set(async (info) => {
|
|
1391
1442
|
const sparse = info.assertion.designation === AdmittedFeed2.Designation.DATA;
|
|
1392
1443
|
if (!info.key.equals(params.genesisFeed.key)) {
|
|
1393
|
-
|
|
1444
|
+
scheduleMicroTask2(this._ctx, async () => {
|
|
1394
1445
|
await this.protocol.addFeed(await params.feedProvider(info.key, {
|
|
1395
1446
|
sparse
|
|
1396
1447
|
}));
|
|
@@ -1403,7 +1454,7 @@ var Space = class extends Resource {
|
|
|
1403
1454
|
credential
|
|
1404
1455
|
}, {
|
|
1405
1456
|
F: __dxlog_file8,
|
|
1406
|
-
L:
|
|
1457
|
+
L: 100,
|
|
1407
1458
|
S: this,
|
|
1408
1459
|
C: (f, a) => f(...a)
|
|
1409
1460
|
});
|
|
@@ -1414,7 +1465,7 @@ var Space = class extends Resource {
|
|
|
1414
1465
|
invitation
|
|
1415
1466
|
}, {
|
|
1416
1467
|
F: __dxlog_file8,
|
|
1417
|
-
L:
|
|
1468
|
+
L: 104,
|
|
1418
1469
|
S: this,
|
|
1419
1470
|
C: (f, a) => f(...a)
|
|
1420
1471
|
});
|
|
@@ -1425,7 +1476,7 @@ var Space = class extends Resource {
|
|
|
1425
1476
|
invitation
|
|
1426
1477
|
}, {
|
|
1427
1478
|
F: __dxlog_file8,
|
|
1428
|
-
L:
|
|
1479
|
+
L: 108,
|
|
1429
1480
|
S: this,
|
|
1430
1481
|
C: (f, a) => f(...a)
|
|
1431
1482
|
});
|
|
@@ -1439,7 +1490,7 @@ var Space = class extends Resource {
|
|
|
1439
1490
|
])
|
|
1440
1491
|
}), {
|
|
1441
1492
|
F: __dxlog_file8,
|
|
1442
|
-
L:
|
|
1493
|
+
L: 112,
|
|
1443
1494
|
S: this,
|
|
1444
1495
|
C: (f, a) => f(...a)
|
|
1445
1496
|
});
|
|
@@ -1474,7 +1525,7 @@ var Space = class extends Resource {
|
|
|
1474
1525
|
async setControlFeed(feed) {
|
|
1475
1526
|
invariant6(!this._controlFeed, "Control feed already set.", {
|
|
1476
1527
|
F: __dxlog_file8,
|
|
1477
|
-
L:
|
|
1528
|
+
L: 156,
|
|
1478
1529
|
S: this,
|
|
1479
1530
|
A: [
|
|
1480
1531
|
"!this._controlFeed",
|
|
@@ -1488,7 +1539,7 @@ var Space = class extends Resource {
|
|
|
1488
1539
|
async setDataFeed(feed) {
|
|
1489
1540
|
invariant6(!this._dataFeed, "Data feed already set.", {
|
|
1490
1541
|
F: __dxlog_file8,
|
|
1491
|
-
L:
|
|
1542
|
+
L: 163,
|
|
1492
1543
|
S: this,
|
|
1493
1544
|
A: [
|
|
1494
1545
|
"!this._dataFeed",
|
|
@@ -1507,45 +1558,45 @@ var Space = class extends Resource {
|
|
|
1507
1558
|
async _open(ctx) {
|
|
1508
1559
|
log7("opening...", void 0, {
|
|
1509
1560
|
F: __dxlog_file8,
|
|
1510
|
-
L:
|
|
1561
|
+
L: 177,
|
|
1511
1562
|
S: this,
|
|
1512
1563
|
C: (f, a) => f(...a)
|
|
1513
1564
|
});
|
|
1514
|
-
await this._controlPipeline.start();
|
|
1565
|
+
await this._controlPipeline.start(ctx);
|
|
1515
1566
|
log7("opened", void 0, {
|
|
1516
1567
|
F: __dxlog_file8,
|
|
1517
|
-
L:
|
|
1568
|
+
L: 182,
|
|
1518
1569
|
S: this,
|
|
1519
1570
|
C: (f, a) => f(...a)
|
|
1520
1571
|
});
|
|
1521
1572
|
}
|
|
1522
|
-
async startProtocol() {
|
|
1573
|
+
async startProtocol(ctx) {
|
|
1523
1574
|
invariant6(this.isOpen, void 0, {
|
|
1524
1575
|
F: __dxlog_file8,
|
|
1525
|
-
L:
|
|
1576
|
+
L: 187,
|
|
1526
1577
|
S: this,
|
|
1527
1578
|
A: [
|
|
1528
1579
|
"this.isOpen",
|
|
1529
1580
|
""
|
|
1530
1581
|
]
|
|
1531
1582
|
});
|
|
1532
|
-
await this.protocol.start();
|
|
1583
|
+
await this.protocol.start(ctx);
|
|
1533
1584
|
await this.protocol.addFeed(await this._feedProvider(this._genesisFeedKey));
|
|
1534
1585
|
}
|
|
1535
|
-
async _close() {
|
|
1586
|
+
async _close(ctx) {
|
|
1536
1587
|
log7("closing...", {
|
|
1537
1588
|
key: this._key
|
|
1538
1589
|
}, {
|
|
1539
1590
|
F: __dxlog_file8,
|
|
1540
|
-
L:
|
|
1591
|
+
L: 194,
|
|
1541
1592
|
S: this,
|
|
1542
1593
|
C: (f, a) => f(...a)
|
|
1543
1594
|
});
|
|
1544
|
-
await this.protocol.stop();
|
|
1595
|
+
await this.protocol.stop(ctx);
|
|
1545
1596
|
await this._controlPipeline.stop();
|
|
1546
1597
|
log7("closed", void 0, {
|
|
1547
1598
|
F: __dxlog_file8,
|
|
1548
|
-
L:
|
|
1599
|
+
L: 200,
|
|
1549
1600
|
S: this,
|
|
1550
1601
|
C: (f, a) => f(...a)
|
|
1551
1602
|
});
|
|
@@ -1587,15 +1638,18 @@ import { schema as schema4 } from "@dxos/protocols/proto";
|
|
|
1587
1638
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1588
1639
|
var __dxlog_file9 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts";
|
|
1589
1640
|
var CredentialRetrieverExtension = class extends RpcExtension2 {
|
|
1641
|
+
_request;
|
|
1642
|
+
_onResult;
|
|
1643
|
+
_ctx = new Context5(void 0, {
|
|
1644
|
+
F: __dxlog_file9,
|
|
1645
|
+
L: 26
|
|
1646
|
+
});
|
|
1590
1647
|
constructor(_request, _onResult) {
|
|
1591
1648
|
super({
|
|
1592
1649
|
requested: {
|
|
1593
1650
|
AdmissionDiscoveryService: schema4.getService("dxos.mesh.teleport.AdmissionDiscoveryService")
|
|
1594
1651
|
}
|
|
1595
|
-
}), this._request = _request, this._onResult = _onResult
|
|
1596
|
-
F: __dxlog_file9,
|
|
1597
|
-
L: 26
|
|
1598
|
-
});
|
|
1652
|
+
}), this._request = _request, this._onResult = _onResult;
|
|
1599
1653
|
}
|
|
1600
1654
|
async getHandlers() {
|
|
1601
1655
|
return {};
|
|
@@ -1619,6 +1673,7 @@ var CredentialRetrieverExtension = class extends RpcExtension2 {
|
|
|
1619
1673
|
}
|
|
1620
1674
|
};
|
|
1621
1675
|
var CredentialServerExtension = class extends RpcExtension2 {
|
|
1676
|
+
_space;
|
|
1622
1677
|
constructor(_space) {
|
|
1623
1678
|
super({
|
|
1624
1679
|
exposed: {
|
|
@@ -1632,7 +1687,12 @@ var CredentialServerExtension = class extends RpcExtension2 {
|
|
|
1632
1687
|
getAdmissionCredential: async (request) => {
|
|
1633
1688
|
const memberInfo = this._space.spaceState.members.get(request.memberKey);
|
|
1634
1689
|
if (!memberInfo?.credential) {
|
|
1635
|
-
throw new ProtocolError(
|
|
1690
|
+
throw new ProtocolError({
|
|
1691
|
+
message: "Space member not found.",
|
|
1692
|
+
context: {
|
|
1693
|
+
...request
|
|
1694
|
+
}
|
|
1695
|
+
});
|
|
1636
1696
|
}
|
|
1637
1697
|
return {
|
|
1638
1698
|
admissionCredential: memberInfo.credential
|
|
@@ -1663,16 +1723,34 @@ var __dxlog_file10 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/
|
|
|
1663
1723
|
var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
|
|
1664
1724
|
var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
1665
1725
|
var SpaceProtocol = class {
|
|
1726
|
+
_networkManager;
|
|
1727
|
+
_swarmIdentity;
|
|
1728
|
+
_onSessionAuth;
|
|
1729
|
+
_onAuthFailure;
|
|
1730
|
+
blobSync;
|
|
1731
|
+
_disableP2pReplication;
|
|
1732
|
+
_topic;
|
|
1733
|
+
_spaceKey;
|
|
1734
|
+
_feeds = /* @__PURE__ */ new Set();
|
|
1735
|
+
_sessions = new ComplexMap4(PublicKey5.hash);
|
|
1736
|
+
// TODO(burdon): Move to config (with sensible defaults).
|
|
1737
|
+
_topology = new MMSTTopology({
|
|
1738
|
+
originateConnections: 4,
|
|
1739
|
+
maxPeers: 10,
|
|
1740
|
+
sampleSize: 20
|
|
1741
|
+
});
|
|
1742
|
+
_connection;
|
|
1743
|
+
feedAdded = new CallbackCollection();
|
|
1744
|
+
get sessions() {
|
|
1745
|
+
return this._sessions;
|
|
1746
|
+
}
|
|
1747
|
+
get feeds() {
|
|
1748
|
+
return this._feeds;
|
|
1749
|
+
}
|
|
1750
|
+
get _ownPeerKey() {
|
|
1751
|
+
return this._swarmIdentity.peerKey;
|
|
1752
|
+
}
|
|
1666
1753
|
constructor({ topic, swarmIdentity, networkManager, onSessionAuth, onAuthFailure, blobStore, disableP2pReplication }) {
|
|
1667
|
-
this._feeds = /* @__PURE__ */ new Set();
|
|
1668
|
-
this._sessions = new ComplexMap4(PublicKey5.hash);
|
|
1669
|
-
// TODO(burdon): Move to config (with sensible defaults).
|
|
1670
|
-
this._topology = new MMSTTopology({
|
|
1671
|
-
originateConnections: 4,
|
|
1672
|
-
maxPeers: 10,
|
|
1673
|
-
sampleSize: 20
|
|
1674
|
-
});
|
|
1675
|
-
this.feedAdded = new CallbackCollection();
|
|
1676
1754
|
this._spaceKey = topic;
|
|
1677
1755
|
this._networkManager = networkManager;
|
|
1678
1756
|
this._swarmIdentity = swarmIdentity;
|
|
@@ -1684,22 +1762,13 @@ var SpaceProtocol = class {
|
|
|
1684
1762
|
this._topic = subtleCrypto2.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(PublicKey5.from);
|
|
1685
1763
|
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
1686
1764
|
}
|
|
1687
|
-
get sessions() {
|
|
1688
|
-
return this._sessions;
|
|
1689
|
-
}
|
|
1690
|
-
get feeds() {
|
|
1691
|
-
return this._feeds;
|
|
1692
|
-
}
|
|
1693
|
-
get _ownPeerKey() {
|
|
1694
|
-
return this._swarmIdentity.peerKey;
|
|
1695
|
-
}
|
|
1696
1765
|
// TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
|
|
1697
1766
|
async addFeed(feed) {
|
|
1698
1767
|
log8("addFeed", {
|
|
1699
1768
|
key: feed.key
|
|
1700
1769
|
}, {
|
|
1701
1770
|
F: __dxlog_file10,
|
|
1702
|
-
L:
|
|
1771
|
+
L: 132,
|
|
1703
1772
|
S: this,
|
|
1704
1773
|
C: (f, a) => f(...a)
|
|
1705
1774
|
});
|
|
@@ -1710,7 +1779,7 @@ var SpaceProtocol = class {
|
|
|
1710
1779
|
await this.feedAdded.callSerial(feed);
|
|
1711
1780
|
}
|
|
1712
1781
|
// TODO(burdon): Rename open? Common open/close interfaces for all services?
|
|
1713
|
-
async start() {
|
|
1782
|
+
async start(ctx) {
|
|
1714
1783
|
if (this._connection) {
|
|
1715
1784
|
return;
|
|
1716
1785
|
}
|
|
@@ -1718,12 +1787,12 @@ var SpaceProtocol = class {
|
|
|
1718
1787
|
await this.blobSync.open();
|
|
1719
1788
|
log8("starting...", void 0, {
|
|
1720
1789
|
F: __dxlog_file10,
|
|
1721
|
-
L:
|
|
1790
|
+
L: 153,
|
|
1722
1791
|
S: this,
|
|
1723
1792
|
C: (f, a) => f(...a)
|
|
1724
1793
|
});
|
|
1725
1794
|
const topic = await this._topic;
|
|
1726
|
-
this._connection = await this._networkManager.joinSwarm({
|
|
1795
|
+
this._connection = await this._networkManager.joinSwarm(ctx, {
|
|
1727
1796
|
protocolProvider: this._createProtocolProvider(credentials),
|
|
1728
1797
|
topic,
|
|
1729
1798
|
topology: this._topology,
|
|
@@ -1731,7 +1800,7 @@ var SpaceProtocol = class {
|
|
|
1731
1800
|
});
|
|
1732
1801
|
log8("started", void 0, {
|
|
1733
1802
|
F: __dxlog_file10,
|
|
1734
|
-
L:
|
|
1803
|
+
L: 162,
|
|
1735
1804
|
S: this,
|
|
1736
1805
|
C: (f, a) => f(...a)
|
|
1737
1806
|
});
|
|
@@ -1739,35 +1808,35 @@ var SpaceProtocol = class {
|
|
|
1739
1808
|
updateTopology() {
|
|
1740
1809
|
this._topology.forceUpdate();
|
|
1741
1810
|
}
|
|
1742
|
-
async stop() {
|
|
1811
|
+
async stop(ctx) {
|
|
1743
1812
|
await this.blobSync.close();
|
|
1744
1813
|
if (this._connection) {
|
|
1745
1814
|
log8("stopping...", void 0, {
|
|
1746
1815
|
F: __dxlog_file10,
|
|
1747
|
-
L:
|
|
1816
|
+
L: 173,
|
|
1748
1817
|
S: this,
|
|
1749
1818
|
C: (f, a) => f(...a)
|
|
1750
1819
|
});
|
|
1751
|
-
await this._connection.close();
|
|
1820
|
+
await this._connection.close(ctx);
|
|
1752
1821
|
log8("stopped", void 0, {
|
|
1753
1822
|
F: __dxlog_file10,
|
|
1754
|
-
L:
|
|
1823
|
+
L: 175,
|
|
1755
1824
|
S: this,
|
|
1756
1825
|
C: (f, a) => f(...a)
|
|
1757
1826
|
});
|
|
1758
1827
|
}
|
|
1759
1828
|
}
|
|
1760
1829
|
_createProtocolProvider(credentials) {
|
|
1761
|
-
return (
|
|
1830
|
+
return (wireProps) => {
|
|
1762
1831
|
const session = new SpaceProtocolSession({
|
|
1763
|
-
|
|
1832
|
+
wireProps,
|
|
1764
1833
|
swarmIdentity: this._swarmIdentity,
|
|
1765
1834
|
onSessionAuth: this._onSessionAuth,
|
|
1766
1835
|
onAuthFailure: this._onAuthFailure,
|
|
1767
1836
|
blobSync: this.blobSync,
|
|
1768
1837
|
disableP2pReplication: this._disableP2pReplication
|
|
1769
1838
|
});
|
|
1770
|
-
this._sessions.set(
|
|
1839
|
+
this._sessions.set(wireProps.remotePeerId, session);
|
|
1771
1840
|
for (const feed of this._feeds) {
|
|
1772
1841
|
session.replicator.addFeed(feed);
|
|
1773
1842
|
}
|
|
@@ -1788,34 +1857,41 @@ _ts_decorate6([
|
|
|
1788
1857
|
SpaceProtocol = _ts_decorate6([
|
|
1789
1858
|
trace3.resource()
|
|
1790
1859
|
], SpaceProtocol);
|
|
1791
|
-
var AuthStatus = /* @__PURE__ */ function(AuthStatus2) {
|
|
1860
|
+
var AuthStatus = /* @__PURE__ */ (function(AuthStatus2) {
|
|
1792
1861
|
AuthStatus2["INITIAL"] = "INITIAL";
|
|
1793
1862
|
AuthStatus2["SUCCESS"] = "SUCCESS";
|
|
1794
1863
|
AuthStatus2["FAILURE"] = "FAILURE";
|
|
1795
1864
|
return AuthStatus2;
|
|
1796
|
-
}({});
|
|
1865
|
+
})({});
|
|
1797
1866
|
var SpaceProtocolSession = class {
|
|
1867
|
+
_wireProps;
|
|
1868
|
+
_disableP2pReplication;
|
|
1869
|
+
_onSessionAuth;
|
|
1870
|
+
_onAuthFailure;
|
|
1871
|
+
_swarmIdentity;
|
|
1872
|
+
_blobSync;
|
|
1873
|
+
_teleport;
|
|
1874
|
+
// TODO(dmaretskyi): Start with upload=false when switching it on the fly works.
|
|
1875
|
+
replicator = new ReplicatorExtension().setOptions({
|
|
1876
|
+
upload: true
|
|
1877
|
+
});
|
|
1878
|
+
_authStatus = "INITIAL";
|
|
1879
|
+
get authStatus() {
|
|
1880
|
+
return this._authStatus;
|
|
1881
|
+
}
|
|
1882
|
+
get stats() {
|
|
1883
|
+
return this._teleport.stats;
|
|
1884
|
+
}
|
|
1798
1885
|
// TODO(dmaretskyi): Allow to pass in extra extensions.
|
|
1799
|
-
constructor({
|
|
1800
|
-
|
|
1801
|
-
this.replicator = new ReplicatorExtension().setOptions({
|
|
1802
|
-
upload: true
|
|
1803
|
-
});
|
|
1804
|
-
this._authStatus = "INITIAL";
|
|
1805
|
-
this._wireParams = wireParams;
|
|
1886
|
+
constructor({ wireProps, swarmIdentity, onSessionAuth, onAuthFailure, blobSync, disableP2pReplication }) {
|
|
1887
|
+
this._wireProps = wireProps;
|
|
1806
1888
|
this._swarmIdentity = swarmIdentity;
|
|
1807
1889
|
this._onSessionAuth = onSessionAuth;
|
|
1808
1890
|
this._onAuthFailure = onAuthFailure;
|
|
1809
1891
|
this._blobSync = blobSync;
|
|
1810
|
-
this._teleport = new Teleport(
|
|
1892
|
+
this._teleport = new Teleport(wireProps);
|
|
1811
1893
|
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
1812
1894
|
}
|
|
1813
|
-
get authStatus() {
|
|
1814
|
-
return this._authStatus;
|
|
1815
|
-
}
|
|
1816
|
-
get stats() {
|
|
1817
|
-
return this._teleport.stats;
|
|
1818
|
-
}
|
|
1819
1895
|
get stream() {
|
|
1820
1896
|
return this._teleport.stream;
|
|
1821
1897
|
}
|
|
@@ -1827,7 +1903,7 @@ var SpaceProtocolSession = class {
|
|
|
1827
1903
|
onAuthSuccess: () => {
|
|
1828
1904
|
log8("Peer authenticated", void 0, {
|
|
1829
1905
|
F: __dxlog_file10,
|
|
1830
|
-
L:
|
|
1906
|
+
L: 286,
|
|
1831
1907
|
S: this,
|
|
1832
1908
|
C: (f, a) => f(...a)
|
|
1833
1909
|
});
|
|
@@ -1847,7 +1923,7 @@ var SpaceProtocolSession = class {
|
|
|
1847
1923
|
async close() {
|
|
1848
1924
|
log8("close", void 0, {
|
|
1849
1925
|
F: __dxlog_file10,
|
|
1850
|
-
L:
|
|
1926
|
+
L: 305,
|
|
1851
1927
|
S: this,
|
|
1852
1928
|
C: (f, a) => f(...a)
|
|
1853
1929
|
});
|
|
@@ -1859,14 +1935,14 @@ var SpaceProtocolSession = class {
|
|
|
1859
1935
|
};
|
|
1860
1936
|
_ts_decorate6([
|
|
1861
1937
|
logInfo2
|
|
1862
|
-
], SpaceProtocolSession.prototype, "
|
|
1938
|
+
], SpaceProtocolSession.prototype, "_wireProps", void 0);
|
|
1863
1939
|
_ts_decorate6([
|
|
1864
1940
|
logInfo2
|
|
1865
1941
|
], SpaceProtocolSession.prototype, "authStatus", null);
|
|
1866
1942
|
|
|
1867
1943
|
// src/space/space-manager.ts
|
|
1868
1944
|
import { parseAutomergeUrl } from "@automerge/automerge-repo";
|
|
1869
|
-
import {
|
|
1945
|
+
import { Trigger as Trigger2, synchronized as synchronized4, trackLeaks as trackLeaks3 } from "@dxos/async";
|
|
1870
1946
|
import { getCredentialAssertion } from "@dxos/credentials";
|
|
1871
1947
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
1872
1948
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
@@ -1881,9 +1957,14 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
1881
1957
|
}
|
|
1882
1958
|
var __dxlog_file11 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
1883
1959
|
var SpaceManager = class {
|
|
1960
|
+
_spaces = new ComplexMap5(PublicKey6.hash);
|
|
1961
|
+
_feedStore;
|
|
1962
|
+
_networkManager;
|
|
1963
|
+
_metadataStore;
|
|
1964
|
+
_blobStore;
|
|
1965
|
+
_instanceId = PublicKey6.random().toHex();
|
|
1966
|
+
_disableP2pReplication;
|
|
1884
1967
|
constructor({ feedStore, networkManager, metadataStore, blobStore, disableP2pReplication }) {
|
|
1885
|
-
this._spaces = new ComplexMap5(PublicKey6.hash);
|
|
1886
|
-
this._instanceId = PublicKey6.random().toHex();
|
|
1887
1968
|
this._feedStore = feedStore;
|
|
1888
1969
|
this._networkManager = networkManager;
|
|
1889
1970
|
this._metadataStore = metadataStore;
|
|
@@ -1906,7 +1987,7 @@ var SpaceManager = class {
|
|
|
1906
1987
|
id: this._instanceId
|
|
1907
1988
|
}), {
|
|
1908
1989
|
F: __dxlog_file11,
|
|
1909
|
-
L:
|
|
1990
|
+
L: 104,
|
|
1910
1991
|
S: this,
|
|
1911
1992
|
C: (f, a) => f(...a)
|
|
1912
1993
|
});
|
|
@@ -1914,7 +1995,7 @@ var SpaceManager = class {
|
|
|
1914
1995
|
spaceKey: metadata.genesisFeedKey
|
|
1915
1996
|
}, {
|
|
1916
1997
|
F: __dxlog_file11,
|
|
1917
|
-
L:
|
|
1998
|
+
L: 105,
|
|
1918
1999
|
S: this,
|
|
1919
2000
|
C: (f, a) => f(...a)
|
|
1920
2001
|
});
|
|
@@ -1946,19 +2027,19 @@ var SpaceManager = class {
|
|
|
1946
2027
|
id: this._instanceId
|
|
1947
2028
|
}), {
|
|
1948
2029
|
F: __dxlog_file11,
|
|
1949
|
-
L:
|
|
2030
|
+
L: 135,
|
|
1950
2031
|
S: this,
|
|
1951
2032
|
C: (f, a) => f(...a)
|
|
1952
2033
|
});
|
|
1953
2034
|
return space;
|
|
1954
2035
|
}
|
|
1955
|
-
async requestSpaceAdmissionCredential(params) {
|
|
2036
|
+
async requestSpaceAdmissionCredential(ctx, params) {
|
|
1956
2037
|
const traceKey = "dxos.echo.space-manager.request-space-admission";
|
|
1957
2038
|
log9.trace(traceKey, trace4.begin({
|
|
1958
2039
|
id: this._instanceId
|
|
1959
2040
|
}), {
|
|
1960
2041
|
F: __dxlog_file11,
|
|
1961
|
-
L:
|
|
2042
|
+
L: 144,
|
|
1962
2043
|
S: this,
|
|
1963
2044
|
C: (f, a) => f(...a)
|
|
1964
2045
|
});
|
|
@@ -1966,7 +2047,7 @@ var SpaceManager = class {
|
|
|
1966
2047
|
spaceKey: params.spaceKey
|
|
1967
2048
|
}, {
|
|
1968
2049
|
F: __dxlog_file11,
|
|
1969
|
-
L:
|
|
2050
|
+
L: 145,
|
|
1970
2051
|
S: this,
|
|
1971
2052
|
C: (f, a) => f(...a)
|
|
1972
2053
|
});
|
|
@@ -1986,7 +2067,7 @@ var SpaceManager = class {
|
|
|
1986
2067
|
disableP2pReplication: this._disableP2pReplication
|
|
1987
2068
|
});
|
|
1988
2069
|
try {
|
|
1989
|
-
await protocol.start();
|
|
2070
|
+
await protocol.start(ctx);
|
|
1990
2071
|
const credential = await onCredentialResolved.wait({
|
|
1991
2072
|
timeout: params.timeout
|
|
1992
2073
|
});
|
|
@@ -1994,7 +2075,7 @@ var SpaceManager = class {
|
|
|
1994
2075
|
id: this._instanceId
|
|
1995
2076
|
}), {
|
|
1996
2077
|
F: __dxlog_file11,
|
|
1997
|
-
L:
|
|
2078
|
+
L: 169,
|
|
1998
2079
|
S: this,
|
|
1999
2080
|
C: (f, a) => f(...a)
|
|
2000
2081
|
});
|
|
@@ -2005,13 +2086,13 @@ var SpaceManager = class {
|
|
|
2005
2086
|
error: err
|
|
2006
2087
|
}), {
|
|
2007
2088
|
F: __dxlog_file11,
|
|
2008
|
-
L:
|
|
2089
|
+
L: 172,
|
|
2009
2090
|
S: this,
|
|
2010
2091
|
C: (f, a) => f(...a)
|
|
2011
2092
|
});
|
|
2012
2093
|
throw err;
|
|
2013
2094
|
} finally {
|
|
2014
|
-
await protocol.stop();
|
|
2095
|
+
await protocol.stop(ctx);
|
|
2015
2096
|
}
|
|
2016
2097
|
}
|
|
2017
2098
|
findSpaceByRootDocumentId(documentId) {
|
|
@@ -2064,4 +2145,4 @@ export {
|
|
|
2064
2145
|
SpaceProtocolSession,
|
|
2065
2146
|
SpaceManager
|
|
2066
2147
|
};
|
|
2067
|
-
//# sourceMappingURL=chunk-
|
|
2148
|
+
//# sourceMappingURL=chunk-DN4YBAWV.mjs.map
|