@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
@@ -84,6 +84,10 @@ export function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttribu
84
84
  export function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean {
85
85
  return !!attributes.summaryFormatVersion && !attributes.disableIsolatedChannels;
86
86
  }
87
+
88
+ /**
89
+ * @public
90
+ */
87
91
  export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {
88
92
  readonly summaryFormatVersion: 1;
89
93
  /** The last message processed at the time of summary. Only primitive property types are added to the summary. */
@@ -98,6 +102,9 @@ export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGC
98
102
  readonly idCompressorEnabled?: boolean;
99
103
  }
100
104
 
105
+ /**
106
+ * @public
107
+ */
101
108
  export interface ICreateContainerMetadata {
102
109
  /** Runtime version of the container when it was first created */
103
110
  createContainerRuntimeVersion?: string;
@@ -105,7 +112,10 @@ export interface ICreateContainerMetadata {
105
112
  createContainerTimestamp?: number;
106
113
  }
107
114
 
108
- /** The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary. */
115
+ /**
116
+ * The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary.
117
+ * @public
118
+ */
109
119
  export type ISummaryMetadataMessage = Pick<
110
120
  ISequencedDocumentMessage,
111
121
  | "clientId"
@@ -47,12 +47,12 @@ export async function raceTimer<T>(
47
47
  cancellationToken?: ISummaryCancellationToken,
48
48
  ): Promise<raceTimerResult<T>> {
49
49
  const promises: Promise<raceTimerResult<T>>[] = [
50
- promise.then((value) => ({ result: "done", value } as const)),
51
- timer.then(({ timerResult: result }) => ({ result } as const)),
50
+ promise.then((value) => ({ result: "done", value }) as const),
51
+ timer.then(({ timerResult: result }) => ({ result }) as const),
52
52
  ];
53
53
  if (cancellationToken !== undefined) {
54
54
  promises.push(
55
- cancellationToken.waitCancelled.then(() => ({ result: "cancelled" } as const)),
55
+ cancellationToken.waitCancelled.then(() => ({ result: "cancelled" }) as const),
56
56
  );
57
57
  }
58
58
  return Promise.race(promises);
@@ -114,7 +114,7 @@ export class SummaryManager extends TypedEventEmitter<ISummarizerEvents> impleme
114
114
  parentLogger: ITelemetryBaseLogger,
115
115
  /** Creates summarizer by asking interactive container to spawn summarizing container and
116
116
  * get back its Summarizer instance. */
117
- private readonly requestSummarizerFn: () => Promise<ISummarizer>,
117
+ private readonly createSummarizerFn: () => Promise<ISummarizer>,
118
118
  private readonly startThrottler: IThrottler,
119
119
  {
120
120
  initialDelayMs = defaultInitialDelayMs,
@@ -264,7 +264,7 @@ export class SummaryManager extends TypedEventEmitter<ISummarizerEvents> impleme
264
264
  );
265
265
  this.state = SummaryManagerState.Running;
266
266
 
267
- const summarizer = await this.requestSummarizerFn();
267
+ const summarizer = await this.createSummarizerFn();
268
268
  this.summarizer = summarizer;
269
269
  this.summarizer.on("summarize", this.handleSummarizeEvent);
270
270
 
@@ -1,145 +0,0 @@
1
- # Garbage Collection: Advanced configuration for early adopters
2
-
3
- _For a technical overview of Garbage Collection, start with [GarbageCollection.md](./garbageCollection.md)_
4
-
5
- GC Sweep is not yet enabled by default, and until that time early adopters have several configuration options available
6
- for how to enable GC and monitor for any GC-impacting bugs that would need to be mitigated.
7
-
8
- Please refer to the section [Techniques Used for Configuration](./garbageCollection.md#techniques-used-for-configuration)
9
- before continuing, to ensure you're familiar with using "GC Options" and "Config Settings" for configuring GC.
10
-
11
- ## What's on by default
12
-
13
- GC Mark Phase is enabled by default, which includes marking objects that are ready to be deleted as Tombstones.
14
- FF will log an informational event if/when a Tombstoned object is loaded - a scenario that would represent data loss if Sweep were enabled.
15
- The eventName for the Tombstone log ends with `GC_Tombstone_DataStore_Requested`.
16
-
17
- There's a similar event logged long before an object is Tombstoned. Ater only 7 days (configurable), an unreferenced object is considered
18
- "Inactive", and FF will log if an Inactive object is loaded as well.
19
- The eventName for the Inactive log ends with `InactiveObject_Loaded`.
20
-
21
- ## Getting earlier signals: Shortening the InactiveObject timeout
22
-
23
- The default timeout for an unreferenced object to become "Inactive" is 7 days. This is intended to be long enough such that
24
- it's very unlikely to hit a legitimate case where an object is revived within the same session it was deleted (e.g. delete then undo).
25
- Based on your application's user experience, you may choose to shorten this timeout to get an earlier signal (but beware of false positives).
26
-
27
- To override the default InactiveObject timeout, use the `inactiveTimeoutMs` GC Option.
28
- There's also a Config Setting which can be used for testing (if the Config Provider allows overriding via localStorage/sessionStorage):
29
- `Fluid.GarbageCollection.TestOverride.InactiveTimeoutMs`
30
-
31
- ## Enabling Tombstone Enforcement
32
-
33
- By default, GC is marking objects as Tombstoned, but merely logging if they're used after that point.
34
- You can enable enforcement of Tombstone objects to simulate real Sweep while having the peace of mind
35
- that the data is not yet deleted from the user's file, and can be recovered.
36
-
37
- The first step is to prevent the Fluid Framework from loading a Tombstoned object (via `handle.get()` as described previously),
38
- by using this Config Setting:
39
-
40
- ```ts
41
- "Fluid.GarbageCollection.ThrowOnTombstoneLoad": true
42
- ```
43
-
44
- Now, even with `Fluid.GarbageCollection.ThrowOnTombstoneLoad` set to true, changes to a Tombstoned object will be allowed.
45
- This is required for the advanced recovery options to work, explained [below](#advanced-back-door-recovering-and-reviving-tombstoned-objects).
46
-
47
- To instruct FF to treat Tombstoned objects as if they are truly not present in the document, use this Config Setting:
48
-
49
- ```ts
50
- "Fluid.GarbageCollection.ThrowOnTombstoneUsage": true
51
- ```
52
-
53
- ### In case of emergency: Bumping the gcTombstoneGeneration
54
-
55
- GC includes a mechanism for Tombstone by which all new documents may be stamped with a "Generation" number,
56
- and if set then Tombstone is only enforceable for documents of the latest Generation. This number is specified
57
- via the `gcTombstoneGeneration` GC Option, and will not change over the lifetime of a given document.
58
-
59
- In case a bug is released that is found to cause GC errors, a bump to the gcTombstoneGeneration can be incuded
60
- with the fix, which will prevent any user pain for those potentially affected documents that were exposed to the bug.
61
-
62
- If gcTombstoneGeneration is unset, Tombstone enforcement will be enabled/disabled as otherwise configured.
63
- In other words, until you start using this, Tombstone enforcement will apply to all documents.
64
-
65
- ### Advanced "Back door": Recovering and reviving Tombstoned objects
66
-
67
- If your application has Tombstone enabled and your users are encountering Tombstones - even at the point where
68
- Tombstone enforcement is enabled - there is a way to still access these objects to recover them and property
69
- reference them ("revival"). However, please understand that this is an advanced and unsupported path that may
70
- be immediately deprecated at any time.
71
-
72
- As mentioned above, bumping the gcTombstoneGeneration will free up impacted documents, but that's a permanent
73
- mitigation - those documents will never be exposed to GC Tombstone or Sweep.
74
-
75
- If there's a particular codepath in your application where objects being loaded may be Tombstoned,
76
- you may use this advanced "back door" to recover them and then properly reference them, thus restoring the document.
77
- For this to work, you must disable the `Fluid.GarbageCollection.ThrowOnTombstoneUsage` Config Setting.
78
-
79
- When a Tombstoned object (via `handle.get()`) fails to load, the 404 response error object has an `underlyingResponseHeaders` with the
80
- `isTombstoned` flag set to true: i.e. `error.underlyingResponseHeaders?.isTombstoned === true`. In this case,
81
- you may turn around and use `IContainerRuntimeWithResolveHandle_Deprecated.resolveHandle` with `allowTombstone: true` in `IRequest.headers` to request
82
- the object again - this time it will succeed.
83
-
84
- To be very clear once again - This path uses deprecated APIs (`resolveHandle`) and comes with no guarantees of support.
85
-
86
- ### Tombstones and the Summarizer Client
87
-
88
- Note: The Summarizer client will _never_ throw on usage or load of a Tombstoned object.
89
-
90
- ## Enabling Sweep
91
-
92
- To enable Sweep for the first time, set this GC Option:
93
-
94
- ```ts
95
- gcSweepGeneration: 0;
96
- ```
97
-
98
- This will enable sweep for all documents moving forward _as well as_ any documents created with `gcTombstoneGeneration: 0`
99
- (this is a special case in the code).
100
-
101
- ### A caveat...
102
-
103
- If you used `gcTombstoneGeneration` **and ever bumped it**, you should skip 0 here to avoid enabling Sweep for old / at-risk documents:
104
-
105
- ```ts
106
- gcSweepGeneration: 1;
107
- ```
108
-
109
- Remember, you can always bump `gcSweepGeneration` to disable Sweep for all existing documents and start fresh,
110
- in case a major bug is discovered and fixed.
111
-
112
- ### More about gcSweepGeneration and gcTombstoneGeneration
113
-
114
- `gcSweepGeneration` is persisted and immutable in the document, just like `gcTombstoneGeneration`.
115
- However, behavior differs in a few important ways.
116
-
117
- For Tombstone, if `gcTombstoneGeneration` is not set, Tombstone enforcement will be **enabled**.
118
- For Sweep however, if `gcSweepGeneration` is not set, Sweep enforcement will be **disabled**.
119
-
120
- This means that until the `gcSweepGeneration` GC Option is set, _no existing document will be eligible for Sweep, ever_.
121
- So all documents created since the most recent bump to the gcSweepGeneration will have Sweep enabled.
122
- Note that if `gcSweepGeneration` is set and matches, Tombstone Mode is off for the session and `gcTombstoneGeneration` is ignored.
123
-
124
- And as mentioned above, there is a special case when `gcSweepGeneration === 0`: Any document with `gcTombstoneGeneration: 0` will
125
- be eligible for Sweep as well. This was done for historical reasons due to circumstances during GC's development.
126
-
127
- ## More Advanced Configurations
128
-
129
- There are a handful of other configuration options/settings that can be used to tweak GC's behavior,
130
- mostly for testing. Please refer to the function [`generateGCConfigs` in gcConfigs.ts](./gcConfigs.ts) and the
131
- [setting/option names listed in gcDefinitions.ts](./gcDefinitions.ts) for the full story.
132
-
133
- Examples of available advanced configuration include:
134
-
135
- - Disabling GC permanently for new files
136
- - Overriding GC Mark/Sweep enablement for this session:
137
- - Disabling running GC Mark and/or Sweep phases for this session
138
- - Forcing GC Mark and/or Sweep to run for this session even if otherwise it would be disabled
139
- - Disabling Tombstone Mode (don't even mark objects as Tombstones)
140
- - Disabling the deletion of either DataStores or AttachmentBlobs independent of one another (when Sweep is enabled)
141
- - Overriding the default Session Expiry for new files (or disabling it altogether, which will also disable Tombstone/Sweep)
142
- - Overriding the Sweep Timeout, _independent of Session Expiry_, so use with care (for testing purposes only - data loss could occur)
143
- - Running in "Test Mode", where objects are deleted as soon as they're unreferenced
144
- - Force "Full GC" to run, which ignores incremental optimizations based on previously computed GC Data
145
- - Treat InactiveObjects like Tombstones: throw an error on load (with the same back door to follow-up with a successful request)