@dxos/echo-pipeline 0.1.56-main.bf228a7 → 0.1.56-main.c19b7cd

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.
@@ -279,7 +279,6 @@ var DatabaseHost = class {
279
279
  // packages/core/echo/echo-pipeline/src/db-host/snapshot-manager.ts
280
280
  var import_async = require("@dxos/async");
281
281
  var import_context2 = require("@dxos/context");
282
- var import_debug = require("@dxos/debug");
283
282
  var import_keys = require("@dxos/keys");
284
283
  var import_protocols2 = require("@dxos/protocols");
285
284
  var import_blob = require("@dxos/protocols/proto/dxos/echo/blob");
@@ -324,9 +323,6 @@ var SnapshotManager = class SnapshotManager2 {
324
323
  return import_keys.PublicKey.from(id).toHex();
325
324
  }
326
325
  };
327
- _ts_decorate([
328
- (0, import_debug.timed)(1e4)
329
- ], SnapshotManager.prototype, "load", null);
330
326
  SnapshotManager = _ts_decorate([
331
327
  (0, import_async.trackLeaks)("open", "close")
332
328
  ], SnapshotManager);
@@ -378,7 +374,7 @@ var SnapshotStore = class {
378
374
  };
379
375
 
380
376
  // packages/core/echo/echo-pipeline/src/db-host/data-service.ts
381
- var import_debug2 = require("@dxos/debug");
377
+ var import_debug = require("@dxos/debug");
382
378
  var import_invariant3 = require("@dxos/invariant");
383
379
  var import_keys2 = require("@dxos/keys");
384
380
  var import_log2 = require("@dxos/log");
@@ -444,7 +440,7 @@ var DataServiceImpl = class {
444
440
  ""
445
441
  ]
446
442
  });
447
- const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug2.raise)(new Error(`space not found: ${request.spaceKey}`));
443
+ const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug.raise)(new Error(`space not found: ${request.spaceKey}`));
448
444
  return host.subscribe();
449
445
  }
450
446
  write(request) {
@@ -467,7 +463,7 @@ var DataServiceImpl = class {
467
463
  ""
468
464
  ]
469
465
  });
470
- const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug2.raise)(new Error(`space not found: ${request.spaceKey}`));
466
+ const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug.raise)(new Error(`space not found: ${request.spaceKey}`));
471
467
  return host.write(request);
472
468
  }
473
469
  };
@@ -744,7 +740,7 @@ var fromBytesInt32 = (buf) => buf.readInt32LE(0);
744
740
  // packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
745
741
  var import_async4 = require("@dxos/async");
746
742
  var import_context3 = require("@dxos/context");
747
- var import_debug4 = require("@dxos/debug");
743
+ var import_debug3 = require("@dxos/debug");
748
744
  var import_feed_store = require("@dxos/feed-store");
749
745
  var import_invariant6 = require("@dxos/invariant");
750
746
  var import_keys3 = require("@dxos/keys");
@@ -784,7 +780,7 @@ var createMessageSelector = (timeframeClock) => {
784
780
 
785
781
  // packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts
786
782
  var import_async3 = require("@dxos/async");
787
- var import_debug3 = require("@dxos/debug");
783
+ var import_debug2 = require("@dxos/debug");
788
784
  var import_log5 = require("@dxos/log");
789
785
  var import_timeframe = require("@dxos/timeframe");
790
786
  function _ts_decorate3(decorators, target, key, desc) {
@@ -877,7 +873,7 @@ var TimeframeClock = class {
877
873
  }
878
874
  };
879
875
  _ts_decorate3([
880
- (0, import_debug3.timed)(5e3)
876
+ (0, import_debug2.timed)(5e3)
881
877
  ], TimeframeClock.prototype, "waitUntilReached", null);
882
878
 
883
879
  // packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
@@ -1060,10 +1056,19 @@ var Pipeline = class {
1060
1056
  }), feed.createFeedWriter());
1061
1057
  }
1062
1058
  async start() {
1063
- (0, import_log6.log)("starting...", void 0, {
1059
+ (0, import_invariant6.invariant)(!this._isStarted, "Pipeline is already started.", {
1064
1060
  F: __dxlog_file7,
1065
1061
  L: 267,
1066
1062
  S: this,
1063
+ A: [
1064
+ "!this._isStarted",
1065
+ "'Pipeline is already started.'"
1066
+ ]
1067
+ });
1068
+ (0, import_log6.log)("starting...", void 0, {
1069
+ F: __dxlog_file7,
1070
+ L: 268,
1071
+ S: this,
1067
1072
  C: (f, a) => f(...a)
1068
1073
  });
1069
1074
  await this._initIterator();
@@ -1071,7 +1076,7 @@ var Pipeline = class {
1071
1076
  this._isStarted = true;
1072
1077
  (0, import_log6.log)("started", void 0, {
1073
1078
  F: __dxlog_file7,
1074
- L: 271,
1079
+ L: 272,
1075
1080
  S: this,
1076
1081
  C: (f, a) => f(...a)
1077
1082
  });
@@ -1080,7 +1085,7 @@ var Pipeline = class {
1080
1085
  var _a;
1081
1086
  (0, import_log6.log)("stopping...", void 0, {
1082
1087
  F: __dxlog_file7,
1083
- L: 276,
1088
+ L: 277,
1084
1089
  S: this,
1085
1090
  C: (f, a) => f(...a)
1086
1091
  });
@@ -1093,7 +1098,7 @@ var Pipeline = class {
1093
1098
  this._isStarted = false;
1094
1099
  (0, import_log6.log)("stopped", void 0, {
1095
1100
  F: __dxlog_file7,
1096
- L: 284,
1101
+ L: 285,
1097
1102
  S: this,
1098
1103
  C: (f, a) => f(...a)
1099
1104
  });
@@ -1105,7 +1110,7 @@ var Pipeline = class {
1105
1110
  async setCursor(timeframe) {
1106
1111
  (0, import_invariant6.invariant)(!this._isStarted || this._isPaused, "Invalid state.", {
1107
1112
  F: __dxlog_file7,
1108
- L: 293,
1113
+ L: 294,
1109
1114
  S: this,
1110
1115
  A: [
1111
1116
  "!this._isStarted || this._isPaused",
@@ -1129,7 +1134,7 @@ var Pipeline = class {
1129
1134
  async pause() {
1130
1135
  (0, import_invariant6.invariant)(this._isStarted, "Pipeline is not open.", {
1131
1136
  F: __dxlog_file7,
1132
- L: 315,
1137
+ L: 316,
1133
1138
  S: this,
1134
1139
  A: [
1135
1140
  "this._isStarted",
@@ -1146,7 +1151,7 @@ var Pipeline = class {
1146
1151
  async unpause() {
1147
1152
  (0, import_invariant6.invariant)(this._isStarted, "Pipeline is not open.", {
1148
1153
  F: __dxlog_file7,
1149
- L: 327,
1154
+ L: 328,
1150
1155
  S: this,
1151
1156
  A: [
1152
1157
  "this._isStarted",
@@ -1155,7 +1160,7 @@ var Pipeline = class {
1155
1160
  });
1156
1161
  (0, import_invariant6.invariant)(this._isPaused, "Pipeline is not paused.", {
1157
1162
  F: __dxlog_file7,
1158
- L: 328,
1163
+ L: 329,
1159
1164
  S: this,
1160
1165
  A: [
1161
1166
  "this._isPaused",
@@ -1172,7 +1177,7 @@ var Pipeline = class {
1172
1177
  async *consume() {
1173
1178
  (0, import_invariant6.invariant)(!this._isOpen, "Pipeline is already being consumed.", {
1174
1179
  F: __dxlog_file7,
1175
- L: 339,
1180
+ L: 340,
1176
1181
  S: this,
1177
1182
  A: [
1178
1183
  "!this._isOpen",
@@ -1182,7 +1187,7 @@ var Pipeline = class {
1182
1187
  this._isOpen = true;
1183
1188
  (0, import_invariant6.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1184
1189
  F: __dxlog_file7,
1185
- L: 342,
1190
+ L: 343,
1186
1191
  S: this,
1187
1192
  A: [
1188
1193
  "this._feedSetIterator",
@@ -1196,7 +1201,7 @@ var Pipeline = class {
1196
1201
  if (lastFeedSetIterator !== this._feedSetIterator) {
1197
1202
  (0, import_invariant6.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1198
1203
  F: __dxlog_file7,
1199
- L: 351,
1204
+ L: 352,
1200
1205
  S: this,
1201
1206
  A: [
1202
1207
  "this._feedSetIterator",
@@ -1208,7 +1213,7 @@ var Pipeline = class {
1208
1213
  }
1209
1214
  const { done, value } = await iterable.next();
1210
1215
  if (!done) {
1211
- const block = value != null ? value : (0, import_debug4.failUndefined)();
1216
+ const block = value != null ? value : (0, import_debug3.failUndefined)();
1212
1217
  this._processingTrigger.reset();
1213
1218
  this._timeframeClock.updatePendingTimeframe(import_keys3.PublicKey.from(block.feedKey), block.seq);
1214
1219
  yield block;
@@ -1225,7 +1230,7 @@ var Pipeline = class {
1225
1230
  feed.undownload({
1226
1231
  callback: () => (0, import_log6.log)("undownload", void 0, {
1227
1232
  F: __dxlog_file7,
1228
- L: 375,
1233
+ L: 377,
1229
1234
  S: this,
1230
1235
  C: (f, a) => f(...a)
1231
1236
  })
@@ -1238,7 +1243,7 @@ var Pipeline = class {
1238
1243
  err
1239
1244
  }, {
1240
1245
  F: __dxlog_file7,
1241
- L: 377,
1246
+ L: 379,
1242
1247
  S: this,
1243
1248
  C: (f, a) => f(...a)
1244
1249
  });
@@ -1252,7 +1257,7 @@ var Pipeline = class {
1252
1257
  this._feedSetIterator.stalled.on((iterator) => {
1253
1258
  import_log6.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
1254
1259
  F: __dxlog_file7,
1255
- L: 388,
1260
+ L: 390,
1256
1261
  S: this,
1257
1262
  C: (f, a) => f(...a)
1258
1263
  });
@@ -1387,6 +1392,7 @@ var import_async7 = require("@dxos/async");
1387
1392
  var import_invariant9 = require("@dxos/invariant");
1388
1393
  var import_log10 = require("@dxos/log");
1389
1394
  var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
1395
+ var import_tracing = require("@dxos/tracing");
1390
1396
  var import_util7 = require("@dxos/util");
1391
1397
 
1392
1398
  // packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
@@ -1974,7 +1980,7 @@ var Space = class Space2 {
1974
1980
  this._isOpen = false;
1975
1981
  (0, import_invariant9.invariant)(params.spaceKey && params.feedProvider, void 0, {
1976
1982
  F: __dxlog_file11,
1977
- L: 70,
1983
+ L: 73,
1978
1984
  S: this,
1979
1985
  A: [
1980
1986
  "params.spaceKey && params.feedProvider",
@@ -2016,7 +2022,7 @@ var Space = class Space2 {
2016
2022
  credential
2017
2023
  }, {
2018
2024
  F: __dxlog_file11,
2019
- L: 106,
2025
+ L: 109,
2020
2026
  S: this,
2021
2027
  C: (f, a) => f(...a)
2022
2028
  });
@@ -2083,7 +2089,7 @@ var Space = class Space2 {
2083
2089
  setControlFeed(feed) {
2084
2090
  (0, import_invariant9.invariant)(!this._controlFeed, "Control feed already set.", {
2085
2091
  F: __dxlog_file11,
2086
- L: 180,
2092
+ L: 183,
2087
2093
  S: this,
2088
2094
  A: [
2089
2095
  "!this._controlFeed",
@@ -2098,7 +2104,7 @@ var Space = class Space2 {
2098
2104
  var _a;
2099
2105
  (0, import_invariant9.invariant)(!this._dataFeed, "Data feed already set.", {
2100
2106
  F: __dxlog_file11,
2101
- L: 187,
2107
+ L: 190,
2102
2108
  S: this,
2103
2109
  A: [
2104
2110
  "!this._dataFeed",
@@ -2121,10 +2127,10 @@ var Space = class Space2 {
2121
2127
  // getDataFeeds(): FeedInfo[] {
2122
2128
  // return this._dataPipeline?.getFeeds();
2123
2129
  // }
2124
- async open() {
2130
+ async open(ctx) {
2125
2131
  (0, import_log10.log)("opening...", void 0, {
2126
2132
  F: __dxlog_file11,
2127
- L: 208,
2133
+ L: 212,
2128
2134
  S: this,
2129
2135
  C: (f, a) => f(...a)
2130
2136
  });
@@ -2137,7 +2143,7 @@ var Space = class Space2 {
2137
2143
  this._isOpen = true;
2138
2144
  (0, import_log10.log)("opened", void 0, {
2139
2145
  F: __dxlog_file11,
2140
- L: 219,
2146
+ L: 223,
2141
2147
  S: this,
2142
2148
  C: (f, a) => f(...a)
2143
2149
  });
@@ -2147,7 +2153,7 @@ var Space = class Space2 {
2147
2153
  key: this._key
2148
2154
  }, {
2149
2155
  F: __dxlog_file11,
2150
- L: 224,
2156
+ L: 228,
2151
2157
  S: this,
2152
2158
  C: (f, a) => f(...a)
2153
2159
  });
@@ -2161,7 +2167,7 @@ var Space = class Space2 {
2161
2167
  this._isOpen = false;
2162
2168
  (0, import_log10.log)("closed", void 0, {
2163
2169
  F: __dxlog_file11,
2164
- L: 237,
2170
+ L: 241,
2165
2171
  S: this,
2166
2172
  C: (f, a) => f(...a)
2167
2173
  });
@@ -2169,13 +2175,13 @@ var Space = class Space2 {
2169
2175
  async initializeDataPipeline() {
2170
2176
  (0, import_log10.log)("initializeDataPipeline", void 0, {
2171
2177
  F: __dxlog_file11,
2172
- L: 242,
2178
+ L: 246,
2173
2179
  S: this,
2174
2180
  C: (f, a) => f(...a)
2175
2181
  });
2176
2182
  (0, import_invariant9.invariant)(this._isOpen, "Space must be open to initialize data pipeline.", {
2177
2183
  F: __dxlog_file11,
2178
- L: 243,
2184
+ L: 247,
2179
2185
  S: this,
2180
2186
  A: [
2181
2187
  "this._isOpen",
@@ -2189,7 +2195,8 @@ _ts_decorate6([
2189
2195
  import_log10.logInfo
2190
2196
  ], Space.prototype, "key", null);
2191
2197
  _ts_decorate6([
2192
- import_async7.synchronized
2198
+ import_async7.synchronized,
2199
+ import_tracing.trace.span()
2193
2200
  ], Space.prototype, "open", null);
2194
2201
  _ts_decorate6([
2195
2202
  import_async7.synchronized
@@ -2198,12 +2205,13 @@ _ts_decorate6([
2198
2205
  import_async7.synchronized
2199
2206
  ], Space.prototype, "initializeDataPipeline", null);
2200
2207
  Space = _ts_decorate6([
2201
- (0, import_async7.trackLeaks)("open", "close")
2208
+ (0, import_async7.trackLeaks)("open", "close"),
2209
+ import_tracing.trace.resource()
2202
2210
  ], Space);
2203
2211
 
2204
2212
  // packages/core/echo/echo-pipeline/src/space/space-manager.ts
2205
2213
  var import_async8 = require("@dxos/async");
2206
- var import_debug5 = require("@dxos/debug");
2214
+ var import_debug4 = require("@dxos/debug");
2207
2215
  var import_keys6 = require("@dxos/keys");
2208
2216
  var import_log12 = require("@dxos/log");
2209
2217
  var import_protocols6 = require("@dxos/protocols");
@@ -2459,7 +2467,7 @@ var SpaceManager = class SpaceManager2 {
2459
2467
  S: this,
2460
2468
  C: (f, a) => f(...a)
2461
2469
  });
2462
- const genesisFeed = await this._feedStore.openFeed((_a = metadata.genesisFeedKey) != null ? _a : (0, import_debug5.failUndefined)());
2470
+ const genesisFeed = await this._feedStore.openFeed((_a = metadata.genesisFeedKey) != null ? _a : (0, import_debug4.failUndefined)());
2463
2471
  const spaceKey = metadata.key;
2464
2472
  const protocol = new SpaceProtocol({
2465
2473
  topic: spaceKey,