@dxos/echo-pipeline 0.1.56-main.fd2d497 → 0.1.56-next.dc2716a
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-M66GL5HD.mjs → chunk-GDF4DQU2.mjs} +221 -169
- package/dist/lib/browser/chunk-GDF4DQU2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +224 -172
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +226 -174
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/db-host/data-service-host.d.ts.map +1 -1
- package/dist/types/src/pipeline/pipeline-stress.test.d.ts +2 -0
- package/dist/types/src/pipeline/pipeline-stress.test.d.ts.map +1 -0
- package/dist/types/src/pipeline/pipeline.d.ts +3 -2
- package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/types/src/space/control-pipeline.d.ts +4 -0
- package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/data-pipeline.d.ts +2 -0
- package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/database-test-rig.d.ts +4 -1
- package/dist/types/src/testing/database-test-rig.d.ts.map +1 -1
- package/package.json +32 -32
- package/src/db-host/data-service-host.ts +9 -2
- package/src/pipeline/pipeline-stress.test.ts +226 -0
- package/src/pipeline/pipeline.test.ts +2 -214
- package/src/pipeline/pipeline.ts +27 -23
- package/src/space/control-pipeline.ts +47 -22
- package/src/space/data-pipeline.ts +18 -9
- package/src/space/space-manager.ts +1 -0
- package/src/space/space-protocol.ts +3 -1
- package/src/space/space.ts +1 -0
- package/src/testing/database-test-rig.ts +27 -2
- package/src/tests/database-unit.test.ts +39 -0
- package/dist/lib/browser/chunk-M66GL5HD.mjs.map +0 -7
|
@@ -39,6 +39,7 @@ import { Context } from "@dxos/context";
|
|
|
39
39
|
import { tagMutationsInBatch, setMetadataOnObject } from "@dxos/echo-db";
|
|
40
40
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
41
41
|
import { log } from "@dxos/log";
|
|
42
|
+
import { EchoEvent } from "@dxos/protocols/proto/dxos/echo/service";
|
|
42
43
|
import { ComplexMap } from "@dxos/util";
|
|
43
44
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
|
|
44
45
|
var DataServiceHost = class {
|
|
@@ -66,11 +67,19 @@ var DataServiceHost = class {
|
|
|
66
67
|
objects
|
|
67
68
|
}
|
|
68
69
|
});
|
|
70
|
+
this._itemDemuxer.snapshot.on(ctx, (snapshot) => {
|
|
71
|
+
next({
|
|
72
|
+
action: EchoEvent.DatabaseAction.RESET,
|
|
73
|
+
batch: {
|
|
74
|
+
objects: snapshot.items
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
69
78
|
this._itemDemuxer.mutation.on(ctx, (message) => {
|
|
70
79
|
const { batch, meta } = message;
|
|
71
80
|
invariant2(!meta.clientTag, "Unexpected client tag in mutation message", {
|
|
72
81
|
F: __dxlog_file2,
|
|
73
|
-
L:
|
|
82
|
+
L: 68,
|
|
74
83
|
S: this,
|
|
75
84
|
A: [
|
|
76
85
|
"!(meta as any).clientTag",
|
|
@@ -78,11 +87,11 @@ var DataServiceHost = class {
|
|
|
78
87
|
]
|
|
79
88
|
});
|
|
80
89
|
log("message", {
|
|
81
|
-
batch,
|
|
90
|
+
batch: batch.objects?.length,
|
|
82
91
|
meta
|
|
83
92
|
}, {
|
|
84
93
|
F: __dxlog_file2,
|
|
85
|
-
L:
|
|
94
|
+
L: 69,
|
|
86
95
|
S: this,
|
|
87
96
|
C: (f, a) => f(...a)
|
|
88
97
|
});
|
|
@@ -110,7 +119,7 @@ var DataServiceHost = class {
|
|
|
110
119
|
async write(request) {
|
|
111
120
|
invariant2(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
|
|
112
121
|
F: __dxlog_file2,
|
|
113
|
-
L:
|
|
122
|
+
L: 95,
|
|
114
123
|
S: this,
|
|
115
124
|
A: [
|
|
116
125
|
"!this._ctx.disposed",
|
|
@@ -119,7 +128,7 @@ var DataServiceHost = class {
|
|
|
119
128
|
});
|
|
120
129
|
invariant2(this._writeStream, "Cannot write mutations in readonly mode", {
|
|
121
130
|
F: __dxlog_file2,
|
|
122
|
-
L:
|
|
131
|
+
L: 96,
|
|
123
132
|
S: this,
|
|
124
133
|
A: [
|
|
125
134
|
"this._writeStream",
|
|
@@ -131,7 +140,7 @@ var DataServiceHost = class {
|
|
|
131
140
|
objectCount: request.batch.objects?.length ?? 0
|
|
132
141
|
}, {
|
|
133
142
|
F: __dxlog_file2,
|
|
134
|
-
L:
|
|
143
|
+
L: 98,
|
|
135
144
|
S: this,
|
|
136
145
|
C: (f, a) => f(...a)
|
|
137
146
|
});
|
|
@@ -145,7 +154,7 @@ var DataServiceHost = class {
|
|
|
145
154
|
seq: receipt2.seq
|
|
146
155
|
}, {
|
|
147
156
|
F: __dxlog_file2,
|
|
148
|
-
L:
|
|
157
|
+
L: 107,
|
|
149
158
|
S: this,
|
|
150
159
|
C: (f, a) => f(...a)
|
|
151
160
|
});
|
|
@@ -716,7 +725,7 @@ import { invariant as invariant6 } from "@dxos/invariant";
|
|
|
716
725
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
717
726
|
import { log as log6 } from "@dxos/log";
|
|
718
727
|
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
719
|
-
import { ComplexMap as ComplexMap3
|
|
728
|
+
import { ComplexMap as ComplexMap3 } from "@dxos/util";
|
|
720
729
|
|
|
721
730
|
// packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
|
|
722
731
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
@@ -867,6 +876,8 @@ var Pipeline = class {
|
|
|
867
876
|
// Waits for the message consumer to process the message and yield control back to the pipeline.
|
|
868
877
|
this._processingTrigger = new Trigger().wake();
|
|
869
878
|
this._pauseTrigger = new Trigger().wake();
|
|
879
|
+
// Pending downloads.
|
|
880
|
+
this._downloads = new ComplexMap3((value) => PublicKey3.hash(value.key));
|
|
870
881
|
this._isStopping = false;
|
|
871
882
|
this._isStarted = false;
|
|
872
883
|
this._isBeingConsumed = false;
|
|
@@ -878,7 +889,7 @@ var Pipeline = class {
|
|
|
878
889
|
get writer() {
|
|
879
890
|
invariant6(this._writer, "Writer not set.", {
|
|
880
891
|
F: __dxlog_file7,
|
|
881
|
-
L:
|
|
892
|
+
L: 233,
|
|
882
893
|
S: this,
|
|
883
894
|
A: [
|
|
884
895
|
"this._writer",
|
|
@@ -907,7 +918,7 @@ var Pipeline = class {
|
|
|
907
918
|
setWriteFeed(feed) {
|
|
908
919
|
invariant6(!this._writer, "Writer already set.", {
|
|
909
920
|
F: __dxlog_file7,
|
|
910
|
-
L:
|
|
921
|
+
L: 260,
|
|
911
922
|
S: this,
|
|
912
923
|
A: [
|
|
913
924
|
"!this._writer",
|
|
@@ -916,7 +927,7 @@ var Pipeline = class {
|
|
|
916
927
|
});
|
|
917
928
|
invariant6(feed.properties.writable, "Feed must be writable.", {
|
|
918
929
|
F: __dxlog_file7,
|
|
919
|
-
L:
|
|
930
|
+
L: 261,
|
|
920
931
|
S: this,
|
|
921
932
|
A: [
|
|
922
933
|
"feed.properties.writable",
|
|
@@ -931,7 +942,7 @@ var Pipeline = class {
|
|
|
931
942
|
async start() {
|
|
932
943
|
invariant6(!this._isStarted, "Pipeline is already started.", {
|
|
933
944
|
F: __dxlog_file7,
|
|
934
|
-
L:
|
|
945
|
+
L: 274,
|
|
935
946
|
S: this,
|
|
936
947
|
A: [
|
|
937
948
|
"!this._isStarted",
|
|
@@ -940,7 +951,7 @@ var Pipeline = class {
|
|
|
940
951
|
});
|
|
941
952
|
log6("starting...", void 0, {
|
|
942
953
|
F: __dxlog_file7,
|
|
943
|
-
L:
|
|
954
|
+
L: 275,
|
|
944
955
|
S: this,
|
|
945
956
|
C: (f, a) => f(...a)
|
|
946
957
|
});
|
|
@@ -949,7 +960,7 @@ var Pipeline = class {
|
|
|
949
960
|
this._isStarted = true;
|
|
950
961
|
log6("started", void 0, {
|
|
951
962
|
F: __dxlog_file7,
|
|
952
|
-
L:
|
|
963
|
+
L: 279,
|
|
953
964
|
S: this,
|
|
954
965
|
C: (f, a) => f(...a)
|
|
955
966
|
});
|
|
@@ -962,11 +973,15 @@ var Pipeline = class {
|
|
|
962
973
|
async stop() {
|
|
963
974
|
log6("stopping...", void 0, {
|
|
964
975
|
F: __dxlog_file7,
|
|
965
|
-
L:
|
|
976
|
+
L: 290,
|
|
966
977
|
S: this,
|
|
967
978
|
C: (f, a) => f(...a)
|
|
968
979
|
});
|
|
969
980
|
this._isStopping = true;
|
|
981
|
+
for (const [feed, handle] of this._downloads.entries()) {
|
|
982
|
+
feed.undownload(handle);
|
|
983
|
+
}
|
|
984
|
+
this._downloads.clear();
|
|
970
985
|
await this._feedSetIterator?.close();
|
|
971
986
|
await this._processingTrigger.wait();
|
|
972
987
|
await this._state._ctx.dispose();
|
|
@@ -975,7 +990,7 @@ var Pipeline = class {
|
|
|
975
990
|
this._isStarted = false;
|
|
976
991
|
log6("stopped", void 0, {
|
|
977
992
|
F: __dxlog_file7,
|
|
978
|
-
L:
|
|
993
|
+
L: 302,
|
|
979
994
|
S: this,
|
|
980
995
|
C: (f, a) => f(...a)
|
|
981
996
|
});
|
|
@@ -987,7 +1002,7 @@ var Pipeline = class {
|
|
|
987
1002
|
async setCursor(timeframe) {
|
|
988
1003
|
invariant6(!this._isStarted || this._isPaused, "Invalid state.", {
|
|
989
1004
|
F: __dxlog_file7,
|
|
990
|
-
L:
|
|
1005
|
+
L: 311,
|
|
991
1006
|
S: this,
|
|
992
1007
|
A: [
|
|
993
1008
|
"!this._isStarted || this._isPaused",
|
|
@@ -1016,7 +1031,7 @@ var Pipeline = class {
|
|
|
1016
1031
|
async unpause() {
|
|
1017
1032
|
invariant6(this._isPaused, "Pipeline is not paused.", {
|
|
1018
1033
|
F: __dxlog_file7,
|
|
1019
|
-
L:
|
|
1034
|
+
L: 340,
|
|
1020
1035
|
S: this,
|
|
1021
1036
|
A: [
|
|
1022
1037
|
"this._isPaused",
|
|
@@ -1036,7 +1051,7 @@ var Pipeline = class {
|
|
|
1036
1051
|
async *consume() {
|
|
1037
1052
|
invariant6(!this._isBeingConsumed, "Pipeline is already being consumed.", {
|
|
1038
1053
|
F: __dxlog_file7,
|
|
1039
|
-
L:
|
|
1054
|
+
L: 355,
|
|
1040
1055
|
S: this,
|
|
1041
1056
|
A: [
|
|
1042
1057
|
"!this._isBeingConsumed",
|
|
@@ -1046,7 +1061,7 @@ var Pipeline = class {
|
|
|
1046
1061
|
this._isBeingConsumed = true;
|
|
1047
1062
|
invariant6(this._feedSetIterator, "Iterator not initialized.", {
|
|
1048
1063
|
F: __dxlog_file7,
|
|
1049
|
-
L:
|
|
1064
|
+
L: 358,
|
|
1050
1065
|
S: this,
|
|
1051
1066
|
A: [
|
|
1052
1067
|
"this._feedSetIterator",
|
|
@@ -1060,7 +1075,7 @@ var Pipeline = class {
|
|
|
1060
1075
|
if (lastFeedSetIterator !== this._feedSetIterator) {
|
|
1061
1076
|
invariant6(this._feedSetIterator, "Iterator not initialized.", {
|
|
1062
1077
|
F: __dxlog_file7,
|
|
1063
|
-
L:
|
|
1078
|
+
L: 367,
|
|
1064
1079
|
S: this,
|
|
1065
1080
|
A: [
|
|
1066
1081
|
"this._feedSetIterator",
|
|
@@ -1083,45 +1098,37 @@ var Pipeline = class {
|
|
|
1083
1098
|
this._isBeingConsumed = false;
|
|
1084
1099
|
}
|
|
1085
1100
|
_setFeedDownloadState(feed) {
|
|
1101
|
+
let handle = this._downloads.get(feed);
|
|
1102
|
+
if (handle) {
|
|
1103
|
+
feed.undownload(handle);
|
|
1104
|
+
}
|
|
1086
1105
|
const timeframe = this._state._startTimeframe;
|
|
1087
1106
|
const seq = timeframe.get(feed.key) ?? -1;
|
|
1088
|
-
log6.info("
|
|
1089
|
-
feed: feed.key,
|
|
1090
|
-
feedInstance: getPrototypeSpecificInstanceId(feed),
|
|
1107
|
+
log6.info("download", {
|
|
1108
|
+
feed: feed.key.truncate(),
|
|
1091
1109
|
seq,
|
|
1092
|
-
|
|
1093
|
-
isStarted: this._isStarted,
|
|
1094
|
-
isPaused: this._isPaused
|
|
1110
|
+
length: feed.length
|
|
1095
1111
|
}, {
|
|
1096
1112
|
F: __dxlog_file7,
|
|
1097
|
-
L:
|
|
1113
|
+
L: 396,
|
|
1098
1114
|
S: this,
|
|
1099
1115
|
C: (f, a) => f(...a)
|
|
1100
1116
|
});
|
|
1101
|
-
|
|
1102
|
-
console.log(new Error().stack);
|
|
1103
|
-
}
|
|
1104
|
-
feed.undownload({
|
|
1105
|
-
callback: () => log6("undownload", void 0, {
|
|
1106
|
-
F: __dxlog_file7,
|
|
1107
|
-
L: 398,
|
|
1108
|
-
S: this,
|
|
1109
|
-
C: (f, a) => f(...a)
|
|
1110
|
-
})
|
|
1111
|
-
});
|
|
1112
|
-
feed.download({
|
|
1117
|
+
handle = feed.download({
|
|
1113
1118
|
start: seq + 1,
|
|
1114
1119
|
linear: true
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1120
|
+
}, (err, data) => {
|
|
1121
|
+
if (err) {
|
|
1122
|
+
} else {
|
|
1123
|
+
log6.info("data", data, {
|
|
1124
|
+
F: __dxlog_file7,
|
|
1125
|
+
L: 401,
|
|
1126
|
+
S: this,
|
|
1127
|
+
C: (f, a) => f(...a)
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1124
1130
|
});
|
|
1131
|
+
this._downloads.set(feed, handle);
|
|
1125
1132
|
}
|
|
1126
1133
|
async _initIterator() {
|
|
1127
1134
|
this._feedSetIterator = new FeedSetIterator(createMessageSelector(this._timeframeClock), {
|
|
@@ -1131,7 +1138,7 @@ var Pipeline = class {
|
|
|
1131
1138
|
this._feedSetIterator.stalled.on((iterator) => {
|
|
1132
1139
|
log6.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
|
|
1133
1140
|
F: __dxlog_file7,
|
|
1134
|
-
L:
|
|
1141
|
+
L: 415,
|
|
1135
1142
|
S: this,
|
|
1136
1143
|
C: (f, a) => f(...a)
|
|
1137
1144
|
});
|
|
@@ -1265,11 +1272,12 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1265
1272
|
import { Event as Event4, scheduleTask as scheduleTask2, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1266
1273
|
import { Context as Context4 } from "@dxos/context";
|
|
1267
1274
|
import { checkCredentialType } from "@dxos/credentials";
|
|
1268
|
-
import { getStateMachineFromItem, ItemManager } from "@dxos/echo-db";
|
|
1275
|
+
import { getStateMachineFromItem, ItemManager, TYPE_PROPERTIES } from "@dxos/echo-db";
|
|
1269
1276
|
import { CancelledError } from "@dxos/errors";
|
|
1270
1277
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
1271
|
-
import { log as log8 } from "@dxos/log";
|
|
1278
|
+
import { log as log8, omit } from "@dxos/log";
|
|
1272
1279
|
import { Timeframe as Timeframe3 } from "@dxos/timeframe";
|
|
1280
|
+
import { TimeSeriesCounter, TimeUsageCounter, trace } from "@dxos/tracing";
|
|
1273
1281
|
import { tracer } from "@dxos/util";
|
|
1274
1282
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
1275
1283
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1296,6 +1304,8 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1296
1304
|
this._lastTimeframeSaveTime = 0;
|
|
1297
1305
|
this._lastSnapshotSaveTime = 0;
|
|
1298
1306
|
this._lastProcessedEpoch = -1;
|
|
1307
|
+
this._usage = new TimeUsageCounter();
|
|
1308
|
+
this._mutations = new TimeSeriesCounter();
|
|
1299
1309
|
this.currentEpoch = void 0;
|
|
1300
1310
|
this.appliedEpoch = void 0;
|
|
1301
1311
|
this.onNewEpoch = new Event4();
|
|
@@ -1337,7 +1347,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1337
1347
|
write: (data, options) => {
|
|
1338
1348
|
invariant8(this._pipeline, "Pipeline is not initialized.", {
|
|
1339
1349
|
F: __dxlog_file9,
|
|
1340
|
-
L:
|
|
1350
|
+
L: 154,
|
|
1341
1351
|
S: this,
|
|
1342
1352
|
A: [
|
|
1343
1353
|
"this._pipeline",
|
|
@@ -1346,7 +1356,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1346
1356
|
});
|
|
1347
1357
|
invariant8(this.currentEpoch, "Epoch is not initialized.", {
|
|
1348
1358
|
F: __dxlog_file9,
|
|
1349
|
-
L:
|
|
1359
|
+
L: 155,
|
|
1350
1360
|
S: this,
|
|
1351
1361
|
A: [
|
|
1352
1362
|
"this.currentEpoch",
|
|
@@ -1372,7 +1382,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1372
1382
|
}
|
|
1373
1383
|
log8("close", void 0, {
|
|
1374
1384
|
F: __dxlog_file9,
|
|
1375
|
-
L:
|
|
1385
|
+
L: 179,
|
|
1376
1386
|
S: this,
|
|
1377
1387
|
C: (f, a) => f(...a)
|
|
1378
1388
|
});
|
|
@@ -1387,7 +1397,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1387
1397
|
} catch (err) {
|
|
1388
1398
|
log8.catch(err, void 0, {
|
|
1389
1399
|
F: __dxlog_file9,
|
|
1390
|
-
L:
|
|
1400
|
+
L: 192,
|
|
1391
1401
|
S: this,
|
|
1392
1402
|
C: (f, a) => f(...a)
|
|
1393
1403
|
});
|
|
@@ -1411,7 +1421,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1411
1421
|
}
|
|
1412
1422
|
invariant8(this._pipeline, "Pipeline is not initialized.", {
|
|
1413
1423
|
F: __dxlog_file9,
|
|
1414
|
-
L:
|
|
1424
|
+
L: 215,
|
|
1415
1425
|
S: this,
|
|
1416
1426
|
A: [
|
|
1417
1427
|
"this._pipeline",
|
|
@@ -1419,13 +1429,15 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1419
1429
|
]
|
|
1420
1430
|
});
|
|
1421
1431
|
for await (const msg of this._pipeline.consume()) {
|
|
1432
|
+
const span = this._usage.beginRecording();
|
|
1433
|
+
this._mutations.inc();
|
|
1422
1434
|
const { feedKey, seq, data } = msg;
|
|
1423
1435
|
log8("processing message", {
|
|
1424
1436
|
feedKey,
|
|
1425
1437
|
seq
|
|
1426
1438
|
}, {
|
|
1427
1439
|
F: __dxlog_file9,
|
|
1428
|
-
L:
|
|
1440
|
+
L: 221,
|
|
1429
1441
|
S: this,
|
|
1430
1442
|
C: (f, a) => f(...a)
|
|
1431
1443
|
});
|
|
@@ -1437,7 +1449,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1437
1449
|
feedKey
|
|
1438
1450
|
}, {
|
|
1439
1451
|
F: __dxlog_file9,
|
|
1440
|
-
L:
|
|
1452
|
+
L: 227,
|
|
1441
1453
|
S: this,
|
|
1442
1454
|
C: (f, a) => f(...a)
|
|
1443
1455
|
});
|
|
@@ -1460,7 +1472,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1460
1472
|
spaceKey: this._params.spaceKey.toHex()
|
|
1461
1473
|
}, {
|
|
1462
1474
|
F: __dxlog_file9,
|
|
1463
|
-
L:
|
|
1475
|
+
L: 244,
|
|
1464
1476
|
S: this,
|
|
1465
1477
|
C: (f, a) => f(...a)
|
|
1466
1478
|
});
|
|
@@ -1469,17 +1481,18 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1469
1481
|
} catch (err) {
|
|
1470
1482
|
log8.catch(err, void 0, {
|
|
1471
1483
|
F: __dxlog_file9,
|
|
1472
|
-
L:
|
|
1484
|
+
L: 254,
|
|
1473
1485
|
S: this,
|
|
1474
1486
|
C: (f, a) => f(...a)
|
|
1475
1487
|
});
|
|
1476
1488
|
}
|
|
1489
|
+
span.end();
|
|
1477
1490
|
}
|
|
1478
1491
|
}
|
|
1479
1492
|
_createSnapshot() {
|
|
1480
1493
|
invariant8(this.databaseHost, "Database backend is not initialized.", {
|
|
1481
1494
|
F: __dxlog_file9,
|
|
1482
|
-
L:
|
|
1495
|
+
L: 262,
|
|
1483
1496
|
S: this,
|
|
1484
1497
|
A: [
|
|
1485
1498
|
"this.databaseHost",
|
|
@@ -1501,14 +1514,14 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1501
1514
|
const cache = {};
|
|
1502
1515
|
try {
|
|
1503
1516
|
const propertiesItem = this.itemManager.items.find((item) => item.modelMeta?.type === "dxos:model/document" && // TODO(burdon): Document?
|
|
1504
|
-
(getStateMachineFromItem(item)?.snapshot()).type ===
|
|
1517
|
+
(getStateMachineFromItem(item)?.snapshot()).type === TYPE_PROPERTIES);
|
|
1505
1518
|
if (propertiesItem) {
|
|
1506
1519
|
cache.properties = getStateMachineFromItem(propertiesItem)?.snapshot();
|
|
1507
1520
|
}
|
|
1508
1521
|
} catch (err) {
|
|
1509
1522
|
log8.warn("Failed to cache properties", err, {
|
|
1510
1523
|
F: __dxlog_file9,
|
|
1511
|
-
L:
|
|
1524
|
+
L: 291,
|
|
1512
1525
|
S: this,
|
|
1513
1526
|
C: (f, a) => f(...a)
|
|
1514
1527
|
});
|
|
@@ -1534,14 +1547,14 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1534
1547
|
if (err instanceof CancelledError) {
|
|
1535
1548
|
log8("Epoch processing cancelled.", void 0, {
|
|
1536
1549
|
F: __dxlog_file9,
|
|
1537
|
-
L:
|
|
1550
|
+
L: 323,
|
|
1538
1551
|
S: this,
|
|
1539
1552
|
C: (f, a) => f(...a)
|
|
1540
1553
|
});
|
|
1541
1554
|
} else {
|
|
1542
1555
|
log8.catch(err, void 0, {
|
|
1543
1556
|
F: __dxlog_file9,
|
|
1544
|
-
L:
|
|
1557
|
+
L: 325,
|
|
1545
1558
|
S: this,
|
|
1546
1559
|
C: (f, a) => f(...a)
|
|
1547
1560
|
});
|
|
@@ -1553,14 +1566,6 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1553
1566
|
if (!this._isOpen) {
|
|
1554
1567
|
return;
|
|
1555
1568
|
}
|
|
1556
|
-
log8("process epoch", {
|
|
1557
|
-
epoch
|
|
1558
|
-
}, {
|
|
1559
|
-
F: __dxlog_file9,
|
|
1560
|
-
L: 322,
|
|
1561
|
-
S: this,
|
|
1562
|
-
C: (f, a) => f(...a)
|
|
1563
|
-
});
|
|
1564
1569
|
await this._processEpoch(ctx, epoch.subject.assertion);
|
|
1565
1570
|
this.appliedEpoch = epoch;
|
|
1566
1571
|
this.onNewEpoch.emit(epoch);
|
|
@@ -1569,7 +1574,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1569
1574
|
async _processEpoch(ctx, epoch) {
|
|
1570
1575
|
invariant8(this._isOpen, "Space is closed.", {
|
|
1571
1576
|
F: __dxlog_file9,
|
|
1572
|
-
L:
|
|
1577
|
+
L: 344,
|
|
1573
1578
|
S: this,
|
|
1574
1579
|
A: [
|
|
1575
1580
|
"this._isOpen",
|
|
@@ -1578,7 +1583,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1578
1583
|
});
|
|
1579
1584
|
invariant8(this._pipeline, void 0, {
|
|
1580
1585
|
F: __dxlog_file9,
|
|
1581
|
-
L:
|
|
1586
|
+
L: 345,
|
|
1582
1587
|
S: this,
|
|
1583
1588
|
A: [
|
|
1584
1589
|
"this._pipeline",
|
|
@@ -1586,11 +1591,11 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1586
1591
|
]
|
|
1587
1592
|
});
|
|
1588
1593
|
this._lastProcessedEpoch = epoch.number;
|
|
1589
|
-
log8("
|
|
1590
|
-
epoch
|
|
1594
|
+
log8("processing", {
|
|
1595
|
+
epoch: omit(epoch, "proof")
|
|
1591
1596
|
}, {
|
|
1592
1597
|
F: __dxlog_file9,
|
|
1593
|
-
L:
|
|
1598
|
+
L: 348,
|
|
1594
1599
|
S: this,
|
|
1595
1600
|
C: (f, a) => f(...a)
|
|
1596
1601
|
});
|
|
@@ -1598,9 +1603,9 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1598
1603
|
const snapshot = await this._params.snapshotManager.load(ctx, epoch.snapshotCid);
|
|
1599
1604
|
this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
|
|
1600
1605
|
}
|
|
1601
|
-
log8("restarting pipeline
|
|
1606
|
+
log8("restarting pipeline from epoch", void 0, {
|
|
1602
1607
|
F: __dxlog_file9,
|
|
1603
|
-
L:
|
|
1608
|
+
L: 354,
|
|
1604
1609
|
S: this,
|
|
1605
1610
|
C: (f, a) => f(...a)
|
|
1606
1611
|
});
|
|
@@ -1611,7 +1616,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1611
1616
|
async waitUntilTimeframe(timeframe) {
|
|
1612
1617
|
invariant8(this._pipeline, "Pipeline is not initialized.", {
|
|
1613
1618
|
F: __dxlog_file9,
|
|
1614
|
-
L:
|
|
1619
|
+
L: 361,
|
|
1615
1620
|
S: this,
|
|
1616
1621
|
A: [
|
|
1617
1622
|
"this._pipeline",
|
|
@@ -1623,7 +1628,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1623
1628
|
async createEpoch() {
|
|
1624
1629
|
invariant8(this._pipeline, void 0, {
|
|
1625
1630
|
F: __dxlog_file9,
|
|
1626
|
-
L:
|
|
1631
|
+
L: 367,
|
|
1627
1632
|
S: this,
|
|
1628
1633
|
A: [
|
|
1629
1634
|
"this._pipeline",
|
|
@@ -1632,7 +1637,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1632
1637
|
});
|
|
1633
1638
|
invariant8(this.currentEpoch, void 0, {
|
|
1634
1639
|
F: __dxlog_file9,
|
|
1635
|
-
L:
|
|
1640
|
+
L: 368,
|
|
1636
1641
|
S: this,
|
|
1637
1642
|
A: [
|
|
1638
1643
|
"this.currentEpoch",
|
|
@@ -1655,6 +1660,12 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1655
1660
|
await this.onNewEpoch.waitForCondition(() => !!this.currentEpoch);
|
|
1656
1661
|
}
|
|
1657
1662
|
};
|
|
1663
|
+
_ts_decorate5([
|
|
1664
|
+
trace.metricsCounter()
|
|
1665
|
+
], DataPipeline.prototype, "_usage", void 0);
|
|
1666
|
+
_ts_decorate5([
|
|
1667
|
+
trace.metricsCounter()
|
|
1668
|
+
], DataPipeline.prototype, "_mutations", void 0);
|
|
1658
1669
|
_ts_decorate5([
|
|
1659
1670
|
synchronized3
|
|
1660
1671
|
], DataPipeline.prototype, "open", null);
|
|
@@ -1668,7 +1679,8 @@ _ts_decorate5([
|
|
|
1668
1679
|
synchronized3
|
|
1669
1680
|
], DataPipeline.prototype, "createEpoch", null);
|
|
1670
1681
|
DataPipeline = _ts_decorate5([
|
|
1671
|
-
trackLeaks2("open", "close")
|
|
1682
|
+
trackLeaks2("open", "close"),
|
|
1683
|
+
trace.resource()
|
|
1672
1684
|
], DataPipeline);
|
|
1673
1685
|
|
|
1674
1686
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
@@ -1676,22 +1688,36 @@ import { Event as Event5, synchronized as synchronized4, trackLeaks as trackLeak
|
|
|
1676
1688
|
import { invariant as invariant9 } from "@dxos/invariant";
|
|
1677
1689
|
import { log as log10, logInfo } from "@dxos/log";
|
|
1678
1690
|
import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1679
|
-
import { trace } from "@dxos/tracing";
|
|
1691
|
+
import { trace as trace3 } from "@dxos/tracing";
|
|
1680
1692
|
import { Callback as Callback2 } from "@dxos/util";
|
|
1681
1693
|
|
|
1682
1694
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
1695
|
+
import { Context as Context5 } from "@dxos/context";
|
|
1683
1696
|
import { SpaceStateMachine } from "@dxos/credentials";
|
|
1684
1697
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1685
1698
|
import { log as log9 } from "@dxos/log";
|
|
1686
1699
|
import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1687
1700
|
import { Timeframe as Timeframe4 } from "@dxos/timeframe";
|
|
1701
|
+
import { TimeSeriesCounter as TimeSeriesCounter2, TimeUsageCounter as TimeUsageCounter2, trace as trace2 } from "@dxos/tracing";
|
|
1688
1702
|
import { Callback, tracer as tracer2 } from "@dxos/util";
|
|
1703
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
1704
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1705
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1706
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1707
|
+
else
|
|
1708
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1709
|
+
if (d = decorators[i])
|
|
1710
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1711
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1712
|
+
}
|
|
1689
1713
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
|
|
1690
1714
|
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2 = 500;
|
|
1691
|
-
var ControlPipeline = class {
|
|
1715
|
+
var ControlPipeline = class ControlPipeline2 {
|
|
1692
1716
|
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
1693
1717
|
this._lastTimeframeSaveTime = Date.now();
|
|
1694
1718
|
this.onFeedAdmitted = new Callback();
|
|
1719
|
+
this._usage = new TimeUsageCounter2();
|
|
1720
|
+
this._mutations = new TimeSeriesCounter2();
|
|
1695
1721
|
this._spaceKey = spaceKey;
|
|
1696
1722
|
this._metadata = metadataStore;
|
|
1697
1723
|
this._pipeline = new Pipeline();
|
|
@@ -1702,7 +1728,7 @@ var ControlPipeline = class {
|
|
|
1702
1728
|
key: info.key
|
|
1703
1729
|
}, {
|
|
1704
1730
|
F: __dxlog_file10,
|
|
1705
|
-
L:
|
|
1731
|
+
L: 61,
|
|
1706
1732
|
S: this,
|
|
1707
1733
|
C: (f, a) => f(...a)
|
|
1708
1734
|
});
|
|
@@ -1713,7 +1739,7 @@ var ControlPipeline = class {
|
|
|
1713
1739
|
} catch (err) {
|
|
1714
1740
|
log9.catch(err, void 0, {
|
|
1715
1741
|
F: __dxlog_file10,
|
|
1716
|
-
L:
|
|
1742
|
+
L: 69,
|
|
1717
1743
|
S: this,
|
|
1718
1744
|
C: (f, a) => f(...a)
|
|
1719
1745
|
});
|
|
@@ -1736,56 +1762,65 @@ var ControlPipeline = class {
|
|
|
1736
1762
|
async start() {
|
|
1737
1763
|
log9("starting...", void 0, {
|
|
1738
1764
|
F: __dxlog_file10,
|
|
1739
|
-
L:
|
|
1765
|
+
L: 93,
|
|
1740
1766
|
S: this,
|
|
1741
1767
|
C: (f, a) => f(...a)
|
|
1742
1768
|
});
|
|
1743
1769
|
setTimeout(async () => {
|
|
1744
|
-
|
|
1745
|
-
try {
|
|
1746
|
-
log9("processing", {
|
|
1747
|
-
key: msg.feedKey,
|
|
1748
|
-
seq: msg.seq
|
|
1749
|
-
}, {
|
|
1750
|
-
F: __dxlog_file10,
|
|
1751
|
-
L: 88,
|
|
1752
|
-
S: this,
|
|
1753
|
-
C: (f, a) => f(...a)
|
|
1754
|
-
});
|
|
1755
|
-
if (msg.data.payload.credential) {
|
|
1756
|
-
const timer = tracer2.mark("dxos.echo.pipeline.control");
|
|
1757
|
-
const result = await this._spaceStateMachine.process(msg.data.payload.credential.credential, PublicKey4.from(msg.feedKey));
|
|
1758
|
-
timer.end();
|
|
1759
|
-
if (!result) {
|
|
1760
|
-
log9.warn("processing failed", {
|
|
1761
|
-
msg
|
|
1762
|
-
}, {
|
|
1763
|
-
F: __dxlog_file10,
|
|
1764
|
-
L: 98,
|
|
1765
|
-
S: this,
|
|
1766
|
-
C: (f, a) => f(...a)
|
|
1767
|
-
});
|
|
1768
|
-
} else {
|
|
1769
|
-
await this._noteTargetStateIfNeeded(this._pipeline.state.pendingTimeframe);
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
} catch (err) {
|
|
1773
|
-
log9.catch(err, void 0, {
|
|
1774
|
-
F: __dxlog_file10,
|
|
1775
|
-
L: 104,
|
|
1776
|
-
S: this,
|
|
1777
|
-
C: (f, a) => f(...a)
|
|
1778
|
-
});
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1770
|
+
void this._consumePipeline(new Context5());
|
|
1781
1771
|
});
|
|
1782
1772
|
await this._pipeline.start();
|
|
1783
1773
|
log9("started", void 0, {
|
|
1784
1774
|
F: __dxlog_file10,
|
|
1785
|
-
L:
|
|
1775
|
+
L: 99,
|
|
1776
|
+
S: this,
|
|
1777
|
+
C: (f, a) => f(...a)
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
async _consumePipeline(ctx) {
|
|
1781
|
+
for await (const msg of this._pipeline.consume()) {
|
|
1782
|
+
const span = this._usage.beginRecording();
|
|
1783
|
+
this._mutations.inc();
|
|
1784
|
+
try {
|
|
1785
|
+
await this._processMessage(ctx, msg);
|
|
1786
|
+
} catch (err) {
|
|
1787
|
+
log9.catch(err, void 0, {
|
|
1788
|
+
F: __dxlog_file10,
|
|
1789
|
+
L: 111,
|
|
1790
|
+
S: this,
|
|
1791
|
+
C: (f, a) => f(...a)
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
span.end();
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
async _processMessage(ctx, msg) {
|
|
1798
|
+
log9("processing", {
|
|
1799
|
+
key: msg.feedKey,
|
|
1800
|
+
seq: msg.seq
|
|
1801
|
+
}, {
|
|
1802
|
+
F: __dxlog_file10,
|
|
1803
|
+
L: 121,
|
|
1786
1804
|
S: this,
|
|
1787
1805
|
C: (f, a) => f(...a)
|
|
1788
1806
|
});
|
|
1807
|
+
if (msg.data.payload.credential) {
|
|
1808
|
+
const timer = tracer2.mark("dxos.echo.pipeline.control");
|
|
1809
|
+
const result = await this._spaceStateMachine.process(msg.data.payload.credential.credential, PublicKey4.from(msg.feedKey));
|
|
1810
|
+
timer.end();
|
|
1811
|
+
if (!result) {
|
|
1812
|
+
log9.warn("processing failed", {
|
|
1813
|
+
msg
|
|
1814
|
+
}, {
|
|
1815
|
+
F: __dxlog_file10,
|
|
1816
|
+
L: 131,
|
|
1817
|
+
S: this,
|
|
1818
|
+
C: (f, a) => f(...a)
|
|
1819
|
+
});
|
|
1820
|
+
} else {
|
|
1821
|
+
await this._noteTargetStateIfNeeded(this._pipeline.state.pendingTimeframe);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1789
1824
|
}
|
|
1790
1825
|
async _noteTargetStateIfNeeded(timeframe) {
|
|
1791
1826
|
if (Date.now() - this._lastTimeframeSaveTime > TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2) {
|
|
@@ -1796,7 +1831,7 @@ var ControlPipeline = class {
|
|
|
1796
1831
|
async stop() {
|
|
1797
1832
|
log9("stopping...", void 0, {
|
|
1798
1833
|
F: __dxlog_file10,
|
|
1799
|
-
L:
|
|
1834
|
+
L: 149,
|
|
1800
1835
|
S: this,
|
|
1801
1836
|
C: (f, a) => f(...a)
|
|
1802
1837
|
});
|
|
@@ -1804,7 +1839,7 @@ var ControlPipeline = class {
|
|
|
1804
1839
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1805
1840
|
log9("stopped", void 0, {
|
|
1806
1841
|
F: __dxlog_file10,
|
|
1807
|
-
L:
|
|
1842
|
+
L: 152,
|
|
1808
1843
|
S: this,
|
|
1809
1844
|
C: (f, a) => f(...a)
|
|
1810
1845
|
});
|
|
@@ -1817,16 +1852,31 @@ var ControlPipeline = class {
|
|
|
1817
1852
|
} catch (err) {
|
|
1818
1853
|
log9(err, void 0, {
|
|
1819
1854
|
F: __dxlog_file10,
|
|
1820
|
-
L:
|
|
1855
|
+
L: 161,
|
|
1821
1856
|
S: this,
|
|
1822
1857
|
C: (f, a) => f(...a)
|
|
1823
1858
|
});
|
|
1824
1859
|
}
|
|
1825
1860
|
}
|
|
1826
1861
|
};
|
|
1862
|
+
_ts_decorate6([
|
|
1863
|
+
trace2.metricsCounter()
|
|
1864
|
+
], ControlPipeline.prototype, "_usage", void 0);
|
|
1865
|
+
_ts_decorate6([
|
|
1866
|
+
trace2.metricsCounter()
|
|
1867
|
+
], ControlPipeline.prototype, "_mutations", void 0);
|
|
1868
|
+
_ts_decorate6([
|
|
1869
|
+
trace2.span()
|
|
1870
|
+
], ControlPipeline.prototype, "_consumePipeline", null);
|
|
1871
|
+
_ts_decorate6([
|
|
1872
|
+
trace2.span()
|
|
1873
|
+
], ControlPipeline.prototype, "_processMessage", null);
|
|
1874
|
+
ControlPipeline = _ts_decorate6([
|
|
1875
|
+
trace2.resource()
|
|
1876
|
+
], ControlPipeline);
|
|
1827
1877
|
|
|
1828
1878
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
1829
|
-
function
|
|
1879
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
1830
1880
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1831
1881
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1832
1882
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1952,7 +2002,7 @@ var Space = class Space2 {
|
|
|
1952
2002
|
setControlFeed(feed) {
|
|
1953
2003
|
invariant9(!this._controlFeed, "Control feed already set.", {
|
|
1954
2004
|
F: __dxlog_file11,
|
|
1955
|
-
L:
|
|
2005
|
+
L: 184,
|
|
1956
2006
|
S: this,
|
|
1957
2007
|
A: [
|
|
1958
2008
|
"!this._controlFeed",
|
|
@@ -1966,7 +2016,7 @@ var Space = class Space2 {
|
|
|
1966
2016
|
setDataFeed(feed) {
|
|
1967
2017
|
invariant9(!this._dataFeed, "Data feed already set.", {
|
|
1968
2018
|
F: __dxlog_file11,
|
|
1969
|
-
L:
|
|
2019
|
+
L: 191,
|
|
1970
2020
|
S: this,
|
|
1971
2021
|
A: [
|
|
1972
2022
|
"!this._dataFeed",
|
|
@@ -1992,7 +2042,7 @@ var Space = class Space2 {
|
|
|
1992
2042
|
async open(ctx) {
|
|
1993
2043
|
log10("opening...", void 0, {
|
|
1994
2044
|
F: __dxlog_file11,
|
|
1995
|
-
L:
|
|
2045
|
+
L: 213,
|
|
1996
2046
|
S: this,
|
|
1997
2047
|
C: (f, a) => f(...a)
|
|
1998
2048
|
});
|
|
@@ -2005,7 +2055,7 @@ var Space = class Space2 {
|
|
|
2005
2055
|
this._isOpen = true;
|
|
2006
2056
|
log10("opened", void 0, {
|
|
2007
2057
|
F: __dxlog_file11,
|
|
2008
|
-
L:
|
|
2058
|
+
L: 224,
|
|
2009
2059
|
S: this,
|
|
2010
2060
|
C: (f, a) => f(...a)
|
|
2011
2061
|
});
|
|
@@ -2015,7 +2065,7 @@ var Space = class Space2 {
|
|
|
2015
2065
|
key: this._key
|
|
2016
2066
|
}, {
|
|
2017
2067
|
F: __dxlog_file11,
|
|
2018
|
-
L:
|
|
2068
|
+
L: 229,
|
|
2019
2069
|
S: this,
|
|
2020
2070
|
C: (f, a) => f(...a)
|
|
2021
2071
|
});
|
|
@@ -2029,7 +2079,7 @@ var Space = class Space2 {
|
|
|
2029
2079
|
this._isOpen = false;
|
|
2030
2080
|
log10("closed", void 0, {
|
|
2031
2081
|
F: __dxlog_file11,
|
|
2032
|
-
L:
|
|
2082
|
+
L: 242,
|
|
2033
2083
|
S: this,
|
|
2034
2084
|
C: (f, a) => f(...a)
|
|
2035
2085
|
});
|
|
@@ -2037,13 +2087,13 @@ var Space = class Space2 {
|
|
|
2037
2087
|
async initializeDataPipeline() {
|
|
2038
2088
|
log10("initializeDataPipeline", void 0, {
|
|
2039
2089
|
F: __dxlog_file11,
|
|
2040
|
-
L:
|
|
2090
|
+
L: 247,
|
|
2041
2091
|
S: this,
|
|
2042
2092
|
C: (f, a) => f(...a)
|
|
2043
2093
|
});
|
|
2044
2094
|
invariant9(this._isOpen, "Space must be open to initialize data pipeline.", {
|
|
2045
2095
|
F: __dxlog_file11,
|
|
2046
|
-
L:
|
|
2096
|
+
L: 248,
|
|
2047
2097
|
S: this,
|
|
2048
2098
|
A: [
|
|
2049
2099
|
"this._isOpen",
|
|
@@ -2053,22 +2103,23 @@ var Space = class Space2 {
|
|
|
2053
2103
|
await this._dataPipeline.open();
|
|
2054
2104
|
}
|
|
2055
2105
|
};
|
|
2056
|
-
|
|
2057
|
-
logInfo
|
|
2106
|
+
_ts_decorate7([
|
|
2107
|
+
logInfo,
|
|
2108
|
+
trace3.info()
|
|
2058
2109
|
], Space.prototype, "key", null);
|
|
2059
|
-
|
|
2110
|
+
_ts_decorate7([
|
|
2060
2111
|
synchronized4,
|
|
2061
|
-
|
|
2112
|
+
trace3.span()
|
|
2062
2113
|
], Space.prototype, "open", null);
|
|
2063
|
-
|
|
2114
|
+
_ts_decorate7([
|
|
2064
2115
|
synchronized4
|
|
2065
2116
|
], Space.prototype, "close", null);
|
|
2066
|
-
|
|
2117
|
+
_ts_decorate7([
|
|
2067
2118
|
synchronized4
|
|
2068
2119
|
], Space.prototype, "initializeDataPipeline", null);
|
|
2069
|
-
Space =
|
|
2120
|
+
Space = _ts_decorate7([
|
|
2070
2121
|
trackLeaks3("open", "close"),
|
|
2071
|
-
|
|
2122
|
+
trace3.resource()
|
|
2072
2123
|
], Space);
|
|
2073
2124
|
|
|
2074
2125
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
@@ -2080,7 +2131,7 @@ import { Teleport } from "@dxos/teleport";
|
|
|
2080
2131
|
import { BlobSync } from "@dxos/teleport-extension-object-sync";
|
|
2081
2132
|
import { ReplicatorExtension } from "@dxos/teleport-extension-replicator";
|
|
2082
2133
|
import { ComplexMap as ComplexMap4 } from "@dxos/util";
|
|
2083
|
-
function
|
|
2134
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
2084
2135
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2085
2136
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2086
2137
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2121,7 +2172,7 @@ var SpaceProtocol = class {
|
|
|
2121
2172
|
key: feed.key
|
|
2122
2173
|
}, {
|
|
2123
2174
|
F: __dxlog_file12,
|
|
2124
|
-
L:
|
|
2175
|
+
L: 96,
|
|
2125
2176
|
S: this,
|
|
2126
2177
|
C: (f, a) => f(...a)
|
|
2127
2178
|
});
|
|
@@ -2130,6 +2181,7 @@ var SpaceProtocol = class {
|
|
|
2130
2181
|
session.replicator.addFeed(feed);
|
|
2131
2182
|
}
|
|
2132
2183
|
}
|
|
2184
|
+
// TODO(burdon): Rename open? Common open/close interfaces for all services?
|
|
2133
2185
|
async start() {
|
|
2134
2186
|
if (this._connection) {
|
|
2135
2187
|
return;
|
|
@@ -2143,7 +2195,7 @@ var SpaceProtocol = class {
|
|
|
2143
2195
|
await this.blobSync.open();
|
|
2144
2196
|
log11("starting...", void 0, {
|
|
2145
2197
|
F: __dxlog_file12,
|
|
2146
|
-
L:
|
|
2198
|
+
L: 122,
|
|
2147
2199
|
S: this,
|
|
2148
2200
|
C: (f, a) => f(...a)
|
|
2149
2201
|
});
|
|
@@ -2153,11 +2205,11 @@ var SpaceProtocol = class {
|
|
|
2153
2205
|
peerId: this._swarmIdentity.peerKey,
|
|
2154
2206
|
topic,
|
|
2155
2207
|
topology: new MMSTTopology(topologyConfig),
|
|
2156
|
-
label: `
|
|
2208
|
+
label: `space swarm ${topic.truncate()}`
|
|
2157
2209
|
});
|
|
2158
2210
|
log11("started", void 0, {
|
|
2159
2211
|
F: __dxlog_file12,
|
|
2160
|
-
L:
|
|
2212
|
+
L: 132,
|
|
2161
2213
|
S: this,
|
|
2162
2214
|
C: (f, a) => f(...a)
|
|
2163
2215
|
});
|
|
@@ -2167,14 +2219,14 @@ var SpaceProtocol = class {
|
|
|
2167
2219
|
if (this._connection) {
|
|
2168
2220
|
log11("stopping...", void 0, {
|
|
2169
2221
|
F: __dxlog_file12,
|
|
2170
|
-
L:
|
|
2222
|
+
L: 139,
|
|
2171
2223
|
S: this,
|
|
2172
2224
|
C: (f, a) => f(...a)
|
|
2173
2225
|
});
|
|
2174
2226
|
await this._connection.close();
|
|
2175
2227
|
log11("stopped", void 0, {
|
|
2176
2228
|
F: __dxlog_file12,
|
|
2177
|
-
L:
|
|
2229
|
+
L: 141,
|
|
2178
2230
|
S: this,
|
|
2179
2231
|
C: (f, a) => f(...a)
|
|
2180
2232
|
});
|
|
@@ -2197,10 +2249,10 @@ var SpaceProtocol = class {
|
|
|
2197
2249
|
};
|
|
2198
2250
|
}
|
|
2199
2251
|
};
|
|
2200
|
-
|
|
2252
|
+
_ts_decorate8([
|
|
2201
2253
|
logInfo2
|
|
2202
2254
|
], SpaceProtocol.prototype, "_topic", void 0);
|
|
2203
|
-
|
|
2255
|
+
_ts_decorate8([
|
|
2204
2256
|
logInfo2
|
|
2205
2257
|
], SpaceProtocol.prototype, "_ownPeerKey", null);
|
|
2206
2258
|
var AuthStatus;
|
|
@@ -2241,7 +2293,7 @@ var SpaceProtocolSession = class {
|
|
|
2241
2293
|
onAuthSuccess: () => {
|
|
2242
2294
|
log11("Peer authenticated", void 0, {
|
|
2243
2295
|
F: __dxlog_file12,
|
|
2244
|
-
L:
|
|
2296
|
+
L: 238,
|
|
2245
2297
|
S: this,
|
|
2246
2298
|
C: (f, a) => f(...a)
|
|
2247
2299
|
});
|
|
@@ -2260,10 +2312,10 @@ var SpaceProtocolSession = class {
|
|
|
2260
2312
|
await this._teleport.close();
|
|
2261
2313
|
}
|
|
2262
2314
|
};
|
|
2263
|
-
|
|
2315
|
+
_ts_decorate8([
|
|
2264
2316
|
logInfo2
|
|
2265
2317
|
], SpaceProtocolSession.prototype, "_wireParams", void 0);
|
|
2266
|
-
|
|
2318
|
+
_ts_decorate8([
|
|
2267
2319
|
logInfo2
|
|
2268
2320
|
], SpaceProtocolSession.prototype, "authStatus", null);
|
|
2269
2321
|
|
|
@@ -2272,9 +2324,9 @@ import { synchronized as synchronized5, trackLeaks as trackLeaks4 } from "@dxos/
|
|
|
2272
2324
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
2273
2325
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
2274
2326
|
import { log as log12 } from "@dxos/log";
|
|
2275
|
-
import { trace as
|
|
2327
|
+
import { trace as trace4 } from "@dxos/protocols";
|
|
2276
2328
|
import { ComplexMap as ComplexMap5 } from "@dxos/util";
|
|
2277
|
-
function
|
|
2329
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
2278
2330
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2279
2331
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2280
2332
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2308,7 +2360,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
2308
2360
|
].map((space) => space.close()));
|
|
2309
2361
|
}
|
|
2310
2362
|
async constructSpace({ metadata, swarmIdentity, onNetworkConnection, onAuthFailure, memberKey }) {
|
|
2311
|
-
log12.trace("dxos.echo.space-manager.construct-space",
|
|
2363
|
+
log12.trace("dxos.echo.space-manager.construct-space", trace4.begin({
|
|
2312
2364
|
id: this._instanceId
|
|
2313
2365
|
}), {
|
|
2314
2366
|
F: __dxlog_file13,
|
|
@@ -2346,24 +2398,24 @@ var SpaceManager = class SpaceManager2 {
|
|
|
2346
2398
|
memberKey
|
|
2347
2399
|
});
|
|
2348
2400
|
this._spaces.set(space.key, space);
|
|
2349
|
-
log12.trace("dxos.echo.space-manager.construct-space",
|
|
2401
|
+
log12.trace("dxos.echo.space-manager.construct-space", trace4.end({
|
|
2350
2402
|
id: this._instanceId
|
|
2351
2403
|
}), {
|
|
2352
2404
|
F: __dxlog_file13,
|
|
2353
|
-
L:
|
|
2405
|
+
L: 126,
|
|
2354
2406
|
S: this,
|
|
2355
2407
|
C: (f, a) => f(...a)
|
|
2356
2408
|
});
|
|
2357
2409
|
return space;
|
|
2358
2410
|
}
|
|
2359
2411
|
};
|
|
2360
|
-
|
|
2412
|
+
_ts_decorate9([
|
|
2361
2413
|
synchronized5
|
|
2362
2414
|
], SpaceManager.prototype, "open", null);
|
|
2363
|
-
|
|
2415
|
+
_ts_decorate9([
|
|
2364
2416
|
synchronized5
|
|
2365
2417
|
], SpaceManager.prototype, "close", null);
|
|
2366
|
-
SpaceManager =
|
|
2418
|
+
SpaceManager = _ts_decorate9([
|
|
2367
2419
|
trackLeaks4("open", "close")
|
|
2368
2420
|
], SpaceManager);
|
|
2369
2421
|
|
|
@@ -2393,4 +2445,4 @@ export {
|
|
|
2393
2445
|
SpaceProtocolSession,
|
|
2394
2446
|
SpaceManager
|
|
2395
2447
|
};
|
|
2396
|
-
//# sourceMappingURL=chunk-
|
|
2448
|
+
//# sourceMappingURL=chunk-GDF4DQU2.mjs.map
|