@fluidframework/container-runtime 2.23.0-325054 → 2.30.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.
- package/CHANGELOG.md +52 -0
- package/api-report/container-runtime.legacy.alpha.api.md +0 -246
- package/dist/blobManager/blobManager.d.ts +11 -9
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +38 -39
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/blobManager/blobManagerSnapSum.d.ts +2 -4
- package/dist/blobManager/blobManagerSnapSum.d.ts.map +1 -1
- package/dist/blobManager/blobManagerSnapSum.js +6 -6
- package/dist/blobManager/blobManagerSnapSum.js.map +1 -1
- package/dist/channelCollection.d.ts +1 -7
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +1 -26
- package/dist/channelCollection.js.map +1 -1
- package/dist/connectionTelemetry.d.ts +0 -43
- package/dist/connectionTelemetry.d.ts.map +1 -1
- package/dist/connectionTelemetry.js.map +1 -1
- package/dist/containerRuntime.d.ts +21 -141
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +49 -290
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +0 -13
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +2 -25
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +2 -20
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +0 -2
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +8 -24
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +1 -3
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +1 -4
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/dist/gc/gcSummaryStateTracker.js +0 -1
- package/dist/gc/gcSummaryStateTracker.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +4 -16
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +0 -29
- package/dist/messageTypes.d.ts.map +1 -1
- package/dist/messageTypes.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/signalTelemetryProcessing.d.ts +33 -0
- package/dist/signalTelemetryProcessing.d.ts.map +1 -0
- package/dist/signalTelemetryProcessing.js +149 -0
- package/dist/signalTelemetryProcessing.js.map +1 -0
- package/dist/summary/documentSchema.d.ts +7 -31
- package/dist/summary/documentSchema.d.ts.map +1 -1
- package/dist/summary/documentSchema.js +2 -18
- package/dist/summary/documentSchema.js.map +1 -1
- package/dist/summary/index.d.ts +2 -1
- package/dist/summary/index.d.ts.map +1 -1
- package/dist/summary/index.js +7 -1
- package/dist/summary/index.js.map +1 -1
- package/dist/summary/orderedClientElection.d.ts +1 -3
- package/dist/summary/orderedClientElection.d.ts.map +1 -1
- package/dist/summary/orderedClientElection.js.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.d.ts +1 -3
- package/dist/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/dist/summary/runWhileConnectedCoordinator.js +2 -7
- package/dist/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/dist/summary/runningSummarizer.d.ts +1 -2
- package/dist/summary/runningSummarizer.d.ts.map +1 -1
- package/dist/summary/runningSummarizer.js +4 -23
- package/dist/summary/runningSummarizer.js.map +1 -1
- package/dist/summary/summarizer.d.ts +2 -5
- package/dist/summary/summarizer.d.ts.map +1 -1
- package/dist/summary/summarizer.js +3 -11
- package/dist/summary/summarizer.js.map +1 -1
- package/dist/summary/summarizerClientElection.d.ts.map +1 -1
- package/dist/summary/summarizerClientElection.js +0 -1
- package/dist/summary/summarizerClientElection.js.map +1 -1
- package/dist/summary/summarizerHeuristics.d.ts +1 -1
- package/dist/summary/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summary/summarizerHeuristics.js.map +1 -1
- package/dist/summary/summarizerTypes.d.ts +109 -22
- package/dist/summary/summarizerTypes.d.ts.map +1 -1
- package/dist/summary/summarizerTypes.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +3 -9
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js.map +1 -1
- package/dist/summary/summaryGenerator.d.ts.map +1 -1
- package/dist/summary/summaryGenerator.js +3 -9
- package/dist/summary/summaryGenerator.js.map +1 -1
- package/dist/summary/summaryHelpers.d.ts +19 -0
- package/dist/summary/summaryHelpers.d.ts.map +1 -0
- package/dist/summary/summaryHelpers.js +90 -0
- package/dist/summary/summaryHelpers.js.map +1 -0
- package/dist/summary/summaryManager.d.ts.map +1 -1
- package/dist/summary/summaryManager.js +0 -2
- package/dist/summary/summaryManager.js.map +1 -1
- package/lib/blobManager/blobManager.d.ts +11 -9
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +37 -37
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/blobManager/blobManagerSnapSum.d.ts +2 -4
- package/lib/blobManager/blobManagerSnapSum.d.ts.map +1 -1
- package/lib/blobManager/blobManagerSnapSum.js +6 -6
- package/lib/blobManager/blobManagerSnapSum.js.map +1 -1
- package/lib/channelCollection.d.ts +1 -7
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +2 -29
- package/lib/channelCollection.js.map +1 -1
- package/lib/connectionTelemetry.d.ts +0 -43
- package/lib/connectionTelemetry.d.ts.map +1 -1
- package/lib/connectionTelemetry.js.map +1 -1
- package/lib/containerRuntime.d.ts +21 -141
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +51 -298
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +0 -13
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +2 -25
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +3 -23
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcConfigs.d.ts.map +1 -1
- package/lib/gc/gcConfigs.js +0 -2
- package/lib/gc/gcConfigs.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +8 -24
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js +1 -3
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +1 -4
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcSummaryStateTracker.d.ts.map +1 -1
- package/lib/gc/gcSummaryStateTracker.js +0 -1
- package/lib/gc/gcSummaryStateTracker.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +5 -19
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +0 -29
- package/lib/messageTypes.d.ts.map +1 -1
- package/lib/messageTypes.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/signalTelemetryProcessing.d.ts +33 -0
- package/lib/signalTelemetryProcessing.d.ts.map +1 -0
- package/lib/signalTelemetryProcessing.js +145 -0
- package/lib/signalTelemetryProcessing.js.map +1 -0
- package/lib/summary/documentSchema.d.ts +7 -31
- package/lib/summary/documentSchema.d.ts.map +1 -1
- package/lib/summary/documentSchema.js +2 -18
- package/lib/summary/documentSchema.js.map +1 -1
- package/lib/summary/index.d.ts +2 -1
- package/lib/summary/index.d.ts.map +1 -1
- package/lib/summary/index.js +1 -0
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/orderedClientElection.d.ts +1 -3
- package/lib/summary/orderedClientElection.d.ts.map +1 -1
- package/lib/summary/orderedClientElection.js.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.d.ts +1 -3
- package/lib/summary/runWhileConnectedCoordinator.d.ts.map +1 -1
- package/lib/summary/runWhileConnectedCoordinator.js +2 -7
- package/lib/summary/runWhileConnectedCoordinator.js.map +1 -1
- package/lib/summary/runningSummarizer.d.ts +1 -2
- package/lib/summary/runningSummarizer.d.ts.map +1 -1
- package/lib/summary/runningSummarizer.js +4 -23
- package/lib/summary/runningSummarizer.js.map +1 -1
- package/lib/summary/summarizer.d.ts +2 -5
- package/lib/summary/summarizer.d.ts.map +1 -1
- package/lib/summary/summarizer.js +3 -11
- package/lib/summary/summarizer.js.map +1 -1
- package/lib/summary/summarizerClientElection.d.ts.map +1 -1
- package/lib/summary/summarizerClientElection.js +0 -1
- package/lib/summary/summarizerClientElection.js.map +1 -1
- package/lib/summary/summarizerHeuristics.d.ts +1 -1
- package/lib/summary/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summary/summarizerHeuristics.js.map +1 -1
- package/lib/summary/summarizerTypes.d.ts +109 -22
- package/lib/summary/summarizerTypes.d.ts.map +1 -1
- package/lib/summary/summarizerTypes.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +3 -9
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryFormat.js.map +1 -1
- package/lib/summary/summaryGenerator.d.ts.map +1 -1
- package/lib/summary/summaryGenerator.js +3 -9
- package/lib/summary/summaryGenerator.js.map +1 -1
- package/lib/summary/summaryHelpers.d.ts +19 -0
- package/lib/summary/summaryHelpers.d.ts.map +1 -0
- package/lib/summary/summaryHelpers.js +84 -0
- package/lib/summary/summaryHelpers.js.map +1 -0
- package/lib/summary/summaryManager.d.ts.map +1 -1
- package/lib/summary/summaryManager.js +0 -2
- package/lib/summary/summaryManager.js.map +1 -1
- package/package.json +27 -20
- package/src/blobManager/blobManager.ts +70 -62
- package/src/blobManager/blobManagerSnapSum.ts +7 -9
- package/src/channelCollection.ts +3 -31
- package/src/connectionTelemetry.ts +0 -51
- package/src/containerRuntime.ts +111 -522
- package/src/dataStoreContext.ts +2 -32
- package/src/gc/garbageCollection.ts +9 -26
- package/src/gc/gcConfigs.ts +3 -6
- package/src/gc/gcDefinitions.ts +10 -28
- package/src/gc/gcHelpers.ts +0 -5
- package/src/gc/gcSummaryStateTracker.ts +1 -2
- package/src/gc/gcTelemetry.ts +6 -13
- package/src/index.ts +6 -6
- package/src/messageTypes.ts +0 -2
- package/src/packageVersion.ts +1 -1
- package/src/signalTelemetryProcessing.ts +233 -0
- package/src/summary/documentSchema.ts +7 -38
- package/src/summary/index.ts +12 -0
- package/src/summary/orderedClientElection.ts +1 -3
- package/src/summary/runWhileConnectedCoordinator.ts +3 -8
- package/src/summary/runningSummarizer.ts +12 -20
- package/src/summary/summarizer.ts +6 -18
- package/src/summary/summarizerClientElection.ts +0 -2
- package/src/summary/summarizerHeuristics.ts +1 -2
- package/src/summary/summarizerTypes.ts +119 -23
- package/src/summary/summaryFormat.ts +4 -13
- package/src/summary/summaryGenerator.ts +1 -8
- package/src/summary/summaryHelpers.ts +118 -0
- package/src/summary/summaryManager.ts +0 -2
|
@@ -12,9 +12,7 @@ import { RuntimeHeaderData } from "../containerRuntime.js";
|
|
|
12
12
|
import { ContainerRuntimeGCMessage } from "../messageTypes.js";
|
|
13
13
|
import { IContainerRuntimeMetadata, ICreateContainerMetadata, IRefreshSummaryResult } from "../summary/index.js";
|
|
14
14
|
/**
|
|
15
|
-
* @
|
|
16
|
-
* @alpha
|
|
17
|
-
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
15
|
+
* @internal
|
|
18
16
|
*/
|
|
19
17
|
export type GCVersion = number;
|
|
20
18
|
/**
|
|
@@ -66,9 +64,7 @@ export declare const defaultSessionExpiryDurationMs: number;
|
|
|
66
64
|
export declare const defaultSweepGracePeriodMs: number;
|
|
67
65
|
/**
|
|
68
66
|
* @see IGCMetadata.gcFeatureMatrix and @see gcGenerationOptionName
|
|
69
|
-
* @
|
|
70
|
-
* @alpha
|
|
71
|
-
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
67
|
+
* @internal
|
|
72
68
|
*/
|
|
73
69
|
export type GCFeatureMatrix = {
|
|
74
70
|
/**
|
|
@@ -103,9 +99,7 @@ export interface IGCMetadata_Deprecated {
|
|
|
103
99
|
/**
|
|
104
100
|
* GC-specific metadata to be written into the summary.
|
|
105
101
|
*
|
|
106
|
-
* @
|
|
107
|
-
* @alpha
|
|
108
|
-
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
102
|
+
* @internal
|
|
109
103
|
*/
|
|
110
104
|
export interface IGCMetadata {
|
|
111
105
|
/**
|
|
@@ -152,9 +146,7 @@ export interface IGCMetadata {
|
|
|
152
146
|
}
|
|
153
147
|
/**
|
|
154
148
|
* The statistics of the system state after a garbage collection mark phase run.
|
|
155
|
-
* @
|
|
156
|
-
* @alpha
|
|
157
|
-
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
149
|
+
* @internal
|
|
158
150
|
*/
|
|
159
151
|
export interface IMarkPhaseStats {
|
|
160
152
|
/**
|
|
@@ -196,9 +188,7 @@ export interface IMarkPhaseStats {
|
|
|
196
188
|
}
|
|
197
189
|
/**
|
|
198
190
|
* The statistics of the system state after a garbage collection sweep phase run.
|
|
199
|
-
* @
|
|
200
|
-
* @alpha
|
|
201
|
-
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
191
|
+
* @internal
|
|
202
192
|
*/
|
|
203
193
|
export interface ISweepPhaseStats {
|
|
204
194
|
/**
|
|
@@ -228,17 +218,13 @@ export interface ISweepPhaseStats {
|
|
|
228
218
|
}
|
|
229
219
|
/**
|
|
230
220
|
* The statistics of the system state after a garbage collection run.
|
|
231
|
-
* @
|
|
232
|
-
* @alpha
|
|
233
|
-
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
221
|
+
* @internal
|
|
234
222
|
*/
|
|
235
223
|
export interface IGCStats extends IMarkPhaseStats, ISweepPhaseStats {
|
|
236
224
|
}
|
|
237
225
|
/**
|
|
238
226
|
* The types of GC nodes in the GC reference graph.
|
|
239
|
-
* @
|
|
240
|
-
* @alpha
|
|
241
|
-
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
227
|
+
* @internal
|
|
242
228
|
*/
|
|
243
229
|
export declare const GCNodeType: {
|
|
244
230
|
readonly DataStore: "DataStore";
|
|
@@ -247,9 +233,7 @@ export declare const GCNodeType: {
|
|
|
247
233
|
readonly Other: "Other";
|
|
248
234
|
};
|
|
249
235
|
/**
|
|
250
|
-
* @
|
|
251
|
-
* @alpha
|
|
252
|
-
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
236
|
+
* @internal
|
|
253
237
|
*/
|
|
254
238
|
export type GCNodeType = (typeof GCNodeType)[keyof typeof GCNodeType];
|
|
255
239
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcDefinitions.d.ts","sourceRoot":"","sources":["../../src/gc/gcDefinitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,E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iBAAiB,CAAC,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;CACzB"}
|
package/dist/gc/gcDefinitions.js
CHANGED
|
@@ -55,9 +55,7 @@ exports.defaultSessionExpiryDurationMs = 30 * exports.oneDayMs; // 30 days
|
|
|
55
55
|
exports.defaultSweepGracePeriodMs = 1 * exports.oneDayMs; // 1 day
|
|
56
56
|
/**
|
|
57
57
|
* The types of GC nodes in the GC reference graph.
|
|
58
|
-
* @
|
|
59
|
-
* @alpha
|
|
60
|
-
* @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.
|
|
58
|
+
* @internal
|
|
61
59
|
*/
|
|
62
60
|
exports.GCNodeType = {
|
|
63
61
|
// Nodes that are for data stores.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcDefinitions.js","sourceRoot":"","sources":["../../src/gc/gcDefinitions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkCH;;GAEG;AACU,QAAA,eAAe,GAAc,CAAC,CAAC;AAC5C;;GAEG;AACU,QAAA,aAAa,GAAc,CAAC,CAAC;AAE1C;;;;;;;;;;GAUG;AACU,QAAA,sBAAsB,GAAG,cAAc,CAAC;AAErD;;GAEG;AACU,QAAA,aAAa,GAAG,oCAAoC,CAAC;AAClE;;GAEG;AACU,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E;;GAEG;AACU,QAAA,8BAA8B,GAC1C,qDAAqD,CAAC;AACvD;;GAEG;AACU,QAAA,uBAAuB,GAAG,8CAA8C,CAAC;AAEtF,2BAA2B;AACd,QAAA,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD;;;;;GAKG;AACU,QAAA,wBAAwB,GAAG,CAAC,GAAG,gBAAQ,CAAC;AAExC,QAAA,wBAAwB,GAAG,CAAC,GAAG,gBAAQ,CAAC,CAAC,SAAS;AAClD,QAAA,8BAA8B,GAAG,EAAE,GAAG,gBAAQ,CAAC,CAAC,UAAU;AAC1D,QAAA,yBAAyB,GAAG,CAAC,GAAG,gBAAQ,CAAC,CAAC,QAAQ;AAoL/D;;;;;GAKG;AACU,QAAA,UAAU,GAAG;IACzB,kCAAkC;IAClC,SAAS,EAAE,WAAW;IACtB,8DAA8D;IAC9D,YAAY,EAAE,cAAc;IAC5B,6EAA6E;IAC7E,IAAI,EAAE,MAAM;IACZ,+DAA+D;IAC/D,KAAK,EAAE,OAAO;CACL,CAAC;AASX;;;GAGG;AACU,QAAA,4BAA4B,GAAG;IAC3C;;OAEG;IACH,KAAK,EAAE,OAAO;IACd;;OAEG;IACH,eAAe,EAAE,iBAAiB;CACzB,CAAC;AAqUX;;GAEG;AACU,QAAA,iBAAiB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,QAAQ;IAChB;;OAEG;IACH,QAAQ,EAAE,UAAU;IACpB;;OAEG;IACH,cAAc,EAAE,gBAAgB;IAChC;;OAEG;IACH,UAAU,EAAE,YAAY;CACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeResult,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { ReadAndParseBlob } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\ttype ITelemetryPropertiesExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { RuntimeHeaderData } from \"../containerRuntime.js\";\nimport { ContainerRuntimeGCMessage } from \"../messageTypes.js\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\tIContainerRuntimeMetadata,\n\t// eslint-disable-next-line import/no-deprecated\n\tICreateContainerMetadata,\n\tIRefreshSummaryResult,\n} from \"../summary/index.js\";\n\n/**\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport type GCVersion = number;\n\n/**\n * The stable/default version of GC Data\n */\nexport const stableGCVersion: GCVersion = 3;\n/**\n * The next version of GC Data, to bump to in case we need to regenerate all GC Data across all files.\n */\nexport const nextGCVersion: GCVersion = 4;\n\n/**\n * This undocumented GC Option (on ContainerRuntime Options) allows configuring which documents can have Sweep enabled.\n * This provides a way to disable both Tombstone Enforcement and Sweep.\n *\n * If unset, Tombstone Enforcement + Sweep will operate as otherwise configured.\n * Otherwise, the Sweep Phase will be disabled for documents where persisted value doesn't match what is passed into this session.\n * This provides a way to disallow Sweep for old documents that may be too difficult for an app to repair,\n * in case a bug is found that violates GC's assumptions.\n *\n * @see GCFeatureMatrix (gcGeneration)\n */\nexport const gcGenerationOptionName = \"gcGeneration\";\n\n/**\n * Config key to turn GC test mode on / off.\n */\nexport const gcTestModeKey = \"Fluid.GarbageCollection.GCTestMode\";\n/**\n * Config key to expire a session after a set period of time. Defaults to true.\n */\nexport const runSessionExpiryKey = \"Fluid.GarbageCollection.RunSessionExpiry\";\n/**\n * Config key to disable throwing an error when tombstone object is loaded (requested).\n */\nexport const disableThrowOnTombstoneLoadKey =\n\t\"Fluid.GarbageCollection.DisableThrowOnTombstoneLoad\";\n/**\n * Config key to enable GC version upgrade.\n */\nexport const gcVersionUpgradeToV4Key = \"Fluid.GarbageCollection.GCVersionUpgradeToV4\";\n\n// One day in milliseconds.\nexport const oneDayMs = 1 * 24 * 60 * 60 * 1000;\n\n/**\n * The maximum snapshot cache expiry in the driver. This is used to calculate the tombstone timeout.\n * Tombstone timeout = session expiry timeout + snapshot cache expiry timeout + a buffer.\n * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days, i.e., any snapshot\n * in cache will be invalidated before 5 days.\n */\nexport const maxSnapshotCacheExpiryMs = 5 * oneDayMs;\n\nexport const defaultInactiveTimeoutMs = 7 * oneDayMs; // 7 days\nexport const defaultSessionExpiryDurationMs = 30 * oneDayMs; // 30 days\nexport const defaultSweepGracePeriodMs = 1 * oneDayMs; // 1 day\n\n/**\n * @see IGCMetadata.gcFeatureMatrix and @see gcGenerationOptionName\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport type GCFeatureMatrix =\n\t| {\n\t\t\t/**\n\t\t\t * The GC Generation value in effect when this file was created.\n\t\t\t * Gives a way for an app to disqualify old files from GC Sweep.\n\t\t\t * Provided via Container Runtime Options.\n\t\t\t */\n\t\t\tgcGeneration?: number;\n\t\t\t/**\n\t\t\t * Deprecated property from legacy type. Will not be set concurrently with gcGeneration\n\t\t\t */\n\t\t\ttombstoneGeneration?: undefined;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The Tombstone Generation value in effect when this file was created.\n\t\t\t * Legacy - new containers would get gcGeneration instead (if anything)\n\t\t\t */\n\t\t\ttombstoneGeneration: number;\n\t };\n\n/**\n * Deprecated properties formerly included in @see IGCMetadata.\n * These may be found in old snapshots, so we need to support them for backwards compatibility.\n */\nexport interface IGCMetadata_Deprecated {\n\t/**\n\t * How long to wait after an object is unreferenced before deleting it via GC Sweep\n\t *\n\t * @deprecated Replaced by @see IGCMetadata.tombstoneTimeoutMs\n\t */\n\treadonly sweepTimeoutMs?: number;\n}\n\n/**\n * GC-specific metadata to be written into the summary.\n *\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport interface IGCMetadata {\n\t/**\n\t * The version of the GC code that was run to generate the GC data that is written in the summary.\n\t * If the persisted value doesn't match the current value in the code, saved GC data will be discarded and regenerated from scratch.\n\t * Also, used to determine whether GC is enabled for this container or not:\n\t * - A value of 0 or undefined means GC is disabled.\n\t * - A value greater than 0 means GC is enabled.\n\t */\n\treadonly gcFeature?: GCVersion;\n\n\t/**\n\t * A collection of different numerical \"Generations\" for different features,\n\t * used to determine feature availability over time.\n\t * This info may come from multiple sources (FF code, config service, app via Container Runtime Options),\n\t * and pertains to aspects of the document that may be fixed for its lifetime.\n\t *\n\t * For each dimension, if the persisted value doesn't match the currently provided value,\n\t * then this file does not support the corresponding feature as currently implemented.\n\t *\n\t * Guidance is that if no value is provided at runtime, it should result in the current default behavior.\n\t */\n\treadonly gcFeatureMatrix?: GCFeatureMatrix;\n\t/**\n\t * Tells whether the GC sweep phase is enabled for this container.\n\t * - True means sweep phase is enabled.\n\t * - False means sweep phase is disabled. If GC is disabled as per gcFeature, sweep is also disabled.\n\t *\n\t * @deprecated use GCFeatureMatrix.gcGeneration instead. @see GCFeatureMatrix.gcGeneration\n\t */\n\treadonly sweepEnabled?: boolean;\n\t/**\n\t * If this is present, the session for this container will expire after this time and the container will close\n\t */\n\treadonly sessionExpiryTimeoutMs?: number;\n\t/**\n\t * How long to wait after an object is unreferenced before it becomes a Tombstone.\n\t *\n\t * After this point, there's a grace period before the object is deleted.\n\t * @see IGCRuntimeOptions.sweepGracePeriodMs\n\t *\n\t * So the full sweep timeout in a session is tombstoneTimeoutMs + sweepGracePeriodMs.\n\t */\n\treadonly tombstoneTimeoutMs?: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection mark phase run.\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport interface IMarkPhaseStats {\n\t/**\n\t * The number of nodes in the container.\n\t */\n\tnodeCount: number;\n\t/**\n\t * The number of data stores in the container.\n\t */\n\tdataStoreCount: number;\n\t/**\n\t * The number of attachment blobs in the container.\n\t */\n\tattachmentBlobCount: number;\n\t/**\n\t * The number of unreferenced nodes in the container.\n\t */\n\tunrefNodeCount: number;\n\t/**\n\t * The number of unreferenced data stores in the container.\n\t */\n\tunrefDataStoreCount: number;\n\t/**\n\t * The number of unreferenced attachment blobs in the container.\n\t */\n\tunrefAttachmentBlobCount: number;\n\t/**\n\t * The number of nodes whose reference state updated since last GC run.\n\t */\n\tupdatedNodeCount: number;\n\t/**\n\t * The number of data stores whose reference state updated since last GC run.\n\t */\n\tupdatedDataStoreCount: number;\n\t/**\n\t * The number of attachment blobs whose reference state updated since last GC run.\n\t */\n\tupdatedAttachmentBlobCount: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection sweep phase run.\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport interface ISweepPhaseStats {\n\t/**\n\t * The number of nodes in the lifetime of the container.\n\t */\n\tlifetimeNodeCount: number;\n\t/**\n\t * The number of data stores in the lifetime of the container.\n\t */\n\tlifetimeDataStoreCount: number;\n\t/**\n\t * The number of attachment blobs in the lifetime of the container.\n\t */\n\tlifetimeAttachmentBlobCount: number;\n\t/**\n\t * The number of deleted nodes in the container.\n\t */\n\tdeletedNodeCount: number;\n\t/**\n\t * The number of deleted data stores in the container.\n\t */\n\tdeletedDataStoreCount: number;\n\t/**\n\t * The number of deleted attachment blobs in the container.\n\t */\n\tdeletedAttachmentBlobCount: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection run.\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport interface IGCStats extends IMarkPhaseStats, ISweepPhaseStats {}\n\n/**\n * The types of GC nodes in the GC reference graph.\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport const GCNodeType = {\n\t// Nodes that are for data stores.\n\tDataStore: \"DataStore\",\n\t// Nodes that are within a data store. For example, DDS nodes.\n\tSubDataStore: \"SubDataStore\",\n\t// Nodes that are for attachment blobs, i.e., blobs uploaded via BlobManager.\n\tBlob: \"Blob\",\n\t// Nodes that are neither of the above. For example, root node.\n\tOther: \"Other\",\n} as const;\n\n/**\n * @legacy\n * @alpha\n * @deprecated This type will be moved to internal in 2.30. External usage is not necessary or supported.\n */\nexport type GCNodeType = (typeof GCNodeType)[keyof typeof GCNodeType];\n\n/**\n * The type of a garbage collection message.\n * @internal\n */\nexport const GarbageCollectionMessageType = {\n\t/**\n\t * Message sent directing GC to delete the given nodes\n\t */\n\tSweep: \"Sweep\",\n\t/**\n\t * Message sent notifying GC that a Tombstoned object was Loaded\n\t */\n\tTombstoneLoaded: \"TombstoneLoaded\",\n} as const;\n\n/**\n * @internal\n */\nexport type GarbageCollectionMessageType =\n\t(typeof GarbageCollectionMessageType)[keyof typeof GarbageCollectionMessageType];\n\n/**\n * The garbage collection sweep message.\n * @internal\n */\nexport interface ISweepMessage {\n\t/**\n\t * @see GarbageCollectionMessageType.Sweep\n\t */\n\ttype: typeof GarbageCollectionMessageType.Sweep;\n\t/**\n\t * The ids of nodes that are deleted.\n\t */\n\tdeletedNodeIds: string[];\n}\n\n/**\n * The GC TombstoneLoaded message.\n * @internal\n */\nexport interface ITombstoneLoadedMessage {\n\t/**\n\t * @see GarbageCollectionMessageType.TombstoneLoaded\n\t */\n\ttype: typeof GarbageCollectionMessageType.TombstoneLoaded;\n\t/**\n\t * The id of Tombstoned node that was loaded.\n\t */\n\tnodePath: string;\n}\n\n/**\n * Type for a message to be used for sending / received garbage collection messages.\n * @internal\n */\nexport type GarbageCollectionMessage = ISweepMessage | ITombstoneLoadedMessage;\n\n/**\n * Defines the APIs for the runtime object to be passed to the garbage collector.\n */\nexport interface IGarbageCollectionRuntime {\n\t/**\n\t * Returns the garbage collection data of the runtime.\n\t */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\t/**\n\t * After GC has run, called to notify the runtime of routes that are used in it.\n\t */\n\tupdateUsedRoutes(usedRoutes: readonly string[]): void;\n\t/**\n\t * After GC has run and identified nodes that are sweep ready, called to delete the sweep ready nodes. The runtime\n\t * should return the routes of nodes that were deleted.\n\t * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.\n\t */\n\tdeleteSweepReadyNodes(sweepReadyRoutes: readonly string[]): readonly string[];\n\t/**\n\t * Called to notify the runtime of routes that are tombstones.\n\t */\n\tupdateTombstonedRoutes(tombstoneRoutes: readonly string[]): void;\n\t/**\n\t * Returns a referenced timestamp to be used to track unreferenced nodes.\n\t */\n\tgetCurrentReferenceTimestampMs(): number | undefined;\n\t/**\n\t * Returns the type of the GC node.\n\t */\n\tgetNodeType(nodePath: string): GCNodeType;\n\t/**\n\t * Called when the runtime should close because of an error.\n\t */\n\tcloseFn: (error?: ICriticalContainerError) => void;\n}\n\n/**\n * Defines the contract for the garbage collector.\n */\nexport interface IGarbageCollector {\n\t/**\n\t * Tells the time at which session expiry timer started in a previous container.\n\t * This is only set when loading from a stashed container and will be equal to the\n\t * original container's local client time when it was loaded (and started the session expiry timer).\n\t */\n\treadonly sessionExpiryTimerStarted: number | undefined;\n\t/**\n\t * Tells whether GC should run or not.\n\t */\n\treadonly shouldRunGC: boolean;\n\t/**\n\t * The count of data stores whose GC state updated since the last summary.\n\t */\n\treadonly updatedDSCountSinceLastSummary: number;\n\t/**\n\t * Initialize the state from the base snapshot after its creation.\n\t */\n\tinitializeBaseState(): Promise<void>;\n\t/**\n\t * Run garbage collection and update the reference / used state of the system.\n\t */\n\tcollectGarbage(\n\t\toptions: {\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\trunSweep?: boolean;\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined>;\n\t/**\n\t * Summarizes the GC data and returns it as a summary tree.\n\t */\n\tsummarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined;\n\t/**\n\t * Returns the garbage collector specific metadata to be written into the summary.\n\t */\n\tgetMetadata(): IGCMetadata;\n\t/**\n\t * Returns the GC details generated from the base snapshot.\n\t */\n\tgetBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;\n\t/**\n\t * Called when the latest summary of the system has been refreshed.\n\t */\n\trefreshLatestSummary(result: IRefreshSummaryResult): Promise<void>;\n\t/**\n\t * Called when a node with the given path is updated. If the node is inactive or tombstoned, this will log an error\n\t * or throw an error if failing on incorrect usage is configured.\n\t */\n\tnodeUpdated(props: IGCNodeUpdatedProps): void;\n\t/**\n\t * Called when a reference is added to a node. Used to identify nodes that were referenced between summaries.\n\t */\n\taddedOutboundReference(\n\t\tfromNodePath: string,\n\t\ttoNodePath: string,\n\t\ttimestampMs: number,\n\t\tautorecovery?: true,\n\t): void;\n\t/**\n\t * Called to process garbage collection messages\n\t */\n\tprocessMessages(\n\t\tmessageContents: GarbageCollectionMessage[],\n\t\tmessageTimestampMs: number,\n\t\tlocal: boolean,\n\t): void;\n\t/**\n\t * Returns true if this node has been deleted by GC during sweep phase.\n\t */\n\tisNodeDeleted(nodePath: string): boolean;\n\tsetConnectionState(connected: boolean, clientId?: string): void;\n\tdispose(): void;\n}\n\n/**\n * Info needed by GC when notified that a node was updated (loaded or changed)\n * @internal\n */\nexport interface IGCNodeUpdatedProps {\n\t/**\n\t * Type and path of the updated node\n\t */\n\tnode: { type: (typeof GCNodeType)[\"DataStore\" | \"Blob\"]; path: string };\n\t/**\n\t * Whether the node (or a subpath) was loaded or changed.\n\t */\n\treason: \"Loaded\" | \"Changed\" | \"Realized\";\n\t/**\n\t * The op-based timestamp when the node changed. If the update is from receiving an op, this should\n\t * be the timestamp of the op. If not, this should be the timestamp of the last op processed.\n\t */\n\ttimestampMs: number | undefined;\n\t/**\n\t * The package path of the node. This may not be available if the node hasn't been loaded yet\n\t */\n\tpackagePath?: readonly string[];\n\t/**\n\t * The original request for loads to preserve it in telemetry\n\t */\n\trequest?: IRequest;\n\t/**\n\t * If the node was loaded via request path, the header data. May be modified from the original request\n\t */\n\theaderData?: RuntimeHeaderData;\n\t/**\n\t * Any other properties to be logged.\n\t */\n\tadditionalProps?: ITelemetryPropertiesExt;\n}\n\n/**\n * Parameters necessary for creating a GarbageCollector.\n */\nexport interface IGarbageCollectorCreateParams {\n\treadonly runtime: IGarbageCollectionRuntime;\n\treadonly gcOptions: IGCRuntimeOptions;\n\treadonly baseLogger: ITelemetryLoggerExt;\n\treadonly existing: boolean;\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly metadata: IContainerRuntimeMetadata | undefined;\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly createContainerMetadata: ICreateContainerMetadata;\n\treadonly baseSnapshot: ISnapshotTree | undefined;\n\treadonly isSummarizerClient: boolean;\n\treadonly getNodePackagePath: (nodePath: string) => Promise<readonly string[] | undefined>;\n\treadonly getLastSummaryTimestampMs: () => number | undefined;\n\treadonly readAndParseBlob: ReadAndParseBlob;\n\treadonly submitMessage: (message: ContainerRuntimeGCMessage) => void;\n\treadonly sessionExpiryTimerStarted?: number | undefined;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IGCRuntimeOptions {\n\t/**\n\t * Flag that if true, will enable the full Sweep Phase of garbage collection for this session,\n\t * where Tombstoned objects are permanently deleted from the container.\n\t *\n\t * IMPORTANT: This only applies if this document is allowed to run Sweep Phase.\n\t *\n\t * Current default behavior is for Sweep Phase not to delete Tombstoned objects,\n\t * but merely to prevent them from being loaded.\n\t */\n\tenableGCSweep?: true;\n\n\t/**\n\t * Flag that will bypass optimizations and generate GC data for all nodes irrespective of whether a node\n\t * changed or not.\n\t */\n\trunFullGC?: boolean;\n\n\t/**\n\t * Maximum session duration for a new container. If not present, a default value will be used.\n\t *\n\t * Note: This setting is persisted in the container's summary and cannot be changed.\n\t */\n\tsessionExpiryTimeoutMs?: number;\n\n\t/**\n\t * Delay between when Tombstone should run and when the object should be deleted.\n\t * This grace period gives a chance to intervene to recover if needed, before Sweep deletes the object.\n\t * If not present, a default (non-zero) value will be used.\n\t */\n\tsweepGracePeriodMs?: number;\n\n\t/**\n\t * Allows additional GC options to be passed.\n\t */\n\t// TODO: Use unknown (breaking change)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t[key: string]: any;\n}\n\n/**\n * The configurations for Garbage Collector that determines what runs and how.\n */\nexport interface IGarbageCollectorConfigs {\n\t/**\n\t * Tracks if GC is allowed for this document. GC may not be allowed for old documents created pre-GC.\n\t * If GC is allowed for a document, it will always be enabled. It cannot be disabled per session.\n\t */\n\treadonly gcAllowed: boolean;\n\t/**\n\t * Tracks whether sweep phase is allowed for this document. Sweep can be disabled per session via the sweepEnabled\n\t * flag defined below.\n\t */\n\treadonly sweepAllowed: boolean;\n\t/**\n\t * Tracks if sweep phase is enabled to run in this session or not\n\t */\n\treadonly sweepEnabled: boolean;\n\t/**\n\t * If true, bypass optimizations and generate GC data for all nodes irrespective of whether a node changed or not.\n\t */\n\treadonly runFullGC: boolean | undefined;\n\t/**\n\t * The time in ms to expire a session for a client for gc.\n\t */\n\treadonly sessionExpiryTimeoutMs: number | undefined;\n\t/**\n\t * The time after which an unreferenced node can be Tombstoned - i.e. GC knows it can't be referenced again (revived).\n\t */\n\treadonly tombstoneTimeoutMs: number | undefined;\n\t/**\n\t * The delay between tombstone and sweep. Not persisted, so concurrent sessions may use different values.\n\t * Sweep is implemented in an eventually-consistent way so this is acceptable.\n\t */\n\treadonly sweepGracePeriodMs: number;\n\t/**\n\t * The time after which an unreferenced node is inactive.\n\t */\n\treadonly inactiveTimeoutMs: number;\n\t/**\n\t * Tracks whether GC should run in test mode. In this mode, unreferenced objects are deleted immediately.\n\t */\n\treadonly testMode: boolean;\n\t/**\n\t * @see GCFeatureMatrix.\n\t */\n\treadonly persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\t/**\n\t * The version of GC in the base snapshot.\n\t */\n\treadonly gcVersionInBaseSnapshot: GCVersion | undefined;\n\t/**\n\t * The current version of GC data in the running code\n\t */\n\treadonly gcVersionInEffect: GCVersion;\n\t/**\n\t * If true, throw an error when a tombstone data store is retrieved\n\t */\n\treadonly throwOnTombstoneLoad: boolean;\n}\n\n/**\n * The state of node that is unreferenced.\n */\nexport const UnreferencedState = {\n\t/**\n\t * The node is active, i.e., it can become referenced again.\n\t */\n\tActive: \"Active\",\n\t/**\n\t * The node is inactive, i.e., it should not become referenced.\n\t */\n\tInactive: \"Inactive\",\n\t/**\n\t * The node is ready to be tombstoned\n\t */\n\tTombstoneReady: \"TombstoneReady\",\n\t/**\n\t * The node is ready to be deleted by the sweep phase.\n\t */\n\tSweepReady: \"SweepReady\",\n} as const;\nexport type UnreferencedState = (typeof UnreferencedState)[keyof typeof UnreferencedState];\n\n/**\n * Represents the result of a GC run.\n */\nexport interface IGCResult {\n\t/**\n\t * The ids of nodes that are referenced in the referenced graph\n\t */\n\treferencedNodeIds: string[];\n\t/**\n\t * The ids of nodes that are not-referenced or deleted in the referenced graph\n\t */\n\tdeletedNodeIds: string[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gcDefinitions.js","sourceRoot":"","sources":["../../src/gc/gcDefinitions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA8BH;;GAEG;AACU,QAAA,eAAe,GAAc,CAAC,CAAC;AAC5C;;GAEG;AACU,QAAA,aAAa,GAAc,CAAC,CAAC;AAE1C;;;;;;;;;;GAUG;AACU,QAAA,sBAAsB,GAAG,cAAc,CAAC;AAErD;;GAEG;AACU,QAAA,aAAa,GAAG,oCAAoC,CAAC;AAClE;;GAEG;AACU,QAAA,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E;;GAEG;AACU,QAAA,8BAA8B,GAC1C,qDAAqD,CAAC;AACvD;;GAEG;AACU,QAAA,uBAAuB,GAAG,8CAA8C,CAAC;AAEtF,2BAA2B;AACd,QAAA,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD;;;;;GAKG;AACU,QAAA,wBAAwB,GAAG,CAAC,GAAG,gBAAQ,CAAC;AAExC,QAAA,wBAAwB,GAAG,CAAC,GAAG,gBAAQ,CAAC,CAAC,SAAS;AAClD,QAAA,8BAA8B,GAAG,EAAE,GAAG,gBAAQ,CAAC,CAAC,UAAU;AAC1D,QAAA,yBAAyB,GAAG,CAAC,GAAG,gBAAQ,CAAC,CAAC,QAAQ;AA0K/D;;;GAGG;AACU,QAAA,UAAU,GAAG;IACzB,kCAAkC;IAClC,SAAS,EAAE,WAAW;IACtB,8DAA8D;IAC9D,YAAY,EAAE,cAAc;IAC5B,6EAA6E;IAC7E,IAAI,EAAE,MAAM;IACZ,+DAA+D;IAC/D,KAAK,EAAE,OAAO;CACL,CAAC;AAOX;;;GAGG;AACU,QAAA,4BAA4B,GAAG;IAC3C;;OAEG;IACH,KAAK,EAAE,OAAO;IACd;;OAEG;IACH,eAAe,EAAE,iBAAiB;CACzB,CAAC;AAqUX;;GAEG;AACU,QAAA,iBAAiB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,QAAQ;IAChB;;OAEG;IACH,QAAQ,EAAE,UAAU;IACpB;;OAEG;IACH,cAAc,EAAE,gBAAgB;IAChC;;OAEG;IACH,UAAU,EAAE,YAAY;CACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeResult,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { ReadAndParseBlob } from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\ttype ITelemetryPropertiesExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { RuntimeHeaderData } from \"../containerRuntime.js\";\nimport { ContainerRuntimeGCMessage } from \"../messageTypes.js\";\nimport {\n\tIContainerRuntimeMetadata,\n\tICreateContainerMetadata,\n\tIRefreshSummaryResult,\n} from \"../summary/index.js\";\n\n/**\n * @internal\n */\nexport type GCVersion = number;\n\n/**\n * The stable/default version of GC Data\n */\nexport const stableGCVersion: GCVersion = 3;\n/**\n * The next version of GC Data, to bump to in case we need to regenerate all GC Data across all files.\n */\nexport const nextGCVersion: GCVersion = 4;\n\n/**\n * This undocumented GC Option (on ContainerRuntime Options) allows configuring which documents can have Sweep enabled.\n * This provides a way to disable both Tombstone Enforcement and Sweep.\n *\n * If unset, Tombstone Enforcement + Sweep will operate as otherwise configured.\n * Otherwise, the Sweep Phase will be disabled for documents where persisted value doesn't match what is passed into this session.\n * This provides a way to disallow Sweep for old documents that may be too difficult for an app to repair,\n * in case a bug is found that violates GC's assumptions.\n *\n * @see GCFeatureMatrix (gcGeneration)\n */\nexport const gcGenerationOptionName = \"gcGeneration\";\n\n/**\n * Config key to turn GC test mode on / off.\n */\nexport const gcTestModeKey = \"Fluid.GarbageCollection.GCTestMode\";\n/**\n * Config key to expire a session after a set period of time. Defaults to true.\n */\nexport const runSessionExpiryKey = \"Fluid.GarbageCollection.RunSessionExpiry\";\n/**\n * Config key to disable throwing an error when tombstone object is loaded (requested).\n */\nexport const disableThrowOnTombstoneLoadKey =\n\t\"Fluid.GarbageCollection.DisableThrowOnTombstoneLoad\";\n/**\n * Config key to enable GC version upgrade.\n */\nexport const gcVersionUpgradeToV4Key = \"Fluid.GarbageCollection.GCVersionUpgradeToV4\";\n\n// One day in milliseconds.\nexport const oneDayMs = 1 * 24 * 60 * 60 * 1000;\n\n/**\n * The maximum snapshot cache expiry in the driver. This is used to calculate the tombstone timeout.\n * Tombstone timeout = session expiry timeout + snapshot cache expiry timeout + a buffer.\n * The snapshot cache expiry timeout cannot be known precisely but the upper bound is 5 days, i.e., any snapshot\n * in cache will be invalidated before 5 days.\n */\nexport const maxSnapshotCacheExpiryMs = 5 * oneDayMs;\n\nexport const defaultInactiveTimeoutMs = 7 * oneDayMs; // 7 days\nexport const defaultSessionExpiryDurationMs = 30 * oneDayMs; // 30 days\nexport const defaultSweepGracePeriodMs = 1 * oneDayMs; // 1 day\n\n/**\n * @see IGCMetadata.gcFeatureMatrix and @see gcGenerationOptionName\n * @internal\n */\nexport type GCFeatureMatrix =\n\t| {\n\t\t\t/**\n\t\t\t * The GC Generation value in effect when this file was created.\n\t\t\t * Gives a way for an app to disqualify old files from GC Sweep.\n\t\t\t * Provided via Container Runtime Options.\n\t\t\t */\n\t\t\tgcGeneration?: number;\n\t\t\t/**\n\t\t\t * Deprecated property from legacy type. Will not be set concurrently with gcGeneration\n\t\t\t */\n\t\t\ttombstoneGeneration?: undefined;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The Tombstone Generation value in effect when this file was created.\n\t\t\t * Legacy - new containers would get gcGeneration instead (if anything)\n\t\t\t */\n\t\t\ttombstoneGeneration: number;\n\t };\n\n/**\n * Deprecated properties formerly included in @see IGCMetadata.\n * These may be found in old snapshots, so we need to support them for backwards compatibility.\n */\nexport interface IGCMetadata_Deprecated {\n\t/**\n\t * How long to wait after an object is unreferenced before deleting it via GC Sweep\n\t *\n\t * @deprecated Replaced by @see IGCMetadata.tombstoneTimeoutMs\n\t */\n\treadonly sweepTimeoutMs?: number;\n}\n\n/**\n * GC-specific metadata to be written into the summary.\n *\n * @internal\n */\nexport interface IGCMetadata {\n\t/**\n\t * The version of the GC code that was run to generate the GC data that is written in the summary.\n\t * If the persisted value doesn't match the current value in the code, saved GC data will be discarded and regenerated from scratch.\n\t * Also, used to determine whether GC is enabled for this container or not:\n\t * - A value of 0 or undefined means GC is disabled.\n\t * - A value greater than 0 means GC is enabled.\n\t */\n\treadonly gcFeature?: GCVersion;\n\n\t/**\n\t * A collection of different numerical \"Generations\" for different features,\n\t * used to determine feature availability over time.\n\t * This info may come from multiple sources (FF code, config service, app via Container Runtime Options),\n\t * and pertains to aspects of the document that may be fixed for its lifetime.\n\t *\n\t * For each dimension, if the persisted value doesn't match the currently provided value,\n\t * then this file does not support the corresponding feature as currently implemented.\n\t *\n\t * Guidance is that if no value is provided at runtime, it should result in the current default behavior.\n\t */\n\treadonly gcFeatureMatrix?: GCFeatureMatrix;\n\t/**\n\t * Tells whether the GC sweep phase is enabled for this container.\n\t * - True means sweep phase is enabled.\n\t * - False means sweep phase is disabled. If GC is disabled as per gcFeature, sweep is also disabled.\n\t *\n\t * @deprecated use GCFeatureMatrix.gcGeneration instead. @see GCFeatureMatrix.gcGeneration\n\t */\n\treadonly sweepEnabled?: boolean;\n\t/**\n\t * If this is present, the session for this container will expire after this time and the container will close\n\t */\n\treadonly sessionExpiryTimeoutMs?: number;\n\t/**\n\t * How long to wait after an object is unreferenced before it becomes a Tombstone.\n\t *\n\t * After this point, there's a grace period before the object is deleted.\n\t * @see IGCRuntimeOptions.sweepGracePeriodMs\n\t *\n\t * So the full sweep timeout in a session is tombstoneTimeoutMs + sweepGracePeriodMs.\n\t */\n\treadonly tombstoneTimeoutMs?: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection mark phase run.\n * @internal\n */\nexport interface IMarkPhaseStats {\n\t/**\n\t * The number of nodes in the container.\n\t */\n\tnodeCount: number;\n\t/**\n\t * The number of data stores in the container.\n\t */\n\tdataStoreCount: number;\n\t/**\n\t * The number of attachment blobs in the container.\n\t */\n\tattachmentBlobCount: number;\n\t/**\n\t * The number of unreferenced nodes in the container.\n\t */\n\tunrefNodeCount: number;\n\t/**\n\t * The number of unreferenced data stores in the container.\n\t */\n\tunrefDataStoreCount: number;\n\t/**\n\t * The number of unreferenced attachment blobs in the container.\n\t */\n\tunrefAttachmentBlobCount: number;\n\t/**\n\t * The number of nodes whose reference state updated since last GC run.\n\t */\n\tupdatedNodeCount: number;\n\t/**\n\t * The number of data stores whose reference state updated since last GC run.\n\t */\n\tupdatedDataStoreCount: number;\n\t/**\n\t * The number of attachment blobs whose reference state updated since last GC run.\n\t */\n\tupdatedAttachmentBlobCount: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection sweep phase run.\n * @internal\n */\nexport interface ISweepPhaseStats {\n\t/**\n\t * The number of nodes in the lifetime of the container.\n\t */\n\tlifetimeNodeCount: number;\n\t/**\n\t * The number of data stores in the lifetime of the container.\n\t */\n\tlifetimeDataStoreCount: number;\n\t/**\n\t * The number of attachment blobs in the lifetime of the container.\n\t */\n\tlifetimeAttachmentBlobCount: number;\n\t/**\n\t * The number of deleted nodes in the container.\n\t */\n\tdeletedNodeCount: number;\n\t/**\n\t * The number of deleted data stores in the container.\n\t */\n\tdeletedDataStoreCount: number;\n\t/**\n\t * The number of deleted attachment blobs in the container.\n\t */\n\tdeletedAttachmentBlobCount: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection run.\n * @internal\n */\nexport interface IGCStats extends IMarkPhaseStats, ISweepPhaseStats {}\n\n/**\n * The types of GC nodes in the GC reference graph.\n * @internal\n */\nexport const GCNodeType = {\n\t// Nodes that are for data stores.\n\tDataStore: \"DataStore\",\n\t// Nodes that are within a data store. For example, DDS nodes.\n\tSubDataStore: \"SubDataStore\",\n\t// Nodes that are for attachment blobs, i.e., blobs uploaded via BlobManager.\n\tBlob: \"Blob\",\n\t// Nodes that are neither of the above. For example, root node.\n\tOther: \"Other\",\n} as const;\n\n/**\n * @internal\n */\nexport type GCNodeType = (typeof GCNodeType)[keyof typeof GCNodeType];\n\n/**\n * The type of a garbage collection message.\n * @internal\n */\nexport const GarbageCollectionMessageType = {\n\t/**\n\t * Message sent directing GC to delete the given nodes\n\t */\n\tSweep: \"Sweep\",\n\t/**\n\t * Message sent notifying GC that a Tombstoned object was Loaded\n\t */\n\tTombstoneLoaded: \"TombstoneLoaded\",\n} as const;\n\n/**\n * @internal\n */\nexport type GarbageCollectionMessageType =\n\t(typeof GarbageCollectionMessageType)[keyof typeof GarbageCollectionMessageType];\n\n/**\n * The garbage collection sweep message.\n * @internal\n */\nexport interface ISweepMessage {\n\t/**\n\t * @see GarbageCollectionMessageType.Sweep\n\t */\n\ttype: typeof GarbageCollectionMessageType.Sweep;\n\t/**\n\t * The ids of nodes that are deleted.\n\t */\n\tdeletedNodeIds: string[];\n}\n\n/**\n * The GC TombstoneLoaded message.\n * @internal\n */\nexport interface ITombstoneLoadedMessage {\n\t/**\n\t * @see GarbageCollectionMessageType.TombstoneLoaded\n\t */\n\ttype: typeof GarbageCollectionMessageType.TombstoneLoaded;\n\t/**\n\t * The id of Tombstoned node that was loaded.\n\t */\n\tnodePath: string;\n}\n\n/**\n * Type for a message to be used for sending / received garbage collection messages.\n * @internal\n */\nexport type GarbageCollectionMessage = ISweepMessage | ITombstoneLoadedMessage;\n\n/**\n * Defines the APIs for the runtime object to be passed to the garbage collector.\n */\nexport interface IGarbageCollectionRuntime {\n\t/**\n\t * Returns the garbage collection data of the runtime.\n\t */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\t/**\n\t * After GC has run, called to notify the runtime of routes that are used in it.\n\t */\n\tupdateUsedRoutes(usedRoutes: readonly string[]): void;\n\t/**\n\t * After GC has run and identified nodes that are sweep ready, called to delete the sweep ready nodes. The runtime\n\t * should return the routes of nodes that were deleted.\n\t * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.\n\t */\n\tdeleteSweepReadyNodes(sweepReadyRoutes: readonly string[]): readonly string[];\n\t/**\n\t * Called to notify the runtime of routes that are tombstones.\n\t */\n\tupdateTombstonedRoutes(tombstoneRoutes: readonly string[]): void;\n\t/**\n\t * Returns a referenced timestamp to be used to track unreferenced nodes.\n\t */\n\tgetCurrentReferenceTimestampMs(): number | undefined;\n\t/**\n\t * Returns the type of the GC node.\n\t */\n\tgetNodeType(nodePath: string): GCNodeType;\n\t/**\n\t * Called when the runtime should close because of an error.\n\t */\n\tcloseFn: (error?: ICriticalContainerError) => void;\n}\n\n/**\n * Defines the contract for the garbage collector.\n */\nexport interface IGarbageCollector {\n\t/**\n\t * Tells the time at which session expiry timer started in a previous container.\n\t * This is only set when loading from a stashed container and will be equal to the\n\t * original container's local client time when it was loaded (and started the session expiry timer).\n\t */\n\treadonly sessionExpiryTimerStarted: number | undefined;\n\t/**\n\t * Tells whether GC should run or not.\n\t */\n\treadonly shouldRunGC: boolean;\n\t/**\n\t * The count of data stores whose GC state updated since the last summary.\n\t */\n\treadonly updatedDSCountSinceLastSummary: number;\n\t/**\n\t * Initialize the state from the base snapshot after its creation.\n\t */\n\tinitializeBaseState(): Promise<void>;\n\t/**\n\t * Run garbage collection and update the reference / used state of the system.\n\t */\n\tcollectGarbage(\n\t\toptions: {\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\trunSweep?: boolean;\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined>;\n\t/**\n\t * Summarizes the GC data and returns it as a summary tree.\n\t */\n\tsummarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined;\n\t/**\n\t * Returns the garbage collector specific metadata to be written into the summary.\n\t */\n\tgetMetadata(): IGCMetadata;\n\t/**\n\t * Returns the GC details generated from the base snapshot.\n\t */\n\tgetBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;\n\t/**\n\t * Called when the latest summary of the system has been refreshed.\n\t */\n\trefreshLatestSummary(result: IRefreshSummaryResult): Promise<void>;\n\t/**\n\t * Called when a node with the given path is updated. If the node is inactive or tombstoned, this will log an error\n\t * or throw an error if failing on incorrect usage is configured.\n\t */\n\tnodeUpdated(props: IGCNodeUpdatedProps): void;\n\t/**\n\t * Called when a reference is added to a node. Used to identify nodes that were referenced between summaries.\n\t */\n\taddedOutboundReference(\n\t\tfromNodePath: string,\n\t\ttoNodePath: string,\n\t\ttimestampMs: number,\n\t\tautorecovery?: true,\n\t): void;\n\t/**\n\t * Called to process garbage collection messages\n\t */\n\tprocessMessages(\n\t\tmessageContents: GarbageCollectionMessage[],\n\t\tmessageTimestampMs: number,\n\t\tlocal: boolean,\n\t): void;\n\t/**\n\t * Returns true if this node has been deleted by GC during sweep phase.\n\t */\n\tisNodeDeleted(nodePath: string): boolean;\n\tsetConnectionState(connected: boolean, clientId?: string): void;\n\tdispose(): void;\n}\n\n/**\n * Info needed by GC when notified that a node was updated (loaded or changed)\n * @internal\n */\nexport interface IGCNodeUpdatedProps {\n\t/**\n\t * Type and path of the updated node\n\t */\n\tnode: { type: (typeof GCNodeType)[\"DataStore\" | \"Blob\"]; path: string };\n\t/**\n\t * Whether the node (or a subpath) was loaded or changed.\n\t */\n\treason: \"Loaded\" | \"Changed\" | \"Realized\";\n\t/**\n\t * The op-based timestamp when the node changed. If the update is from receiving an op, this should\n\t * be the timestamp of the op. If not, this should be the timestamp of the last op processed.\n\t */\n\ttimestampMs: number | undefined;\n\t/**\n\t * The package path of the node. This may not be available if the node hasn't been loaded yet\n\t */\n\tpackagePath?: readonly string[];\n\t/**\n\t * The original request for loads to preserve it in telemetry\n\t */\n\trequest?: IRequest;\n\t/**\n\t * If the node was loaded via request path, the header data. May be modified from the original request\n\t */\n\theaderData?: RuntimeHeaderData;\n\t/**\n\t * Any other properties to be logged.\n\t */\n\tadditionalProps?: ITelemetryPropertiesExt;\n}\n\n/**\n * Parameters necessary for creating a GarbageCollector.\n */\nexport interface IGarbageCollectorCreateParams {\n\treadonly runtime: IGarbageCollectionRuntime;\n\treadonly gcOptions: IGCRuntimeOptions;\n\treadonly baseLogger: ITelemetryLoggerExt;\n\treadonly existing: boolean;\n\n\treadonly metadata: IContainerRuntimeMetadata | undefined;\n\n\treadonly createContainerMetadata: ICreateContainerMetadata;\n\treadonly baseSnapshot: ISnapshotTree | undefined;\n\treadonly isSummarizerClient: boolean;\n\treadonly getNodePackagePath: (nodePath: string) => Promise<readonly string[] | undefined>;\n\treadonly getLastSummaryTimestampMs: () => number | undefined;\n\treadonly readAndParseBlob: ReadAndParseBlob;\n\treadonly submitMessage: (message: ContainerRuntimeGCMessage) => void;\n\treadonly sessionExpiryTimerStarted?: number | undefined;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IGCRuntimeOptions {\n\t/**\n\t * Flag that if true, will enable the full Sweep Phase of garbage collection for this session,\n\t * where Tombstoned objects are permanently deleted from the container.\n\t *\n\t * IMPORTANT: This only applies if this document is allowed to run Sweep Phase.\n\t *\n\t * Current default behavior is for Sweep Phase not to delete Tombstoned objects,\n\t * but merely to prevent them from being loaded.\n\t */\n\tenableGCSweep?: true;\n\n\t/**\n\t * Flag that will bypass optimizations and generate GC data for all nodes irrespective of whether a node\n\t * changed or not.\n\t */\n\trunFullGC?: boolean;\n\n\t/**\n\t * Maximum session duration for a new container. If not present, a default value will be used.\n\t *\n\t * Note: This setting is persisted in the container's summary and cannot be changed.\n\t */\n\tsessionExpiryTimeoutMs?: number;\n\n\t/**\n\t * Delay between when Tombstone should run and when the object should be deleted.\n\t * This grace period gives a chance to intervene to recover if needed, before Sweep deletes the object.\n\t * If not present, a default (non-zero) value will be used.\n\t */\n\tsweepGracePeriodMs?: number;\n\n\t/**\n\t * Allows additional GC options to be passed.\n\t */\n\t// TODO: Use unknown (breaking change)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t[key: string]: any;\n}\n\n/**\n * The configurations for Garbage Collector that determines what runs and how.\n */\nexport interface IGarbageCollectorConfigs {\n\t/**\n\t * Tracks if GC is allowed for this document. GC may not be allowed for old documents created pre-GC.\n\t * If GC is allowed for a document, it will always be enabled. It cannot be disabled per session.\n\t */\n\treadonly gcAllowed: boolean;\n\t/**\n\t * Tracks whether sweep phase is allowed for this document. Sweep can be disabled per session via the sweepEnabled\n\t * flag defined below.\n\t */\n\treadonly sweepAllowed: boolean;\n\t/**\n\t * Tracks if sweep phase is enabled to run in this session or not\n\t */\n\treadonly sweepEnabled: boolean;\n\t/**\n\t * If true, bypass optimizations and generate GC data for all nodes irrespective of whether a node changed or not.\n\t */\n\treadonly runFullGC: boolean | undefined;\n\t/**\n\t * The time in ms to expire a session for a client for gc.\n\t */\n\treadonly sessionExpiryTimeoutMs: number | undefined;\n\t/**\n\t * The time after which an unreferenced node can be Tombstoned - i.e. GC knows it can't be referenced again (revived).\n\t */\n\treadonly tombstoneTimeoutMs: number | undefined;\n\t/**\n\t * The delay between tombstone and sweep. Not persisted, so concurrent sessions may use different values.\n\t * Sweep is implemented in an eventually-consistent way so this is acceptable.\n\t */\n\treadonly sweepGracePeriodMs: number;\n\t/**\n\t * The time after which an unreferenced node is inactive.\n\t */\n\treadonly inactiveTimeoutMs: number;\n\t/**\n\t * Tracks whether GC should run in test mode. In this mode, unreferenced objects are deleted immediately.\n\t */\n\treadonly testMode: boolean;\n\t/**\n\t * @see GCFeatureMatrix.\n\t */\n\treadonly persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\t/**\n\t * The version of GC in the base snapshot.\n\t */\n\treadonly gcVersionInBaseSnapshot: GCVersion | undefined;\n\t/**\n\t * The current version of GC data in the running code\n\t */\n\treadonly gcVersionInEffect: GCVersion;\n\t/**\n\t * If true, throw an error when a tombstone data store is retrieved\n\t */\n\treadonly throwOnTombstoneLoad: boolean;\n}\n\n/**\n * The state of node that is unreferenced.\n */\nexport const UnreferencedState = {\n\t/**\n\t * The node is active, i.e., it can become referenced again.\n\t */\n\tActive: \"Active\",\n\t/**\n\t * The node is inactive, i.e., it should not become referenced.\n\t */\n\tInactive: \"Inactive\",\n\t/**\n\t * The node is ready to be tombstoned\n\t */\n\tTombstoneReady: \"TombstoneReady\",\n\t/**\n\t * The node is ready to be deleted by the sweep phase.\n\t */\n\tSweepReady: \"SweepReady\",\n} as const;\nexport type UnreferencedState = (typeof UnreferencedState)[keyof typeof UnreferencedState];\n\n/**\n * Represents the result of a GC run.\n */\nexport interface IGCResult {\n\t/**\n\t * The ids of nodes that are referenced in the referenced graph\n\t */\n\treferencedNodeIds: string[];\n\t/**\n\t * The ids of nodes that are not-referenced or deleted in the referenced graph\n\t */\n\tdeletedNodeIds: string[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcHelpers.d.ts","sourceRoot":"","sources":["../../src/gc/gcHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,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sB,GAC7B,sBAAsB,CAWxB;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAC1C,cAAc,EAAE,aAAa,EAC7B,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,8BAA8B,CAAC,CAgCzC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACxC,SAAS,EAAE,6BAA6B,GACtC,GAAG,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAgE5C;AAWD;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAChD,qBAAqB,EAAE,KAAK,EAC5B,cAAc,EAAE,QAAQ,GAAG,eAAe,GAAG,SAAS,GACpD,OAAO,CAGT"}
|
package/dist/gc/gcHelpers.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.compatBehaviorAllowsGCMessageType = exports.dataStoreNodePathOnly = expo
|
|
|
8
8
|
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
9
|
const internal_2 = require("@fluidframework/runtime-definitions/internal");
|
|
10
10
|
const gcDefinitions_js_1 = require("./gcDefinitions.js");
|
|
11
|
-
// eslint-disable-next-line import/no-deprecated
|
|
12
11
|
function getGCVersion(metadata) {
|
|
13
12
|
if (!metadata) {
|
|
14
13
|
// Force to 0/disallowed in prior versions
|
|
@@ -43,9 +42,7 @@ exports.getGCVersionInEffect = getGCVersionInEffect;
|
|
|
43
42
|
* @param currentGeneration - The current app-provided gcGeneration value
|
|
44
43
|
* @returns true if GC Sweep should be allowed for this document
|
|
45
44
|
*/
|
|
46
|
-
function shouldAllowGcSweep(
|
|
47
|
-
// eslint-disable-next-line import/no-deprecated
|
|
48
|
-
featureMatrix, currentGeneration) {
|
|
45
|
+
function shouldAllowGcSweep(featureMatrix, currentGeneration) {
|
|
49
46
|
// If no Generation value is provided for this session, default to true
|
|
50
47
|
if (currentGeneration === undefined) {
|
|
51
48
|
return true;
|
package/dist/gc/gcHelpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcHelpers.js","sourceRoot":"","sources":["../../src/gc/gcHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,2EAMsD;AAGtD,yDAU4B;AAO5B,gDAAgD;AAChD,SAAgB,YAAY,CAAC,QAAsB;IAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,0CAA0C;QAC1C,OAAO,CAAC,CAAC;IACV,CAAC;IACD,OAAO,QAAQ,CAAC,SAAS,IAAI,CAAC,CAAC;AAChC,CAAC;AAND,oCAMC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,cAA+B;IACnE,yEAAyE;IACzE,OAAO,cAAc,CAAC,UAAU,CAAC,0CAAuB,CAAC,KAAK,IAAI;QACjE,CAAC,CAAC,gCAAa;QACf,CAAC,CAAC,kCAAe,CAAC;AACpB,CAAC;AALD,oDAKC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,kBAAkB;AACjC,gDAAgD;AAChD,aAA8B,EAC9B,iBAAqC;IAErC,uEAAuE;IACvE,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,2FAA2F;IAC3F,MAAM,gBAAgB,GAAG,aAAa,CAAC,mBAAmB,IAAI,aAAa,CAAC,YAAY,CAAC;IAEzF,OAAO,iBAAiB,KAAK,gBAAgB,CAAC;AAC/C,CAAC;AAdD,gDAcC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CACpC,OAAgC;IAEhC,MAAM,aAAa,GAA2C,MAAM,CAAC,OAAO,CAC3E,OAAO,CAAC,OAAO,CACf,CAAC;IACF,aAAa,CAAC,IAAI,CAA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AAC;IAChD,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AAlED,8DAkEC;AAED;;;;GAIG;AACH,SAAS,6BAA6B,CAAC,GAAW;IACjD,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,GAAW;IAC1C,OAAO,IAAI,6BAA6B,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/D,CAAC;AAFD,0CAEC;AAED;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,gBAAwB;IAC7D,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7C,CAAC;AAFD,sDAEC;AAED;;;;;;;GAOG;AACH,SAAgB,iCAAiC,CAChD,qBAA4B,EAC5B,cAAsD;IAEtD,yDAAyD;IACzD,OAAO,cAAc,KAAK,QAAQ,CAAC;AACpC,CAAC;AAND,8EAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIGarbageCollectionDetailsBase,\n\tgcBlobPrefix,\n\tgcDeletedBlobKey,\n\tgcTombstoneBlobKey,\n\tIGarbageCollectionData,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { IConfigProvider } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\tGCFeatureMatrix,\n\t// eslint-disable-next-line import/no-deprecated\n\tGCVersion,\n\t// eslint-disable-next-line import/no-deprecated\n\tIGCMetadata,\n\tgcVersionUpgradeToV4Key,\n\tnextGCVersion,\n\tstableGCVersion,\n} from \"./gcDefinitions.js\";\nimport {\n\tIGarbageCollectionNodeData,\n\tIGarbageCollectionSnapshotData,\n\tIGarbageCollectionState,\n} from \"./gcSummaryDefinitions.js\";\n\n// eslint-disable-next-line import/no-deprecated\nexport function getGCVersion(metadata?: IGCMetadata): GCVersion {\n\tif (!metadata) {\n\t\t// Force to 0/disallowed in prior versions\n\t\treturn 0;\n\t}\n\treturn metadata.gcFeature ?? 0;\n}\n\n/**\n * Indicates what GC version is in effect for new GC data being written in this session\n */\nexport function getGCVersionInEffect(configProvider: IConfigProvider): number {\n\t// If version upgrade is not enabled, fall back to the stable GC version.\n\treturn configProvider.getBoolean(gcVersionUpgradeToV4Key) === true\n\t\t? nextGCVersion\n\t\t: stableGCVersion;\n}\n\n/**\n * Indicates whether Sweep is allowed for this document based on the persisted GC Feature Matrix and current gcGeneration.\n * This applies to the entire Sweep Phase the same - both Tombstone Enforcement (i.e. should loading a Tombstone fail?) and Deletion.\n *\n * In order to protect old documents that were created at a time when known bugs exist that violate GC's invariants\n * such that enforcing GC Sweep would cause legitimate data loss, the container author may increment the generation value for Sweep\n * such that containers created with a different value will not be subjected to GC Sweep.\n *\n * If no generation is provided, Sweep will be enabled for all documents.\n *\n * For backwards compatibility, the current generation value is also compared against the persisted gcTombstoneGeneration if present.\n *\n * @param featureMatrix - The GC Feature Matrix, containing the persisted generation value\n * @param currentGeneration - The current app-provided gcGeneration value\n * @returns true if GC Sweep should be allowed for this document\n */\nexport function shouldAllowGcSweep(\n\t// eslint-disable-next-line import/no-deprecated\n\tfeatureMatrix: GCFeatureMatrix,\n\tcurrentGeneration: number | undefined,\n): boolean {\n\t// If no Generation value is provided for this session, default to true\n\tif (currentGeneration === undefined) {\n\t\treturn true;\n\t}\n\n\t// tombstoneGeneration is the predecessor and needs to be supported for back-compat reasons\n\tconst targetGeneration = featureMatrix.tombstoneGeneration ?? featureMatrix.gcGeneration;\n\n\treturn currentGeneration === targetGeneration;\n}\n\n/**\n * Sorts the given GC state as per the id of the GC nodes. It also sorts the outbound routes array of each node.\n */\nexport function generateSortedGCState(\n\tgcState: IGarbageCollectionState,\n): IGarbageCollectionState {\n\tconst sortableArray: [string, IGarbageCollectionNodeData][] = Object.entries(\n\t\tgcState.gcNodes,\n\t);\n\tsortableArray.sort(([a], [b]) => a.localeCompare(b));\n\tconst sortedGCState: IGarbageCollectionState = { gcNodes: {} };\n\tfor (const [nodeId, nodeData] of sortableArray) {\n\t\tnodeData.outboundRoutes.sort();\n\t\tsortedGCState.gcNodes[nodeId] = nodeData;\n\t}\n\treturn sortedGCState;\n}\n\n/**\n * Concatenates the given GC states and returns the concatenated GC state.\n */\nexport function concatGarbageCollectionStates(\n\tgcState1: IGarbageCollectionState,\n\tgcState2: IGarbageCollectionState,\n): IGarbageCollectionState {\n\tconst combinedGCNodes: { [id: string]: IGarbageCollectionNodeData } = {};\n\tfor (const [nodeId, nodeData] of Object.entries(gcState1.gcNodes)) {\n\t\tcombinedGCNodes[nodeId] = {\n\t\t\toutboundRoutes: [...nodeData.outboundRoutes],\n\t\t\tunreferencedTimestampMs: nodeData.unreferencedTimestampMs,\n\t\t};\n\t}\n\n\tfor (const [nodeId, nodeData] of Object.entries(gcState2.gcNodes)) {\n\t\tlet combineNodeData = combinedGCNodes[nodeId];\n\t\tif (combineNodeData === undefined) {\n\t\t\tcombineNodeData = {\n\t\t\t\toutboundRoutes: [...nodeData.outboundRoutes],\n\t\t\t\tunreferencedTimestampMs: nodeData.unreferencedTimestampMs,\n\t\t\t};\n\t\t} else {\n\t\t\t// Validate that same node doesn't have different unreferenced timestamp.\n\t\t\tif (\n\t\t\t\tnodeData.unreferencedTimestampMs !== undefined &&\n\t\t\t\tcombineNodeData.unreferencedTimestampMs !== undefined\n\t\t\t) {\n\t\t\t\tassert(\n\t\t\t\t\tnodeData.unreferencedTimestampMs === combineNodeData.unreferencedTimestampMs,\n\t\t\t\t\t0x5d7 /* Two entries for the same GC node with different unreferenced timestamp */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcombineNodeData = {\n\t\t\t\toutboundRoutes: [\n\t\t\t\t\t...new Set([...nodeData.outboundRoutes, ...combineNodeData.outboundRoutes]),\n\t\t\t\t],\n\t\t\t\tunreferencedTimestampMs:\n\t\t\t\t\tnodeData.unreferencedTimestampMs ?? combineNodeData.unreferencedTimestampMs,\n\t\t\t};\n\t\t}\n\t\tcombinedGCNodes[nodeId] = combineNodeData;\n\t}\n\treturn { gcNodes: combinedGCNodes };\n}\n\n/**\n * Helper function that clones the GC data.\n * @param gcData - The GC data to clone.\n * @returns a clone of the given GC data.\n */\nexport function cloneGCData(gcData: IGarbageCollectionData): IGarbageCollectionData {\n\tconst clonedGCNodes: { [id: string]: string[] } = {};\n\tfor (const [id, outboundRoutes] of Object.entries(gcData.gcNodes)) {\n\t\tclonedGCNodes[id] = [...outboundRoutes];\n\t}\n\treturn {\n\t\tgcNodes: clonedGCNodes,\n\t};\n}\n\n/**\n * Concatenates the given GC data and returns the concatenated GC data.\n */\nexport function concatGarbageCollectionData(\n\tgcData1: IGarbageCollectionData,\n\tgcData2: IGarbageCollectionData,\n): IGarbageCollectionData {\n\tconst combinedGCData: IGarbageCollectionData = cloneGCData(gcData1);\n\tfor (const [id, routes] of Object.entries(gcData2.gcNodes)) {\n\t\tif (combinedGCData.gcNodes[id] === undefined) {\n\t\t\tcombinedGCData.gcNodes[id] = [...routes];\n\t\t} else {\n\t\t\tconst combinedRoutes = [...routes, ...combinedGCData.gcNodes[id]];\n\t\t\tcombinedGCData.gcNodes[id] = [...new Set(combinedRoutes)];\n\t\t}\n\t}\n\treturn combinedGCData;\n}\n\n/**\n * Gets the base garbage collection state from the given snapshot tree. It contains GC state, deleted nodes and\n * tombstones. The GC state may be written into multiple blobs. Merge the GC state from all such blobs into one.\n */\nexport async function getGCDataFromSnapshot(\n\tgcSnapshotTree: ISnapshotTree,\n\treadAndParseBlob: <T>(id: string) => Promise<T>,\n): Promise<IGarbageCollectionSnapshotData> {\n\tlet rootGCState: IGarbageCollectionState = { gcNodes: {} };\n\tlet tombstones: string[] | undefined;\n\tlet deletedNodes: string[] | undefined;\n\tfor (const key of Object.keys(gcSnapshotTree.blobs)) {\n\t\t// Update deleted nodes blob.\n\t\tif (key === gcDeletedBlobKey) {\n\t\t\tdeletedNodes = await readAndParseBlob<string[]>(gcSnapshotTree.blobs[key]);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Update tombstone blob.\n\t\tif (key === gcTombstoneBlobKey) {\n\t\t\ttombstones = await readAndParseBlob<string[]>(gcSnapshotTree.blobs[key]);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Skip blobs that do not start with the GC prefix.\n\t\tif (!key.startsWith(gcBlobPrefix)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst blobId = gcSnapshotTree.blobs[key];\n\t\tif (blobId === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst gcState = await readAndParseBlob<IGarbageCollectionState>(blobId);\n\t\tassert(gcState !== undefined, 0x5d8 /* GC blob missing from snapshot */);\n\t\t// Merge the GC state of this blob into the root GC state.\n\t\trootGCState = concatGarbageCollectionStates(rootGCState, gcState);\n\t}\n\treturn { gcState: rootGCState, tombstones, deletedNodes };\n}\n\n/**\n * Helper function that unpacks the GC details of the children from a given node's GC details.\n * @param gcDetails - The GC details of a node.\n * @returns A map of GC details of each children of the the given node.\n */\nexport function unpackChildNodesGCDetails(\n\tgcDetails: IGarbageCollectionDetailsBase,\n): Map<string, IGarbageCollectionDetailsBase> {\n\tconst childGCDetailsMap: Map<string, IGarbageCollectionDetailsBase> = new Map();\n\n\t// If GC data is not available, bail out.\n\tif (gcDetails.gcData === undefined) {\n\t\treturn childGCDetailsMap;\n\t}\n\n\tconst gcNodes = gcDetails.gcData.gcNodes;\n\tfor (const [id, outboundRoutes] of Object.entries(gcNodes)) {\n\t\t// Skip self-node since only children GC data is to be generated.\n\t\tif (id === \"/\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst childId = id.split(\"/\")[1];\n\t\tassert(\n\t\t\tchildId !== undefined,\n\t\t\t0x9fe /* node id should be an absolute route with child id part */,\n\t\t);\n\t\tlet childGCNodeId = id.slice(childId.length + 1);\n\t\t// GC node id always begins with \"/\". Handle the special case where a child's id in the parent's GC nodes is\n\t\t// of format `/root`. In this case, the childId is root and childGCNodeId is \"\". Make childGCNodeId = \"/\".\n\t\tif (childGCNodeId === \"\") {\n\t\t\tchildGCNodeId = \"/\";\n\t\t}\n\n\t\tlet childGCDetails = childGCDetailsMap.get(childId);\n\t\tif (childGCDetails === undefined) {\n\t\t\tchildGCDetails = { gcData: { gcNodes: {} }, usedRoutes: [] };\n\t\t}\n\t\t// gcData should not undefined as its always at least initialized as empty above.\n\t\tassert(\n\t\t\tchildGCDetails.gcData !== undefined,\n\t\t\t0x5da /* Child GC data should have been initialized */,\n\t\t);\n\t\tchildGCDetails.gcData.gcNodes[childGCNodeId] = [...new Set(outboundRoutes)];\n\t\tchildGCDetailsMap.set(childId, childGCDetails);\n\t}\n\n\tif (gcDetails.usedRoutes === undefined) {\n\t\treturn childGCDetailsMap;\n\t}\n\n\t// Remove the node's self used route, if any, and generate the children used routes.\n\tconst usedRoutes = gcDetails.usedRoutes.filter((route) => route !== \"\" && route !== \"/\");\n\tfor (const route of usedRoutes) {\n\t\tconst childId = route.split(\"/\")[1];\n\t\tassert(\n\t\t\tchildId !== undefined,\n\t\t\t0x9ff /* used route should be an absolute route with child id part */,\n\t\t);\n\t\tconst childUsedRoute = route.slice(childId.length + 1);\n\n\t\tconst childGCDetails = childGCDetailsMap.get(childId);\n\t\tassert(\n\t\t\tchildGCDetails?.usedRoutes !== undefined,\n\t\t\t0x5dc /* This should have be initialized when generate GC nodes above */,\n\t\t);\n\n\t\tchildGCDetails.usedRoutes.push(childUsedRoute);\n\t\tchildGCDetailsMap.set(childId, childGCDetails);\n\t}\n\treturn childGCDetailsMap;\n}\n\n/**\n * Trims the leading and trailing slashes from the given string.\n * @param str - A string that may contain leading and / or trailing slashes.\n * @returns A new string without leading and trailing slashes.\n */\nfunction trimLeadingAndTrailingSlashes(str: string): string {\n\treturn str.replace(/^\\/+|\\/+$/g, \"\");\n}\n\n/**\n * Reformats a request URL to match expected format for a GC node path\n */\nexport function urlToGCNodePath(url: string): string {\n\treturn `/${trimLeadingAndTrailingSlashes(url.split(\"?\")[0])}`;\n}\n\n/**\n * Pulls out the first path segment and formats it as a GC Node path\n * e.g. \"/dataStoreId/ddsId\" yields \"/dataStoreId\"\n */\nexport function dataStoreNodePathOnly(subDataStorePath: string): string {\n\treturn `/${subDataStorePath.split(\"/\")[1]}`;\n}\n\n/**\n * Utility to implement compat behaviors given an unknown message type\n * The parameters are typed to support compile-time enforcement of handling all known types/behaviors\n *\n * @param _unknownGCMessageType - Typed as never to ensure all known types have been\n * handled before calling this function (e.g. in a switch statement).\n * @param compatBehavior - Typed redundantly with CompatModeBehavior to ensure handling is added when updating that type\n */\nexport function compatBehaviorAllowsGCMessageType(\n\t_unknownGCMessageType: never,\n\tcompatBehavior: \"Ignore\" | \"FailToProcess\" | undefined,\n): boolean {\n\t// undefined defaults to same behavior as \"FailToProcess\"\n\treturn compatBehavior === \"Ignore\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gcHelpers.js","sourceRoot":"","sources":["../../src/gc/gcHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,2EAMsD;AAGtD,yDAO4B;AAO5B,SAAgB,YAAY,CAAC,QAAsB;IAClD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACf,0CAA0C;QAC1C,OAAO,CAAC,CAAC;IACV,CAAC;IACD,OAAO,QAAQ,CAAC,SAAS,IAAI,CAAC,CAAC;AAChC,CAAC;AAND,oCAMC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,cAA+B;IACnE,yEAAyE;IACzE,OAAO,cAAc,CAAC,UAAU,CAAC,0CAAuB,CAAC,KAAK,IAAI;QACjE,CAAC,CAAC,gCAAa;QACf,CAAC,CAAC,kCAAe,CAAC;AACpB,CAAC;AALD,oDAKC;AAED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AAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAA,iBAAM,EACL,OAAO,KAAK,SAAS,EACrB,KAAK,CAAC,+DAA+D,CACrE,CAAC;QACF,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAEvD,MAAM,cAAc,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACtD,IAAA,iBAAM,EACL,cAAc,EAAE,UAAU,KAAK,SAAS,EACxC,KAAK,CAAC,kEAAkE,CACxE,CAAC;QAEF,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/C,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AAlED,8DAkEC;AAED;;;;GAIG;AACH,SAAS,6BAA6B,CAAC,GAAW;IACjD,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,GAAW;IAC1C,OAAO,IAAI,6BAA6B,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/D,CAAC;AAFD,0CAEC;AAED;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,gBAAwB;IAC7D,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC7C,CAAC;AAFD,sDAEC;AAED;;;;;;;GAOG;AACH,SAAgB,iCAAiC,CAChD,qBAA4B,EAC5B,cAAsD;IAEtD,yDAAyD;IACzD,OAAO,cAAc,KAAK,QAAQ,CAAC;AACpC,CAAC;AAND,8EAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIGarbageCollectionDetailsBase,\n\tgcBlobPrefix,\n\tgcDeletedBlobKey,\n\tgcTombstoneBlobKey,\n\tIGarbageCollectionData,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { IConfigProvider } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tGCFeatureMatrix,\n\tGCVersion,\n\tIGCMetadata,\n\tgcVersionUpgradeToV4Key,\n\tnextGCVersion,\n\tstableGCVersion,\n} from \"./gcDefinitions.js\";\nimport {\n\tIGarbageCollectionNodeData,\n\tIGarbageCollectionSnapshotData,\n\tIGarbageCollectionState,\n} from \"./gcSummaryDefinitions.js\";\n\nexport function getGCVersion(metadata?: IGCMetadata): GCVersion {\n\tif (!metadata) {\n\t\t// Force to 0/disallowed in prior versions\n\t\treturn 0;\n\t}\n\treturn metadata.gcFeature ?? 0;\n}\n\n/**\n * Indicates what GC version is in effect for new GC data being written in this session\n */\nexport function getGCVersionInEffect(configProvider: IConfigProvider): number {\n\t// If version upgrade is not enabled, fall back to the stable GC version.\n\treturn configProvider.getBoolean(gcVersionUpgradeToV4Key) === true\n\t\t? nextGCVersion\n\t\t: stableGCVersion;\n}\n\n/**\n * Indicates whether Sweep is allowed for this document based on the persisted GC Feature Matrix and current gcGeneration.\n * This applies to the entire Sweep Phase the same - both Tombstone Enforcement (i.e. should loading a Tombstone fail?) and Deletion.\n *\n * In order to protect old documents that were created at a time when known bugs exist that violate GC's invariants\n * such that enforcing GC Sweep would cause legitimate data loss, the container author may increment the generation value for Sweep\n * such that containers created with a different value will not be subjected to GC Sweep.\n *\n * If no generation is provided, Sweep will be enabled for all documents.\n *\n * For backwards compatibility, the current generation value is also compared against the persisted gcTombstoneGeneration if present.\n *\n * @param featureMatrix - The GC Feature Matrix, containing the persisted generation value\n * @param currentGeneration - The current app-provided gcGeneration value\n * @returns true if GC Sweep should be allowed for this document\n */\nexport function shouldAllowGcSweep(\n\tfeatureMatrix: GCFeatureMatrix,\n\tcurrentGeneration: number | undefined,\n): boolean {\n\t// If no Generation value is provided for this session, default to true\n\tif (currentGeneration === undefined) {\n\t\treturn true;\n\t}\n\n\t// tombstoneGeneration is the predecessor and needs to be supported for back-compat reasons\n\tconst targetGeneration = featureMatrix.tombstoneGeneration ?? featureMatrix.gcGeneration;\n\n\treturn currentGeneration === targetGeneration;\n}\n\n/**\n * Sorts the given GC state as per the id of the GC nodes. It also sorts the outbound routes array of each node.\n */\nexport function generateSortedGCState(\n\tgcState: IGarbageCollectionState,\n): IGarbageCollectionState {\n\tconst sortableArray: [string, IGarbageCollectionNodeData][] = Object.entries(\n\t\tgcState.gcNodes,\n\t);\n\tsortableArray.sort(([a], [b]) => a.localeCompare(b));\n\tconst sortedGCState: IGarbageCollectionState = { gcNodes: {} };\n\tfor (const [nodeId, nodeData] of sortableArray) {\n\t\tnodeData.outboundRoutes.sort();\n\t\tsortedGCState.gcNodes[nodeId] = nodeData;\n\t}\n\treturn sortedGCState;\n}\n\n/**\n * Concatenates the given GC states and returns the concatenated GC state.\n */\nexport function concatGarbageCollectionStates(\n\tgcState1: IGarbageCollectionState,\n\tgcState2: IGarbageCollectionState,\n): IGarbageCollectionState {\n\tconst combinedGCNodes: { [id: string]: IGarbageCollectionNodeData } = {};\n\tfor (const [nodeId, nodeData] of Object.entries(gcState1.gcNodes)) {\n\t\tcombinedGCNodes[nodeId] = {\n\t\t\toutboundRoutes: [...nodeData.outboundRoutes],\n\t\t\tunreferencedTimestampMs: nodeData.unreferencedTimestampMs,\n\t\t};\n\t}\n\n\tfor (const [nodeId, nodeData] of Object.entries(gcState2.gcNodes)) {\n\t\tlet combineNodeData = combinedGCNodes[nodeId];\n\t\tif (combineNodeData === undefined) {\n\t\t\tcombineNodeData = {\n\t\t\t\toutboundRoutes: [...nodeData.outboundRoutes],\n\t\t\t\tunreferencedTimestampMs: nodeData.unreferencedTimestampMs,\n\t\t\t};\n\t\t} else {\n\t\t\t// Validate that same node doesn't have different unreferenced timestamp.\n\t\t\tif (\n\t\t\t\tnodeData.unreferencedTimestampMs !== undefined &&\n\t\t\t\tcombineNodeData.unreferencedTimestampMs !== undefined\n\t\t\t) {\n\t\t\t\tassert(\n\t\t\t\t\tnodeData.unreferencedTimestampMs === combineNodeData.unreferencedTimestampMs,\n\t\t\t\t\t0x5d7 /* Two entries for the same GC node with different unreferenced timestamp */,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcombineNodeData = {\n\t\t\t\toutboundRoutes: [\n\t\t\t\t\t...new Set([...nodeData.outboundRoutes, ...combineNodeData.outboundRoutes]),\n\t\t\t\t],\n\t\t\t\tunreferencedTimestampMs:\n\t\t\t\t\tnodeData.unreferencedTimestampMs ?? combineNodeData.unreferencedTimestampMs,\n\t\t\t};\n\t\t}\n\t\tcombinedGCNodes[nodeId] = combineNodeData;\n\t}\n\treturn { gcNodes: combinedGCNodes };\n}\n\n/**\n * Helper function that clones the GC data.\n * @param gcData - The GC data to clone.\n * @returns a clone of the given GC data.\n */\nexport function cloneGCData(gcData: IGarbageCollectionData): IGarbageCollectionData {\n\tconst clonedGCNodes: { [id: string]: string[] } = {};\n\tfor (const [id, outboundRoutes] of Object.entries(gcData.gcNodes)) {\n\t\tclonedGCNodes[id] = [...outboundRoutes];\n\t}\n\treturn {\n\t\tgcNodes: clonedGCNodes,\n\t};\n}\n\n/**\n * Concatenates the given GC data and returns the concatenated GC data.\n */\nexport function concatGarbageCollectionData(\n\tgcData1: IGarbageCollectionData,\n\tgcData2: IGarbageCollectionData,\n): IGarbageCollectionData {\n\tconst combinedGCData: IGarbageCollectionData = cloneGCData(gcData1);\n\tfor (const [id, routes] of Object.entries(gcData2.gcNodes)) {\n\t\tif (combinedGCData.gcNodes[id] === undefined) {\n\t\t\tcombinedGCData.gcNodes[id] = [...routes];\n\t\t} else {\n\t\t\tconst combinedRoutes = [...routes, ...combinedGCData.gcNodes[id]];\n\t\t\tcombinedGCData.gcNodes[id] = [...new Set(combinedRoutes)];\n\t\t}\n\t}\n\treturn combinedGCData;\n}\n\n/**\n * Gets the base garbage collection state from the given snapshot tree. It contains GC state, deleted nodes and\n * tombstones. The GC state may be written into multiple blobs. Merge the GC state from all such blobs into one.\n */\nexport async function getGCDataFromSnapshot(\n\tgcSnapshotTree: ISnapshotTree,\n\treadAndParseBlob: <T>(id: string) => Promise<T>,\n): Promise<IGarbageCollectionSnapshotData> {\n\tlet rootGCState: IGarbageCollectionState = { gcNodes: {} };\n\tlet tombstones: string[] | undefined;\n\tlet deletedNodes: string[] | undefined;\n\tfor (const key of Object.keys(gcSnapshotTree.blobs)) {\n\t\t// Update deleted nodes blob.\n\t\tif (key === gcDeletedBlobKey) {\n\t\t\tdeletedNodes = await readAndParseBlob<string[]>(gcSnapshotTree.blobs[key]);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Update tombstone blob.\n\t\tif (key === gcTombstoneBlobKey) {\n\t\t\ttombstones = await readAndParseBlob<string[]>(gcSnapshotTree.blobs[key]);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Skip blobs that do not start with the GC prefix.\n\t\tif (!key.startsWith(gcBlobPrefix)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst blobId = gcSnapshotTree.blobs[key];\n\t\tif (blobId === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst gcState = await readAndParseBlob<IGarbageCollectionState>(blobId);\n\t\tassert(gcState !== undefined, 0x5d8 /* GC blob missing from snapshot */);\n\t\t// Merge the GC state of this blob into the root GC state.\n\t\trootGCState = concatGarbageCollectionStates(rootGCState, gcState);\n\t}\n\treturn { gcState: rootGCState, tombstones, deletedNodes };\n}\n\n/**\n * Helper function that unpacks the GC details of the children from a given node's GC details.\n * @param gcDetails - The GC details of a node.\n * @returns A map of GC details of each children of the the given node.\n */\nexport function unpackChildNodesGCDetails(\n\tgcDetails: IGarbageCollectionDetailsBase,\n): Map<string, IGarbageCollectionDetailsBase> {\n\tconst childGCDetailsMap: Map<string, IGarbageCollectionDetailsBase> = new Map();\n\n\t// If GC data is not available, bail out.\n\tif (gcDetails.gcData === undefined) {\n\t\treturn childGCDetailsMap;\n\t}\n\n\tconst gcNodes = gcDetails.gcData.gcNodes;\n\tfor (const [id, outboundRoutes] of Object.entries(gcNodes)) {\n\t\t// Skip self-node since only children GC data is to be generated.\n\t\tif (id === \"/\") {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst childId = id.split(\"/\")[1];\n\t\tassert(\n\t\t\tchildId !== undefined,\n\t\t\t0x9fe /* node id should be an absolute route with child id part */,\n\t\t);\n\t\tlet childGCNodeId = id.slice(childId.length + 1);\n\t\t// GC node id always begins with \"/\". Handle the special case where a child's id in the parent's GC nodes is\n\t\t// of format `/root`. In this case, the childId is root and childGCNodeId is \"\". Make childGCNodeId = \"/\".\n\t\tif (childGCNodeId === \"\") {\n\t\t\tchildGCNodeId = \"/\";\n\t\t}\n\n\t\tlet childGCDetails = childGCDetailsMap.get(childId);\n\t\tif (childGCDetails === undefined) {\n\t\t\tchildGCDetails = { gcData: { gcNodes: {} }, usedRoutes: [] };\n\t\t}\n\t\t// gcData should not undefined as its always at least initialized as empty above.\n\t\tassert(\n\t\t\tchildGCDetails.gcData !== undefined,\n\t\t\t0x5da /* Child GC data should have been initialized */,\n\t\t);\n\t\tchildGCDetails.gcData.gcNodes[childGCNodeId] = [...new Set(outboundRoutes)];\n\t\tchildGCDetailsMap.set(childId, childGCDetails);\n\t}\n\n\tif (gcDetails.usedRoutes === undefined) {\n\t\treturn childGCDetailsMap;\n\t}\n\n\t// Remove the node's self used route, if any, and generate the children used routes.\n\tconst usedRoutes = gcDetails.usedRoutes.filter((route) => route !== \"\" && route !== \"/\");\n\tfor (const route of usedRoutes) {\n\t\tconst childId = route.split(\"/\")[1];\n\t\tassert(\n\t\t\tchildId !== undefined,\n\t\t\t0x9ff /* used route should be an absolute route with child id part */,\n\t\t);\n\t\tconst childUsedRoute = route.slice(childId.length + 1);\n\n\t\tconst childGCDetails = childGCDetailsMap.get(childId);\n\t\tassert(\n\t\t\tchildGCDetails?.usedRoutes !== undefined,\n\t\t\t0x5dc /* This should have be initialized when generate GC nodes above */,\n\t\t);\n\n\t\tchildGCDetails.usedRoutes.push(childUsedRoute);\n\t\tchildGCDetailsMap.set(childId, childGCDetails);\n\t}\n\treturn childGCDetailsMap;\n}\n\n/**\n * Trims the leading and trailing slashes from the given string.\n * @param str - A string that may contain leading and / or trailing slashes.\n * @returns A new string without leading and trailing slashes.\n */\nfunction trimLeadingAndTrailingSlashes(str: string): string {\n\treturn str.replace(/^\\/+|\\/+$/g, \"\");\n}\n\n/**\n * Reformats a request URL to match expected format for a GC node path\n */\nexport function urlToGCNodePath(url: string): string {\n\treturn `/${trimLeadingAndTrailingSlashes(url.split(\"?\")[0])}`;\n}\n\n/**\n * Pulls out the first path segment and formats it as a GC Node path\n * e.g. \"/dataStoreId/ddsId\" yields \"/dataStoreId\"\n */\nexport function dataStoreNodePathOnly(subDataStorePath: string): string {\n\treturn `/${subDataStorePath.split(\"/\")[1]}`;\n}\n\n/**\n * Utility to implement compat behaviors given an unknown message type\n * The parameters are typed to support compile-time enforcement of handling all known types/behaviors\n *\n * @param _unknownGCMessageType - Typed as never to ensure all known types have been\n * handled before calling this function (e.g. in a switch statement).\n * @param compatBehavior - Typed redundantly with CompatModeBehavior to ensure handling is added when updating that type\n */\nexport function compatBehaviorAllowsGCMessageType(\n\t_unknownGCMessageType: never,\n\tcompatBehavior: \"Ignore\" | \"FailToProcess\" | undefined,\n): boolean {\n\t// undefined defaults to same behavior as \"FailToProcess\"\n\treturn compatBehavior === \"Ignore\";\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcSummaryStateTracker.d.ts","sourceRoot":"","sources":["../../src/gc/gcSummaryStateTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEN,gBAAgB,EAKhB,MAAM,8CAA8C,CAAC;AAGtD,OAA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M,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAU/E;;OAEG;IAEI,yBAAyB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;CAGvD"}
|
|
@@ -148,7 +148,6 @@ class GCSummaryStateTracker {
|
|
|
148
148
|
/**
|
|
149
149
|
* Called to update the state from a GC run's stats. Used to update the count of data stores whose state updated.
|
|
150
150
|
*/
|
|
151
|
-
// eslint-disable-next-line import/no-deprecated
|
|
152
151
|
updateStateFromGCRunStats(stats) {
|
|
153
152
|
this.updatedDSCountSinceLastSummary += stats.updatedDataStoreCount;
|
|
154
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcSummaryStateTracker.js","sourceRoot":"","sources":["../../src/gc/gcSummaryStateTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAAiE;AACjE,2EAOsD;AACtD,qEAAwF;AAMxF,iDAAuD;AAM1C,QAAA,cAAc,GAAG,GAAG,uBAAY,OAAO,CAAC;AAWrD;;;;;GAKG;AACH,MAAa,qBAAqB;IAUjC;IACC,sCAAsC;IACrB,OAGhB;QAHgB,YAAO,GAAP,OAAO,CAGvB;QATF,8GAA8G;QAC9G,iCAAiC;QAC1B,mCAA8B,GAAW,CAAC,CAAC;IAQ/C,CAAC;IAEJ;;OAEG;IACI,mBAAmB,CACzB,gBAA4D;QAE5D,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO;QACR,CAAC;QAED,8FAA8F;QAC9F,IAAI,CAAC,iBAAiB,GAAG;YACxB,iBAAiB,EAAE,gBAAgB,CAAC,OAAO;gBAC1C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAA,oCAAqB,EAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;gBACjE,CAAC,CAAC,SAAS;YACZ,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,UAAU,CAAC;YACjE,sBAAsB,EAAE,IAAI,CA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AC;QACF,CAAC;QAED,0DAA0D;QAC1D,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;YAC1C,OAAO,OAAO,CAAC,cAAc,EAAE,CAAC;QACjC,CAAC;QAED,iGAAiG;QACjG,IACC,IAAI,CAAC,iBAAiB,EAAE,sBAAsB,KAAK,sBAAsB;YACzE,UAAU,EACT,CAAC;YACF,OAAO,CAAC,SAAS,CAChB,2BAAgB,EAChB,gCAAW,CAAC,IAAI,EAChB,IAAI,oBAAS,IAAI,2BAAgB,EAAE,CACnC,CAAC;QACH,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,OAAO,CAAC,2BAAgB,EAAE,sBAAsB,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,OAAO,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,oBAAoB,CAAC,MAA6B;QAC9D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACzD,OAAO;QACR,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACjD,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;QACpC,IAAI,CAAC,8BAA8B,GAAG,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,gDAAgD;IACzC,yBAAyB,CAAC,KAAe;QAC/C,IAAI,CAAC,8BAA8B,IAAI,KAAK,CAAC,qBAAqB,CAAC;IACpE,CAAC;CACD;AAlMD,sDAkMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport {\n\tISummaryTreeWithStats,\n\tISummarizeResult,\n\tgcBlobPrefix,\n\tgcDeletedBlobKey,\n\tgcTombstoneBlobKey,\n\tgcTreeKey,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder, mergeStats } from \"@fluidframework/runtime-utils/internal\";\n\nimport { IRefreshSummaryResult } from \"../summary/index.js\";\n\n// eslint-disable-next-line import/no-deprecated\nimport { IGCStats, IGarbageCollectorConfigs } from \"./gcDefinitions.js\";\nimport { generateSortedGCState } from \"./gcHelpers.js\";\nimport {\n\tIGarbageCollectionSnapshotData,\n\tIGarbageCollectionState,\n} from \"./gcSummaryDefinitions.js\";\n\nexport const gcStateBlobKey = `${gcBlobPrefix}_root`;\n\n/**\n * The GC data that is tracked for a summary.\n */\nexport interface IGCSummaryTrackingData {\n\tserializedGCState: string | undefined;\n\tserializedTombstones: string | undefined;\n\tserializedDeletedNodes: string | undefined;\n}\n\n/**\n * Encapsulates the garbage collection state that is tracked across summaries.\n * It maintains the GC state as per the latest summary in by the server. It updates state when a summary tracked by this\n * client is acked by the server or from a snapshot is downloaded from the server.\n * On summarize, it decides whether to write new state or re-use previous summary's state.\n */\nexport class GCSummaryStateTracker {\n\t// Keeps track of the GC data from the latest summary successfully acked by the server.\n\tprivate latestSummaryData: IGCSummaryTrackingData | undefined;\n\t// Keeps track of the GC data from the last summary submitted to the server but not yet acked.\n\tprivate pendingSummaryData: IGCSummaryTrackingData | undefined;\n\n\t// Tracks the count of data stores whose state updated since the last summary, i.e., they went from referenced\n\t// to unreferenced or vice-versa.\n\tpublic updatedDSCountSinceLastSummary: number = 0;\n\n\tconstructor(\n\t\t// Tells whether GC should run or not.\n\t\tprivate readonly configs: Pick<\n\t\t\tIGarbageCollectorConfigs,\n\t\t\t\"gcAllowed\" | \"gcVersionInBaseSnapshot\" | \"gcVersionInEffect\"\n\t\t>,\n\t) {}\n\n\t/**\n\t * Called during GC initialization. Initialize the latest summary data from the base snapshot data.\n\t */\n\tpublic initializeBaseState(\n\t\tbaseSnapshotData: IGarbageCollectionSnapshotData | undefined,\n\t): void {\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If tracking state across summaries, update latest summary data from the snapshot's GC data.\n\t\tthis.latestSummaryData = {\n\t\t\tserializedGCState: baseSnapshotData.gcState\n\t\t\t\t? JSON.stringify(generateSortedGCState(baseSnapshotData.gcState))\n\t\t\t\t: undefined,\n\t\t\tserializedTombstones: JSON.stringify(baseSnapshotData.tombstones),\n\t\t\tserializedDeletedNodes: JSON.stringify(baseSnapshotData.deletedNodes),\n\t\t};\n\t}\n\n\t/**\n\t * Summarizes three component of the GC data - GC state, tombstones and deleted nodes.\n\t * It does incremental summary, i.e., it writes summary tree / summary blob only for the component that changed.\n\t * For components that did not change, a summary handle is returned that points to the previous successful summary.\n\t * If none of the components changed, it returns a summary handle for the entire GC data.\n\t */\n\tpublic summarize(\n\t\ttrackState: boolean,\n\t\tgcState: IGarbageCollectionState,\n\t\tdeletedNodes: Set<string>,\n\t\ttombstones: string[],\n\t): ISummarizeResult | undefined {\n\t\tif (!this.configs.gcAllowed) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializedGCState = JSON.stringify(generateSortedGCState(gcState));\n\t\t// Serialize and write deleted nodes, if any. This is done irrespective of whether sweep is enabled or not so\n\t\t// to identify deleted nodes' usage.\n\t\tconst serializedDeletedNodes =\n\t\t\tdeletedNodes.size > 0 ? JSON.stringify([...deletedNodes].sort()) : undefined;\n\t\t// Serialize and write tombstones, if any.\n\t\tconst serializedTombstones =\n\t\t\ttombstones.length > 0 ? JSON.stringify(tombstones.sort()) : undefined;\n\n\t\t/**\n\t\t * Incremental summary of GC data - If none of GC state, deleted nodes or tombstones changed since last summary,\n\t\t * write summary handle instead of summary tree for GC.\n\t\t * Otherwise, write the GC summary tree. In the tree, for each of these that changed, write a summary blob and\n\t\t * for each of these that did not change, write a summary handle.\n\t\t */\n\t\tthis.pendingSummaryData = {\n\t\t\tserializedGCState,\n\t\t\tserializedTombstones,\n\t\t\tserializedDeletedNodes,\n\t\t};\n\n\t\tif (trackState && this.latestSummaryData !== undefined) {\n\t\t\t// If nothing changed since last summary, send a summary handle for the entire GC data.\n\t\t\tif (\n\t\t\t\tthis.latestSummaryData.serializedGCState === serializedGCState &&\n\t\t\t\tthis.latestSummaryData.serializedTombstones === serializedTombstones &&\n\t\t\t\tthis.latestSummaryData.serializedDeletedNodes === serializedDeletedNodes\n\t\t\t) {\n\t\t\t\tconst stats = mergeStats();\n\t\t\t\tstats.handleNodeCount++;\n\t\t\t\treturn {\n\t\t\t\t\tsummary: {\n\t\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\t\thandle: `/${gcTreeKey}`,\n\t\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t\t},\n\t\t\t\t\tstats,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// If some state changed, build a GC summary tree.\n\t\t\treturn this.buildGCSummaryTree(\n\t\t\t\tserializedGCState,\n\t\t\t\tserializedTombstones,\n\t\t\t\tserializedDeletedNodes,\n\t\t\t\ttrue /* trackState */,\n\t\t\t);\n\t\t}\n\t\t// If not tracking GC state, build a GC summary tree without any summary handles.\n\t\treturn this.buildGCSummaryTree(\n\t\t\tserializedGCState,\n\t\t\tserializedTombstones,\n\t\t\tserializedDeletedNodes,\n\t\t\tfalse /* trackState */,\n\t\t);\n\t}\n\n\t/**\n\t * Builds the GC summary tree which contains GC state, deleted nodes and tombstones.\n\t * If trackState is false, all of GC state, deleted nodes and tombstones are written as summary blobs.\n\t * If trackState is true, only states that changed are written. Rest are written as handles.\n\t * @param serializedGCState - The GC state serialized as string.\n\t * @param serializedTombstones - The tombstone state serialized as string.\n\t * @param serializedDeletedNodes - Deleted nodes serialized as string.\n\t * @param trackState - Whether we are tracking GC state across summaries.\n\t * @returns the GC summary tree.\n\t */\n\tprivate buildGCSummaryTree(\n\t\tserializedGCState: string,\n\t\tserializedTombstones: string | undefined,\n\t\tserializedDeletedNodes: string | undefined,\n\t\ttrackState: boolean,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\t// If the GC state hasn't changed, write a summary handle, else write a summary blob for it.\n\t\tif (this.latestSummaryData?.serializedGCState === serializedGCState && trackState) {\n\t\t\tbuilder.addHandle(gcStateBlobKey, SummaryType.Blob, `/${gcTreeKey}/${gcStateBlobKey}`);\n\t\t} else {\n\t\t\tbuilder.addBlob(gcStateBlobKey, serializedGCState);\n\t\t}\n\n\t\t// If tombstones exist, write a summary handle if it hasn't changed. If it has changed, write a\n\t\t// summary blob.\n\t\tif (serializedTombstones !== undefined) {\n\t\t\tif (\n\t\t\t\tthis.latestSummaryData?.serializedTombstones === serializedTombstones &&\n\t\t\t\ttrackState\n\t\t\t) {\n\t\t\t\tbuilder.addHandle(\n\t\t\t\t\tgcTombstoneBlobKey,\n\t\t\t\t\tSummaryType.Blob,\n\t\t\t\t\t`/${gcTreeKey}/${gcTombstoneBlobKey}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbuilder.addBlob(gcTombstoneBlobKey, serializedTombstones);\n\t\t\t}\n\t\t}\n\n\t\t// If there are no deleted nodes, return the summary tree.\n\t\tif (serializedDeletedNodes === undefined) {\n\t\t\treturn builder.getSummaryTree();\n\t\t}\n\n\t\t// If the deleted nodes hasn't changed, write a summary handle, else write a summary blob for it.\n\t\tif (\n\t\t\tthis.latestSummaryData?.serializedDeletedNodes === serializedDeletedNodes &&\n\t\t\ttrackState\n\t\t) {\n\t\t\tbuilder.addHandle(\n\t\t\t\tgcDeletedBlobKey,\n\t\t\t\tSummaryType.Blob,\n\t\t\t\t`/${gcTreeKey}/${gcDeletedBlobKey}`,\n\t\t\t);\n\t\t} else {\n\t\t\tbuilder.addBlob(gcDeletedBlobKey, serializedDeletedNodes);\n\t\t}\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\tif (!this.configs.gcAllowed || !result.isSummaryTracked) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.latestSummaryData = this.pendingSummaryData;\n\t\tthis.pendingSummaryData = undefined;\n\t\tthis.updatedDSCountSinceLastSummary = 0;\n\t}\n\n\t/**\n\t * Called to update the state from a GC run's stats. Used to update the count of data stores whose state updated.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic updateStateFromGCRunStats(stats: IGCStats): void {\n\t\tthis.updatedDSCountSinceLastSummary += stats.updatedDataStoreCount;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gcSummaryStateTracker.js","sourceRoot":"","sources":["../../src/gc/gcSummaryStateTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAAiE;AACjE,2EAOsD;AACtD,qEAAwF;AAKxF,iDAAuD;AAM1C,QAAA,cAAc,GAAG,GAAG,uBAAY,OAAO,CAAC;AAWrD;;;;;GAKG;AACH,MAAa,qBAAqB;IAUjC;IACC,sCAAsC;IACrB,OAGhB;QAHgB,YAAO,GAAP,OAAO,CAGvB;QATF,8GAA8G;QAC9G,iCAAiC;QAC1B,mCAA8B,GAAW,CAAC,CAAC;IAQ/C,CAAC;IAEJ;;OAEG;IACI,mBAAmB,CACzB,gBAA4D;QAE5D,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO;QACR,CAAC;QAED,8FAA8F;QAC9F,IAAI,CAAC,iBAAiB,GAAG;YACxB,iBAAiB,EAAE,gBAAgB,CAAC,OAAO;gBAC1C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAA,oCAAqB,EAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;gBACjE,CAAC,CAAC,SAAS;YACZ,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,UAAU,CAAC;YACjE,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC;SACrE,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,SAAS,CACf,UAAmB,EACnB,OAAgC,EAChC,YAAyB,EACzB,UAAoB;QAEpB,IAAI,CAAC,IAAI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AAiB,EAAE,sBAAsB,KAAK,sBAAsB;YACzE,UAAU,EACT,CAAC;YACF,OAAO,CAAC,SAAS,CAChB,2BAAgB,EAChB,gCAAW,CAAC,IAAI,EAChB,IAAI,oBAAS,IAAI,2BAAgB,EAAE,CACnC,CAAC;QACH,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,OAAO,CAAC,2BAAgB,EAAE,sBAAsB,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,OAAO,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,oBAAoB,CAAC,MAA6B;QAC9D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACzD,OAAO;QACR,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QACjD,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;QACpC,IAAI,CAAC,8BAA8B,GAAG,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IAEI,yBAAyB,CAAC,KAAe;QAC/C,IAAI,CAAC,8BAA8B,IAAI,KAAK,CAAC,qBAAqB,CAAC;IACpE,CAAC;CACD;AAlMD,sDAkMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport {\n\tISummaryTreeWithStats,\n\tISummarizeResult,\n\tgcBlobPrefix,\n\tgcDeletedBlobKey,\n\tgcTombstoneBlobKey,\n\tgcTreeKey,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { SummaryTreeBuilder, mergeStats } from \"@fluidframework/runtime-utils/internal\";\n\nimport { IRefreshSummaryResult } from \"../summary/index.js\";\n\nimport { IGCStats, IGarbageCollectorConfigs } from \"./gcDefinitions.js\";\nimport { generateSortedGCState } from \"./gcHelpers.js\";\nimport {\n\tIGarbageCollectionSnapshotData,\n\tIGarbageCollectionState,\n} from \"./gcSummaryDefinitions.js\";\n\nexport const gcStateBlobKey = `${gcBlobPrefix}_root`;\n\n/**\n * The GC data that is tracked for a summary.\n */\nexport interface IGCSummaryTrackingData {\n\tserializedGCState: string | undefined;\n\tserializedTombstones: string | undefined;\n\tserializedDeletedNodes: string | undefined;\n}\n\n/**\n * Encapsulates the garbage collection state that is tracked across summaries.\n * It maintains the GC state as per the latest summary in by the server. It updates state when a summary tracked by this\n * client is acked by the server or from a snapshot is downloaded from the server.\n * On summarize, it decides whether to write new state or re-use previous summary's state.\n */\nexport class GCSummaryStateTracker {\n\t// Keeps track of the GC data from the latest summary successfully acked by the server.\n\tprivate latestSummaryData: IGCSummaryTrackingData | undefined;\n\t// Keeps track of the GC data from the last summary submitted to the server but not yet acked.\n\tprivate pendingSummaryData: IGCSummaryTrackingData | undefined;\n\n\t// Tracks the count of data stores whose state updated since the last summary, i.e., they went from referenced\n\t// to unreferenced or vice-versa.\n\tpublic updatedDSCountSinceLastSummary: number = 0;\n\n\tconstructor(\n\t\t// Tells whether GC should run or not.\n\t\tprivate readonly configs: Pick<\n\t\t\tIGarbageCollectorConfigs,\n\t\t\t\"gcAllowed\" | \"gcVersionInBaseSnapshot\" | \"gcVersionInEffect\"\n\t\t>,\n\t) {}\n\n\t/**\n\t * Called during GC initialization. Initialize the latest summary data from the base snapshot data.\n\t */\n\tpublic initializeBaseState(\n\t\tbaseSnapshotData: IGarbageCollectionSnapshotData | undefined,\n\t): void {\n\t\tif (baseSnapshotData === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If tracking state across summaries, update latest summary data from the snapshot's GC data.\n\t\tthis.latestSummaryData = {\n\t\t\tserializedGCState: baseSnapshotData.gcState\n\t\t\t\t? JSON.stringify(generateSortedGCState(baseSnapshotData.gcState))\n\t\t\t\t: undefined,\n\t\t\tserializedTombstones: JSON.stringify(baseSnapshotData.tombstones),\n\t\t\tserializedDeletedNodes: JSON.stringify(baseSnapshotData.deletedNodes),\n\t\t};\n\t}\n\n\t/**\n\t * Summarizes three component of the GC data - GC state, tombstones and deleted nodes.\n\t * It does incremental summary, i.e., it writes summary tree / summary blob only for the component that changed.\n\t * For components that did not change, a summary handle is returned that points to the previous successful summary.\n\t * If none of the components changed, it returns a summary handle for the entire GC data.\n\t */\n\tpublic summarize(\n\t\ttrackState: boolean,\n\t\tgcState: IGarbageCollectionState,\n\t\tdeletedNodes: Set<string>,\n\t\ttombstones: string[],\n\t): ISummarizeResult | undefined {\n\t\tif (!this.configs.gcAllowed) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializedGCState = JSON.stringify(generateSortedGCState(gcState));\n\t\t// Serialize and write deleted nodes, if any. This is done irrespective of whether sweep is enabled or not so\n\t\t// to identify deleted nodes' usage.\n\t\tconst serializedDeletedNodes =\n\t\t\tdeletedNodes.size > 0 ? JSON.stringify([...deletedNodes].sort()) : undefined;\n\t\t// Serialize and write tombstones, if any.\n\t\tconst serializedTombstones =\n\t\t\ttombstones.length > 0 ? JSON.stringify(tombstones.sort()) : undefined;\n\n\t\t/**\n\t\t * Incremental summary of GC data - If none of GC state, deleted nodes or tombstones changed since last summary,\n\t\t * write summary handle instead of summary tree for GC.\n\t\t * Otherwise, write the GC summary tree. In the tree, for each of these that changed, write a summary blob and\n\t\t * for each of these that did not change, write a summary handle.\n\t\t */\n\t\tthis.pendingSummaryData = {\n\t\t\tserializedGCState,\n\t\t\tserializedTombstones,\n\t\t\tserializedDeletedNodes,\n\t\t};\n\n\t\tif (trackState && this.latestSummaryData !== undefined) {\n\t\t\t// If nothing changed since last summary, send a summary handle for the entire GC data.\n\t\t\tif (\n\t\t\t\tthis.latestSummaryData.serializedGCState === serializedGCState &&\n\t\t\t\tthis.latestSummaryData.serializedTombstones === serializedTombstones &&\n\t\t\t\tthis.latestSummaryData.serializedDeletedNodes === serializedDeletedNodes\n\t\t\t) {\n\t\t\t\tconst stats = mergeStats();\n\t\t\t\tstats.handleNodeCount++;\n\t\t\t\treturn {\n\t\t\t\t\tsummary: {\n\t\t\t\t\t\ttype: SummaryType.Handle,\n\t\t\t\t\t\thandle: `/${gcTreeKey}`,\n\t\t\t\t\t\thandleType: SummaryType.Tree,\n\t\t\t\t\t},\n\t\t\t\t\tstats,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// If some state changed, build a GC summary tree.\n\t\t\treturn this.buildGCSummaryTree(\n\t\t\t\tserializedGCState,\n\t\t\t\tserializedTombstones,\n\t\t\t\tserializedDeletedNodes,\n\t\t\t\ttrue /* trackState */,\n\t\t\t);\n\t\t}\n\t\t// If not tracking GC state, build a GC summary tree without any summary handles.\n\t\treturn this.buildGCSummaryTree(\n\t\t\tserializedGCState,\n\t\t\tserializedTombstones,\n\t\t\tserializedDeletedNodes,\n\t\t\tfalse /* trackState */,\n\t\t);\n\t}\n\n\t/**\n\t * Builds the GC summary tree which contains GC state, deleted nodes and tombstones.\n\t * If trackState is false, all of GC state, deleted nodes and tombstones are written as summary blobs.\n\t * If trackState is true, only states that changed are written. Rest are written as handles.\n\t * @param serializedGCState - The GC state serialized as string.\n\t * @param serializedTombstones - The tombstone state serialized as string.\n\t * @param serializedDeletedNodes - Deleted nodes serialized as string.\n\t * @param trackState - Whether we are tracking GC state across summaries.\n\t * @returns the GC summary tree.\n\t */\n\tprivate buildGCSummaryTree(\n\t\tserializedGCState: string,\n\t\tserializedTombstones: string | undefined,\n\t\tserializedDeletedNodes: string | undefined,\n\t\ttrackState: boolean,\n\t): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\t// If the GC state hasn't changed, write a summary handle, else write a summary blob for it.\n\t\tif (this.latestSummaryData?.serializedGCState === serializedGCState && trackState) {\n\t\t\tbuilder.addHandle(gcStateBlobKey, SummaryType.Blob, `/${gcTreeKey}/${gcStateBlobKey}`);\n\t\t} else {\n\t\t\tbuilder.addBlob(gcStateBlobKey, serializedGCState);\n\t\t}\n\n\t\t// If tombstones exist, write a summary handle if it hasn't changed. If it has changed, write a\n\t\t// summary blob.\n\t\tif (serializedTombstones !== undefined) {\n\t\t\tif (\n\t\t\t\tthis.latestSummaryData?.serializedTombstones === serializedTombstones &&\n\t\t\t\ttrackState\n\t\t\t) {\n\t\t\t\tbuilder.addHandle(\n\t\t\t\t\tgcTombstoneBlobKey,\n\t\t\t\t\tSummaryType.Blob,\n\t\t\t\t\t`/${gcTreeKey}/${gcTombstoneBlobKey}`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tbuilder.addBlob(gcTombstoneBlobKey, serializedTombstones);\n\t\t\t}\n\t\t}\n\n\t\t// If there are no deleted nodes, return the summary tree.\n\t\tif (serializedDeletedNodes === undefined) {\n\t\t\treturn builder.getSummaryTree();\n\t\t}\n\n\t\t// If the deleted nodes hasn't changed, write a summary handle, else write a summary blob for it.\n\t\tif (\n\t\t\tthis.latestSummaryData?.serializedDeletedNodes === serializedDeletedNodes &&\n\t\t\ttrackState\n\t\t) {\n\t\t\tbuilder.addHandle(\n\t\t\t\tgcDeletedBlobKey,\n\t\t\t\tSummaryType.Blob,\n\t\t\t\t`/${gcTreeKey}/${gcDeletedBlobKey}`,\n\t\t\t);\n\t\t} else {\n\t\t\tbuilder.addBlob(gcDeletedBlobKey, serializedDeletedNodes);\n\t\t}\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Called to refresh the latest summary state. This happens when a pending summary is acked.\n\t */\n\tpublic async refreshLatestSummary(result: IRefreshSummaryResult): Promise<void> {\n\t\tif (!this.configs.gcAllowed || !result.isSummaryTracked) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.latestSummaryData = this.pendingSummaryData;\n\t\tthis.pendingSummaryData = undefined;\n\t\tthis.updatedDSCountSinceLastSummary = 0;\n\t}\n\n\t/**\n\t * Called to update the state from a GC run's stats. Used to update the count of data stores whose state updated.\n\t */\n\n\tpublic updateStateFromGCRunStats(stats: IGCStats): void {\n\t\tthis.updatedDSCountSinceLastSummary += stats.updatedDataStoreCount;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcTelemetry.d.ts","sourceRoot":"","sources":["../../src/gc/gcTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EACN,mBAAmB,EACnB,iBAAiB,EAGjB,KAAK,uBAAuB,EAC5B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"gcTelemetry.d.ts","sourceRoot":"","sources":["../../src/gc/gcTelemetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EACN,mBAAmB,EACnB,iBAAiB,EAGjB,KAAK,uBAAuB,EAC5B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAEN,UAAU,EACV,wBAAwB,EAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,KAAK,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAEnE;;GAEG;AACH,UAAU,YAAY;IACrB,SAAS,EAAE,aAAa,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,eAAe,CAAC,EAAE,uBAAuB,CAAC;CAC1C;AA4BD;;GAEG;AACH,UAAU,eAAgB,SAAQ,YAAY;IAC7C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,2B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YAAY,EACZ,GAAG,mBAAmB,EACtB,EAAE,eAAe,GAChB,IAAI;IAqGP;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAoClC;;;;;;;;;;;OAWG;IACI,8BAA8B,CACpC,aAAa,EAAE,sBAAsB,EACrC,cAAc,EAAE,sBAAsB,EACtC,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACzC,MAAM,EAAE,mBAAmB,GACzB,IAAI;IAwCP;;;OAGG;IACU,gBAAgB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAiDzE"}
|
package/dist/gc/gcTelemetry.js
CHANGED
|
@@ -24,11 +24,7 @@ const gcDefinitions_js_1 = require("./gcDefinitions.js");
|
|
|
24
24
|
* Note: The telemetry for a Deleted node being used is logged elsewhere in this package.
|
|
25
25
|
*/
|
|
26
26
|
class GCTelemetryTracker {
|
|
27
|
-
constructor(mc, configs, isSummarizerClient,
|
|
28
|
-
// eslint-disable-next-line import/no-deprecated
|
|
29
|
-
createContainerMetadata,
|
|
30
|
-
// eslint-disable-next-line import/no-deprecated
|
|
31
|
-
getNodeType, getNodeStateTracker, getNodePackagePath) {
|
|
27
|
+
constructor(mc, configs, isSummarizerClient, createContainerMetadata, getNodeType, getNodeStateTracker, getNodePackagePath) {
|
|
32
28
|
this.mc = mc;
|
|
33
29
|
this.configs = configs;
|
|
34
30
|
this.isSummarizerClient = isSummarizerClient;
|
|
@@ -52,19 +48,15 @@ class GCTelemetryTracker {
|
|
|
52
48
|
*
|
|
53
49
|
* 2. An event is logged only once per container instance per event per node.
|
|
54
50
|
*/
|
|
55
|
-
shouldLogNonActiveEvent(
|
|
56
|
-
// eslint-disable-next-line import/no-deprecated
|
|
57
|
-
nodeType, usageType, nodeStateTracker, uniqueEventId) {
|
|
51
|
+
shouldLogNonActiveEvent(nodeType, usageType, nodeStateTracker, uniqueEventId) {
|
|
58
52
|
if (nodeStateTracker.state === gcDefinitions_js_1.UnreferencedState.Active) {
|
|
59
53
|
return false;
|
|
60
54
|
}
|
|
61
|
-
// eslint-disable-next-line import/no-deprecated
|
|
62
55
|
if (nodeType === gcDefinitions_js_1.GCNodeType.Other) {
|
|
63
56
|
return false;
|
|
64
57
|
}
|
|
65
58
|
// For sub data store (DDS) nodes, if they are changed, its data store will also be changed,
|
|
66
59
|
// so skip logging to make the telemetry less noisy.
|
|
67
|
-
// eslint-disable-next-line import/no-deprecated
|
|
68
60
|
if (nodeType === gcDefinitions_js_1.GCNodeType.SubDataStore && usageType === "Changed") {
|
|
69
61
|
return false;
|
|
70
62
|
}
|
|
@@ -172,9 +164,7 @@ class GCTelemetryTracker {
|
|
|
172
164
|
/**
|
|
173
165
|
* Logs telemetry when a tombstoned object is changed, revived or loaded.
|
|
174
166
|
*/
|
|
175
|
-
logTombstoneUsageTelemetry(unrefEventProps,
|
|
176
|
-
// eslint-disable-next-line import/no-deprecated
|
|
177
|
-
nodeType, usageType, packagePath) {
|
|
167
|
+
logTombstoneUsageTelemetry(unrefEventProps, nodeType, usageType, packagePath) {
|
|
178
168
|
// This will log the following events:
|
|
179
169
|
// GC_Tombstone_DataStore_Requested, GC_Tombstone_DataStore_Changed, GC_Tombstone_DataStore_Revived
|
|
180
170
|
// GC_Tombstone_SubDataStore_Requested, GC_Tombstone_SubDataStore_Changed, GC_Tombstone_SubDataStore_Revived
|
|
@@ -227,9 +217,7 @@ class GCTelemetryTracker {
|
|
|
227
217
|
const missingExplicitRoutes = [];
|
|
228
218
|
for (const route of currentOutboundRoutes) {
|
|
229
219
|
const nodeType = this.getNodeType(route);
|
|
230
|
-
if (
|
|
231
|
-
// eslint-disable-next-line import/no-deprecated
|
|
232
|
-
(nodeType === gcDefinitions_js_1.GCNodeType.DataStore || nodeType === gcDefinitions_js_1.GCNodeType.Blob) &&
|
|
220
|
+
if ((nodeType === gcDefinitions_js_1.GCNodeType.DataStore || nodeType === gcDefinitions_js_1.GCNodeType.Blob) &&
|
|
233
221
|
!nodeId.startsWith(route) &&
|
|
234
222
|
!previousRoutes.includes(route) &&
|
|
235
223
|
!explicitRoutes.includes(route)) {
|