@dxos/echo-pipeline 0.1.45-next.599f154 → 0.1.46-next.01810f0
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-2NGLSBL4.mjs → chunk-YFIFTFHQ.mjs} +85 -50
- package/dist/lib/browser/chunk-YFIFTFHQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -3
- package/dist/lib/browser/index.mjs.map +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 +85 -51
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +122 -86
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/dbhost/snapshot-manager.d.ts.map +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts +0 -6
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/dbhost/snapshot-manager.ts +8 -2
- package/src/metadata/metadata-store.ts +2 -8
- package/src/space/data-pipeline.ts +3 -0
- package/src/space/space-manager.browser.test.ts +3 -2
- package/src/space/space-protocol.browser.test.ts +2 -1
- package/dist/lib/browser/chunk-2NGLSBL4.mjs.map +0 -7
|
@@ -6,7 +6,7 @@ import assert from "@dxos/node-std/assert";
|
|
|
6
6
|
import { synchronized } from "@dxos/async";
|
|
7
7
|
import { DataCorruptionError } from "@dxos/errors";
|
|
8
8
|
import { log } from "@dxos/log";
|
|
9
|
-
import { schema } from "@dxos/protocols";
|
|
9
|
+
import { STORAGE_VERSION, schema } from "@dxos/protocols";
|
|
10
10
|
var __decorate = function(decorators, target, key, desc) {
|
|
11
11
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
12
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -17,7 +17,6 @@ var __decorate = function(decorators, target, key, desc) {
|
|
|
17
17
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
19
|
};
|
|
20
|
-
var STORAGE_VERSION = 1;
|
|
21
20
|
var emptyEchoMetadata = () => ({
|
|
22
21
|
version: STORAGE_VERSION,
|
|
23
22
|
spaces: [],
|
|
@@ -59,7 +58,7 @@ var MetadataStore = class {
|
|
|
59
58
|
checksum
|
|
60
59
|
}, {
|
|
61
60
|
file: "metadata-store.ts",
|
|
62
|
-
line:
|
|
61
|
+
line: 63,
|
|
63
62
|
scope: this,
|
|
64
63
|
callSite: (f, a) => f(...a)
|
|
65
64
|
});
|
|
@@ -77,7 +76,7 @@ var MetadataStore = class {
|
|
|
77
76
|
err
|
|
78
77
|
}, {
|
|
79
78
|
file: "metadata-store.ts",
|
|
80
|
-
line:
|
|
79
|
+
line: 78,
|
|
81
80
|
scope: this,
|
|
82
81
|
callSite: (f, a) => f(...a)
|
|
83
82
|
});
|
|
@@ -108,7 +107,7 @@ var MetadataStore = class {
|
|
|
108
107
|
checksum
|
|
109
108
|
}, {
|
|
110
109
|
file: "metadata-store.ts",
|
|
111
|
-
line:
|
|
110
|
+
line: 109,
|
|
112
111
|
scope: this,
|
|
113
112
|
callSite: (f, a) => f(...a)
|
|
114
113
|
});
|
|
@@ -127,11 +126,12 @@ var MetadataStore = class {
|
|
|
127
126
|
async clear() {
|
|
128
127
|
log("clearing all metadata", {}, {
|
|
129
128
|
file: "metadata-store.ts",
|
|
130
|
-
line:
|
|
129
|
+
line: 125,
|
|
131
130
|
scope: this,
|
|
132
131
|
callSite: (f, a) => f(...a)
|
|
133
132
|
});
|
|
134
133
|
await this._directory.delete();
|
|
134
|
+
this._metadata = emptyEchoMetadata();
|
|
135
135
|
}
|
|
136
136
|
getIdentityRecord() {
|
|
137
137
|
return this._metadata.identity;
|
|
@@ -815,6 +815,8 @@ var DatabaseHost = class {
|
|
|
815
815
|
|
|
816
816
|
// packages/core/echo/echo-pipeline/src/dbhost/snapshot-manager.ts
|
|
817
817
|
import { trackLeaks } from "@dxos/async";
|
|
818
|
+
import { timed as timed2 } from "@dxos/debug";
|
|
819
|
+
import { log as log7 } from "@dxos/log";
|
|
818
820
|
import { schema as schema4 } from "@dxos/protocols";
|
|
819
821
|
import { ObjectSync } from "@dxos/teleport-extension-object-sync";
|
|
820
822
|
var __decorate4 = function(decorators, target, key, desc) {
|
|
@@ -834,6 +836,15 @@ var SnapshotManager = class SnapshotManager2 {
|
|
|
834
836
|
this._objectSync = new ObjectSync({
|
|
835
837
|
getObject: async (id) => {
|
|
836
838
|
const snapshot = await this._snapshotStore.loadSnapshot(id);
|
|
839
|
+
log7("getObject", {
|
|
840
|
+
id,
|
|
841
|
+
snapshot
|
|
842
|
+
}, {
|
|
843
|
+
file: "snapshot-manager.ts",
|
|
844
|
+
line: 30,
|
|
845
|
+
scope: this,
|
|
846
|
+
callSite: (f, a) => f(...a)
|
|
847
|
+
});
|
|
837
848
|
if (!snapshot) {
|
|
838
849
|
return void 0;
|
|
839
850
|
}
|
|
@@ -843,7 +854,15 @@ var SnapshotManager = class SnapshotManager2 {
|
|
|
843
854
|
};
|
|
844
855
|
},
|
|
845
856
|
setObject: async (data) => {
|
|
846
|
-
|
|
857
|
+
log7("setObject", {
|
|
858
|
+
data
|
|
859
|
+
}, {
|
|
860
|
+
file: "snapshot-manager.ts",
|
|
861
|
+
line: 40,
|
|
862
|
+
scope: this,
|
|
863
|
+
callSite: (f, a) => f(...a)
|
|
864
|
+
});
|
|
865
|
+
const snapshot = schema4.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(data.payload.value);
|
|
847
866
|
await this._snapshotStore.saveSnapshot(snapshot);
|
|
848
867
|
}
|
|
849
868
|
});
|
|
@@ -863,13 +882,16 @@ var SnapshotManager = class SnapshotManager2 {
|
|
|
863
882
|
return local;
|
|
864
883
|
}
|
|
865
884
|
const remote = await this._objectSync.download(id);
|
|
866
|
-
return schema4.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(remote.payload);
|
|
885
|
+
return schema4.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(remote.payload.value);
|
|
867
886
|
}
|
|
868
887
|
async store(snapshot) {
|
|
869
888
|
const id = await this._snapshotStore.saveSnapshot(snapshot);
|
|
870
889
|
return id;
|
|
871
890
|
}
|
|
872
891
|
};
|
|
892
|
+
__decorate4([
|
|
893
|
+
timed2(1e4)
|
|
894
|
+
], SnapshotManager.prototype, "load", null);
|
|
873
895
|
SnapshotManager = __decorate4([
|
|
874
896
|
trackLeaks("open", "close")
|
|
875
897
|
], SnapshotManager);
|
|
@@ -923,7 +945,7 @@ var SnapshotStore = class {
|
|
|
923
945
|
import assert7 from "@dxos/node-std/assert";
|
|
924
946
|
import { raise } from "@dxos/debug";
|
|
925
947
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
926
|
-
import { log as
|
|
948
|
+
import { log as log8 } from "@dxos/log";
|
|
927
949
|
import { ComplexMap as ComplexMap3 } from "@dxos/util";
|
|
928
950
|
var DataServiceSubscriptions = class {
|
|
929
951
|
constructor() {
|
|
@@ -933,7 +955,7 @@ var DataServiceSubscriptions = class {
|
|
|
933
955
|
this._spaces.clear();
|
|
934
956
|
}
|
|
935
957
|
registerSpace(spaceKey, host) {
|
|
936
|
-
|
|
958
|
+
log8("Registering space", {
|
|
937
959
|
spaceKey
|
|
938
960
|
}, {
|
|
939
961
|
file: "data-service.ts",
|
|
@@ -944,7 +966,7 @@ var DataServiceSubscriptions = class {
|
|
|
944
966
|
this._spaces.set(spaceKey, host);
|
|
945
967
|
}
|
|
946
968
|
unregisterSpace(spaceKey) {
|
|
947
|
-
|
|
969
|
+
log8("Unregistering space", {
|
|
948
970
|
spaceKey
|
|
949
971
|
}, {
|
|
950
972
|
file: "data-service.ts",
|
|
@@ -983,7 +1005,7 @@ import { Event as Event3, scheduleTask as scheduleTask2, synchronized as synchro
|
|
|
983
1005
|
import { Context as Context3 } from "@dxos/context";
|
|
984
1006
|
import { getCredentialAssertion } from "@dxos/credentials";
|
|
985
1007
|
import { getStateMachineFromItem, ItemManager } from "@dxos/echo-db";
|
|
986
|
-
import { log as
|
|
1008
|
+
import { log as log9 } from "@dxos/log";
|
|
987
1009
|
import { Timeframe as Timeframe3 } from "@dxos/timeframe";
|
|
988
1010
|
var __decorate5 = function(decorators, target, key, desc) {
|
|
989
1011
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1030,7 +1052,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1030
1052
|
if (assertion["@type"] !== "dxos.halo.credentials.Epoch") {
|
|
1031
1053
|
return;
|
|
1032
1054
|
}
|
|
1033
|
-
|
|
1055
|
+
log9("new epoch", {
|
|
1034
1056
|
credential
|
|
1035
1057
|
}, {
|
|
1036
1058
|
file: "data-pipeline.ts",
|
|
@@ -1077,7 +1099,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1077
1099
|
if (!this._isOpen) {
|
|
1078
1100
|
return;
|
|
1079
1101
|
}
|
|
1080
|
-
|
|
1102
|
+
log9("close", {}, {
|
|
1081
1103
|
file: "data-pipeline.ts",
|
|
1082
1104
|
line: 162,
|
|
1083
1105
|
scope: this,
|
|
@@ -1092,7 +1114,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1092
1114
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1093
1115
|
}
|
|
1094
1116
|
} catch (err) {
|
|
1095
|
-
|
|
1117
|
+
log9.catch(err, {}, {
|
|
1096
1118
|
file: "data-pipeline.ts",
|
|
1097
1119
|
line: 175,
|
|
1098
1120
|
scope: this,
|
|
@@ -1107,7 +1129,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1107
1129
|
assert8(this._pipeline, "Pipeline is not initialized.");
|
|
1108
1130
|
for await (const msg of this._pipeline.consume()) {
|
|
1109
1131
|
const { feedKey, seq, data } = msg;
|
|
1110
|
-
|
|
1132
|
+
log9("processing message", {
|
|
1111
1133
|
feedKey,
|
|
1112
1134
|
seq
|
|
1113
1135
|
}, {
|
|
@@ -1120,7 +1142,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1120
1142
|
if (data.payload.data) {
|
|
1121
1143
|
const feedInfo = this._params.feedInfoProvider(feedKey);
|
|
1122
1144
|
if (!feedInfo) {
|
|
1123
|
-
|
|
1145
|
+
log9.error("Could not find feed.", {
|
|
1124
1146
|
feedKey
|
|
1125
1147
|
}, {
|
|
1126
1148
|
file: "data-pipeline.ts",
|
|
@@ -1142,7 +1164,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1142
1164
|
await this._noteTargetStateIfNeeded(this._pipeline.state.pendingTimeframe);
|
|
1143
1165
|
}
|
|
1144
1166
|
} catch (err) {
|
|
1145
|
-
|
|
1167
|
+
log9.catch(err, {}, {
|
|
1146
1168
|
file: "data-pipeline.ts",
|
|
1147
1169
|
line: 211,
|
|
1148
1170
|
scope: this,
|
|
@@ -1177,7 +1199,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1177
1199
|
cache.properties = (_a = getStateMachineFromItem(propertiesItem)) == null ? void 0 : _a.snapshot();
|
|
1178
1200
|
}
|
|
1179
1201
|
} catch (err) {
|
|
1180
|
-
|
|
1202
|
+
log9.warn("Failed to cache properties", err, {
|
|
1181
1203
|
file: "data-pipeline.ts",
|
|
1182
1204
|
line: 245,
|
|
1183
1205
|
scope: this,
|
|
@@ -1198,10 +1220,24 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1198
1220
|
async _processEpoch(epoch) {
|
|
1199
1221
|
assert8(this._isOpen);
|
|
1200
1222
|
assert8(this._pipeline);
|
|
1223
|
+
log9("Processing epoch", {
|
|
1224
|
+
epoch
|
|
1225
|
+
}, {
|
|
1226
|
+
file: "data-pipeline.ts",
|
|
1227
|
+
line: 274,
|
|
1228
|
+
scope: this,
|
|
1229
|
+
callSite: (f, a) => f(...a)
|
|
1230
|
+
});
|
|
1201
1231
|
if (epoch.snapshotCid) {
|
|
1202
1232
|
const snapshot = await this._params.snapshotManager.load(epoch.snapshotCid);
|
|
1203
1233
|
this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
|
|
1204
1234
|
}
|
|
1235
|
+
log9("restarting pipeline for epoch", {}, {
|
|
1236
|
+
file: "data-pipeline.ts",
|
|
1237
|
+
line: 282,
|
|
1238
|
+
scope: this,
|
|
1239
|
+
callSite: (f, a) => f(...a)
|
|
1240
|
+
});
|
|
1205
1241
|
await this._pipeline.pause();
|
|
1206
1242
|
await this._pipeline.setCursor(epoch.timeframe);
|
|
1207
1243
|
await this._pipeline.unpause();
|
|
@@ -1248,14 +1284,14 @@ DataPipeline = __decorate5([
|
|
|
1248
1284
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
1249
1285
|
import assert9 from "@dxos/node-std/assert";
|
|
1250
1286
|
import { Event as Event4, synchronized as synchronized4, trackLeaks as trackLeaks3, Lock } from "@dxos/async";
|
|
1251
|
-
import { log as
|
|
1287
|
+
import { log as log11, logInfo } from "@dxos/log";
|
|
1252
1288
|
import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1253
1289
|
import { Callback as Callback2 } from "@dxos/util";
|
|
1254
1290
|
|
|
1255
1291
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
1256
1292
|
import { SpaceStateMachine } from "@dxos/credentials";
|
|
1257
1293
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
1258
|
-
import { log as
|
|
1294
|
+
import { log as log10 } from "@dxos/log";
|
|
1259
1295
|
import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1260
1296
|
import { Callback } from "@dxos/util";
|
|
1261
1297
|
var ControlPipeline = class {
|
|
@@ -1265,7 +1301,7 @@ var ControlPipeline = class {
|
|
|
1265
1301
|
void this._pipeline.addFeed(genesisFeed);
|
|
1266
1302
|
this._spaceStateMachine = new SpaceStateMachine(spaceKey);
|
|
1267
1303
|
this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
|
|
1268
|
-
|
|
1304
|
+
log10("feed admitted", {
|
|
1269
1305
|
key: info.key
|
|
1270
1306
|
}, {
|
|
1271
1307
|
file: "control-pipeline.ts",
|
|
@@ -1278,7 +1314,7 @@ var ControlPipeline = class {
|
|
|
1278
1314
|
const feed = await feedProvider(info.key);
|
|
1279
1315
|
await this._pipeline.addFeed(feed);
|
|
1280
1316
|
} catch (err) {
|
|
1281
|
-
|
|
1317
|
+
log10.catch(err, {}, {
|
|
1282
1318
|
file: "control-pipeline.ts",
|
|
1283
1319
|
line: 47,
|
|
1284
1320
|
scope: this,
|
|
@@ -1301,7 +1337,7 @@ var ControlPipeline = class {
|
|
|
1301
1337
|
this._pipeline.setWriteFeed(feed);
|
|
1302
1338
|
}
|
|
1303
1339
|
async start() {
|
|
1304
|
-
|
|
1340
|
+
log10("starting...", {}, {
|
|
1305
1341
|
file: "control-pipeline.ts",
|
|
1306
1342
|
line: 71,
|
|
1307
1343
|
scope: this,
|
|
@@ -1310,7 +1346,7 @@ var ControlPipeline = class {
|
|
|
1310
1346
|
setTimeout(async () => {
|
|
1311
1347
|
for await (const msg of this._pipeline.consume()) {
|
|
1312
1348
|
try {
|
|
1313
|
-
|
|
1349
|
+
log10("processing", {
|
|
1314
1350
|
key: msg.feedKey,
|
|
1315
1351
|
seq: msg.seq
|
|
1316
1352
|
}, {
|
|
@@ -1322,7 +1358,7 @@ var ControlPipeline = class {
|
|
|
1322
1358
|
if (msg.data.payload.credential) {
|
|
1323
1359
|
const result = await this._spaceStateMachine.process(msg.data.payload.credential.credential, PublicKey3.from(msg.feedKey));
|
|
1324
1360
|
if (!result) {
|
|
1325
|
-
|
|
1361
|
+
log10.warn("processing failed", {
|
|
1326
1362
|
msg
|
|
1327
1363
|
}, {
|
|
1328
1364
|
file: "control-pipeline.ts",
|
|
@@ -1333,7 +1369,7 @@ var ControlPipeline = class {
|
|
|
1333
1369
|
}
|
|
1334
1370
|
}
|
|
1335
1371
|
} catch (err) {
|
|
1336
|
-
|
|
1372
|
+
log10.catch(err, {}, {
|
|
1337
1373
|
file: "control-pipeline.ts",
|
|
1338
1374
|
line: 87,
|
|
1339
1375
|
scope: this,
|
|
@@ -1343,7 +1379,7 @@ var ControlPipeline = class {
|
|
|
1343
1379
|
}
|
|
1344
1380
|
});
|
|
1345
1381
|
await this._pipeline.start();
|
|
1346
|
-
|
|
1382
|
+
log10("started", {}, {
|
|
1347
1383
|
file: "control-pipeline.ts",
|
|
1348
1384
|
line: 93,
|
|
1349
1385
|
scope: this,
|
|
@@ -1351,14 +1387,14 @@ var ControlPipeline = class {
|
|
|
1351
1387
|
});
|
|
1352
1388
|
}
|
|
1353
1389
|
async stop() {
|
|
1354
|
-
|
|
1390
|
+
log10("stopping...", {}, {
|
|
1355
1391
|
file: "control-pipeline.ts",
|
|
1356
1392
|
line: 97,
|
|
1357
1393
|
scope: this,
|
|
1358
1394
|
callSite: (f, a) => f(...a)
|
|
1359
1395
|
});
|
|
1360
1396
|
await this._pipeline.stop();
|
|
1361
|
-
|
|
1397
|
+
log10("stopped", {}, {
|
|
1362
1398
|
file: "control-pipeline.ts",
|
|
1363
1399
|
line: 99,
|
|
1364
1400
|
scope: this,
|
|
@@ -1412,7 +1448,7 @@ var Space = class Space2 {
|
|
|
1412
1448
|
});
|
|
1413
1449
|
this._controlPipeline.onCredentialProcessed.set(async (credential) => {
|
|
1414
1450
|
await this.onCredentialProcessed.callIfSet(credential);
|
|
1415
|
-
|
|
1451
|
+
log11("onCredentialProcessed", {
|
|
1416
1452
|
credential
|
|
1417
1453
|
}, {
|
|
1418
1454
|
file: "space.ts",
|
|
@@ -1504,7 +1540,7 @@ var Space = class Space2 {
|
|
|
1504
1540
|
// return this._dataPipeline?.getFeeds();
|
|
1505
1541
|
// }
|
|
1506
1542
|
async open() {
|
|
1507
|
-
|
|
1543
|
+
log11("opening...", {}, {
|
|
1508
1544
|
file: "space.ts",
|
|
1509
1545
|
line: 208,
|
|
1510
1546
|
scope: this,
|
|
@@ -1517,7 +1553,7 @@ var Space = class Space2 {
|
|
|
1517
1553
|
await this.protocol.start();
|
|
1518
1554
|
this._dataPipelineCredentialConsumer = this._controlPipeline.spaceState.registerProcessor(this._dataPipeline.createCredentialProcessor());
|
|
1519
1555
|
this._isOpen = true;
|
|
1520
|
-
|
|
1556
|
+
log11("opened", {}, {
|
|
1521
1557
|
file: "space.ts",
|
|
1522
1558
|
line: 222,
|
|
1523
1559
|
scope: this,
|
|
@@ -1526,7 +1562,7 @@ var Space = class Space2 {
|
|
|
1526
1562
|
}
|
|
1527
1563
|
async close() {
|
|
1528
1564
|
var _a;
|
|
1529
|
-
|
|
1565
|
+
log11("closing...", {
|
|
1530
1566
|
key: this._key
|
|
1531
1567
|
}, {
|
|
1532
1568
|
file: "space.ts",
|
|
@@ -1543,7 +1579,7 @@ var Space = class Space2 {
|
|
|
1543
1579
|
await this.protocol.stop();
|
|
1544
1580
|
await this._controlPipeline.stop();
|
|
1545
1581
|
this._isOpen = false;
|
|
1546
|
-
|
|
1582
|
+
log11("closed", {}, {
|
|
1547
1583
|
file: "space.ts",
|
|
1548
1584
|
line: 241,
|
|
1549
1585
|
scope: this,
|
|
@@ -1551,7 +1587,7 @@ var Space = class Space2 {
|
|
|
1551
1587
|
});
|
|
1552
1588
|
}
|
|
1553
1589
|
async initializeDataPipeline() {
|
|
1554
|
-
|
|
1590
|
+
log11.info("initializeDataPipeline", {}, {
|
|
1555
1591
|
file: "space.ts",
|
|
1556
1592
|
line: 245,
|
|
1557
1593
|
scope: this,
|
|
@@ -1578,7 +1614,7 @@ Space = __decorate6([
|
|
|
1578
1614
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
1579
1615
|
import { discoveryKey, sha256 } from "@dxos/crypto";
|
|
1580
1616
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1581
|
-
import { log as
|
|
1617
|
+
import { log as log12, logInfo as logInfo2 } from "@dxos/log";
|
|
1582
1618
|
import { MMSTTopology } from "@dxos/network-manager";
|
|
1583
1619
|
import { Teleport } from "@dxos/teleport";
|
|
1584
1620
|
import { ReplicatorExtension } from "@dxos/teleport-extension-replicator";
|
|
@@ -1615,7 +1651,7 @@ var SpaceProtocol = class {
|
|
|
1615
1651
|
}
|
|
1616
1652
|
// TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
|
|
1617
1653
|
addFeed(feed) {
|
|
1618
|
-
|
|
1654
|
+
log12("addFeed", {
|
|
1619
1655
|
key: feed.key
|
|
1620
1656
|
}, {
|
|
1621
1657
|
file: "space-protocol.ts",
|
|
@@ -1638,7 +1674,7 @@ var SpaceProtocol = class {
|
|
|
1638
1674
|
maxPeers: 10,
|
|
1639
1675
|
sampleSize: 20
|
|
1640
1676
|
};
|
|
1641
|
-
|
|
1677
|
+
log12("starting...", {}, {
|
|
1642
1678
|
file: "space-protocol.ts",
|
|
1643
1679
|
line: 107,
|
|
1644
1680
|
scope: this,
|
|
@@ -1651,7 +1687,7 @@ var SpaceProtocol = class {
|
|
|
1651
1687
|
topology: new MMSTTopology(topologyConfig),
|
|
1652
1688
|
label: `Protocol swarm: ${this._topic}`
|
|
1653
1689
|
});
|
|
1654
|
-
|
|
1690
|
+
log12("started", {}, {
|
|
1655
1691
|
file: "space-protocol.ts",
|
|
1656
1692
|
line: 116,
|
|
1657
1693
|
scope: this,
|
|
@@ -1660,14 +1696,14 @@ var SpaceProtocol = class {
|
|
|
1660
1696
|
}
|
|
1661
1697
|
async stop() {
|
|
1662
1698
|
if (this._connection) {
|
|
1663
|
-
|
|
1699
|
+
log12("stopping...", {}, {
|
|
1664
1700
|
file: "space-protocol.ts",
|
|
1665
1701
|
line: 121,
|
|
1666
1702
|
scope: this,
|
|
1667
1703
|
callSite: (f, a) => f(...a)
|
|
1668
1704
|
});
|
|
1669
1705
|
await this._connection.close();
|
|
1670
|
-
|
|
1706
|
+
log12("stopped", {}, {
|
|
1671
1707
|
file: "space-protocol.ts",
|
|
1672
1708
|
line: 123,
|
|
1673
1709
|
scope: this,
|
|
@@ -1729,7 +1765,7 @@ var SpaceProtocolSession = class {
|
|
|
1729
1765
|
onAuthSuccess: () => {
|
|
1730
1766
|
var _a;
|
|
1731
1767
|
this._authStatus = AuthStatus.SUCCESS;
|
|
1732
|
-
|
|
1768
|
+
log12("Peer authenticated", {}, {
|
|
1733
1769
|
file: "space-protocol.ts",
|
|
1734
1770
|
line: 206,
|
|
1735
1771
|
scope: this,
|
|
@@ -1738,7 +1774,7 @@ var SpaceProtocolSession = class {
|
|
|
1738
1774
|
(_a = this._onSessionAuth) == null ? void 0 : _a.call(this, this._teleport);
|
|
1739
1775
|
},
|
|
1740
1776
|
onAuthFailure: () => {
|
|
1741
|
-
|
|
1777
|
+
log12.warn("Auth failed", {}, {
|
|
1742
1778
|
file: "space-protocol.ts",
|
|
1743
1779
|
line: 211,
|
|
1744
1780
|
scope: this,
|
|
@@ -1764,7 +1800,7 @@ __decorate7([
|
|
|
1764
1800
|
import { synchronized as synchronized5, trackLeaks as trackLeaks4 } from "@dxos/async";
|
|
1765
1801
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
1766
1802
|
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1767
|
-
import { log as
|
|
1803
|
+
import { log as log13 } from "@dxos/log";
|
|
1768
1804
|
import { trace } from "@dxos/protocols";
|
|
1769
1805
|
import { ComplexMap as ComplexMap5 } from "@dxos/util";
|
|
1770
1806
|
var __decorate8 = function(decorators, target, key, desc) {
|
|
@@ -1800,7 +1836,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
1800
1836
|
}
|
|
1801
1837
|
async constructSpace({ metadata, swarmIdentity, onNetworkConnection, memberKey }) {
|
|
1802
1838
|
var _a;
|
|
1803
|
-
|
|
1839
|
+
log13.trace("dxos.echo.space-manager.construct-space", trace.begin({
|
|
1804
1840
|
id: this._instanceId
|
|
1805
1841
|
}), {
|
|
1806
1842
|
file: "space-manager.ts",
|
|
@@ -1808,7 +1844,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
1808
1844
|
scope: this,
|
|
1809
1845
|
callSite: (f, a) => f(...a)
|
|
1810
1846
|
});
|
|
1811
|
-
|
|
1847
|
+
log13("constructing space...", {
|
|
1812
1848
|
spaceKey: metadata.genesisFeedKey
|
|
1813
1849
|
}, {
|
|
1814
1850
|
file: "space-manager.ts",
|
|
@@ -1836,7 +1872,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
1836
1872
|
memberKey
|
|
1837
1873
|
});
|
|
1838
1874
|
this._spaces.set(space.key, space);
|
|
1839
|
-
|
|
1875
|
+
log13.trace("dxos.echo.space-manager.construct-space", trace.end({
|
|
1840
1876
|
id: this._instanceId
|
|
1841
1877
|
}), {
|
|
1842
1878
|
file: "space-manager.ts",
|
|
@@ -1858,7 +1894,6 @@ SpaceManager = __decorate8([
|
|
|
1858
1894
|
], SpaceManager);
|
|
1859
1895
|
|
|
1860
1896
|
export {
|
|
1861
|
-
STORAGE_VERSION,
|
|
1862
1897
|
MetadataStore,
|
|
1863
1898
|
codec,
|
|
1864
1899
|
valueEncoding,
|
|
@@ -1884,4 +1919,4 @@ export {
|
|
|
1884
1919
|
SpaceProtocolSession,
|
|
1885
1920
|
SpaceManager
|
|
1886
1921
|
};
|
|
1887
|
-
//# sourceMappingURL=chunk-
|
|
1922
|
+
//# sourceMappingURL=chunk-YFIFTFHQ.mjs.map
|