@fluidframework/container-runtime 2.0.0-rc.1.0.2 → 2.0.0-rc.1.0.4
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/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +0 -5
- package/dist/blobManager.js.map +1 -1
- package/dist/dataStores.d.ts +1 -1
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +2 -5
- package/dist/dataStores.js.map +1 -1
- package/dist/gc/garbageCollection.d.ts +7 -2
- package/dist/gc/garbageCollection.d.ts.map +1 -1
- package/dist/gc/garbageCollection.js +44 -22
- package/dist/gc/garbageCollection.js.map +1 -1
- package/dist/gc/gcConfigs.d.ts.map +1 -1
- package/dist/gc/gcConfigs.js +11 -4
- package/dist/gc/gcConfigs.js.map +1 -1
- package/dist/gc/gcDefinitions.d.ts +11 -7
- package/dist/gc/gcDefinitions.d.ts.map +1 -1
- package/dist/gc/gcDefinitions.js +7 -4
- package/dist/gc/gcDefinitions.js.map +1 -1
- package/dist/gc/index.d.ts +1 -1
- 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/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/blobManager.d.mts.map +1 -1
- package/lib/blobManager.mjs +0 -5
- package/lib/blobManager.mjs.map +1 -1
- package/lib/dataStores.d.mts +1 -1
- package/lib/dataStores.d.mts.map +1 -1
- package/lib/dataStores.mjs +2 -5
- package/lib/dataStores.mjs.map +1 -1
- package/lib/gc/garbageCollection.d.mts +7 -2
- package/lib/gc/garbageCollection.d.mts.map +1 -1
- package/lib/gc/garbageCollection.mjs +44 -22
- package/lib/gc/garbageCollection.mjs.map +1 -1
- package/lib/gc/gcConfigs.d.mts.map +1 -1
- package/lib/gc/gcConfigs.mjs +12 -5
- package/lib/gc/gcConfigs.mjs.map +1 -1
- package/lib/gc/gcDefinitions.d.mts +11 -7
- package/lib/gc/gcDefinitions.d.mts.map +1 -1
- package/lib/gc/gcDefinitions.mjs +6 -3
- package/lib/gc/gcDefinitions.mjs.map +1 -1
- package/lib/gc/index.d.mts +1 -1
- package/lib/gc/index.d.mts.map +1 -1
- package/lib/gc/index.mjs +1 -1
- package/lib/gc/index.mjs.map +1 -1
- package/lib/packageVersion.d.mts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/package.json +16 -16
- package/src/blobManager.ts +0 -6
- package/src/dataStores.ts +2 -5
- package/src/gc/garbageCollection.ts +44 -23
- package/src/gc/gcConfigs.ts +14 -4
- package/src/gc/gcDefinitions.ts +12 -7
- package/src/gc/index.ts +1 -1
- package/src/packageVersion.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcDefinitions.mjs","sourceRoot":"","sources":["../../src/gc/gcDefinitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0BH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAc,CAAC,CAAC;AAC5C,0GAA0G;AAC1G,MAAM,CAAC,MAAM,aAAa,GAAc,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,+BAA+B,CAAC;AAEvF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAErD,sCAAsC;AACtC,MAAM,CAAC,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACxD,4CAA4C;AAC5C,MAAM,CAAC,MAAM,WAAW,GAAG,kCAAkC,CAAC;AAC9D,gDAAgD;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,oCAAoC,CAAC;AAClE,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,mHAAmH;AACnH,MAAM,CAAC,MAAM,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,4FAA4F;AAC5F,MAAM,CAAC,MAAM,+BAA+B,GAC3C,sDAAsD,CAAC;AACxD,4GAA4G;AAC5G,MAAM,CAAC,MAAM,wBAAwB,GAAG,+CAA+C,CAAC;AACxF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,8CAA8C,CAAC;AACtF,qDAAqD;AACrD,MAAM,CAAC,MAAM,wBAAwB,GAAG,+CAA+C,CAAC;AACxF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,6BAA6B,GAAG,oDAAoD,CAAC;AAClG,0GAA0G;AAC1G,MAAM,CAAC,MAAM,6BAA6B,GAAG,oDAAoD,CAAC;AAElG,2BAA2B;AAC3B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,QAAQ,CAAC;AAErD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,SAAS;AAC/D,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,GAAG,QAAQ,CAAC,CAAC,UAAU;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,QAAQ;AAwI/D;;;GAGG;AACH,MAAM,CAAC,MAAM,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;CACd,CAAC;AAOF;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC3C,0DAA0D;IAC1D,KAAK,EAAE,OAAO;CACL,CAAC;AAyPX,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,gEAAgE;IAChE,MAAM,EAAE,QAAQ;IAChB,mEAAmE;IACnE,QAAQ,EAAE,UAAU;IACpB,yCAAyC;IACzC,cAAc,EAAE,gBAAgB;IAChC,0DAA0D;IAC1D,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/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeResult,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ReadAndParseBlob } from \"@fluidframework/runtime-utils\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIContainerRuntimeMetadata,\n\tICreateContainerMetadata,\n\tIRefreshSummaryResult,\n} from \"../summary\";\nimport { RuntimeHeaderData } from \"../containerRuntime\";\nimport { ContainerRuntimeGCMessage } from \"../messageTypes\";\n\n/**\n * @alpha\n */\nexport type GCVersion = number;\n\n/** The stable/default version of GC Data */\nexport const stableGCVersion: GCVersion = 3;\n/** The next version of GC Data, to bump to in case we need to regenerate all GC Data across all files. */\nexport const nextGCVersion: GCVersion = 4;\n\n/**\n * This undocumented GC Option (on ContainerRuntime Options) allows an app to disable throwing an error when tombstone\n * object is loaded (requested), merely logging a message instead.\n *\n * By default, attempting to load a Tombstoned object will result in an error.\n */\nexport const gcDisableThrowOnTombstoneLoadOptionName = \"gcDisableThrowOnTombstoneLoad\";\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/** Config key to turn GC on / off. */\nexport const runGCKey = \"Fluid.GarbageCollection.RunGC\";\n/** Config key to turn GC sweep on / off. */\nexport const runSweepKey = \"Fluid.GarbageCollection.RunSweep\";\n/** Config key to turn GC test mode on / off. */\nexport const gcTestModeKey = \"Fluid.GarbageCollection.GCTestMode\";\n/** Config key to expire a session after a set period of time. Defaults to true. */\nexport const runSessionExpiryKey = \"Fluid.GarbageCollection.RunSessionExpiry\";\n/** Config key to disable the tombstone feature, i.e., tombstone information is not read / written into summary. */\nexport const disableTombstoneKey = \"Fluid.GarbageCollection.DisableTombstone\";\n/** Config key to override throwing an error when tombstone object is loaded (requested). */\nexport const throwOnTombstoneLoadOverrideKey =\n\t\"Fluid.GarbageCollection.ThrowOnTombstoneLoadOverride\";\n/** Config key to enable throwing an error when tombstone object is used (e.g. outgoing or incoming ops). */\nexport const throwOnTombstoneUsageKey = \"Fluid.GarbageCollection.ThrowOnTombstoneUsage\";\n/** Config key to enable GC version upgrade. */\nexport const gcVersionUpgradeToV4Key = \"Fluid.GarbageCollection.GCVersionUpgradeToV4\";\n/** Config key to disable GC sweep for datastores. */\nexport const disableDatastoreSweepKey = \"Fluid.GarbageCollection.DisableDataStoreSweep\";\n/** Config key to disable GC sweep for attachment blobs. */\nexport const disableAttachmentBlobSweepKey = \"Fluid.GarbageCollection.DisableAttachmentBlobSweep\";\n/** Config key to revert new paradigm of detecting outbound routes in ContainerRuntime layer (use true) */\nexport const detectOutboundRoutesViaDDSKey = \"Fluid.GarbageCollection.DetectOutboundRoutesViaDDS\";\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 * @alpha\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/** Deprecated property from legacy type. Will not be set concurrently with gcGeneration */\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 * @alpha\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/** If this is present, the session for this container will expire after this time and the container will close */\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 * @alpha\n */\nexport interface IMarkPhaseStats {\n\t/** The number of nodes in the container. */\n\tnodeCount: number;\n\t/** The number of data stores in the container. */\n\tdataStoreCount: number;\n\t/** The number of attachment blobs in the container. */\n\tattachmentBlobCount: number;\n\t/** The number of unreferenced nodes in the container. */\n\tunrefNodeCount: number;\n\t/** The number of unreferenced data stores in the container. */\n\tunrefDataStoreCount: number;\n\t/** The number of unreferenced attachment blobs in the container. */\n\tunrefAttachmentBlobCount: number;\n\t/** The number of nodes whose reference state updated since last GC run. */\n\tupdatedNodeCount: number;\n\t/** The number of data stores whose reference state updated since last GC run. */\n\tupdatedDataStoreCount: number;\n\t/** The number of attachment blobs whose reference state updated since last GC run. */\n\tupdatedAttachmentBlobCount: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection sweep phase run.\n * @alpha\n */\nexport interface ISweepPhaseStats {\n\t/** The number of nodes in the lifetime of the container. */\n\tlifetimeNodeCount: number;\n\t/** The number of data stores in the lifetime of the container. */\n\tlifetimeDataStoreCount: number;\n\t/** The number of attachment blobs in the lifetime of the container. */\n\tlifetimeAttachmentBlobCount: number;\n\t/** The number of deleted nodes in the container. */\n\tdeletedNodeCount: number;\n\t/** The number of deleted data stores in the container. */\n\tdeletedDataStoreCount: number;\n\t/** The number of deleted attachment blobs in the container. */\n\tdeletedAttachmentBlobCount: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection run.\n * @alpha\n */\nexport interface IGCStats extends IMarkPhaseStats, ISweepPhaseStats {}\n\n/**\n * The types of GC nodes in the GC reference graph.\n * @alpha\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};\n\n/**\n * @alpha\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/** Message sent directing GC to delete the given nodes */\n\tSweep: \"Sweep\",\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\ttype: \"Sweep\";\n\t// The ids of nodes that are deleted.\n\tdeletedNodeIds: 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;\n\n/**\n * Defines the APIs for the runtime object to be passed to the garbage collector.\n */\nexport interface IGarbageCollectionRuntime {\n\t/** Before GC runs, called to notify the runtime to update any pending GC state. */\n\tupdateStateBeforeGC(): Promise<void>;\n\t/** Returns the garbage collection data of the runtime. */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\t/** After GC has run, called to notify the runtime of routes that are used in it. */\n\tupdateUsedRoutes(usedRoutes: readonly string[]): void;\n\t/** After GC has run, called to notify the runtime of routes that are unused in it. */\n\tupdateUnusedRoutes(unusedRoutes: 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/** Called to notify the runtime of routes that are tombstones. */\n\tupdateTombstonedRoutes(tombstoneRoutes: readonly string[]): void;\n\t/** Returns a referenced timestamp to be used to track unreferenced nodes. */\n\tgetCurrentReferenceTimestampMs(): number | undefined;\n\t/** Returns the type of the GC node. */\n\tgetNodeType(nodePath: string): GCNodeType;\n\t/** Called when the runtime should close because of an error. */\n\tcloseFn: (error?: ICriticalContainerError) => void;\n}\n\n/** Defines the contract for the garbage collector. */\nexport interface IGarbageCollector {\n\t/** Tells whether GC should run or not. */\n\treadonly shouldRunGC: boolean;\n\t/** Tells whether the GC state in summary needs to be reset in the next summary. */\n\treadonly summaryStateNeedsReset: boolean;\n\t/** The count of data stores whose GC state updated since the last summary. */\n\treadonly updatedDSCountSinceLastSummary: number;\n\t/** Tells whether tombstone feature is enabled and enforced. */\n\treadonly tombstoneEnforcementAllowed: boolean;\n\t/** Tells whether loading a tombstone object should fail or merely log. */\n\treadonly throwOnTombstoneLoad: boolean;\n\t/** Tells whether using a tombstone object should fail or merely log. */\n\treadonly throwOnTombstoneUsage: boolean;\n\t/** Initialize the state from the base snapshot after its creation. */\n\tinitializeBaseState(): Promise<void>;\n\t/** Run garbage collection and update the reference / used state of the system. */\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/** Summarizes the GC data and returns it as a summary tree. */\n\tsummarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined;\n\t/** Returns the garbage collector specific metadata to be written into the summary. */\n\tgetMetadata(): IGCMetadata;\n\t/** Returns the GC details generated from the base snapshot. */\n\tgetBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;\n\t/** Called when the latest summary of the system has been refreshed. */\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(\n\t\tnodePath: string,\n\t\treason: \"Loaded\" | \"Changed\",\n\t\ttimestampMs?: number,\n\t\tpackagePath?: readonly string[],\n\t\trequest?: IRequest,\n\t\theaderData?: RuntimeHeaderData,\n\t): void;\n\t/** Called when a reference is added to a node. Used to identify nodes that were referenced between summaries. */\n\taddedOutboundReference(fromNodePath: string, toNodePath: string): void;\n\t/** Called to process a garbage collection message. */\n\tprocessMessage(message: ContainerRuntimeGCMessage, local: boolean): void;\n\t/** Returns true if this node has been deleted by GC during sweep phase. */\n\tisNodeDeleted(nodePath: string): boolean;\n\tsetConnectionState(connected: boolean, clientId?: string): void;\n\tdispose(): void;\n}\n\n/** Parameters necessary for creating a GarbageCollector. */\nexport interface IGarbageCollectorCreateParams {\n\treadonly runtime: IGarbageCollectionRuntime;\n\treadonly gcOptions: IGCRuntimeOptions;\n\treadonly baseLogger: ITelemetryLoggerExt;\n\treadonly existing: boolean;\n\treadonly metadata: IContainerRuntimeMetadata | undefined;\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}\n\n/**\n * @alpha\n */\nexport interface IGCRuntimeOptions {\n\t/**\n\t * Flag that if true, will enable running garbage collection (GC) for a new container.\n\t *\n\t * GC has mark phase and sweep phase. In mark phase, unreferenced objects are identified\n\t * and marked as such in the summary. This option enables the mark phase.\n\t * In sweep phase, unreferenced objects are eventually deleted from the container if they meet certain conditions.\n\t * Sweep phase can be enabled using the \"enableGCSweep\" option.\n\t *\n\t * Note: This setting is persisted in the container's summary and cannot be changed.\n\t */\n\tgcAllowed?: boolean;\n\n\t/**\n\t * Flag that if true, will disable garbage collection for the session.\n\t * Can be used to disable running GC on containers where it is allowed via the gcAllowed option.\n\t */\n\tdisableGC?: boolean;\n\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[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 enabled for this document. This is specified during document creation and doesn't change\n\t * throughout its lifetime.\n\t */\n\treadonly gcEnabled: boolean;\n\t/**\n\t * Tracks if sweep phase is enabled for this document. This is specified during document creation and doesn't change\n\t * throughout its lifetime.\n\t */\n\treadonly sweepEnabled: boolean;\n\t/**\n\t * Tracks if GC should run or not. Even if GC is enabled for a document (see gcEnabled), it can be explicitly\n\t * disabled via runtime options or feature flags.\n\t */\n\treadonly shouldRunGC: boolean;\n\t/**\n\t * Tracks if sweep phase should run or not. Even if the sweep phase is enabled for a document (see sweepEnabled), it\n\t * can be explicitly disabled via feature flags. It also won't run if session expiry is not enabled.\n\t */\n\treadonly shouldRunSweep: 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/** The time in ms to expire a session for a client for gc. */\n\treadonly sessionExpiryTimeoutMs: number | undefined;\n\t/** The time after which an unreferenced node can be Tombstoned - i.e. GC knows it can't be referenced again (revived). */\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/** The time after which an unreferenced node is inactive. */\n\treadonly inactiveTimeoutMs: number;\n\t/** Tracks whether GC should run in test mode. In this mode, unreferenced objects are deleted immediately. */\n\treadonly testMode: boolean;\n\t/**\n\t * Tracks whether GC should run in tombstone mode. In this mode, objects are marked as tombstones as a step along the\n\t * way before they are fully deleted.\n\t * In interactive (non-summarizer) clients, tombstone objects behave as if they are deleted, i.e., access to them\n\t * is not allowed. However, these objects can be accessed after referencing them first. It is used as a \"warning\"\n\t * step before sweep, where objects wrongly marked as unreferenced can be recovered.\n\t */\n\treadonly tombstoneMode: boolean;\n\t/** @see GCFeatureMatrix. */\n\treadonly persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\t/** The version of GC in the base snapshot. */\n\treadonly gcVersionInBaseSnapshot: GCVersion | undefined;\n\t/** The current version of GC data in the running code */\n\treadonly gcVersionInEffect: GCVersion;\n\t/** It is easier for users to diagnose InactiveObject usage if we throw on load, which this option enables */\n\treadonly throwOnInactiveLoad: boolean | undefined;\n\t/** If true, throw an error when a tombstone data store is retrieved */\n\treadonly throwOnTombstoneLoad: boolean;\n\t/** If true, throw an error when a tombstone data store is used. */\n\treadonly throwOnTombstoneUsage: boolean;\n}\n\n/** The state of node that is unreferenced. */\nexport const UnreferencedState = {\n\t/** The node is active, i.e., it can become referenced again. */\n\tActive: \"Active\",\n\t/** The node is inactive, i.e., it should not become referenced. */\n\tInactive: \"Inactive\",\n\t/** The node is ready to be tombstoned */\n\tTombstoneReady: \"TombstoneReady\",\n\t/** The node is ready to be deleted by the sweep phase. */\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/** The ids of nodes that are referenced in the referenced graph */\n\treferencedNodeIds: string[];\n\t/** The ids of nodes that are not-referenced or deleted in the referenced graph */\n\tdeletedNodeIds: string[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gcDefinitions.mjs","sourceRoot":"","sources":["../../src/gc/gcDefinitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0BH,4CAA4C;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAc,CAAC,CAAC;AAC5C,0GAA0G;AAC1G,MAAM,CAAC,MAAM,aAAa,GAAc,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,+BAA+B,CAAC;AAEvF;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,uBAAuB,CAAC;AAEzE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC;AAErD,sCAAsC;AACtC,MAAM,CAAC,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACxD,4CAA4C;AAC5C,MAAM,CAAC,MAAM,WAAW,GAAG,kCAAkC,CAAC;AAC9D,gDAAgD;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,oCAAoC,CAAC;AAClE,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,mHAAmH;AACnH,MAAM,CAAC,MAAM,mBAAmB,GAAG,0CAA0C,CAAC;AAC9E,4FAA4F;AAC5F,MAAM,CAAC,MAAM,+BAA+B,GAC3C,sDAAsD,CAAC;AACxD,4GAA4G;AAC5G,MAAM,CAAC,MAAM,wBAAwB,GAAG,+CAA+C,CAAC;AACxF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,8CAA8C,CAAC;AACtF,mFAAmF;AACnF,MAAM,CAAC,MAAM,wBAAwB,GAAG,+CAA+C,CAAC;AACxF,0GAA0G;AAC1G,MAAM,CAAC,MAAM,6BAA6B,GAAG,oDAAoD,CAAC;AAElG,2BAA2B;AAC3B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,QAAQ,CAAC;AAErD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,SAAS;AAC/D,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,GAAG,QAAQ,CAAC,CAAC,UAAU;AACvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,QAAQ;AAwI/D;;;GAGG;AACH,MAAM,CAAC,MAAM,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;CACd,CAAC;AAOF;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC3C,0DAA0D;IAC1D,KAAK,EAAE,OAAO;CACL,CAAC;AA0PX,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,gEAAgE;IAChE,MAAM,EAAE,QAAQ;IAChB,mEAAmE;IACnE,QAAQ,EAAE,UAAU;IACpB,yCAAyC;IACzC,cAAc,EAAE,gBAAgB;IAChC,0DAA0D;IAC1D,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/protocol-definitions\";\nimport {\n\tIGarbageCollectionData,\n\tIGarbageCollectionDetailsBase,\n\tISummarizeResult,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ReadAndParseBlob } from \"@fluidframework/runtime-utils\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIContainerRuntimeMetadata,\n\tICreateContainerMetadata,\n\tIRefreshSummaryResult,\n} from \"../summary\";\nimport { RuntimeHeaderData } from \"../containerRuntime\";\nimport { ContainerRuntimeGCMessage } from \"../messageTypes\";\n\n/**\n * @alpha\n */\nexport type GCVersion = number;\n\n/** The stable/default version of GC Data */\nexport const stableGCVersion: GCVersion = 3;\n/** The next version of GC Data, to bump to in case we need to regenerate all GC Data across all files. */\nexport const nextGCVersion: GCVersion = 4;\n\n/**\n * This undocumented GC Option (on ContainerRuntime Options) allows an app to disable throwing an error when tombstone\n * object is loaded (requested), merely logging a message instead.\n *\n * By default, attempting to load a Tombstoned object will result in an error.\n */\nexport const gcDisableThrowOnTombstoneLoadOptionName = \"gcDisableThrowOnTombstoneLoad\";\n\n/**\n * This undocumented GC Option (on ContainerRuntime Options) allows an app to enable Sweep for blobs only.\n * Only applies if enableGCSweep option is set to true.\n */\nexport const gcDisableDataStoreSweepOptionName = \"disableDataStoreSweep\";\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/** Config key to turn GC on / off. */\nexport const runGCKey = \"Fluid.GarbageCollection.RunGC\";\n/** Config key to turn GC sweep on / off. */\nexport const runSweepKey = \"Fluid.GarbageCollection.RunSweep\";\n/** Config key to turn GC test mode on / off. */\nexport const gcTestModeKey = \"Fluid.GarbageCollection.GCTestMode\";\n/** Config key to expire a session after a set period of time. Defaults to true. */\nexport const runSessionExpiryKey = \"Fluid.GarbageCollection.RunSessionExpiry\";\n/** Config key to disable the tombstone feature, i.e., tombstone information is not read / written into summary. */\nexport const disableTombstoneKey = \"Fluid.GarbageCollection.DisableTombstone\";\n/** Config key to override throwing an error when tombstone object is loaded (requested). */\nexport const throwOnTombstoneLoadOverrideKey =\n\t\"Fluid.GarbageCollection.ThrowOnTombstoneLoadOverride\";\n/** Config key to enable throwing an error when tombstone object is used (e.g. outgoing or incoming ops). */\nexport const throwOnTombstoneUsageKey = \"Fluid.GarbageCollection.ThrowOnTombstoneUsage\";\n/** Config key to enable GC version upgrade. */\nexport const gcVersionUpgradeToV4Key = \"Fluid.GarbageCollection.GCVersionUpgradeToV4\";\n/** Config key to disable GC sweep for datastores. They'll merely be Tombstoned. */\nexport const disableDatastoreSweepKey = \"Fluid.GarbageCollection.DisableDataStoreSweep\";\n/** Config key to revert new paradigm of detecting outbound routes in ContainerRuntime layer (use true) */\nexport const detectOutboundRoutesViaDDSKey = \"Fluid.GarbageCollection.DetectOutboundRoutesViaDDS\";\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 * @alpha\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/** Deprecated property from legacy type. Will not be set concurrently with gcGeneration */\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 * @alpha\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/** If this is present, the session for this container will expire after this time and the container will close */\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 * @alpha\n */\nexport interface IMarkPhaseStats {\n\t/** The number of nodes in the container. */\n\tnodeCount: number;\n\t/** The number of data stores in the container. */\n\tdataStoreCount: number;\n\t/** The number of attachment blobs in the container. */\n\tattachmentBlobCount: number;\n\t/** The number of unreferenced nodes in the container. */\n\tunrefNodeCount: number;\n\t/** The number of unreferenced data stores in the container. */\n\tunrefDataStoreCount: number;\n\t/** The number of unreferenced attachment blobs in the container. */\n\tunrefAttachmentBlobCount: number;\n\t/** The number of nodes whose reference state updated since last GC run. */\n\tupdatedNodeCount: number;\n\t/** The number of data stores whose reference state updated since last GC run. */\n\tupdatedDataStoreCount: number;\n\t/** The number of attachment blobs whose reference state updated since last GC run. */\n\tupdatedAttachmentBlobCount: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection sweep phase run.\n * @alpha\n */\nexport interface ISweepPhaseStats {\n\t/** The number of nodes in the lifetime of the container. */\n\tlifetimeNodeCount: number;\n\t/** The number of data stores in the lifetime of the container. */\n\tlifetimeDataStoreCount: number;\n\t/** The number of attachment blobs in the lifetime of the container. */\n\tlifetimeAttachmentBlobCount: number;\n\t/** The number of deleted nodes in the container. */\n\tdeletedNodeCount: number;\n\t/** The number of deleted data stores in the container. */\n\tdeletedDataStoreCount: number;\n\t/** The number of deleted attachment blobs in the container. */\n\tdeletedAttachmentBlobCount: number;\n}\n\n/**\n * The statistics of the system state after a garbage collection run.\n * @alpha\n */\nexport interface IGCStats extends IMarkPhaseStats, ISweepPhaseStats {}\n\n/**\n * The types of GC nodes in the GC reference graph.\n * @alpha\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};\n\n/**\n * @alpha\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/** Message sent directing GC to delete the given nodes */\n\tSweep: \"Sweep\",\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\ttype: \"Sweep\";\n\t// The ids of nodes that are deleted.\n\tdeletedNodeIds: 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;\n\n/**\n * Defines the APIs for the runtime object to be passed to the garbage collector.\n */\nexport interface IGarbageCollectionRuntime {\n\t/** Before GC runs, called to notify the runtime to update any pending GC state. */\n\tupdateStateBeforeGC(): Promise<void>;\n\t/** Returns the garbage collection data of the runtime. */\n\tgetGCData(fullGC?: boolean): Promise<IGarbageCollectionData>;\n\t/** After GC has run, called to notify the runtime of routes that are used in it. */\n\tupdateUsedRoutes(usedRoutes: readonly string[]): void;\n\t/** After GC has run, called to notify the runtime of routes that are unused in it. */\n\tupdateUnusedRoutes(unusedRoutes: 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/** Called to notify the runtime of routes that are tombstones. */\n\tupdateTombstonedRoutes(tombstoneRoutes: readonly string[]): void;\n\t/** Returns a referenced timestamp to be used to track unreferenced nodes. */\n\tgetCurrentReferenceTimestampMs(): number | undefined;\n\t/** Returns the type of the GC node. */\n\tgetNodeType(nodePath: string): GCNodeType;\n\t/** Called when the runtime should close because of an error. */\n\tcloseFn: (error?: ICriticalContainerError) => void;\n}\n\n/** Defines the contract for the garbage collector. */\nexport interface IGarbageCollector {\n\t/** Tells whether GC should run or not. */\n\treadonly shouldRunGC: boolean;\n\t/** Tells whether the GC state in summary needs to be reset in the next summary. */\n\treadonly summaryStateNeedsReset: boolean;\n\t/** The count of data stores whose GC state updated since the last summary. */\n\treadonly updatedDSCountSinceLastSummary: number;\n\t/** Tells whether tombstone feature is enabled and enforced. */\n\treadonly tombstoneEnforcementAllowed: boolean;\n\t/** Tells whether loading a tombstone object should fail or merely log. */\n\treadonly throwOnTombstoneLoad: boolean;\n\t/** Tells whether using a tombstone object should fail or merely log. */\n\treadonly throwOnTombstoneUsage: boolean;\n\t/** Initialize the state from the base snapshot after its creation. */\n\tinitializeBaseState(): Promise<void>;\n\t/** Run garbage collection and update the reference / used state of the system. */\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/** Summarizes the GC data and returns it as a summary tree. */\n\tsummarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummarizeResult | undefined;\n\t/** Returns the garbage collector specific metadata to be written into the summary. */\n\tgetMetadata(): IGCMetadata;\n\t/** Returns the GC details generated from the base snapshot. */\n\tgetBaseGCDetails(): Promise<IGarbageCollectionDetailsBase>;\n\t/** Called when the latest summary of the system has been refreshed. */\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(\n\t\tnodePath: string,\n\t\treason: \"Loaded\" | \"Changed\",\n\t\ttimestampMs?: number,\n\t\tpackagePath?: readonly string[],\n\t\trequest?: IRequest,\n\t\theaderData?: RuntimeHeaderData,\n\t): void;\n\t/** Called when a reference is added to a node. Used to identify nodes that were referenced between summaries. */\n\taddedOutboundReference(fromNodePath: string, toNodePath: string): void;\n\t/** Called to process a garbage collection message. */\n\tprocessMessage(message: ContainerRuntimeGCMessage, local: boolean): void;\n\t/** Returns true if this node has been deleted by GC during sweep phase. */\n\tisNodeDeleted(nodePath: string): boolean;\n\tsetConnectionState(connected: boolean, clientId?: string): void;\n\tdispose(): void;\n}\n\n/** Parameters necessary for creating a GarbageCollector. */\nexport interface IGarbageCollectorCreateParams {\n\treadonly runtime: IGarbageCollectionRuntime;\n\treadonly gcOptions: IGCRuntimeOptions;\n\treadonly baseLogger: ITelemetryLoggerExt;\n\treadonly existing: boolean;\n\treadonly metadata: IContainerRuntimeMetadata | undefined;\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}\n\n/**\n * @alpha\n */\nexport interface IGCRuntimeOptions {\n\t/**\n\t * Flag that if true, will enable running garbage collection (GC) for a new container.\n\t *\n\t * GC has mark phase and sweep phase. In mark phase, unreferenced objects are identified\n\t * and marked as such in the summary. This option enables the mark phase.\n\t * In sweep phase, unreferenced objects are eventually deleted from the container if they meet certain conditions.\n\t * Sweep phase can be enabled using the \"enableGCSweep\" option.\n\t *\n\t * Note: This setting is persisted in the container's summary and cannot be changed.\n\t */\n\tgcAllowed?: boolean;\n\n\t/**\n\t * Flag that if true, will disable garbage collection for the session.\n\t * Can be used to disable running GC on containers where it is allowed via the gcAllowed option.\n\t */\n\tdisableGC?: boolean;\n\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[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 enabled for this document. This is specified during document creation and doesn't change\n\t * throughout its lifetime.\n\t */\n\treadonly gcEnabled: boolean;\n\t/**\n\t * Tracks if sweep phase is allowed for this document. This is specified during document creation and doesn't change\n\t * throughout its lifetime.\n\t */\n\treadonly sweepEnabled: boolean;\n\t/**\n\t * Tracks if GC should run or not. Even if GC is enabled for a document (see gcEnabled), it can be explicitly\n\t * disabled via runtime options or feature flags.\n\t */\n\treadonly shouldRunGC: boolean;\n\t/**\n\t * Tracks if sweep phase should run or not, or if it should run only for attachment blobs.\n\t * Even if the sweep phase is allowed for a document (see sweepEnabled), it may be disabled or partially enabled\n\t * for the session, depending on a variety of other configurations present.\n\t */\n\treadonly shouldRunSweep: \"YES\" | \"ONLY_BLOBS\" | \"NO\";\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/** The time in ms to expire a session for a client for gc. */\n\treadonly sessionExpiryTimeoutMs: number | undefined;\n\t/** The time after which an unreferenced node can be Tombstoned - i.e. GC knows it can't be referenced again (revived). */\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/** The time after which an unreferenced node is inactive. */\n\treadonly inactiveTimeoutMs: number;\n\t/** Tracks whether GC should run in test mode. In this mode, unreferenced objects are deleted immediately. */\n\treadonly testMode: boolean;\n\t/**\n\t * Tracks whether GC should run in tombstone mode. In this mode, objects are marked as tombstones as a step along the\n\t * way before they are fully deleted.\n\t * In interactive (non-summarizer) clients, tombstone objects behave as if they are deleted, i.e., access to them\n\t * is not allowed. However, these objects can be accessed after referencing them first. It is used as a \"warning\"\n\t * step before sweep, where objects wrongly marked as unreferenced can be recovered.\n\t */\n\treadonly tombstoneMode: boolean;\n\t/** @see GCFeatureMatrix. */\n\treadonly persistedGcFeatureMatrix: GCFeatureMatrix | undefined;\n\t/** The version of GC in the base snapshot. */\n\treadonly gcVersionInBaseSnapshot: GCVersion | undefined;\n\t/** The current version of GC data in the running code */\n\treadonly gcVersionInEffect: GCVersion;\n\t/** It is easier for users to diagnose InactiveObject usage if we throw on load, which this option enables */\n\treadonly throwOnInactiveLoad: boolean | undefined;\n\t/** If true, throw an error when a tombstone data store is retrieved */\n\treadonly throwOnTombstoneLoad: boolean;\n\t/** If true, throw an error when a tombstone data store is used. */\n\treadonly throwOnTombstoneUsage: boolean;\n}\n\n/** The state of node that is unreferenced. */\nexport const UnreferencedState = {\n\t/** The node is active, i.e., it can become referenced again. */\n\tActive: \"Active\",\n\t/** The node is inactive, i.e., it should not become referenced. */\n\tInactive: \"Inactive\",\n\t/** The node is ready to be tombstoned */\n\tTombstoneReady: \"TombstoneReady\",\n\t/** The node is ready to be deleted by the sweep phase. */\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/** The ids of nodes that are referenced in the referenced graph */\n\treferencedNodeIds: string[];\n\t/** The ids of nodes that are not-referenced or deleted in the referenced graph */\n\tdeletedNodeIds: string[];\n}\n"]}
|
package/lib/gc/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { GarbageCollector } from "./garbageCollection.mjs";
|
|
6
|
-
export { nextGCVersion, defaultInactiveTimeoutMs, defaultSweepGracePeriodMs, defaultSessionExpiryDurationMs, GCNodeType, gcTestModeKey, gcDisableThrowOnTombstoneLoadOptionName, gcGenerationOptionName, GCFeatureMatrix, GCVersion, gcVersionUpgradeToV4Key, IGarbageCollectionRuntime, IGarbageCollector, IGarbageCollectorConfigs, IGarbageCollectorCreateParams, IGCMetadata, IGCMetadata_Deprecated, IGCResult, IGCRuntimeOptions, IMarkPhaseStats, ISweepPhaseStats, IGCStats, oneDayMs, runGCKey, runSessionExpiryKey, runSweepKey, stableGCVersion,
|
|
6
|
+
export { nextGCVersion, defaultInactiveTimeoutMs, defaultSweepGracePeriodMs, defaultSessionExpiryDurationMs, GCNodeType, gcTestModeKey, gcDisableDataStoreSweepOptionName, gcDisableThrowOnTombstoneLoadOptionName, gcGenerationOptionName, GCFeatureMatrix, GCVersion, gcVersionUpgradeToV4Key, IGarbageCollectionRuntime, IGarbageCollector, IGarbageCollectorConfigs, IGarbageCollectorCreateParams, IGCMetadata, IGCMetadata_Deprecated, IGCResult, IGCRuntimeOptions, IMarkPhaseStats, ISweepPhaseStats, IGCStats, oneDayMs, runGCKey, runSessionExpiryKey, runSweepKey, stableGCVersion, disableDatastoreSweepKey, detectOutboundRoutesViaDDSKey, UnreferencedState, throwOnTombstoneLoadOverrideKey, GarbageCollectionMessage, ISweepMessage, } from "./gcDefinitions.mjs";
|
|
7
7
|
export { cloneGCData, concatGarbageCollectionStates, trimLeadingAndTrailingSlashes, unpackChildNodesGCDetails, } from "./gcHelpers.mjs";
|
|
8
8
|
export { runGarbageCollection } from "./gcReferenceGraphAlgorithm.mjs";
|
|
9
9
|
export { IGarbageCollectionNodeData, IGarbageCollectionSnapshotData, IGarbageCollectionState, IGarbageCollectionSummaryDetailsLegacy, } from "./gcSummaryDefinitions.mjs";
|
package/lib/gc/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,gBAAgB,EAAE;OACpB,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,uCAAuC,EACvC,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,WAAW,EACX,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,gBAAgB,EAAE;OACpB,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,iCAAiC,EACjC,uCAAuC,EACvC,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,uBAAuB,EACvB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,WAAW,EACX,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,+BAA+B,EAC/B,wBAAwB,EACxB,aAAa,GACb;OACM,EACN,WAAW,EACX,6BAA6B,EAC7B,6BAA6B,EAC7B,yBAAyB,GACzB;OACM,EAAE,oBAAoB,EAAE;OACxB,EACN,0BAA0B,EAC1B,8BAA8B,EAC9B,uBAAuB,EACvB,sCAAsC,GACtC;OACM,EACN,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACtB;OACM,EAAE,kBAAkB,EAAE,0BAA0B,EAAE;OAClD,EAAE,wBAAwB,EAAE"}
|
package/lib/gc/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { GarbageCollector } from "./garbageCollection.mjs";
|
|
6
|
-
export { nextGCVersion, defaultInactiveTimeoutMs, defaultSweepGracePeriodMs, defaultSessionExpiryDurationMs, GCNodeType, gcTestModeKey, gcDisableThrowOnTombstoneLoadOptionName, gcGenerationOptionName, gcVersionUpgradeToV4Key, oneDayMs, runGCKey, runSessionExpiryKey, runSweepKey, stableGCVersion,
|
|
6
|
+
export { nextGCVersion, defaultInactiveTimeoutMs, defaultSweepGracePeriodMs, defaultSessionExpiryDurationMs, GCNodeType, gcTestModeKey, gcDisableDataStoreSweepOptionName, gcDisableThrowOnTombstoneLoadOptionName, gcGenerationOptionName, gcVersionUpgradeToV4Key, oneDayMs, runGCKey, runSessionExpiryKey, runSweepKey, stableGCVersion, disableDatastoreSweepKey, detectOutboundRoutesViaDDSKey, UnreferencedState, throwOnTombstoneLoadOverrideKey, } from "./gcDefinitions.mjs";
|
|
7
7
|
export { cloneGCData, concatGarbageCollectionStates, trimLeadingAndTrailingSlashes, unpackChildNodesGCDetails, } from "./gcHelpers.mjs";
|
|
8
8
|
export { runGarbageCollection } from "./gcReferenceGraphAlgorithm.mjs";
|
|
9
9
|
export { gcStateBlobKey, GCSummaryStateTracker, } from "./gcSummaryStateTracker.mjs";
|
package/lib/gc/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,gBAAgB,EAAE;OACpB,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,uCAAuC,EACvC,sBAAsB,EAGtB,uBAAuB,EAYvB,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/gc/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,gBAAgB,EAAE;OACpB,EACN,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,UAAU,EACV,aAAa,EACb,iCAAiC,EACjC,uCAAuC,EACvC,sBAAsB,EAGtB,uBAAuB,EAYvB,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,+BAA+B,GAG/B;OACM,EACN,WAAW,EACX,6BAA6B,EAC7B,6BAA6B,EAC7B,yBAAyB,GACzB;OACM,EAAE,oBAAoB,EAAE;OAOxB,EACN,cAAc,EACd,qBAAqB,GAErB;OACM,EAAE,kBAAkB,EAAE,0BAA0B,EAAE;OAClD,EAAE,wBAAwB,EAAE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { GarbageCollector } from \"./garbageCollection\";\nexport {\n\tnextGCVersion,\n\tdefaultInactiveTimeoutMs,\n\tdefaultSweepGracePeriodMs,\n\tdefaultSessionExpiryDurationMs,\n\tGCNodeType,\n\tgcTestModeKey,\n\tgcDisableDataStoreSweepOptionName,\n\tgcDisableThrowOnTombstoneLoadOptionName,\n\tgcGenerationOptionName,\n\tGCFeatureMatrix,\n\tGCVersion,\n\tgcVersionUpgradeToV4Key,\n\tIGarbageCollectionRuntime,\n\tIGarbageCollector,\n\tIGarbageCollectorConfigs,\n\tIGarbageCollectorCreateParams,\n\tIGCMetadata,\n\tIGCMetadata_Deprecated,\n\tIGCResult,\n\tIGCRuntimeOptions,\n\tIMarkPhaseStats,\n\tISweepPhaseStats,\n\tIGCStats,\n\toneDayMs,\n\trunGCKey,\n\trunSessionExpiryKey,\n\trunSweepKey,\n\tstableGCVersion,\n\tdisableDatastoreSweepKey,\n\tdetectOutboundRoutesViaDDSKey,\n\tUnreferencedState,\n\tthrowOnTombstoneLoadOverrideKey,\n\tGarbageCollectionMessage,\n\tISweepMessage,\n} from \"./gcDefinitions\";\nexport {\n\tcloneGCData,\n\tconcatGarbageCollectionStates,\n\ttrimLeadingAndTrailingSlashes,\n\tunpackChildNodesGCDetails,\n} from \"./gcHelpers\";\nexport { runGarbageCollection } from \"./gcReferenceGraphAlgorithm\";\nexport {\n\tIGarbageCollectionNodeData,\n\tIGarbageCollectionSnapshotData,\n\tIGarbageCollectionState,\n\tIGarbageCollectionSummaryDetailsLegacy,\n} from \"./gcSummaryDefinitions\";\nexport {\n\tgcStateBlobKey,\n\tGCSummaryStateTracker,\n\tIGCSummaryTrackingData,\n} from \"./gcSummaryStateTracker\";\nexport { GCTelemetryTracker, sendGCUnexpectedUsageEvent } from \"./gcTelemetry\";\nexport { UnreferencedStateTracker } from \"./gcUnreferencedStateTracker\";\n"]}
|
package/lib/packageVersion.d.mts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/container-runtime";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-rc.1.0.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-rc.1.0.4";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.mts.map
|
package/lib/packageVersion.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.0.0-rc.1.0.
|
|
1
|
+
{"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.0.0-rc.1.0.4\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/container-runtime",
|
|
3
|
-
"version": "2.0.0-rc.1.0.
|
|
3
|
+
"version": "2.0.0-rc.1.0.4",
|
|
4
4
|
"description": "Fluid container runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -147,19 +147,19 @@
|
|
|
147
147
|
"temp-directory": "nyc/.nyc_output"
|
|
148
148
|
},
|
|
149
149
|
"dependencies": {
|
|
150
|
-
"@fluid-internal/client-utils": ">=2.0.0-rc.1.0.
|
|
151
|
-
"@fluidframework/container-definitions": ">=2.0.0-rc.1.0.
|
|
152
|
-
"@fluidframework/container-runtime-definitions": ">=2.0.0-rc.1.0.
|
|
153
|
-
"@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.
|
|
154
|
-
"@fluidframework/core-utils": ">=2.0.0-rc.1.0.
|
|
155
|
-
"@fluidframework/datastore": ">=2.0.0-rc.1.0.
|
|
156
|
-
"@fluidframework/driver-definitions": ">=2.0.0-rc.1.0.
|
|
157
|
-
"@fluidframework/driver-utils": ">=2.0.0-rc.1.0.
|
|
158
|
-
"@fluidframework/id-compressor": ">=2.0.0-rc.1.0.
|
|
150
|
+
"@fluid-internal/client-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
151
|
+
"@fluidframework/container-definitions": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
152
|
+
"@fluidframework/container-runtime-definitions": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
153
|
+
"@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
154
|
+
"@fluidframework/core-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
155
|
+
"@fluidframework/datastore": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
156
|
+
"@fluidframework/driver-definitions": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
157
|
+
"@fluidframework/driver-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
158
|
+
"@fluidframework/id-compressor": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
159
159
|
"@fluidframework/protocol-definitions": "^3.1.0",
|
|
160
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-rc.1.0.
|
|
161
|
-
"@fluidframework/runtime-utils": ">=2.0.0-rc.1.0.
|
|
162
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-rc.1.0.
|
|
160
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
161
|
+
"@fluidframework/runtime-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
162
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
163
163
|
"@tylerbu/sorted-btree-es6": "^1.8.0",
|
|
164
164
|
"double-ended-queue": "^2.1.0-0",
|
|
165
165
|
"events": "^3.1.0",
|
|
@@ -168,15 +168,15 @@
|
|
|
168
168
|
},
|
|
169
169
|
"devDependencies": {
|
|
170
170
|
"@arethetypeswrong/cli": "^0.13.3",
|
|
171
|
-
"@fluid-private/stochastic-test-utils": ">=2.0.0-rc.1.0.
|
|
171
|
+
"@fluid-private/stochastic-test-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
172
172
|
"@fluid-tools/benchmark": "^0.48.0",
|
|
173
173
|
"@fluid-tools/build-cli": "^0.29.0",
|
|
174
174
|
"@fluidframework/build-common": "^2.0.3",
|
|
175
175
|
"@fluidframework/build-tools": "^0.29.0",
|
|
176
176
|
"@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.0.0-internal.8.0.0",
|
|
177
177
|
"@fluidframework/eslint-config-fluid": "^3.2.0",
|
|
178
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.
|
|
179
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-rc.1.0.
|
|
178
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
179
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-rc.1.0.4 <2.0.0-rc.1.1.0",
|
|
180
180
|
"@microsoft/api-extractor": "^7.38.3",
|
|
181
181
|
"@types/double-ended-queue": "^2.1.0",
|
|
182
182
|
"@types/events": "^3.0.0",
|
package/src/blobManager.ts
CHANGED
|
@@ -39,7 +39,6 @@ import {
|
|
|
39
39
|
} from "@fluidframework/runtime-definitions";
|
|
40
40
|
|
|
41
41
|
import { canRetryOnError, runWithRetry } from "@fluidframework/driver-utils";
|
|
42
|
-
import { disableAttachmentBlobSweepKey } from "./gc";
|
|
43
42
|
import { IBlobMetadata } from "./metadata";
|
|
44
43
|
|
|
45
44
|
/**
|
|
@@ -742,11 +741,6 @@ export class BlobManager extends TypedEventEmitter<IBlobManagerEvents> {
|
|
|
742
741
|
* @returns The routes of blobs that were deleted.
|
|
743
742
|
*/
|
|
744
743
|
public deleteSweepReadyNodes(sweepReadyBlobRoutes: readonly string[]): readonly string[] {
|
|
745
|
-
// If sweep for attachment blobs is not enabled, return empty list indicating nothing is deleted.
|
|
746
|
-
if (this.mc.config.getBoolean(disableAttachmentBlobSweepKey) === true) {
|
|
747
|
-
return [];
|
|
748
|
-
}
|
|
749
|
-
|
|
750
744
|
this.deleteBlobsFromRedirectTable(sweepReadyBlobRoutes);
|
|
751
745
|
return Array.from(sweepReadyBlobRoutes);
|
|
752
746
|
}
|
package/src/dataStores.ts
CHANGED
|
@@ -61,8 +61,8 @@ import {
|
|
|
61
61
|
LocalDetachedFluidDataStoreContext,
|
|
62
62
|
} from "./dataStoreContext";
|
|
63
63
|
import { StorageServiceWithAttachBlobs } from "./storageServiceWithAttachBlobs";
|
|
64
|
+
import { GCNodeType, detectOutboundRoutesViaDDSKey } from "./gc";
|
|
64
65
|
import { IDataStoreAliasMessage, isDataStoreAliasMessage } from "./dataStore";
|
|
65
|
-
import { GCNodeType, detectOutboundRoutesViaDDSKey, disableDatastoreSweepKey } from "./gc";
|
|
66
66
|
import { IContainerRuntimeMetadata, nonDataStorePaths, rootHasIsolatedChannels } from "./summary";
|
|
67
67
|
|
|
68
68
|
type PendingAliasResolve = (success: boolean) => void;
|
|
@@ -839,16 +839,13 @@ export class DataStores implements IDisposable {
|
|
|
839
839
|
* @returns The routes of data stores and its objects that were deleted.
|
|
840
840
|
*/
|
|
841
841
|
public deleteSweepReadyNodes(sweepReadyDataStoreRoutes: readonly string[]): readonly string[] {
|
|
842
|
-
// If sweep for data stores is not enabled, return empty list indicating nothing is deleted.
|
|
843
|
-
if (this.mc.config.getBoolean(disableDatastoreSweepKey) === true) {
|
|
844
|
-
return [];
|
|
845
|
-
}
|
|
846
842
|
for (const route of sweepReadyDataStoreRoutes) {
|
|
847
843
|
const pathParts = route.split("/");
|
|
848
844
|
const dataStoreId = pathParts[1];
|
|
849
845
|
|
|
850
846
|
// Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only
|
|
851
847
|
// need to delete the data store.
|
|
848
|
+
// These routes will still be returned below as among the deleted routes
|
|
852
849
|
if (pathParts.length > 2) {
|
|
853
850
|
continue;
|
|
854
851
|
}
|
|
@@ -555,8 +555,9 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
555
555
|
);
|
|
556
556
|
|
|
557
557
|
// 4. Run the Sweep phase.
|
|
558
|
-
// It will
|
|
559
|
-
//
|
|
558
|
+
// It will initiate the deletion (sending the GC Sweep op) of any sweep-ready nodes that are
|
|
559
|
+
// allowed to be deleted per config, and tombstone the rest along with the tombstone-ready nodes.
|
|
560
|
+
// Note that no nodes will be deleted until the GC Sweep op is processed.
|
|
560
561
|
this.runSweepPhase(gcResult, tombstoneReadyNodeIds, sweepReadyNodeIds);
|
|
561
562
|
|
|
562
563
|
this.gcDataFromLastRun = cloneGCData(gcData);
|
|
@@ -667,19 +668,34 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
667
668
|
return;
|
|
668
669
|
}
|
|
669
670
|
|
|
670
|
-
//
|
|
671
|
+
// We'll build up the lists of nodes to be either Tombstoned or Deleted
|
|
672
|
+
// based on the configuration and the nodes' current state.
|
|
673
|
+
// We must Tombstone any sweep-ready node that Sweep won't run for.
|
|
671
674
|
// This is important because a container may never load during a node's Sweep Grace Period,
|
|
672
675
|
// so that node would directly become sweep-ready skipping over tombstone-ready state,
|
|
673
676
|
// but should be Tombstoned since Sweep is disabled.
|
|
674
|
-
const { nodesToTombstone, nodesToDelete } =
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
:
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
677
|
+
const { nodesToTombstone, nodesToDelete } = {
|
|
678
|
+
nodesToTombstone: [...tombstoneReadyNodes],
|
|
679
|
+
nodesToDelete: [] as string[],
|
|
680
|
+
};
|
|
681
|
+
switch (this.configs.shouldRunSweep) {
|
|
682
|
+
case "YES":
|
|
683
|
+
nodesToDelete.push(...sweepReadyNodes);
|
|
684
|
+
break;
|
|
685
|
+
case "ONLY_BLOBS":
|
|
686
|
+
sweepReadyNodes.forEach((nodeId) => {
|
|
687
|
+
const nodeType = this.runtime.getNodeType(nodeId);
|
|
688
|
+
if (nodeType === GCNodeType.Blob) {
|
|
689
|
+
nodesToDelete.push(nodeId);
|
|
690
|
+
} else {
|
|
691
|
+
nodesToTombstone.push(nodeId);
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
break;
|
|
695
|
+
default: // case "NO":
|
|
696
|
+
nodesToTombstone.push(...sweepReadyNodes);
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
683
699
|
|
|
684
700
|
if (this.configs.tombstoneMode) {
|
|
685
701
|
this.tombstones = nodesToTombstone;
|
|
@@ -687,7 +703,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
687
703
|
this.runtime.updateTombstonedRoutes(this.tombstones);
|
|
688
704
|
}
|
|
689
705
|
|
|
690
|
-
if (
|
|
706
|
+
if (nodesToDelete.length > 0) {
|
|
691
707
|
// Do not send DDS node ids in the GC op. This is an optimization to reduce its size. Since GC applies to
|
|
692
708
|
// to data store only, all its DDSes are deleted along with it. The DDS ids will be retrieved from the
|
|
693
709
|
// local state when processing the op.
|
|
@@ -883,6 +899,10 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
883
899
|
/**
|
|
884
900
|
* Delete nodes that are sweep-ready. Call the runtime to delete these nodes and clear the unreferenced state
|
|
885
901
|
* tracking for nodes that are actually deleted by the runtime.
|
|
902
|
+
*
|
|
903
|
+
* Note that this doesn't check any configuration around whether Sweep is enabled.
|
|
904
|
+
* That happens before the op is submitted, and from that point, any client should execute the delete.
|
|
905
|
+
*
|
|
886
906
|
* @param sweepReadyNodeIds - The ids of nodes that are ready to be deleted.
|
|
887
907
|
*/
|
|
888
908
|
private deleteSweepReadyNodes(sweepReadyNodeIds: readonly string[]) {
|
|
@@ -1113,8 +1133,9 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
1113
1133
|
|
|
1114
1134
|
/**
|
|
1115
1135
|
* Generates the stats of a garbage collection sweep phase run.
|
|
1116
|
-
* @param deletedNodes - The nodes that have been deleted
|
|
1117
|
-
* @param sweepReadyNodes - The nodes that are sweep-ready in this GC run.
|
|
1136
|
+
* @param deletedNodes - The nodes that have already been deleted even before this run.
|
|
1137
|
+
* @param sweepReadyNodes - The nodes that are sweep-ready in this GC run. These will be deleted but are not deleted yet,
|
|
1138
|
+
* due to either sweep not being enabled or the Sweep Op needing to roundtrip before the delete is executed.
|
|
1118
1139
|
* @param markPhaseStats - The stats of the mark phase run.
|
|
1119
1140
|
* @returns the stats of the sweep phase run.
|
|
1120
1141
|
*/
|
|
@@ -1160,19 +1181,18 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
1160
1181
|
}
|
|
1161
1182
|
}
|
|
1162
1183
|
|
|
1163
|
-
//
|
|
1184
|
+
// The counts from the mark phase stats do not include nodes that were
|
|
1164
1185
|
// deleted in previous runs. So, add the deleted node counts to life time stats.
|
|
1165
1186
|
sweepPhaseStats.lifetimeNodeCount += sweepPhaseStats.deletedNodeCount;
|
|
1166
1187
|
sweepPhaseStats.lifetimeDataStoreCount += sweepPhaseStats.deletedDataStoreCount;
|
|
1167
1188
|
sweepPhaseStats.lifetimeAttachmentBlobCount += sweepPhaseStats.deletedAttachmentBlobCount;
|
|
1168
1189
|
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
// If sweep is not enabled,
|
|
1174
|
-
//
|
|
1175
|
-
// If sweep is enabled, this will happen in the run after the GC op round trips back.
|
|
1190
|
+
// These stats are used to estimate the impact of GC in terms of how much garbage is/will be cleaned up.
|
|
1191
|
+
// So we include the current sweep-ready node stats since these nodes will be deleted eventually.
|
|
1192
|
+
// - If sweep is enabled, this will happen in the run after the GC op round trips back
|
|
1193
|
+
// (they'll be in deletedNodes that time).
|
|
1194
|
+
// - If sweep is not enabled, we still want to include these nodes since they
|
|
1195
|
+
// _will be_ deleted once it is enabled.
|
|
1176
1196
|
for (const nodeId of sweepReadyNodes) {
|
|
1177
1197
|
sweepPhaseStats.deletedNodeCount++;
|
|
1178
1198
|
const nodeType = this.runtime.getNodeType(nodeId);
|
|
@@ -1182,6 +1202,7 @@ export class GarbageCollector implements IGarbageCollector {
|
|
|
1182
1202
|
sweepPhaseStats.deletedAttachmentBlobCount++;
|
|
1183
1203
|
}
|
|
1184
1204
|
}
|
|
1205
|
+
|
|
1185
1206
|
return sweepPhaseStats;
|
|
1186
1207
|
}
|
|
1187
1208
|
}
|
package/src/gc/gcConfigs.ts
CHANGED
|
@@ -32,6 +32,8 @@ import {
|
|
|
32
32
|
defaultSweepGracePeriodMs,
|
|
33
33
|
gcGenerationOptionName,
|
|
34
34
|
IGCMetadata_Deprecated,
|
|
35
|
+
disableDatastoreSweepKey,
|
|
36
|
+
gcDisableDataStoreSweepOptionName,
|
|
35
37
|
} from "./gcDefinitions";
|
|
36
38
|
import { getGCVersion, shouldAllowGcSweep } from "./gcHelpers";
|
|
37
39
|
|
|
@@ -137,18 +139,26 @@ export function generateGCConfigs(
|
|
|
137
139
|
* Whether sweep should run or not. This refers to whether Tombstones should fail on load and whether
|
|
138
140
|
* sweep-ready nodes should be deleted.
|
|
139
141
|
*
|
|
140
|
-
* Assuming overall GC is enabled and
|
|
142
|
+
* Assuming overall GC is enabled and tombstoneTimeout is provided, the following conditions have to be met to run sweep:
|
|
141
143
|
*
|
|
142
|
-
* 1. Sweep should be
|
|
143
|
-
* 2. Sweep should be enabled for this session.
|
|
144
|
+
* 1. Sweep should be allowed in this container.
|
|
145
|
+
* 2. Sweep should be enabled for this session, optionally restricted to attachment blobs only.
|
|
144
146
|
*
|
|
145
147
|
* These conditions can be overridden via the RunSweep feature flag.
|
|
146
148
|
*/
|
|
147
|
-
const
|
|
149
|
+
const sweepEnabled: boolean =
|
|
148
150
|
!shouldRunGC || tombstoneTimeoutMs === undefined
|
|
149
151
|
? false
|
|
150
152
|
: mc.config.getBoolean(runSweepKey) ??
|
|
151
153
|
(sweepAllowed && createParams.gcOptions.enableGCSweep === true);
|
|
154
|
+
const disableDatastoreSweep =
|
|
155
|
+
mc.config.getBoolean(disableDatastoreSweepKey) === true ||
|
|
156
|
+
createParams.gcOptions[gcDisableDataStoreSweepOptionName] === true;
|
|
157
|
+
const shouldRunSweep: IGarbageCollectorConfigs["shouldRunSweep"] = sweepEnabled
|
|
158
|
+
? disableDatastoreSweep
|
|
159
|
+
? "ONLY_BLOBS"
|
|
160
|
+
: "YES"
|
|
161
|
+
: "NO";
|
|
152
162
|
|
|
153
163
|
// Override inactive timeout if test config or gc options to override it is set.
|
|
154
164
|
const inactiveTimeoutMs =
|
package/src/gc/gcDefinitions.ts
CHANGED
|
@@ -40,6 +40,12 @@ export const nextGCVersion: GCVersion = 4;
|
|
|
40
40
|
*/
|
|
41
41
|
export const gcDisableThrowOnTombstoneLoadOptionName = "gcDisableThrowOnTombstoneLoad";
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* This undocumented GC Option (on ContainerRuntime Options) allows an app to enable Sweep for blobs only.
|
|
45
|
+
* Only applies if enableGCSweep option is set to true.
|
|
46
|
+
*/
|
|
47
|
+
export const gcDisableDataStoreSweepOptionName = "disableDataStoreSweep";
|
|
48
|
+
|
|
43
49
|
/**
|
|
44
50
|
* This undocumented GC Option (on ContainerRuntime Options) allows configuring which documents can have Sweep enabled.
|
|
45
51
|
* This provides a way to disable both Tombstone Enforcement and Sweep.
|
|
@@ -70,10 +76,8 @@ export const throwOnTombstoneLoadOverrideKey =
|
|
|
70
76
|
export const throwOnTombstoneUsageKey = "Fluid.GarbageCollection.ThrowOnTombstoneUsage";
|
|
71
77
|
/** Config key to enable GC version upgrade. */
|
|
72
78
|
export const gcVersionUpgradeToV4Key = "Fluid.GarbageCollection.GCVersionUpgradeToV4";
|
|
73
|
-
/** Config key to disable GC sweep for datastores. */
|
|
79
|
+
/** Config key to disable GC sweep for datastores. They'll merely be Tombstoned. */
|
|
74
80
|
export const disableDatastoreSweepKey = "Fluid.GarbageCollection.DisableDataStoreSweep";
|
|
75
|
-
/** Config key to disable GC sweep for attachment blobs. */
|
|
76
|
-
export const disableAttachmentBlobSweepKey = "Fluid.GarbageCollection.DisableAttachmentBlobSweep";
|
|
77
81
|
/** Config key to revert new paradigm of detecting outbound routes in ContainerRuntime layer (use true) */
|
|
78
82
|
export const detectOutboundRoutesViaDDSKey = "Fluid.GarbageCollection.DetectOutboundRoutesViaDDS";
|
|
79
83
|
|
|
@@ -449,7 +453,7 @@ export interface IGarbageCollectorConfigs {
|
|
|
449
453
|
*/
|
|
450
454
|
readonly gcEnabled: boolean;
|
|
451
455
|
/**
|
|
452
|
-
* Tracks if sweep phase is
|
|
456
|
+
* Tracks if sweep phase is allowed for this document. This is specified during document creation and doesn't change
|
|
453
457
|
* throughout its lifetime.
|
|
454
458
|
*/
|
|
455
459
|
readonly sweepEnabled: boolean;
|
|
@@ -459,10 +463,11 @@ export interface IGarbageCollectorConfigs {
|
|
|
459
463
|
*/
|
|
460
464
|
readonly shouldRunGC: boolean;
|
|
461
465
|
/**
|
|
462
|
-
* Tracks if sweep phase should run or not
|
|
463
|
-
*
|
|
466
|
+
* Tracks if sweep phase should run or not, or if it should run only for attachment blobs.
|
|
467
|
+
* Even if the sweep phase is allowed for a document (see sweepEnabled), it may be disabled or partially enabled
|
|
468
|
+
* for the session, depending on a variety of other configurations present.
|
|
464
469
|
*/
|
|
465
|
-
readonly shouldRunSweep:
|
|
470
|
+
readonly shouldRunSweep: "YES" | "ONLY_BLOBS" | "NO";
|
|
466
471
|
/**
|
|
467
472
|
* If true, bypass optimizations and generate GC data for all nodes irrespective of whether a node changed or not.
|
|
468
473
|
*/
|
package/src/gc/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export {
|
|
|
11
11
|
defaultSessionExpiryDurationMs,
|
|
12
12
|
GCNodeType,
|
|
13
13
|
gcTestModeKey,
|
|
14
|
+
gcDisableDataStoreSweepOptionName,
|
|
14
15
|
gcDisableThrowOnTombstoneLoadOptionName,
|
|
15
16
|
gcGenerationOptionName,
|
|
16
17
|
GCFeatureMatrix,
|
|
@@ -32,7 +33,6 @@ export {
|
|
|
32
33
|
runSessionExpiryKey,
|
|
33
34
|
runSweepKey,
|
|
34
35
|
stableGCVersion,
|
|
35
|
-
disableAttachmentBlobSweepKey,
|
|
36
36
|
disableDatastoreSweepKey,
|
|
37
37
|
detectOutboundRoutesViaDDSKey,
|
|
38
38
|
UnreferencedState,
|
package/src/packageVersion.ts
CHANGED