@fluidframework/container-runtime 2.0.0-rc.3.0.1 → 2.0.0-rc.3.0.10
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/api-report/container-runtime.api.md +30 -12
- package/dist/channelCollection.d.ts +5 -3
- package/dist/channelCollection.d.ts.map +1 -1
- package/dist/channelCollection.js +88 -29
- package/dist/channelCollection.js.map +1 -1
- package/dist/containerRuntime.d.ts +6 -1
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +55 -48
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +1 -1
- package/dist/dataStoreContexts.d.ts +2 -0
- package/dist/dataStoreContexts.d.ts.map +1 -1
- package/dist/dataStoreContexts.js +7 -0
- package/dist/dataStoreContexts.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +4 -11
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +45 -29
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +26 -5
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/gcHelpers.d.ts +5 -4
- package/dist/gc/gcHelpers.d.ts.map +1 -1
- package/dist/gc/gcHelpers.js +14 -2
- package/dist/gc/gcHelpers.js.map +1 -1
- package/dist/gc/gcTelemetry.d.ts +13 -2
- package/dist/gc/gcTelemetry.d.ts.map +1 -1
- package/dist/gc/gcTelemetry.js +24 -21
- package/dist/gc/gcTelemetry.js.map +1 -1
- package/dist/gc/index.d.ts +2 -2
- package/dist/gc/index.d.ts.map +1 -1
- package/dist/gc/index.js +2 -2
- package/dist/gc/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +1 -0
- package/dist/metadata.d.ts +2 -2
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js.map +1 -1
- package/dist/opLifecycle/batchManager.d.ts +4 -1
- package/dist/opLifecycle/batchManager.d.ts.map +1 -1
- package/dist/opLifecycle/batchManager.js +0 -10
- package/dist/opLifecycle/batchManager.js.map +1 -1
- package/dist/opLifecycle/outbox.d.ts +0 -4
- package/dist/opLifecycle/outbox.d.ts.map +1 -1
- package/dist/opLifecycle/outbox.js +7 -38
- package/dist/opLifecycle/outbox.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/summary/documentSchema.js +1 -1
- package/dist/summary/documentSchema.js.map +1 -1
- package/lib/channelCollection.d.ts +5 -3
- package/lib/channelCollection.d.ts.map +1 -1
- package/lib/channelCollection.js +90 -31
- package/lib/channelCollection.js.map +1 -1
- package/lib/containerRuntime.d.ts +6 -1
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +54 -47
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +1 -1
- package/lib/dataStoreContexts.d.ts +2 -0
- package/lib/dataStoreContexts.d.ts.map +1 -1
- package/lib/dataStoreContexts.js +7 -0
- package/lib/dataStoreContexts.js.map +1 -1
- package/lib/gc/garbageCollection.d.ts +4 -11
- package/lib/gc/garbageCollection.d.ts.map +1 -1
- package/lib/gc/garbageCollection.js +47 -31
- package/lib/gc/garbageCollection.js.map +1 -1
- package/lib/gc/gcDefinitions.d.ts +26 -5
- package/lib/gc/gcDefinitions.d.ts.map +1 -1
- package/lib/gc/gcDefinitions.js.map +1 -1
- package/lib/gc/gcHelpers.d.ts +5 -4
- package/lib/gc/gcHelpers.d.ts.map +1 -1
- package/lib/gc/gcHelpers.js +12 -1
- package/lib/gc/gcHelpers.js.map +1 -1
- package/lib/gc/gcTelemetry.d.ts +13 -2
- package/lib/gc/gcTelemetry.d.ts.map +1 -1
- package/lib/gc/gcTelemetry.js +24 -21
- package/lib/gc/gcTelemetry.js.map +1 -1
- package/lib/gc/index.d.ts +2 -2
- package/lib/gc/index.d.ts.map +1 -1
- package/lib/gc/index.js +1 -1
- package/lib/gc/index.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +1 -0
- package/lib/metadata.d.ts +2 -2
- package/lib/metadata.d.ts.map +1 -1
- package/lib/metadata.js.map +1 -1
- package/lib/opLifecycle/batchManager.d.ts +4 -1
- package/lib/opLifecycle/batchManager.d.ts.map +1 -1
- package/lib/opLifecycle/batchManager.js +0 -10
- package/lib/opLifecycle/batchManager.js.map +1 -1
- package/lib/opLifecycle/outbox.d.ts +0 -4
- package/lib/opLifecycle/outbox.d.ts.map +1 -1
- package/lib/opLifecycle/outbox.js +7 -38
- package/lib/opLifecycle/outbox.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/summary/documentSchema.js +1 -1
- package/lib/summary/documentSchema.js.map +1 -1
- package/package.json +20 -20
- package/src/channelCollection.ts +108 -49
- package/src/containerRuntime.ts +66 -80
- package/src/dataStoreContexts.ts +12 -0
- package/src/gc/garbageCollection.ts +63 -41
- package/src/gc/gcDefinitions.ts +21 -9
- package/src/gc/gcHelpers.ts +14 -1
- package/src/gc/gcTelemetry.ts +56 -47
- package/src/gc/index.ts +2 -1
- package/src/index.ts +2 -0
- package/src/metadata.ts +2 -2
- package/src/opLifecycle/README.md +4 -4
- package/src/opLifecycle/batchManager.ts +5 -14
- package/src/opLifecycle/outbox.ts +7 -53
- package/src/packageVersion.ts +1 -1
- package/src/summary/documentSchema.ts +1 -1
- package/dist/public.d.ts +0 -12
- package/lib/public.d.ts +0 -12
|
@@ -169,7 +169,7 @@ export declare abstract class FluidDataStoreContext extends TypedEventEmitter<IF
|
|
|
169
169
|
abstract setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
|
|
170
170
|
private rejectDeferredRealize;
|
|
171
171
|
realize(): Promise<IFluidDataStoreChannel>;
|
|
172
|
-
protected factoryFromPackagePath(): Promise<import("@fluidframework/runtime-definitions
|
|
172
|
+
protected factoryFromPackagePath(): Promise<import("@fluidframework/runtime-definitions").IFluidDataStoreFactory>;
|
|
173
173
|
private realizeCore;
|
|
174
174
|
/**
|
|
175
175
|
* Notifies this object about changes in the connection state.
|
|
@@ -29,6 +29,8 @@ export declare class DataStoreContexts implements Iterable<[string, FluidDataSto
|
|
|
29
29
|
has(id: string): boolean;
|
|
30
30
|
get(id: string): FluidDataStoreContext | undefined;
|
|
31
31
|
delete(id: string): boolean;
|
|
32
|
+
private readonly _recentlyDeletedContexts;
|
|
33
|
+
getRecentlyDeletedContext(id: string): FluidDataStoreContext | undefined;
|
|
32
34
|
/**
|
|
33
35
|
* Return the unbound local context with the given id,
|
|
34
36
|
* or undefined if it's not found or not unbound.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreContexts.d.ts","sourceRoot":"","sources":["../src/dataStoreContexts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAE1F,gBAAgB;AAChB,qBAAa,iBAAkB,YAAW,QAAQ,CAAC,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,EAAE,WAAW;IAC/F,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;IAEtD,0CAA0C;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4C;IAEtE;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsD;IAEvF,OAAO,CAAC,QAAQ,CAAC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,CAExB;IAED,IAAW,QAAQ,YAElB;IACD,SAAgB,OAAO,aAAgC;IAEhD,cAAc;IAId,UAAU,CAAC,EAAE,EAAE,MAAM;IAIrB,GAAG,CAAC,EAAE,EAAE,MAAM;IAId,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAIlD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAWlC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAC9B;IAEJ,yBAAyB,CAAC,EAAE,EAAE,MAAM;IAI3C;;;OAGG;IACI,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS;IASrE;;OAEG;IACI,UAAU,CAAC,OAAO,EAAE,0BAA0B;IAUrD;;;;;OAKG;IACU,iBAAiB,CAC7B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,OAAO,GACX,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IAU7C,OAAO,CAAC,cAAc;IAWtB;;OAEG;IACI,IAAI,CAAC,EAAE,EAAE,MAAM;IAOtB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAavB;;;;OAIG;IACI,iBAAiB,CAAC,OAAO,EAAE,qBAAqB;CAUvD"}
|
|
@@ -37,6 +37,7 @@ class DataStoreContexts {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
this.dispose = () => this.disposeOnce.value;
|
|
40
|
+
this._recentlyDeletedContexts = new Map();
|
|
40
41
|
this._logger = (0, internal_2.createChildLogger)({ logger: baseLogger });
|
|
41
42
|
}
|
|
42
43
|
[Symbol.iterator]() {
|
|
@@ -63,8 +64,14 @@ class DataStoreContexts {
|
|
|
63
64
|
delete(id) {
|
|
64
65
|
this.deferredContexts.delete(id);
|
|
65
66
|
this.notBoundContexts.delete(id);
|
|
67
|
+
// Stash the context here in case it's requested in this session, we can log some details about it
|
|
68
|
+
const context = this._contexts.get(id);
|
|
69
|
+
this._recentlyDeletedContexts.set(id, context);
|
|
66
70
|
return this._contexts.delete(id);
|
|
67
71
|
}
|
|
72
|
+
getRecentlyDeletedContext(id) {
|
|
73
|
+
return this._recentlyDeletedContexts.get(id);
|
|
74
|
+
}
|
|
68
75
|
/**
|
|
69
76
|
* Return the unbound local context with the given id,
|
|
70
77
|
* or undefined if it's not found or not unbound.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreContexts.js","sourceRoot":"","sources":["../src/dataStoreContexts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6E;AAE7E,uEAA6E;AAI7E,gBAAgB;AAChB,MAAa,iBAAiB;IAoC7B,YAAY,UAAgC;QAnC3B,qBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;QAEtD,0CAA0C;QACzB,cAAS,GAAG,IAAI,GAAG,EAAiC,CAAC;QAEtE;;;;;;WAMG;QACc,qBAAgB,GAAG,IAAI,GAAG,EAA2C,CAAC;QAEtE,gBAAW,GAAG,IAAI,eAAI,CAAO,GAAG,EAAE;YAClD,gCAAgC;YAChC,KAAK,MAAM,CAAC,gBAAgB,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACjE,QAAQ,CAAC,OAAO;qBACd,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;oBACjB,OAAO,CAAC,OAAO,EAAE,CAAC;gBACnB,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,YAAY,EAAE,EAAE;oBACvB,IAAI,CAAC,OAAO,CAAC,cAAc,CAC1B;wBACC,SAAS,EAAE,mCAAmC;wBAC9C,gBAAgB;qBAChB,EACD,YAAY,CACZ,CAAC;gBACH,CAAC,CAAC,CAAC;aACJ;QACF,CAAC,CAAC,CAAC;QAmBa,YAAO,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;QAdtD,IAAI,CAAC,OAAO,GAAG,IAAA,4BAAiB,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,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AM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvC,IAAA,iBAAM,EAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACnE,IAAA,iBAAM,EACL,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,EAC9B,KAAK,CAAC,oEAAoE,CAC1E,CAAC;QAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC/C,IAAA,iBAAM,EAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAClE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,OAA8B;QACtD,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;QACtB,IAAA,iBAAM,EAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAE/E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAEhC,qEAAqE;QACrE,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;QACxB,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;CACD;AA7KD,8CA6KC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, Deferred, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { FluidDataStoreContext, LocalFluidDataStoreContext } from \"./dataStoreContext.js\";\n\n/** @internal */\nexport class DataStoreContexts implements Iterable<[string, FluidDataStoreContext]>, IDisposable {\n\tprivate readonly notBoundContexts = new Set<string>();\n\n\t/** Attached and loaded context proxies */\n\tprivate readonly _contexts = new Map<string, FluidDataStoreContext>();\n\n\t/**\n\t * List of pending context waiting either to be bound or to arrive from another client.\n\t * This covers the case where a local context has been created but not yet bound,\n\t * or the case where a client knows a store will exist and is waiting on its creation,\n\t * so that a caller may await the deferred's promise until such a time as the context is fully ready.\n\t * This is a superset of _contexts, since contexts remain here once the Deferred resolves.\n\t */\n\tprivate readonly deferredContexts = new Map<string, Deferred<FluidDataStoreContext>>();\n\n\tprivate readonly disposeOnce = new Lazy<void>(() => {\n\t\t// close/stop all store contexts\n\t\tfor (const [fluidDataStoreId, contextD] of this.deferredContexts) {\n\t\t\tcontextD.promise\n\t\t\t\t.then((context) => {\n\t\t\t\t\tcontext.dispose();\n\t\t\t\t})\n\t\t\t\t.catch((contextError) => {\n\t\t\t\t\tthis._logger.sendErrorEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"FluidDataStoreContextDisposeError\",\n\t\t\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcontextError,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t}\n\t});\n\n\tprivate readonly _logger: ITelemetryLoggerExt;\n\n\tconstructor(baseLogger: ITelemetryBaseLogger) {\n\t\tthis._logger = createChildLogger({ logger: baseLogger });\n\t}\n\n\t[Symbol.iterator](): Iterator<[string, FluidDataStoreContext]> {\n\t\treturn this._contexts.entries();\n\t}\n\n\tpublic get size(): number {\n\t\treturn this._contexts.size;\n\t}\n\n\tpublic get disposed() {\n\t\treturn this.disposeOnce.evaluated;\n\t}\n\tpublic readonly dispose = () => this.disposeOnce.value;\n\n\tpublic notBoundLength() {\n\t\treturn this.notBoundContexts.size;\n\t}\n\n\tpublic isNotBound(id: string) {\n\t\treturn this.notBoundContexts.has(id);\n\t}\n\n\tpublic has(id: string) {\n\t\treturn this._contexts.has(id);\n\t}\n\n\tpublic get(id: string): FluidDataStoreContext | undefined {\n\t\treturn this._contexts.get(id);\n\t}\n\n\tpublic delete(id: string): boolean {\n\t\tthis.deferredContexts.delete(id);\n\t\tthis.notBoundContexts.delete(id);\n\t\treturn this._contexts.delete(id);\n\t}\n\n\t/**\n\t * Return the unbound local context with the given id,\n\t * or undefined if it's not found or not unbound.\n\t */\n\tpublic getUnbound(id: string): LocalFluidDataStoreContext | undefined {\n\t\tconst context = this._contexts.get(id);\n\t\tif (context === undefined || !this.notBoundContexts.has(id)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn context as LocalFluidDataStoreContext;\n\t}\n\n\t/**\n\t * Add the given context, marking it as to-be-bound\n\t */\n\tpublic addUnbound(context: LocalFluidDataStoreContext) {\n\t\tconst id = context.id;\n\t\tassert(!this._contexts.has(id), 0x158 /* \"Creating store with existing ID\" */);\n\n\t\tthis._contexts.set(id, context);\n\n\t\tthis.notBoundContexts.add(id);\n\t\tthis.ensureDeferred(id);\n\t}\n\n\t/**\n\t * Get the context with the given id, once it exists locally and is attached.\n\t * e.g. If created locally, it must be bound, or if created remotely then it's fine as soon as it's sync'd in.\n\t * @param id - The id of the context to get\n\t * @param wait - If false, return undefined if the context isn't present and ready now. Otherwise, wait for it.\n\t */\n\tpublic async getBoundOrRemoted(\n\t\tid: string,\n\t\twait: boolean,\n\t): Promise<FluidDataStoreContext | undefined> {\n\t\tconst deferredContext = this.ensureDeferred(id);\n\n\t\tif (!wait && !deferredContext.isCompleted) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn deferredContext.promise;\n\t}\n\n\tprivate ensureDeferred(id: string): Deferred<FluidDataStoreContext> {\n\t\tconst deferred = this.deferredContexts.get(id);\n\t\tif (deferred) {\n\t\t\treturn deferred;\n\t\t}\n\n\t\tconst newDeferred = new Deferred<FluidDataStoreContext>();\n\t\tthis.deferredContexts.set(id, newDeferred);\n\t\treturn newDeferred;\n\t}\n\n\t/**\n\t * Update this context as bound\n\t */\n\tpublic bind(id: string) {\n\t\tconst removed: boolean = this.notBoundContexts.delete(id);\n\t\tassert(removed, 0x159 /* \"The given id was not found in notBoundContexts to delete\" */);\n\n\t\tthis.resolveDeferred(id);\n\t}\n\n\t/**\n\t * Triggers the deferred to resolve, indicating the context is not local-only\n\t * @param id - The id of the context to resolve to\n\t */\n\tprivate resolveDeferred(id: string) {\n\t\tconst context = this._contexts.get(id);\n\t\tassert(!!context, 0x15a /* \"Cannot find context to resolve to\" */);\n\t\tassert(\n\t\t\t!this.notBoundContexts.has(id),\n\t\t\t0x15b /* \"Expected this id to already be removed from notBoundContexts\" */,\n\t\t);\n\n\t\tconst deferred = this.deferredContexts.get(id);\n\t\tassert(!!deferred, 0x15c /* \"Cannot find deferred to resolve\" */);\n\t\tdeferred.resolve(context);\n\t}\n\n\t/**\n\t * Add the given context, marking it as not local-only.\n\t * This could be because it's a local context that's been bound, or because it's a remote context.\n\t * @param context - The context to add\n\t */\n\tpublic addBoundOrRemoted(context: FluidDataStoreContext) {\n\t\tconst id = context.id;\n\t\tassert(!this._contexts.has(id), 0x15d /* \"Creating store with existing ID\" */);\n\n\t\tthis._contexts.set(id, context);\n\n\t\t// Resolve the deferred immediately since this context is not unbound\n\t\tthis.ensureDeferred(id);\n\t\tthis.resolveDeferred(id);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dataStoreContexts.js","sourceRoot":"","sources":["../src/dataStoreContexts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6E;AAE7E,uEAA6E;AAI7E,gBAAgB;AAChB,MAAa,iBAAiB;IAoC7B,YAAY,UAAgC;QAnC3B,qBAAgB,GAAG,IAAI,GAAG,EAAU,CAAC;QAEtD,0CAA0C;QACzB,cAAS,GAAG,IAAI,GAAG,EAAiC,CAAC;QAEtE;;;;;;WAMG;QACc,qBAAgB,GAAG,IAAI,GAAG,EAA2C,CAAC;QAEtE,gBAAW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C;QAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC/C,IAAA,iBAAM,EAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAClE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,OAA8B;QACtD,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;QACtB,IAAA,iBAAM,EAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAE/E,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAEhC,qEAAqE;QACrE,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;QACxB,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;CACD;AAzLD,8CAyLC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { assert, Deferred, Lazy } from \"@fluidframework/core-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { FluidDataStoreContext, LocalFluidDataStoreContext } from \"./dataStoreContext.js\";\n\n/** @internal */\nexport class DataStoreContexts implements Iterable<[string, FluidDataStoreContext]>, IDisposable {\n\tprivate readonly notBoundContexts = new Set<string>();\n\n\t/** Attached and loaded context proxies */\n\tprivate readonly _contexts = new Map<string, FluidDataStoreContext>();\n\n\t/**\n\t * List of pending context waiting either to be bound or to arrive from another client.\n\t * This covers the case where a local context has been created but not yet bound,\n\t * or the case where a client knows a store will exist and is waiting on its creation,\n\t * so that a caller may await the deferred's promise until such a time as the context is fully ready.\n\t * This is a superset of _contexts, since contexts remain here once the Deferred resolves.\n\t */\n\tprivate readonly deferredContexts = new Map<string, Deferred<FluidDataStoreContext>>();\n\n\tprivate readonly disposeOnce = new Lazy<void>(() => {\n\t\t// close/stop all store contexts\n\t\tfor (const [fluidDataStoreId, contextD] of this.deferredContexts) {\n\t\t\tcontextD.promise\n\t\t\t\t.then((context) => {\n\t\t\t\t\tcontext.dispose();\n\t\t\t\t})\n\t\t\t\t.catch((contextError) => {\n\t\t\t\t\tthis._logger.sendErrorEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"FluidDataStoreContextDisposeError\",\n\t\t\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcontextError,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t}\n\t});\n\n\tprivate readonly _logger: ITelemetryLoggerExt;\n\n\tconstructor(baseLogger: ITelemetryBaseLogger) {\n\t\tthis._logger = createChildLogger({ logger: baseLogger });\n\t}\n\n\t[Symbol.iterator](): Iterator<[string, FluidDataStoreContext]> {\n\t\treturn this._contexts.entries();\n\t}\n\n\tpublic get size(): number {\n\t\treturn this._contexts.size;\n\t}\n\n\tpublic get disposed() {\n\t\treturn this.disposeOnce.evaluated;\n\t}\n\tpublic readonly dispose = () => this.disposeOnce.value;\n\n\tpublic notBoundLength() {\n\t\treturn this.notBoundContexts.size;\n\t}\n\n\tpublic isNotBound(id: string) {\n\t\treturn this.notBoundContexts.has(id);\n\t}\n\n\tpublic has(id: string) {\n\t\treturn this._contexts.has(id);\n\t}\n\n\tpublic get(id: string): FluidDataStoreContext | undefined {\n\t\treturn this._contexts.get(id);\n\t}\n\n\tpublic delete(id: string): boolean {\n\t\tthis.deferredContexts.delete(id);\n\t\tthis.notBoundContexts.delete(id);\n\n\t\t// Stash the context here in case it's requested in this session, we can log some details about it\n\t\tconst context = this._contexts.get(id);\n\t\tthis._recentlyDeletedContexts.set(id, context);\n\n\t\treturn this._contexts.delete(id);\n\t}\n\n\tprivate readonly _recentlyDeletedContexts: Map<string, FluidDataStoreContext | undefined> =\n\t\tnew Map();\n\n\tpublic getRecentlyDeletedContext(id: string) {\n\t\treturn this._recentlyDeletedContexts.get(id);\n\t}\n\n\t/**\n\t * Return the unbound local context with the given id,\n\t * or undefined if it's not found or not unbound.\n\t */\n\tpublic getUnbound(id: string): LocalFluidDataStoreContext | undefined {\n\t\tconst context = this._contexts.get(id);\n\t\tif (context === undefined || !this.notBoundContexts.has(id)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn context as LocalFluidDataStoreContext;\n\t}\n\n\t/**\n\t * Add the given context, marking it as to-be-bound\n\t */\n\tpublic addUnbound(context: LocalFluidDataStoreContext) {\n\t\tconst id = context.id;\n\t\tassert(!this._contexts.has(id), 0x158 /* \"Creating store with existing ID\" */);\n\n\t\tthis._contexts.set(id, context);\n\n\t\tthis.notBoundContexts.add(id);\n\t\tthis.ensureDeferred(id);\n\t}\n\n\t/**\n\t * Get the context with the given id, once it exists locally and is attached.\n\t * e.g. If created locally, it must be bound, or if created remotely then it's fine as soon as it's sync'd in.\n\t * @param id - The id of the context to get\n\t * @param wait - If false, return undefined if the context isn't present and ready now. Otherwise, wait for it.\n\t */\n\tpublic async getBoundOrRemoted(\n\t\tid: string,\n\t\twait: boolean,\n\t): Promise<FluidDataStoreContext | undefined> {\n\t\tconst deferredContext = this.ensureDeferred(id);\n\n\t\tif (!wait && !deferredContext.isCompleted) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn deferredContext.promise;\n\t}\n\n\tprivate ensureDeferred(id: string): Deferred<FluidDataStoreContext> {\n\t\tconst deferred = this.deferredContexts.get(id);\n\t\tif (deferred) {\n\t\t\treturn deferred;\n\t\t}\n\n\t\tconst newDeferred = new Deferred<FluidDataStoreContext>();\n\t\tthis.deferredContexts.set(id, newDeferred);\n\t\treturn newDeferred;\n\t}\n\n\t/**\n\t * Update this context as bound\n\t */\n\tpublic bind(id: string) {\n\t\tconst removed: boolean = this.notBoundContexts.delete(id);\n\t\tassert(removed, 0x159 /* \"The given id was not found in notBoundContexts to delete\" */);\n\n\t\tthis.resolveDeferred(id);\n\t}\n\n\t/**\n\t * Triggers the deferred to resolve, indicating the context is not local-only\n\t * @param id - The id of the context to resolve to\n\t */\n\tprivate resolveDeferred(id: string) {\n\t\tconst context = this._contexts.get(id);\n\t\tassert(!!context, 0x15a /* \"Cannot find context to resolve to\" */);\n\t\tassert(\n\t\t\t!this.notBoundContexts.has(id),\n\t\t\t0x15b /* \"Expected this id to already be removed from notBoundContexts\" */,\n\t\t);\n\n\t\tconst deferred = this.deferredContexts.get(id);\n\t\tassert(!!deferred, 0x15c /* \"Cannot find deferred to resolve\" */);\n\t\tdeferred.resolve(context);\n\t}\n\n\t/**\n\t * Add the given context, marking it as not local-only.\n\t * This could be because it's a local context that's been bound, or because it's a remote context.\n\t * @param context - The context to add\n\t */\n\tpublic addBoundOrRemoted(context: FluidDataStoreContext) {\n\t\tconst id = context.id;\n\t\tassert(!this._contexts.has(id), 0x15d /* \"Creating store with existing ID\" */);\n\n\t\tthis._contexts.set(id, context);\n\n\t\t// Resolve the deferred immediately since this context is not unbound\n\t\tthis.ensureDeferred(id);\n\t\tthis.resolveDeferred(id);\n\t}\n}\n"]}
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
5
|
import { ITelemetryContext } from "@fluidframework/runtime-definitions";
|
|
7
6
|
import { IGarbageCollectionDetailsBase, ISummarizeResult } from "@fluidframework/runtime-definitions/internal";
|
|
8
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
9
|
-
import { RuntimeHeaderData } from "../containerRuntime.js";
|
|
10
8
|
import { ContainerRuntimeGCMessage } from "../messageTypes.js";
|
|
11
9
|
import { IRefreshSummaryResult } from "../summary/index.js";
|
|
12
|
-
import { IGCMetadata, IGCStats, IGarbageCollector, IGarbageCollectorCreateParams } from "./gcDefinitions.js";
|
|
10
|
+
import { IGCMetadata, IGCStats, IGarbageCollector, IGarbageCollectorCreateParams, type IGCNodeUpdatedProps } from "./gcDefinitions.js";
|
|
13
11
|
/**
|
|
14
12
|
* The garbage collector for the container runtime. It consolidates the garbage collection functionality and maintains
|
|
15
13
|
* its state across summaries.
|
|
@@ -195,14 +193,9 @@ export declare class GarbageCollector implements IGarbageCollector {
|
|
|
195
193
|
/**
|
|
196
194
|
* Called when a node with the given id is updated. If the node is inactive or tombstoned, this will log an error
|
|
197
195
|
* or throw an error if failing on incorrect usage is configured.
|
|
198
|
-
* @param
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
* @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.
|
|
202
|
-
* @param request - The original request for loads to preserve it in telemetry.
|
|
203
|
-
* @param requestHeaders - If the node was loaded via request path, the headers in the request.
|
|
204
|
-
*/
|
|
205
|
-
nodeUpdated(nodePath: string, reason: "Loaded" | "Changed", timestampMs?: number, packagePath?: readonly string[], request?: IRequest, headerData?: RuntimeHeaderData): void;
|
|
196
|
+
* @param IGCNodeUpdatedProps - Details about the node and how it was updated
|
|
197
|
+
*/
|
|
198
|
+
nodeUpdated({ node, reason, timestampMs, packagePath, request, headerData, }: IGCNodeUpdatedProps): void;
|
|
206
199
|
/**
|
|
207
200
|
* The given node should have its unreferenced state reset in the next GC,
|
|
208
201
|
* even if the true GC graph shows it is unreferenced. This will
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollection.d.ts","sourceRoot":"","sources":["../../src/gc/garbageCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"garbageCollection.d.ts","sourceRoot":"","sources":["../../src/gc/garbageCollection.ts"],"names":[],"mappings":"AAAA;;;GAG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+ErB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,gCAAgC;IAqExC;;;;OAIG;IACI,SAAS,CACf,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,OAAO,EACnB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,gBAAgB,GAAG,SAAS;IAsBxB,WAAW,IAAI,WAAW;IAcjC;;OAEG;IACU,oBAAoB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/E;;;;OAIG;IACI,cAAc,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO;IAyCxE;;;;;;;;OAQG;IACH,OAAO,CAAC,qBAAqB;IAiC7B;;;;OAIG;IACI,WAAW,CAAC,EAClB,IAAI,EACJ,MAAM,EACN,WAAW,EACX,WAAW,EACX,OAAO,EACP,UAAU,GACV,EAAE,mBAAmB;IA0EtB;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAkB3B;;;;;;;OAOG;IACI,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,IAAI;IAgD3F;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIxC,OAAO,IAAI,IAAI;IAKtB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA0DzB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;CAkE1B"}
|
|
@@ -255,16 +255,22 @@ class GarbageCollector {
|
|
|
255
255
|
if (currentReferenceTimestampMs === undefined) {
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
258
|
+
const initialized = this.gcDataFromLastRun !== undefined;
|
|
259
|
+
await internal_4.PerformanceEvent.timedExecAsync(this.mc.logger, {
|
|
260
|
+
eventName: "InitializeOrUpdateGCState",
|
|
261
|
+
details: { initialized, unrefNodeCount: this.unreferencedNodesState.size },
|
|
262
|
+
}, async () => {
|
|
263
|
+
// If the GC state hasn't been initialized yet, initialize it and return.
|
|
264
|
+
if (!initialized) {
|
|
265
|
+
await this.initializeGCStateFromBaseSnapshotP;
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
// If the GC state has been initialized, update the tracking of unreferenced nodes as per the current
|
|
269
|
+
// reference timestamp.
|
|
270
|
+
for (const [, nodeStateTracker] of this.unreferencedNodesState) {
|
|
271
|
+
nodeStateTracker.updateTracking(currentReferenceTimestampMs);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
268
274
|
}
|
|
269
275
|
/**
|
|
270
276
|
* Called when the connection state of the runtime changes, i.e., it connects or disconnects. GC subscribes to this
|
|
@@ -711,21 +717,20 @@ class GarbageCollector {
|
|
|
711
717
|
/**
|
|
712
718
|
* Called when a node with the given id is updated. If the node is inactive or tombstoned, this will log an error
|
|
713
719
|
* or throw an error if failing on incorrect usage is configured.
|
|
714
|
-
* @param
|
|
715
|
-
* @param reason - Whether the node was loaded or changed.
|
|
716
|
-
* @param timestampMs - The timestamp when the node changed.
|
|
717
|
-
* @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.
|
|
718
|
-
* @param request - The original request for loads to preserve it in telemetry.
|
|
719
|
-
* @param requestHeaders - If the node was loaded via request path, the headers in the request.
|
|
720
|
+
* @param IGCNodeUpdatedProps - Details about the node and how it was updated
|
|
720
721
|
*/
|
|
721
|
-
nodeUpdated(
|
|
722
|
+
nodeUpdated({ node, reason, timestampMs, packagePath, request, headerData, }) {
|
|
722
723
|
if (!this.configs.shouldRunGC) {
|
|
723
724
|
return;
|
|
724
725
|
}
|
|
725
|
-
|
|
726
|
+
// trackedId will be either DataStore or Blob ID (not sub-DataStore ID, since some of those are unrecognized by GC)
|
|
727
|
+
const trackedId = node.path;
|
|
728
|
+
const isTombstoned = this.tombstones.includes(trackedId);
|
|
729
|
+
const isInactive = this.unreferencedNodesState.get(trackedId)?.state === "Inactive";
|
|
730
|
+
const fullPath = request !== undefined ? (0, gcHelpers_js_1.urlToGCNodePath)(request.url) : trackedId;
|
|
726
731
|
// This will log if appropriate
|
|
727
|
-
this.telemetryTracker.nodeUsed({
|
|
728
|
-
id:
|
|
732
|
+
this.telemetryTracker.nodeUsed(trackedId, {
|
|
733
|
+
id: fullPath,
|
|
729
734
|
usageType: reason,
|
|
730
735
|
currentReferenceTimestampMs: timestampMs ?? this.runtime.getCurrentReferenceTimestampMs(),
|
|
731
736
|
packagePath,
|
|
@@ -733,6 +738,8 @@ class GarbageCollector {
|
|
|
733
738
|
isTombstoned,
|
|
734
739
|
lastSummaryTime: this.getLastSummaryTimestampMs(),
|
|
735
740
|
headers: headerData,
|
|
741
|
+
requestUrl: request?.url,
|
|
742
|
+
requestHeaders: JSON.stringify(request?.headers),
|
|
736
743
|
});
|
|
737
744
|
// Any time we log a Tombstone Loaded error (via Telemetry Tracker),
|
|
738
745
|
// we want to also trigger autorecovery to avoid the object being deleted
|
|
@@ -740,14 +747,16 @@ class GarbageCollector {
|
|
|
740
747
|
// to be loaded by the Summarizer, and auto-recovery will be triggered then.
|
|
741
748
|
if (isTombstoned && reason === "Loaded") {
|
|
742
749
|
// Note that when a DataStore and its DDS are all loaded, each will trigger AutoRecovery for itself.
|
|
743
|
-
this.triggerAutoRecovery(
|
|
750
|
+
this.triggerAutoRecovery(fullPath);
|
|
744
751
|
}
|
|
745
|
-
const nodeType = this.runtime.getNodeType(
|
|
752
|
+
const nodeType = this.runtime.getNodeType(fullPath);
|
|
746
753
|
// Unless this is a Loaded event for a Blob or DataStore, we're done after telemetry tracking
|
|
747
|
-
|
|
754
|
+
const loadedBlobOrDataStore = reason === "Loaded" &&
|
|
755
|
+
(nodeType === gcDefinitions_js_1.GCNodeType.Blob || nodeType === gcDefinitions_js_1.GCNodeType.DataStore);
|
|
756
|
+
if (!loadedBlobOrDataStore) {
|
|
748
757
|
return;
|
|
749
758
|
}
|
|
750
|
-
const errorRequest = request ?? { url:
|
|
759
|
+
const errorRequest = request ?? { url: fullPath };
|
|
751
760
|
if (isTombstoned && this.throwOnTombstoneLoad && headerData?.allowTombstone !== true) {
|
|
752
761
|
// The requested data store is removed by gc. Create a 404 gc response exception.
|
|
753
762
|
throw (0, internal_3.responseToException)((0, internal_3.createResponseError)(404, `${nodeType} was tombstoned`, errorRequest, {
|
|
@@ -755,7 +764,7 @@ class GarbageCollector {
|
|
|
755
764
|
}), errorRequest);
|
|
756
765
|
}
|
|
757
766
|
// If the object is inactive and inactive enforcement is configured, throw an error.
|
|
758
|
-
if (
|
|
767
|
+
if (isInactive) {
|
|
759
768
|
const shouldThrowOnInactiveLoad = !this.isSummarizerClient &&
|
|
760
769
|
this.configs.throwOnInactiveLoad === true &&
|
|
761
770
|
headerData?.allowInactive !== true;
|
|
@@ -816,21 +825,28 @@ class GarbageCollector {
|
|
|
816
825
|
const outboundRoutes = this.newReferencesSinceLastRun.get(fromNodePath) ?? [];
|
|
817
826
|
outboundRoutes.push(toNodePath);
|
|
818
827
|
this.newReferencesSinceLastRun.set(fromNodePath, outboundRoutes);
|
|
819
|
-
|
|
828
|
+
// GC won't recognize some subDataStore paths that we encounter (e.g. a path suited for a custom request handler)
|
|
829
|
+
// So for subDataStore paths we need to check the parent dataStore for current tombstone/inactive status.
|
|
830
|
+
const trackedId = this.runtime.getNodeType(toNodePath) === "SubDataStore"
|
|
831
|
+
? (0, gcHelpers_js_1.dataStoreNodePathOnly)(toNodePath)
|
|
832
|
+
: toNodePath;
|
|
833
|
+
this.telemetryTracker.nodeUsed(trackedId, {
|
|
820
834
|
id: toNodePath,
|
|
835
|
+
fromId: fromNodePath,
|
|
821
836
|
usageType: "Revived",
|
|
822
837
|
currentReferenceTimestampMs: this.runtime.getCurrentReferenceTimestampMs(),
|
|
823
838
|
packagePath: undefined,
|
|
824
839
|
completedGCRuns: this.completedRuns,
|
|
825
|
-
isTombstoned: this.tombstones.includes(
|
|
840
|
+
isTombstoned: this.tombstones.includes(trackedId),
|
|
826
841
|
lastSummaryTime: this.getLastSummaryTimestampMs(),
|
|
827
|
-
fromId: fromNodePath,
|
|
828
842
|
autorecovery,
|
|
829
843
|
});
|
|
830
|
-
// This node is referenced - Clear its unreferenced state
|
|
844
|
+
// This node is referenced - Clear its unreferenced state if present
|
|
831
845
|
// But don't delete the node id from the map yet.
|
|
832
846
|
// When generating GC stats, the set of nodes in here is used as the baseline for
|
|
833
847
|
// what was unreferenced in the last GC run.
|
|
848
|
+
// NOTE: We use toNodePath not trackedId even though it may be an unrecognized subDataStore route (hence no-op),
|
|
849
|
+
// because a reference to such a path is not sufficient to consider the DataStore referenced.
|
|
834
850
|
this.unreferencedNodesState.get(toNodePath)?.stopTracking();
|
|
835
851
|
}
|
|
836
852
|
/**
|