@fluidframework/container-runtime 2.0.0-dev.7.2.0.203917 → 2.0.0-dev.7.2.0.205722

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.
Files changed (90) hide show
  1. package/api-report/container-runtime.api.md +5 -4
  2. package/dist/blobManager.d.ts +3 -4
  3. package/dist/blobManager.d.ts.map +1 -1
  4. package/dist/blobManager.js +20 -14
  5. package/dist/blobManager.js.map +1 -1
  6. package/dist/containerRuntime.d.ts +8 -8
  7. package/dist/containerRuntime.d.ts.map +1 -1
  8. package/dist/containerRuntime.js +14 -2
  9. package/dist/containerRuntime.js.map +1 -1
  10. package/dist/dataStoreContext.d.ts.map +1 -1
  11. package/dist/dataStoreContext.js +1 -5
  12. package/dist/dataStoreContext.js.map +1 -1
  13. package/dist/dataStores.d.ts +0 -2
  14. package/dist/dataStores.d.ts.map +1 -1
  15. package/dist/dataStores.js +2 -7
  16. package/dist/dataStores.js.map +1 -1
  17. package/dist/gc/garbageCollection.d.ts +6 -0
  18. package/dist/gc/garbageCollection.d.ts.map +1 -1
  19. package/dist/gc/garbageCollection.js +13 -1
  20. package/dist/gc/garbageCollection.js.map +1 -1
  21. package/dist/gc/gcConfigs.d.ts +1 -0
  22. package/dist/gc/gcConfigs.d.ts.map +1 -1
  23. package/dist/gc/gcConfigs.js +12 -2
  24. package/dist/gc/gcConfigs.js.map +1 -1
  25. package/dist/gc/gcDefinitions.d.ts +14 -4
  26. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  27. package/dist/gc/gcDefinitions.js.map +1 -1
  28. package/dist/gc/gcTelemetry.d.ts +1 -2
  29. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  30. package/dist/gc/gcTelemetry.js +2 -3
  31. package/dist/gc/gcTelemetry.js.map +1 -1
  32. package/dist/gc/index.d.ts +2 -2
  33. package/dist/gc/index.d.ts.map +1 -1
  34. package/dist/gc/index.js +1 -5
  35. package/dist/gc/index.js.map +1 -1
  36. package/dist/packageVersion.d.ts +1 -1
  37. package/dist/packageVersion.js +1 -1
  38. package/dist/packageVersion.js.map +1 -1
  39. package/lib/blobManager.d.ts +3 -4
  40. package/lib/blobManager.d.ts.map +1 -1
  41. package/lib/blobManager.js +21 -15
  42. package/lib/blobManager.js.map +1 -1
  43. package/lib/containerRuntime.d.ts +8 -8
  44. package/lib/containerRuntime.d.ts.map +1 -1
  45. package/lib/containerRuntime.js +15 -3
  46. package/lib/containerRuntime.js.map +1 -1
  47. package/lib/dataStoreContext.d.ts.map +1 -1
  48. package/lib/dataStoreContext.js +2 -6
  49. package/lib/dataStoreContext.js.map +1 -1
  50. package/lib/dataStores.d.ts +0 -2
  51. package/lib/dataStores.d.ts.map +1 -1
  52. package/lib/dataStores.js +3 -8
  53. package/lib/dataStores.js.map +1 -1
  54. package/lib/gc/garbageCollection.d.ts +6 -0
  55. package/lib/gc/garbageCollection.d.ts.map +1 -1
  56. package/lib/gc/garbageCollection.js +13 -1
  57. package/lib/gc/garbageCollection.js.map +1 -1
  58. package/lib/gc/gcConfigs.d.ts +1 -0
  59. package/lib/gc/gcConfigs.d.ts.map +1 -1
  60. package/lib/gc/gcConfigs.js +14 -4
  61. package/lib/gc/gcConfigs.js.map +1 -1
  62. package/lib/gc/gcDefinitions.d.ts +14 -4
  63. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  64. package/lib/gc/gcDefinitions.js.map +1 -1
  65. package/lib/gc/gcTelemetry.d.ts +1 -2
  66. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  67. package/lib/gc/gcTelemetry.js +2 -3
  68. package/lib/gc/gcTelemetry.js.map +1 -1
  69. package/lib/gc/index.d.ts +2 -2
  70. package/lib/gc/index.d.ts.map +1 -1
  71. package/lib/gc/index.js +2 -2
  72. package/lib/gc/index.js.map +1 -1
  73. package/lib/packageVersion.d.ts +1 -1
  74. package/lib/packageVersion.js +1 -1
  75. package/lib/packageVersion.js.map +1 -1
  76. package/package.json +24 -20
  77. package/src/blobManager.ts +28 -22
  78. package/src/containerRuntime.ts +18 -14
  79. package/src/dataStoreContext.ts +2 -6
  80. package/src/dataStores.ts +4 -16
  81. package/src/gc/garbageCollection.ts +13 -1
  82. package/src/gc/gcConfigs.ts +22 -4
  83. package/src/gc/gcDefinitions.ts +14 -4
  84. package/src/gc/gcTelemetry.ts +2 -3
  85. package/src/gc/index.ts +0 -4
  86. package/src/packageVersion.ts +1 -1
  87. package/dist/container-runtime-alpha.d.ts +0 -1742
  88. package/dist/container-runtime-beta.d.ts +0 -1742
  89. package/dist/container-runtime-public.d.ts +0 -1742
  90. package/dist/container-runtime-untrimmed.d.ts +0 -1803
@@ -25,6 +25,7 @@ import {
25
25
  ILoaderOptions,
26
26
  ILoader,
27
27
  LoaderHeader,
28
+ IGetPendingLocalStateProps,
28
29
  } from "@fluidframework/container-definitions";
29
30
  import {
30
31
  IContainerRuntime,
@@ -166,7 +167,6 @@ import {
166
167
  IGarbageCollector,
167
168
  IGCRuntimeOptions,
168
169
  IGCStats,
169
- shouldAllowGcTombstoneEnforcement,
170
170
  trimLeadingAndTrailingSlashes,
171
171
  } from "./gc";
172
172
  import { channelToDataStore, IDataStoreAliasMessage, isDataStoreAliasMessage } from "./dataStore";
@@ -1181,10 +1181,20 @@ export class ContainerRuntime
1181
1181
  */
1182
1182
  private nextSummaryNumber: number;
1183
1183
 
1184
- /**
1185
- * If false, loading or using a Tombstoned object should merely log, not fail
1186
- */
1187
- public readonly gcTombstoneEnforcementAllowed: boolean;
1184
+ /** If false, loading or using a Tombstoned object should merely log, not fail */
1185
+ public get gcTombstoneEnforcementAllowed(): boolean {
1186
+ return this.garbageCollector.tombstoneEnforcementAllowed;
1187
+ }
1188
+
1189
+ /** If true, throw an error when a tombstone data store is retrieved */
1190
+ public get gcThrowOnTombstoneLoad(): boolean {
1191
+ return this.garbageCollector.throwOnTombstoneLoad;
1192
+ }
1193
+
1194
+ /** If true, throw an error when a tombstone data store is used. */
1195
+ public get gcThrowOnTombstoneUsage(): boolean {
1196
+ return this.garbageCollector.throwOnTombstoneUsage;
1197
+ }
1188
1198
 
1189
1199
  /**
1190
1200
  * GUID to identify a document in telemetry
@@ -1331,11 +1341,6 @@ export class ContainerRuntime
1331
1341
  // Later updates come through calls to setConnectionState.
1332
1342
  this._connected = connected;
1333
1343
 
1334
- this.gcTombstoneEnforcementAllowed = shouldAllowGcTombstoneEnforcement(
1335
- metadata?.gcFeatureMatrix?.tombstoneGeneration /* persisted */,
1336
- this.runtimeOptions.gcOptions[gcTombstoneGenerationOptionName] /* current */,
1337
- );
1338
-
1339
1344
  this.mc.logger.sendTelemetryEvent({
1340
1345
  eventName: "GCFeatureMatrix",
1341
1346
  metadataValue: JSON.stringify(metadata?.gcFeatureMatrix),
@@ -3928,9 +3933,7 @@ export class ContainerRuntime
3928
3933
 
3929
3934
  public notifyAttaching() {} // do nothing (deprecated method)
3930
3935
 
3931
- public async getPendingLocalState(props?: {
3932
- notifyImminentClosure: boolean;
3933
- }): Promise<unknown> {
3936
+ public async getPendingLocalState(props?: IGetPendingLocalStateProps): Promise<unknown> {
3934
3937
  return PerformanceEvent.timedExecAsync(
3935
3938
  this.mc.logger,
3936
3939
  {
@@ -3940,6 +3943,7 @@ export class ContainerRuntime
3940
3943
  async (event) => {
3941
3944
  this.verifyNotClosed();
3942
3945
  const waitBlobsToAttach = props?.notifyImminentClosure;
3946
+ const stopBlobAttachingSignal = props?.stopBlobAttachingSignal;
3943
3947
  if (this._orderSequentiallyCalls !== 0) {
3944
3948
  throw new UsageError("can't get state during orderSequentially");
3945
3949
  }
@@ -3948,7 +3952,7 @@ export class ContainerRuntime
3948
3952
  // to close current batch.
3949
3953
  this.flush();
3950
3954
  const pendingAttachmentBlobs = waitBlobsToAttach
3951
- ? await this.blobManager.attachAndGetPendingBlobs()
3955
+ ? await this.blobManager.attachAndGetPendingBlobs(stopBlobAttachingSignal)
3952
3956
  : undefined;
3953
3957
  const pending = this.pendingStateManager.getLocalState();
3954
3958
  if (!pendingAttachmentBlobs && !this.hasPendingMessages()) {
@@ -78,7 +78,7 @@ import {
78
78
  summarizerClientType,
79
79
  } from "./summary";
80
80
  import { ContainerRuntime } from "./containerRuntime";
81
- import { sendGCUnexpectedUsageEvent, throwOnTombstoneUsageKey } from "./gc";
81
+ import { sendGCUnexpectedUsageEvent } from "./gc";
82
82
 
83
83
  function createAttributes(
84
84
  pkg: readonly string[],
@@ -325,11 +325,7 @@ export abstract class FluidDataStoreContext
325
325
  this.mc.logger,
326
326
  );
327
327
 
328
- // Tombstone should only throw when the feature flag is enabled and the client isn't a summarizer
329
- this.throwOnTombstoneUsage =
330
- this.mc.config.getBoolean(throwOnTombstoneUsageKey) === true &&
331
- this._containerRuntime.gcTombstoneEnforcementAllowed &&
332
- this.clientDetails.type !== summarizerClientType;
328
+ this.throwOnTombstoneUsage = this._containerRuntime.gcThrowOnTombstoneUsage;
333
329
 
334
330
  // By default, a data store can log maximum 10 local changes telemetry in summarizer.
335
331
  this.localChangesTelemetryCount =
package/src/dataStores.ts CHANGED
@@ -65,12 +65,7 @@ import {
65
65
  } from "./dataStoreContext";
66
66
  import { StorageServiceWithAttachBlobs } from "./storageServiceWithAttachBlobs";
67
67
  import { IDataStoreAliasMessage, isDataStoreAliasMessage } from "./dataStore";
68
- import {
69
- GCNodeType,
70
- disableDatastoreSweepKey,
71
- throwOnTombstoneLoadKey,
72
- sendGCUnexpectedUsageEvent,
73
- } from "./gc";
68
+ import { GCNodeType, disableDatastoreSweepKey, sendGCUnexpectedUsageEvent } from "./gc";
74
69
  import {
75
70
  summarizerClientType,
76
71
  IContainerRuntimeMetadata,
@@ -104,8 +99,6 @@ export class DataStores implements IDisposable {
104
99
  // Stores the ids of new data stores between two GC runs. This is used to notify the garbage collector of new
105
100
  // root data stores that are added.
106
101
  private dataStoresSinceLastGC: string[] = [];
107
- /** If true, throw an error when a tombstone data store is retrieved. */
108
- private readonly throwOnTombstoneLoad: boolean;
109
102
  // The handle to the container runtime. This is used mainly for GC purposes to represent outbound reference from
110
103
  // the container runtime to other nodes.
111
104
  private readonly containerRuntimeHandle: IFluidHandle;
@@ -140,12 +133,6 @@ export class DataStores implements IDisposable {
140
133
  this.runtime.IFluidHandleContext,
141
134
  );
142
135
 
143
- // Tombstone should only throw when the feature flag is enabled and the client isn't a summarizer
144
- this.throwOnTombstoneLoad =
145
- this.mc.config.getBoolean(throwOnTombstoneLoadKey) === true &&
146
- this.runtime.gcTombstoneEnforcementAllowed &&
147
- this.runtime.clientDetails.type !== summarizerClientType;
148
-
149
136
  // Extract stores stored inside the snapshot
150
137
  const fluidDataStores = new Map<string, ISnapshotTree>();
151
138
  if (baseSnapshot) {
@@ -542,7 +529,8 @@ export class DataStores implements IDisposable {
542
529
  if (!context.tombstoned) {
543
530
  return false;
544
531
  }
545
- const logErrorEvent = this.throwOnTombstoneLoad && !requestHeaderData.allowTombstone;
532
+ const logErrorEvent =
533
+ this.runtime.gcThrowOnTombstoneLoad && !requestHeaderData.allowTombstone;
546
534
  sendGCUnexpectedUsageEvent(
547
535
  this.mc,
548
536
  {
@@ -578,7 +566,7 @@ export class DataStores implements IDisposable {
578
566
  request,
579
567
  );
580
568
  // Throw an error if configured via options and via request headers.
581
- if (this.throwOnTombstoneLoad && !requestHeaderData.allowTombstone) {
569
+ if (this.runtime.gcThrowOnTombstoneLoad && !requestHeaderData.allowTombstone) {
582
570
  throw error;
583
571
  }
584
572
  }
@@ -113,6 +113,19 @@ export class GarbageCollector implements IGarbageCollector {
113
113
  private readonly summaryStateTracker: GCSummaryStateTracker;
114
114
  private readonly telemetryTracker: GCTelemetryTracker;
115
115
 
116
+ /** If false, loading or using a Tombstoned object should merely log, not fail */
117
+ public get tombstoneEnforcementAllowed(): boolean {
118
+ return this.configs.tombstoneEnforcementAllowed;
119
+ }
120
+ /** If true, throw an error when a tombstone data store is retrieved */
121
+ public get throwOnTombstoneLoad(): boolean {
122
+ return this.configs.throwOnTombstoneLoad;
123
+ }
124
+ /** If true, throw an error when a tombstone data store is used */
125
+ public get throwOnTombstoneUsage(): boolean {
126
+ return this.configs.throwOnTombstoneUsage;
127
+ }
128
+
116
129
  /** For a given node path, returns the node's package path. */
117
130
  private readonly getNodePackagePath: (
118
131
  nodePath: string,
@@ -176,7 +189,6 @@ export class GarbageCollector implements IGarbageCollector {
176
189
  this.mc,
177
190
  this.configs,
178
191
  this.isSummarizerClient,
179
- this.runtime.gcTombstoneEnforcementAllowed,
180
192
  createParams.createContainerMetadata,
181
193
  (nodeId: string) => this.runtime.getNodeType(nodeId),
182
194
  (nodeId: string) => this.unreferencedNodesState.get(nodeId),
@@ -24,8 +24,10 @@ import {
24
24
  runSessionExpiryKey,
25
25
  runSweepKey,
26
26
  stableGCVersion,
27
+ throwOnTombstoneLoadKey,
28
+ throwOnTombstoneUsageKey,
27
29
  } from "./gcDefinitions";
28
- import { getGCVersion, shouldAllowGcSweep } from "./gcHelpers";
30
+ import { getGCVersion, shouldAllowGcSweep, shouldAllowGcTombstoneEnforcement } from "./gcHelpers";
29
31
 
30
32
  /**
31
33
  * Generates configurations for the Garbage Collector that it uses to determine what to run and how.
@@ -42,6 +44,7 @@ export function generateGCConfigs(
42
44
  gcOptions: IGCRuntimeOptions;
43
45
  metadata: IContainerRuntimeMetadata | undefined;
44
46
  existing: boolean;
47
+ isSummarizerClient: boolean;
45
48
  },
46
49
  ): IGarbageCollectorConfigs {
47
50
  let gcEnabled: boolean;
@@ -152,8 +155,6 @@ export function generateGCConfigs(
152
155
  throw new UsageError("inactive timeout should not be greater than the sweep timeout");
153
156
  }
154
157
 
155
- const throwOnInactiveLoad: boolean | undefined = createParams.gcOptions.throwOnInactiveLoad;
156
-
157
158
  // Whether we are running in test mode. In this mode, unreferenced nodes are immediately deleted.
158
159
  const testMode =
159
160
  mc.config.getBoolean(gcTestModeKey) ?? createParams.gcOptions.runGCInTestMode === true;
@@ -162,6 +163,20 @@ export function generateGCConfigs(
162
163
  const tombstoneMode = !shouldRunSweep && mc.config.getBoolean(disableTombstoneKey) !== true;
163
164
  const runFullGC = createParams.gcOptions.runFullGC;
164
165
 
166
+ const throwOnInactiveLoad: boolean | undefined = createParams.gcOptions.throwOnInactiveLoad;
167
+ const tombstoneEnforcementAllowed = shouldAllowGcTombstoneEnforcement(
168
+ createParams.metadata?.gcFeatureMatrix?.tombstoneGeneration /* persisted */,
169
+ createParams.gcOptions[gcTombstoneGenerationOptionName] /* current */,
170
+ );
171
+ const throwOnTombstoneLoad =
172
+ mc.config.getBoolean(throwOnTombstoneLoadKey) === true &&
173
+ tombstoneEnforcementAllowed &&
174
+ !createParams.isSummarizerClient;
175
+ const throwOnTombstoneUsage =
176
+ mc.config.getBoolean(throwOnTombstoneUsageKey) === true &&
177
+ tombstoneEnforcementAllowed &&
178
+ !createParams.isSummarizerClient;
179
+
165
180
  return {
166
181
  gcEnabled,
167
182
  sweepEnabled,
@@ -173,10 +188,13 @@ export function generateGCConfigs(
173
188
  sessionExpiryTimeoutMs,
174
189
  sweepTimeoutMs,
175
190
  inactiveTimeoutMs,
176
- throwOnInactiveLoad,
177
191
  persistedGcFeatureMatrix,
178
192
  gcVersionInBaseSnapshot,
179
193
  gcVersionInEffect,
194
+ throwOnInactiveLoad,
195
+ tombstoneEnforcementAllowed,
196
+ throwOnTombstoneLoad,
197
+ throwOnTombstoneUsage,
180
198
  };
181
199
  }
182
200
 
@@ -212,8 +212,6 @@ export interface IGarbageCollectionRuntime {
212
212
  getNodeType(nodePath: string): GCNodeType;
213
213
  /** Called when the runtime should close because of an error. */
214
214
  closeFn: (error?: ICriticalContainerError) => void;
215
- /** If false, loading or using a Tombstoned object should merely log, not fail */
216
- gcTombstoneEnforcementAllowed: boolean;
217
215
  }
218
216
 
219
217
  /** Defines the contract for the garbage collector. */
@@ -224,6 +222,12 @@ export interface IGarbageCollector {
224
222
  readonly summaryStateNeedsReset: boolean;
225
223
  /** The count of data stores whose GC state updated since the last summary. */
226
224
  readonly updatedDSCountSinceLastSummary: number;
225
+ /** Tells whether tombstone feature is enabled and enforced. */
226
+ readonly tombstoneEnforcementAllowed: boolean;
227
+ /** Tells whether loading a tombstone object should fail or merely log. */
228
+ readonly throwOnTombstoneLoad: boolean;
229
+ /** Tells whether using a tombstone object should fail or merely log. */
230
+ readonly throwOnTombstoneUsage: boolean;
227
231
  /** Initialize the state from the base snapshot after its creation. */
228
232
  initializeBaseState(): Promise<void>;
229
233
  /** Run garbage collection and update the reference / used state of the system. */
@@ -354,8 +358,6 @@ export interface IGarbageCollectorConfigs {
354
358
  readonly sweepTimeoutMs: number | undefined;
355
359
  /** The time after which an unreferenced node is inactive. */
356
360
  readonly inactiveTimeoutMs: number;
357
- /** It is easier for users to diagnose InactiveObject usage if we throw on load, which this option enables */
358
- readonly throwOnInactiveLoad: boolean | undefined;
359
361
  /** Tracks whether GC should run in test mode. In this mode, unreferenced objects are deleted immediately. */
360
362
  readonly testMode: boolean;
361
363
  /**
@@ -371,6 +373,14 @@ export interface IGarbageCollectorConfigs {
371
373
  readonly gcVersionInBaseSnapshot: GCVersion | undefined;
372
374
  /** The current version of GC data in the running code */
373
375
  readonly gcVersionInEffect: GCVersion;
376
+ /** It is easier for users to diagnose InactiveObject usage if we throw on load, which this option enables */
377
+ readonly throwOnInactiveLoad: boolean | undefined;
378
+ /** If false, loading or using a Tombstoned object should merely log, not fail */
379
+ readonly tombstoneEnforcementAllowed: boolean;
380
+ /** If true, throw an error when a tombstone data store is retrieved */
381
+ readonly throwOnTombstoneLoad: boolean;
382
+ /** If true, throw an error when a tombstone data store is used. */
383
+ readonly throwOnTombstoneUsage: boolean;
374
384
  }
375
385
 
376
386
  /** The state of node that is unreferenced. */
@@ -80,10 +80,9 @@ export class GCTelemetryTracker {
80
80
  private readonly mc: MonitoringContext,
81
81
  private readonly configs: Pick<
82
82
  IGarbageCollectorConfigs,
83
- "inactiveTimeoutMs" | "sweepTimeoutMs"
83
+ "inactiveTimeoutMs" | "sweepTimeoutMs" | "tombstoneEnforcementAllowed"
84
84
  >,
85
85
  private readonly isSummarizerClient: boolean,
86
- private readonly gcTombstoneEnforcementAllowed: boolean,
87
86
  private readonly createContainerMetadata: ICreateContainerMetadata,
88
87
  private readonly getNodeType: (nodeId: string) => GCNodeType,
89
88
  private readonly getNodeStateTracker: (
@@ -184,7 +183,7 @@ export class GCTelemetryTracker {
184
183
  eventName: `GC_Tombstone_${nodeType}_Revived`,
185
184
  category: "generic",
186
185
  ...tagCodeArtifacts({ url: id }),
187
- gcTombstoneEnforcementAllowed: this.gcTombstoneEnforcementAllowed,
186
+ gcTombstoneEnforcementAllowed: this.configs.tombstoneEnforcementAllowed,
188
187
  },
189
188
  undefined /* packagePath */,
190
189
  );
package/src/gc/index.ts CHANGED
@@ -31,15 +31,11 @@ export {
31
31
  stableGCVersion,
32
32
  disableAttachmentBlobSweepKey,
33
33
  disableDatastoreSweepKey,
34
- throwOnTombstoneLoadKey,
35
- throwOnTombstoneUsageKey,
36
34
  UnreferencedState,
37
35
  } from "./gcDefinitions";
38
36
  export {
39
37
  cloneGCData,
40
38
  concatGarbageCollectionStates,
41
- shouldAllowGcTombstoneEnforcement,
42
- shouldAllowGcSweep,
43
39
  trimLeadingAndTrailingSlashes,
44
40
  unpackChildNodesGCDetails,
45
41
  } from "./gcHelpers";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.0.0-dev.7.2.0.203917";
9
+ export const pkgVersion = "2.0.0-dev.7.2.0.205722";