@fluidframework/container-runtime 2.0.0-internal.7.0.0 → 2.0.0-internal.7.2.0

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 (248) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/api-extractor.json +1 -1
  3. package/api-report/container-runtime.api.md +864 -0
  4. package/dist/blobManager.d.ts +4 -6
  5. package/dist/blobManager.d.ts.map +1 -1
  6. package/dist/blobManager.js +42 -56
  7. package/dist/blobManager.js.map +1 -1
  8. package/dist/connectionTelemetry.d.ts.map +1 -1
  9. package/dist/connectionTelemetry.js +75 -42
  10. package/dist/connectionTelemetry.js.map +1 -1
  11. package/dist/containerRuntime.d.ts +90 -36
  12. package/dist/containerRuntime.d.ts.map +1 -1
  13. package/dist/containerRuntime.js +125 -59
  14. package/dist/containerRuntime.js.map +1 -1
  15. package/dist/dataStore.js +2 -2
  16. package/dist/dataStore.js.map +1 -1
  17. package/dist/dataStoreContext.d.ts +8 -2
  18. package/dist/dataStoreContext.d.ts.map +1 -1
  19. package/dist/dataStoreContext.js +15 -8
  20. package/dist/dataStoreContext.js.map +1 -1
  21. package/dist/dataStoreRegistry.d.ts +3 -0
  22. package/dist/dataStoreRegistry.d.ts.map +1 -1
  23. package/dist/dataStoreRegistry.js +3 -0
  24. package/dist/dataStoreRegistry.js.map +1 -1
  25. package/dist/dataStores.d.ts +0 -2
  26. package/dist/dataStores.d.ts.map +1 -1
  27. package/dist/dataStores.js +2 -7
  28. package/dist/dataStores.js.map +1 -1
  29. package/dist/deltaManagerProxyBase.d.ts +1 -1
  30. package/dist/deltaManagerProxyBase.d.ts.map +1 -1
  31. package/dist/deltaManagerProxyBase.js +2 -2
  32. package/dist/deltaManagerProxyBase.js.map +1 -1
  33. package/dist/error.d.ts.map +1 -1
  34. package/dist/error.js.map +1 -1
  35. package/dist/gc/garbageCollection.d.ts +6 -0
  36. package/dist/gc/garbageCollection.d.ts.map +1 -1
  37. package/dist/gc/garbageCollection.js +16 -3
  38. package/dist/gc/garbageCollection.js.map +1 -1
  39. package/dist/gc/gcConfigs.d.ts +1 -0
  40. package/dist/gc/gcConfigs.d.ts.map +1 -1
  41. package/dist/gc/gcConfigs.js +12 -2
  42. package/dist/gc/gcConfigs.js.map +1 -1
  43. package/dist/gc/gcDefinitions.d.ts +42 -11
  44. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  45. package/dist/gc/gcDefinitions.js +4 -1
  46. package/dist/gc/gcDefinitions.js.map +1 -1
  47. package/dist/gc/gcSummaryDefinitions.d.ts +1 -1
  48. package/dist/gc/gcSummaryDefinitions.js.map +1 -1
  49. package/dist/gc/gcTelemetry.d.ts +2 -3
  50. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  51. package/dist/gc/gcTelemetry.js +7 -8
  52. package/dist/gc/gcTelemetry.js.map +1 -1
  53. package/dist/gc/index.d.ts +2 -2
  54. package/dist/gc/index.d.ts.map +1 -1
  55. package/dist/gc/index.js +1 -5
  56. package/dist/gc/index.js.map +1 -1
  57. package/dist/id-compressor/utilities.d.ts +3 -0
  58. package/dist/id-compressor/utilities.d.ts.map +1 -1
  59. package/dist/id-compressor/utilities.js +3 -0
  60. package/dist/id-compressor/utilities.js.map +1 -1
  61. package/dist/index.d.ts +4 -3
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +4 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/messageTypes.d.ts +4 -1
  66. package/dist/messageTypes.d.ts.map +1 -1
  67. package/dist/messageTypes.js +3 -0
  68. package/dist/messageTypes.js.map +1 -1
  69. package/dist/opLifecycle/definitions.d.ts +3 -0
  70. package/dist/opLifecycle/definitions.d.ts.map +1 -1
  71. package/dist/opLifecycle/definitions.js.map +1 -1
  72. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  73. package/dist/opLifecycle/outbox.js +7 -2
  74. package/dist/opLifecycle/outbox.js.map +1 -1
  75. package/dist/packageVersion.d.ts +1 -1
  76. package/dist/packageVersion.js +1 -1
  77. package/dist/packageVersion.js.map +1 -1
  78. package/dist/pendingStateManager.d.ts.map +1 -1
  79. package/dist/pendingStateManager.js +3 -1
  80. package/dist/pendingStateManager.js.map +1 -1
  81. package/dist/scheduleManager.js +6 -2
  82. package/dist/scheduleManager.js.map +1 -1
  83. package/dist/summary/orderedClientElection.d.ts +4 -1
  84. package/dist/summary/orderedClientElection.d.ts.map +1 -1
  85. package/dist/summary/orderedClientElection.js.map +1 -1
  86. package/dist/summary/runWhileConnectedCoordinator.d.ts +5 -0
  87. package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  88. package/dist/summary/runWhileConnectedCoordinator.js +1 -0
  89. package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
  90. package/dist/summary/summarizer.d.ts +2 -0
  91. package/dist/summary/summarizer.d.ts.map +1 -1
  92. package/dist/summary/summarizer.js +15 -7
  93. package/dist/summary/summarizer.js.map +1 -1
  94. package/dist/summary/summarizerTypes.d.ts +94 -10
  95. package/dist/summary/summarizerTypes.d.ts.map +1 -1
  96. package/dist/summary/summarizerTypes.js.map +1 -1
  97. package/dist/summary/summaryCollection.d.ts +16 -0
  98. package/dist/summary/summaryCollection.d.ts.map +1 -1
  99. package/dist/summary/summaryCollection.js +2 -0
  100. package/dist/summary/summaryCollection.js.map +1 -1
  101. package/dist/summary/summaryFormat.d.ts +10 -1
  102. package/dist/summary/summaryFormat.d.ts.map +1 -1
  103. package/dist/summary/summaryFormat.js.map +1 -1
  104. package/dist/summary/summaryGenerator.js.map +1 -1
  105. package/dist/summary/summaryManager.d.ts +2 -2
  106. package/dist/summary/summaryManager.d.ts.map +1 -1
  107. package/dist/summary/summaryManager.js +3 -3
  108. package/dist/summary/summaryManager.js.map +1 -1
  109. package/dist/tsdoc-metadata.json +1 -1
  110. package/lib/blobManager.d.ts +4 -6
  111. package/lib/blobManager.d.ts.map +1 -1
  112. package/lib/blobManager.js +44 -58
  113. package/lib/blobManager.js.map +1 -1
  114. package/lib/connectionTelemetry.d.ts.map +1 -1
  115. package/lib/connectionTelemetry.js +76 -43
  116. package/lib/connectionTelemetry.js.map +1 -1
  117. package/lib/containerRuntime.d.ts +90 -36
  118. package/lib/containerRuntime.d.ts.map +1 -1
  119. package/lib/containerRuntime.js +125 -62
  120. package/lib/containerRuntime.js.map +1 -1
  121. package/lib/dataStore.js +2 -2
  122. package/lib/dataStore.js.map +1 -1
  123. package/lib/dataStoreContext.d.ts +8 -2
  124. package/lib/dataStoreContext.d.ts.map +1 -1
  125. package/lib/dataStoreContext.js +16 -9
  126. package/lib/dataStoreContext.js.map +1 -1
  127. package/lib/dataStoreRegistry.d.ts +3 -0
  128. package/lib/dataStoreRegistry.d.ts.map +1 -1
  129. package/lib/dataStoreRegistry.js +3 -0
  130. package/lib/dataStoreRegistry.js.map +1 -1
  131. package/lib/dataStores.d.ts +0 -2
  132. package/lib/dataStores.d.ts.map +1 -1
  133. package/lib/dataStores.js +3 -8
  134. package/lib/dataStores.js.map +1 -1
  135. package/lib/deltaManagerProxyBase.d.ts +1 -1
  136. package/lib/deltaManagerProxyBase.d.ts.map +1 -1
  137. package/lib/deltaManagerProxyBase.js +2 -2
  138. package/lib/deltaManagerProxyBase.js.map +1 -1
  139. package/lib/error.d.ts.map +1 -1
  140. package/lib/error.js.map +1 -1
  141. package/lib/gc/garbageCollection.d.ts +6 -0
  142. package/lib/gc/garbageCollection.d.ts.map +1 -1
  143. package/lib/gc/garbageCollection.js +16 -3
  144. package/lib/gc/garbageCollection.js.map +1 -1
  145. package/lib/gc/gcConfigs.d.ts +1 -0
  146. package/lib/gc/gcConfigs.d.ts.map +1 -1
  147. package/lib/gc/gcConfigs.js +14 -4
  148. package/lib/gc/gcConfigs.js.map +1 -1
  149. package/lib/gc/gcDefinitions.d.ts +42 -11
  150. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  151. package/lib/gc/gcDefinitions.js +4 -1
  152. package/lib/gc/gcDefinitions.js.map +1 -1
  153. package/lib/gc/gcSummaryDefinitions.d.ts +1 -1
  154. package/lib/gc/gcSummaryDefinitions.js.map +1 -1
  155. package/lib/gc/gcTelemetry.d.ts +2 -3
  156. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  157. package/lib/gc/gcTelemetry.js +7 -8
  158. package/lib/gc/gcTelemetry.js.map +1 -1
  159. package/lib/gc/index.d.ts +2 -2
  160. package/lib/gc/index.d.ts.map +1 -1
  161. package/lib/gc/index.js +2 -2
  162. package/lib/gc/index.js.map +1 -1
  163. package/lib/id-compressor/utilities.d.ts +3 -0
  164. package/lib/id-compressor/utilities.d.ts.map +1 -1
  165. package/lib/id-compressor/utilities.js +3 -0
  166. package/lib/id-compressor/utilities.js.map +1 -1
  167. package/lib/index.d.ts +4 -3
  168. package/lib/index.d.ts.map +1 -1
  169. package/lib/index.js +2 -1
  170. package/lib/index.js.map +1 -1
  171. package/lib/messageTypes.d.ts +4 -1
  172. package/lib/messageTypes.d.ts.map +1 -1
  173. package/lib/messageTypes.js +3 -0
  174. package/lib/messageTypes.js.map +1 -1
  175. package/lib/opLifecycle/definitions.d.ts +3 -0
  176. package/lib/opLifecycle/definitions.d.ts.map +1 -1
  177. package/lib/opLifecycle/definitions.js.map +1 -1
  178. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  179. package/lib/opLifecycle/outbox.js +7 -2
  180. package/lib/opLifecycle/outbox.js.map +1 -1
  181. package/lib/packageVersion.d.ts +1 -1
  182. package/lib/packageVersion.js +1 -1
  183. package/lib/packageVersion.js.map +1 -1
  184. package/lib/pendingStateManager.d.ts.map +1 -1
  185. package/lib/pendingStateManager.js +3 -1
  186. package/lib/pendingStateManager.js.map +1 -1
  187. package/lib/scheduleManager.js +6 -2
  188. package/lib/scheduleManager.js.map +1 -1
  189. package/lib/summary/orderedClientElection.d.ts +4 -1
  190. package/lib/summary/orderedClientElection.d.ts.map +1 -1
  191. package/lib/summary/orderedClientElection.js.map +1 -1
  192. package/lib/summary/runWhileConnectedCoordinator.d.ts +5 -0
  193. package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
  194. package/lib/summary/runWhileConnectedCoordinator.js +1 -0
  195. package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
  196. package/lib/summary/summarizer.d.ts +2 -0
  197. package/lib/summary/summarizer.d.ts.map +1 -1
  198. package/lib/summary/summarizer.js +16 -8
  199. package/lib/summary/summarizer.js.map +1 -1
  200. package/lib/summary/summarizerTypes.d.ts +94 -10
  201. package/lib/summary/summarizerTypes.d.ts.map +1 -1
  202. package/lib/summary/summarizerTypes.js.map +1 -1
  203. package/lib/summary/summaryCollection.d.ts +16 -0
  204. package/lib/summary/summaryCollection.d.ts.map +1 -1
  205. package/lib/summary/summaryCollection.js +2 -0
  206. package/lib/summary/summaryCollection.js.map +1 -1
  207. package/lib/summary/summaryFormat.d.ts +10 -1
  208. package/lib/summary/summaryFormat.d.ts.map +1 -1
  209. package/lib/summary/summaryFormat.js.map +1 -1
  210. package/lib/summary/summaryGenerator.js.map +1 -1
  211. package/lib/summary/summaryManager.d.ts +2 -2
  212. package/lib/summary/summaryManager.d.ts.map +1 -1
  213. package/lib/summary/summaryManager.js +3 -3
  214. package/lib/summary/summaryManager.js.map +1 -1
  215. package/package.json +26 -58
  216. package/src/blobManager.ts +61 -74
  217. package/src/connectionTelemetry.ts +97 -52
  218. package/src/containerRuntime.ts +173 -93
  219. package/src/dataStore.ts +2 -2
  220. package/src/dataStoreContext.ts +16 -9
  221. package/src/dataStoreRegistry.ts +3 -0
  222. package/src/dataStores.ts +4 -16
  223. package/src/deltaManagerProxyBase.ts +2 -2
  224. package/src/error.ts +4 -1
  225. package/src/gc/garbageCollection.ts +18 -3
  226. package/src/gc/gcConfigs.ts +22 -4
  227. package/src/gc/gcDefinitions.ts +43 -11
  228. package/src/gc/gcSummaryDefinitions.ts +1 -1
  229. package/src/gc/gcTelemetry.ts +8 -8
  230. package/src/gc/index.ts +0 -4
  231. package/src/id-compressor/utilities.ts +3 -0
  232. package/src/index.ts +14 -1
  233. package/src/messageTypes.ts +4 -1
  234. package/src/opLifecycle/README.md +53 -28
  235. package/src/opLifecycle/definitions.ts +3 -0
  236. package/src/opLifecycle/outbox.ts +3 -0
  237. package/src/packageVersion.ts +1 -1
  238. package/src/pendingStateManager.ts +1 -0
  239. package/src/scheduleManager.ts +2 -0
  240. package/src/summary/orderedClientElection.ts +4 -1
  241. package/src/summary/runWhileConnectedCoordinator.ts +5 -1
  242. package/src/summary/summarizer.ts +21 -9
  243. package/src/summary/summarizerTypes.ts +95 -11
  244. package/src/summary/summaryCollection.ts +19 -1
  245. package/src/summary/summaryFormat.ts +11 -1
  246. package/src/summary/summaryGenerator.ts +3 -3
  247. package/src/summary/summaryManager.ts +2 -2
  248. package/src/gc/gcEarlyAdoption.md +0 -145
@@ -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 =
@@ -458,6 +454,11 @@ export abstract class FluidDataStoreContext
458
454
  const channel = await factory.instantiateDataStore(this, existing);
459
455
  assert(channel !== undefined, 0x140 /* "undefined channel on datastore context" */);
460
456
  this.bindRuntime(channel);
457
+ // This data store may have been disposed before the channel is created during realization. If so,
458
+ // dispose the channel now.
459
+ if (this.disposed) {
460
+ channel.dispose();
461
+ }
461
462
  }
462
463
 
463
464
  /**
@@ -720,11 +721,17 @@ export abstract class FluidDataStoreContext
720
721
  }
721
722
  }
722
723
 
723
- public submitSignal(type: string, content: any) {
724
+ /**
725
+ * Submits the signal to be sent to other clients.
726
+ * @param type - Type of the signal.
727
+ * @param content - Content of the signal.
728
+ * @param targetClientId - When specified, the signal is only sent to the provided client id.
729
+ */
730
+ public submitSignal(type: string, content: any, targetClientId?: string) {
724
731
  this.verifyNotClosed("submitSignal");
725
732
 
726
733
  assert(!!this.channel, 0x147 /* "Channel must exist on submitting signal" */);
727
- return this._containerRuntime.submitDataStoreSignal(this.id, type, content);
734
+ return this._containerRuntime.submitDataStoreSignal(this.id, type, content, targetClientId);
728
735
  }
729
736
 
730
737
  /**
@@ -815,7 +822,7 @@ export abstract class FluidDataStoreContext
815
822
  }
816
823
 
817
824
  /**
818
- * @deprecated - The functionality to get base GC details has been moved to summarizer node.
825
+ * @deprecated The functionality to get base GC details has been moved to summarizer node.
819
826
  */
820
827
  public async getBaseGCDetails(): Promise<IGarbageCollectionDetailsBase> {
821
828
  return {};
@@ -9,6 +9,9 @@ import {
9
9
  NamedFluidDataStoreRegistryEntries,
10
10
  } from "@fluidframework/runtime-definitions";
11
11
 
12
+ /**
13
+ * @public
14
+ */
12
15
  export class FluidDataStoreRegistry implements IFluidDataStoreRegistry {
13
16
  private readonly map: Map<
14
17
  string,
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
  }
@@ -101,8 +101,8 @@ export class DeltaManagerProxyBase
101
101
  super.dispose();
102
102
  }
103
103
 
104
- public submitSignal(content: any): void {
105
- return this.deltaManager.submitSignal(content);
104
+ public submitSignal(content: any, targetClientId?: string): void {
105
+ return this.deltaManager.submitSignal(content, targetClientId);
106
106
  }
107
107
 
108
108
  public flush(): void {
package/src/error.ts CHANGED
@@ -12,7 +12,10 @@ import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
12
12
  export class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase {
13
13
  readonly errorType = ContainerErrorTypes.clientSessionExpiredError;
14
14
 
15
- constructor(message: string, readonly expiryMs: number) {
15
+ constructor(
16
+ message: string,
17
+ readonly expiryMs: number,
18
+ ) {
16
19
  super(message, { timeoutMs: expiryMs });
17
20
  }
18
21
  }
@@ -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),
@@ -881,8 +893,11 @@ export class GarbageCollector implements IGarbageCollector {
881
893
  viaHandle: requestHeaders?.[RuntimeHeaders.viaHandle],
882
894
  });
883
895
 
884
- // Unless this is a Loaded event, we're done after telemetry tracking
885
- if (reason !== "Loaded") {
896
+ // Unless this is a Loaded event for a Blob or DataStore, we're done after telemetry tracking
897
+ if (
898
+ reason !== "Loaded" ||
899
+ ![GCNodeType.Blob, GCNodeType.DataStore].includes(this.runtime.getNodeType(nodePath))
900
+ ) {
886
901
  return;
887
902
  }
888
903
 
@@ -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
 
@@ -20,6 +20,9 @@ import {
20
20
  IRefreshSummaryResult,
21
21
  } from "../summary";
22
22
 
23
+ /**
24
+ * @public
25
+ */
23
26
  export type GCVersion = number;
24
27
 
25
28
  /** The stable/default version of GC Data */
@@ -80,7 +83,10 @@ export const maxSnapshotCacheExpiryMs = 5 * oneDayMs;
80
83
  export const defaultInactiveTimeoutMs = 7 * oneDayMs; // 7 days
81
84
  export const defaultSessionExpiryDurationMs = 30 * oneDayMs; // 30 days
82
85
 
83
- /** @see IGCMetadata.gcFeatureMatrix */
86
+ /**
87
+ * @see IGCMetadata.gcFeatureMatrix
88
+ * @public
89
+ */
84
90
  export interface GCFeatureMatrix {
85
91
  /**
86
92
  * The Tombstone Generation value in effect when this file was created.
@@ -96,6 +102,9 @@ export interface GCFeatureMatrix {
96
102
  sweepGeneration?: number;
97
103
  }
98
104
 
105
+ /**
106
+ * @public
107
+ */
99
108
  export interface IGCMetadata {
100
109
  /**
101
110
  * The version of the GC code that was run to generate the GC data that is written in the summary.
@@ -119,11 +128,11 @@ export interface IGCMetadata {
119
128
  */
120
129
  readonly gcFeatureMatrix?: GCFeatureMatrix;
121
130
  /**
122
- * @deprecated - @see GCFeatureMatrix.sweepGeneration
123
- *
124
131
  * Tells whether the GC sweep phase is enabled for this container.
125
132
  * - True means sweep phase is enabled.
126
133
  * - False means sweep phase is disabled. If GC is disabled as per gcFeature, sweep is also disabled.
134
+ *
135
+ * @deprecated use GCFeatureMatrix.sweepGeneration instead. @see GCFeatureMatrix.sweepGeneration
127
136
  */
128
137
  readonly sweepEnabled?: boolean;
129
138
  /** If this is present, the session for this container will expire after this time and the container will close */
@@ -132,7 +141,10 @@ export interface IGCMetadata {
132
141
  readonly sweepTimeoutMs?: number;
133
142
  }
134
143
 
135
- /** The statistics of the system state after a garbage collection run. */
144
+ /**
145
+ * The statistics of the system state after a garbage collection run.
146
+ * @public
147
+ */
136
148
  export interface IGCStats {
137
149
  /** The number of nodes in the container. */
138
150
  nodeCount: number;
@@ -154,7 +166,10 @@ export interface IGCStats {
154
166
  updatedAttachmentBlobCount: number;
155
167
  }
156
168
 
157
- /** The types of GC nodes in the GC reference graph. */
169
+ /**
170
+ * The types of GC nodes in the GC reference graph.
171
+ * @public
172
+ */
158
173
  export const GCNodeType = {
159
174
  // Nodes that are for data stores.
160
175
  DataStore: "DataStore",
@@ -165,7 +180,11 @@ export const GCNodeType = {
165
180
  // Nodes that are neither of the above. For example, root node.
166
181
  Other: "Other",
167
182
  };
168
- export type GCNodeType = typeof GCNodeType[keyof typeof GCNodeType];
183
+
184
+ /**
185
+ * @public
186
+ */
187
+ export type GCNodeType = (typeof GCNodeType)[keyof typeof GCNodeType];
169
188
 
170
189
  /**
171
190
  * Defines the APIs for the runtime object to be passed to the garbage collector.
@@ -193,8 +212,6 @@ export interface IGarbageCollectionRuntime {
193
212
  getNodeType(nodePath: string): GCNodeType;
194
213
  /** Called when the runtime should close because of an error. */
195
214
  closeFn: (error?: ICriticalContainerError) => void;
196
- /** If false, loading or using a Tombstoned object should merely log, not fail */
197
- gcTombstoneEnforcementAllowed: boolean;
198
215
  }
199
216
 
200
217
  /** Defines the contract for the garbage collector. */
@@ -205,6 +222,12 @@ export interface IGarbageCollector {
205
222
  readonly summaryStateNeedsReset: boolean;
206
223
  /** The count of data stores whose GC state updated since the last summary. */
207
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;
208
231
  /** Initialize the state from the base snapshot after its creation. */
209
232
  initializeBaseState(): Promise<void>;
210
233
  /** Run garbage collection and update the reference / used state of the system. */
@@ -260,6 +283,9 @@ export interface IGarbageCollectorCreateParams {
260
283
  readonly activeConnection: () => boolean;
261
284
  }
262
285
 
286
+ /**
287
+ * @public
288
+ */
263
289
  export interface IGCRuntimeOptions {
264
290
  /**
265
291
  * Flag that if true, will enable running garbage collection (GC) for a new container.
@@ -332,8 +358,6 @@ export interface IGarbageCollectorConfigs {
332
358
  readonly sweepTimeoutMs: number | undefined;
333
359
  /** The time after which an unreferenced node is inactive. */
334
360
  readonly inactiveTimeoutMs: number;
335
- /** It is easier for users to diagnose InactiveObject usage if we throw on load, which this option enables */
336
- readonly throwOnInactiveLoad: boolean | undefined;
337
361
  /** Tracks whether GC should run in test mode. In this mode, unreferenced objects are deleted immediately. */
338
362
  readonly testMode: boolean;
339
363
  /**
@@ -349,6 +373,14 @@ export interface IGarbageCollectorConfigs {
349
373
  readonly gcVersionInBaseSnapshot: GCVersion | undefined;
350
374
  /** The current version of GC data in the running code */
351
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;
352
384
  }
353
385
 
354
386
  /** The state of node that is unreferenced. */
@@ -360,7 +392,7 @@ export const UnreferencedState = {
360
392
  /** The node is ready to be deleted by the sweep phase. */
361
393
  SweepReady: "SweepReady",
362
394
  } as const;
363
- export type UnreferencedState = typeof UnreferencedState[keyof typeof UnreferencedState];
395
+ export type UnreferencedState = (typeof UnreferencedState)[keyof typeof UnreferencedState];
364
396
 
365
397
  /**
366
398
  * Represents the result of a GC run.
@@ -41,7 +41,7 @@ export interface IGarbageCollectionSnapshotData {
41
41
  }
42
42
 
43
43
  /**
44
- * @deprecated - IGarbageCollectionState is written in the root of the summary now.
44
+ * @deprecated IGarbageCollectionState is written in the root of the summary now.
45
45
  * Legacy GC details from when the GC details were written at the data store's summary tree.
46
46
  */
47
47
  export interface IGarbageCollectionSummaryDetailsLegacy {
@@ -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: (
@@ -96,7 +95,7 @@ export class GCTelemetryTracker {
96
95
 
97
96
  /**
98
97
  * Returns whether an event should be logged for a node that isn't active anymore. Some scenarios where we won't log:
99
- * 1. When a DDS is changed or loaded. The corresponding data store's event will be logged instead.
98
+ * 1. When a DDS is changed. The corresponding data store's event will be logged instead.
100
99
  * 2. An event is logged only once per container instance per event per node.
101
100
  */
102
101
  private shouldLogNonActiveEvent(
@@ -110,12 +109,13 @@ export class GCTelemetryTracker {
110
109
  return false;
111
110
  }
112
111
 
113
- // For sub data store (DDS) nodes, if they are changed or loaded, its data store will also be changed or loaded,
114
- // so skip logging to make the telemetry less noisy.
115
- if (nodeType === GCNodeType.SubDataStore && usageType !== "Revived") {
112
+ if (nodeType === GCNodeType.Other) {
116
113
  return false;
117
114
  }
118
- if (nodeType === GCNodeType.Other) {
115
+
116
+ // For sub data store (DDS) nodes, if they are changed, its data store will also be changed,
117
+ // so skip logging to make the telemetry less noisy.
118
+ if (nodeType === GCNodeType.SubDataStore && usageType === "Changed") {
119
119
  return false;
120
120
  }
121
121
 
@@ -183,7 +183,7 @@ export class GCTelemetryTracker {
183
183
  eventName: `GC_Tombstone_${nodeType}_Revived`,
184
184
  category: "generic",
185
185
  ...tagCodeArtifacts({ url: id }),
186
- gcTombstoneEnforcementAllowed: this.gcTombstoneEnforcementAllowed,
186
+ gcTombstoneEnforcementAllowed: this.configs.tombstoneEnforcementAllowed,
187
187
  },
188
188
  undefined /* packagePath */,
189
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";
@@ -35,6 +35,7 @@ export function createSessionId(): SessionId {
35
35
 
36
36
  /**
37
37
  * Asserts that the given string is a stable ID.
38
+ * @public
38
39
  */
39
40
  export function assertIsStableId(stableId: string): StableId {
40
41
  assert(isStableId(stableId), 0x4a3 /* Expected a StableId */);
@@ -51,6 +52,7 @@ export function assertIsSessionId(stableId: string): SessionId {
51
52
 
52
53
  /**
53
54
  * Generate a random stable ID
55
+ * @public
54
56
  */
55
57
  export function generateStableId(): StableId {
56
58
  return assertIsStableId(v4());
@@ -59,6 +61,7 @@ export function generateStableId(): StableId {
59
61
  /**
60
62
  * Returns true iff the given string is a valid Version 4, variant 2 UUID
61
63
  * 'xxxxxxxx-xxxx-4xxx-vxxx-xxxxxxxxxxxx'
64
+ * @public
62
65
  */
63
66
  export function isStableId(str: string): str is StableId {
64
67
  if (str.length !== 36) {
package/src/index.ts CHANGED
@@ -23,6 +23,7 @@ export {
23
23
  DefaultSummaryConfiguration,
24
24
  ICompressionRuntimeOptions,
25
25
  CompressionAlgorithms,
26
+ TEST_requestSummarizer,
26
27
  } from "./containerRuntime";
27
28
  export {
28
29
  ContainerMessageType,
@@ -31,8 +32,16 @@ export {
31
32
  CompatModeBehavior,
32
33
  RecentlyAddedContainerRuntimeMessageDetails,
33
34
  } from "./messageTypes";
35
+ export { IBlobManagerLoadInfo } from "./blobManager";
34
36
  export { FluidDataStoreRegistry } from "./dataStoreRegistry";
35
- export { IGCRuntimeOptions, IGCStats } from "./gc";
37
+ export {
38
+ GCNodeType,
39
+ IGCMetadata,
40
+ GCFeatureMatrix,
41
+ GCVersion,
42
+ IGCRuntimeOptions,
43
+ IGCStats,
44
+ } from "./gc";
36
45
  export {
37
46
  IAckedSummary,
38
47
  ISummarizer,
@@ -48,6 +57,8 @@ export {
48
57
  IBroadcastSummaryResult,
49
58
  ICancellationToken,
50
59
  IConnectableRuntime,
60
+ IContainerRuntimeMetadata,
61
+ ICreateContainerMetadata,
51
62
  IEnqueueSummarizeOptions,
52
63
  IGenerateSummaryTreeResult,
53
64
  IGeneratedSummaryStats,
@@ -56,6 +67,7 @@ export {
56
67
  IRefreshSummaryAckOptions,
57
68
  ISubmitSummaryOpResult,
58
69
  ISubmitSummaryOptions,
70
+ ISerializedElection,
59
71
  ISummarizeOptions,
60
72
  ISummarizerEvents,
61
73
  ISummarizerInternalsProvider,
@@ -68,6 +80,7 @@ export {
68
80
  ISummary,
69
81
  ISummaryCollectionOpEvents,
70
82
  ISummaryAckMessage,
83
+ ISummaryMetadataMessage,
71
84
  ISummaryNackMessage,
72
85
  ISummaryOpMessage,
73
86
  OpActionEventListener,
@@ -14,6 +14,9 @@ import {
14
14
  import { IDataStoreAliasMessage } from "./dataStore";
15
15
  import { IChunkedOp } from "./opLifecycle";
16
16
 
17
+ /**
18
+ * @public
19
+ */
17
20
  export enum ContainerMessageType {
18
21
  // An op to be delivered to store
19
22
  FluidDataStoreOp = "component",
@@ -210,7 +213,7 @@ export type InboundSequencedRecentlyAddedContainerRuntimeMessage = ISequencedDoc
210
213
  * IMPORTANT: when creating one to be serialized, set the properties in the order they appear here.
211
214
  * This way stringified values can be compared.
212
215
  *
213
- * @deprecated - this is an internal type which should not be used outside of the package.
216
+ * @deprecated this is an internal type which should not be used outside of the package.
214
217
  * Internally, it is superseded by `TypedContainerRuntimeMessage`.
215
218
  *
216
219
  * @internal