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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/api-report/container-runtime.api.md +0 -1
  2. package/dist/blobManager.d.ts +3 -4
  3. package/dist/blobManager.d.ts.map +1 -1
  4. package/dist/blobManager.js +17 -36
  5. package/dist/blobManager.js.map +1 -1
  6. package/dist/containerRuntime.d.ts +1 -2
  7. package/dist/containerRuntime.d.ts.map +1 -1
  8. package/dist/containerRuntime.js +11 -7
  9. package/dist/containerRuntime.js.map +1 -1
  10. package/dist/dataStoreContext.d.ts +1 -0
  11. package/dist/dataStoreContext.d.ts.map +1 -1
  12. package/dist/dataStoreContext.js +38 -29
  13. package/dist/dataStoreContext.js.map +1 -1
  14. package/dist/dataStores.d.ts +0 -14
  15. package/dist/dataStores.d.ts.map +1 -1
  16. package/dist/dataStores.js +0 -43
  17. package/dist/dataStores.js.map +1 -1
  18. package/dist/gc/garbageCollection.d.ts +6 -3
  19. package/dist/gc/garbageCollection.d.ts.map +1 -1
  20. package/dist/gc/garbageCollection.js +27 -17
  21. package/dist/gc/garbageCollection.js.map +1 -1
  22. package/dist/gc/gcDefinitions.d.ts +7 -3
  23. package/dist/gc/gcDefinitions.d.ts.map +1 -1
  24. package/dist/gc/gcDefinitions.js.map +1 -1
  25. package/dist/gc/gcTelemetry.d.ts +11 -4
  26. package/dist/gc/gcTelemetry.d.ts.map +1 -1
  27. package/dist/gc/gcTelemetry.js +72 -39
  28. package/dist/gc/gcTelemetry.js.map +1 -1
  29. package/dist/packageVersion.d.ts +1 -1
  30. package/dist/packageVersion.js +1 -1
  31. package/dist/packageVersion.js.map +1 -1
  32. package/lib/blobManager.d.ts +3 -4
  33. package/lib/blobManager.d.ts.map +1 -1
  34. package/lib/blobManager.js +18 -37
  35. package/lib/blobManager.js.map +1 -1
  36. package/lib/containerRuntime.d.ts +1 -2
  37. package/lib/containerRuntime.d.ts.map +1 -1
  38. package/lib/containerRuntime.js +11 -7
  39. package/lib/containerRuntime.js.map +1 -1
  40. package/lib/dataStoreContext.d.ts +1 -0
  41. package/lib/dataStoreContext.d.ts.map +1 -1
  42. package/lib/dataStoreContext.js +38 -29
  43. package/lib/dataStoreContext.js.map +1 -1
  44. package/lib/dataStores.d.ts +0 -14
  45. package/lib/dataStores.d.ts.map +1 -1
  46. package/lib/dataStores.js +1 -44
  47. package/lib/dataStores.js.map +1 -1
  48. package/lib/gc/garbageCollection.d.ts +6 -3
  49. package/lib/gc/garbageCollection.d.ts.map +1 -1
  50. package/lib/gc/garbageCollection.js +28 -18
  51. package/lib/gc/garbageCollection.js.map +1 -1
  52. package/lib/gc/gcDefinitions.d.ts +7 -3
  53. package/lib/gc/gcDefinitions.d.ts.map +1 -1
  54. package/lib/gc/gcDefinitions.js.map +1 -1
  55. package/lib/gc/gcTelemetry.d.ts +11 -4
  56. package/lib/gc/gcTelemetry.d.ts.map +1 -1
  57. package/lib/gc/gcTelemetry.js +72 -39
  58. package/lib/gc/gcTelemetry.js.map +1 -1
  59. package/lib/packageVersion.d.ts +1 -1
  60. package/lib/packageVersion.js +1 -1
  61. package/lib/packageVersion.js.map +1 -1
  62. package/package.json +15 -15
  63. package/src/blobManager.ts +18 -46
  64. package/src/containerRuntime.ts +20 -10
  65. package/src/dataStoreContext.ts +15 -2
  66. package/src/dataStores.ts +1 -67
  67. package/src/gc/garbageCollection.ts +39 -25
  68. package/src/gc/gcDefinitions.ts +8 -3
  69. package/src/gc/gcTelemetry.ts +102 -54
  70. package/src/packageVersion.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dataStores.js","sourceRoot":"","sources":["../src/dataStores.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,yDAA8D;AAE9D,6EAe6C;AAC7C,iEASuC;AACvC,qEAOyC;AACzC,iFAAoE;AACpE,+DAAiE;AACjE,2DAA0D;AAC1D,+BAAkC;AA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gB,uBAAuB,CACtC,QAAmC,EACnC,QAAoC;IAEpC,IAAI,CAAC,QAAQ,EAAE;QACd,OAAO,SAAS,CAAC;KACjB;IAED,IAAI,IAAA,iCAAuB,EAAC,QAAQ,CAAC,EAAE;QACtC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,KAAK,CAAC,sCAAgB,CAAC,CAAC;QAC5D,IAAA,mBAAM,EAAC,CAAC,CAAC,kBAAkB,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC9E,OAAO,kBAAkB,CAAC;KAC1B;SAAM;QACN,qFAAqF;QACrF,MAAM,eAAe,GAA2B,EAAE,CAAC;QACnD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC1D,IAAI,CAAC,2BAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACrC,eAAe,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aAC7B;SACD;QACD,OAAO;YACN,GAAG,QAAQ;YACX,KAAK,EAAE,eAAe;SACtB,CAAC;KACF;AACF,CAAC;AAzBD,0DAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tITelemetryBaseLogger,\n\tIDisposable,\n\tIFluidHandle,\n\tIRequest,\n} from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tAliasResult,\n\tchannelsTreeName,\n\tCreateChildSummarizerNodeFn,\n\tCreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\tIAttachMessage,\n\tIEnvelope,\n\tIFluidDataStoreContextDetached,\n\tIGarbageCollectionData,\n\tIInboundSignalMessage,\n\tInboundAttachMessage,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertToSummaryTree,\n\tcreate404Response,\n\tcreateResponseError,\n\tGCDataBuilder,\n\tresponseToException,\n\tSummaryTreeBuilder,\n\tunpackChildNodesUsedRoutes,\n} from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildMonitoringContext,\n\tDataCorruptionError,\n\textractSafePropertiesFromMessage,\n\tLoggingError,\n\tMonitoringContext,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport { assert, Lazy } from \"@fluidframework/core-utils\";\nimport { v4 as uuid } from \"uuid\";\nimport { DataStoreContexts } from \"./dataStoreContexts\";\nimport {\n\tContainerRuntime,\n\tdefaultRuntimeHeaderData,\n\tRuntimeHeaderData,\n\tTombstoneResponseHeaderKey,\n} from \"./containerRuntime\";\nimport {\n\tFluidDataStoreContext,\n\tRemoteFluidDataStoreContext,\n\tLocalFluidDataStoreContext,\n\tcreateAttributesBlob,\n\tLocalDetachedFluidDataStoreContext,\n} from \"./dataStoreContext\";\nimport { StorageServiceWithAttachBlobs } from \"./storageServiceWithAttachBlobs\";\nimport { IDataStoreAliasMessage, isDataStoreAliasMessage } from \"./dataStore\";\nimport { GCNodeType, disableDatastoreSweepKey, sendGCUnexpectedUsageEvent } from \"./gc\";\nimport {\n\tsummarizerClientType,\n\tIContainerRuntimeMetadata,\n\tnonDataStorePaths,\n\trootHasIsolatedChannels,\n} from \"./summary\";\n\ntype PendingAliasResolve = (success: boolean) => void;\n\n/**\n * This class encapsulates data store handling. Currently it is only used by the container runtime,\n * but eventually could be hosted on any channel once we formalize the channel api boundary.\n */\nexport class DataStores implements IDisposable {\n\t// Stores tracked by the Domain\n\tprivate readonly pendingAttach = new Map<string, IAttachMessage>();\n\t// 0.24 back-compat attachingBeforeSummary\n\tpublic readonly attachOpFiredForDataStore = new Set<string>();\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly disposeOnce = new Lazy<void>(() => this.contexts.dispose());\n\n\tpublic readonly containerLoadStats: {\n\t\t// number of dataStores during loadContainer\n\t\treadonly containerLoadDataStoreCount: number;\n\t\t// number of unreferenced dataStores during loadContainer\n\t\treadonly referencedDataStoreCount: number;\n\t};\n\n\t// Stores the ids of new data stores between two GC runs. This is used to notify the garbage collector of new\n\t// root data stores that are added.\n\tprivate dataStoresSinceLastGC: string[] = [];\n\t// The handle to the container runtime. This is used mainly for GC purposes to represent outbound reference from\n\t// the container runtime to other nodes.\n\tprivate readonly containerRuntimeHandle: IFluidHandle;\n\tprivate readonly pendingAliasMap: Map<string, Promise<AliasResult>> = new Map<\n\t\tstring,\n\t\tPromise<AliasResult>\n\t>();\n\n\tconstructor(\n\t\tprivate readonly baseSnapshot: ISnapshotTree | undefined,\n\t\tprivate readonly runtime: ContainerRuntime,\n\t\tprivate readonly submitAttachFn: (attachContent: IAttachMessage) => void,\n\t\tprivate readonly getCreateChildSummarizerNodeFn: (\n\t\t\tid: string,\n\t\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\t) => CreateChildSummarizerNodeFn,\n\t\tprivate readonly deleteChildSummarizerNodeFn: (id: string) => void,\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly gcNodeUpdated: (\n\t\t\tnodePath: string,\n\t\t\ttimestampMs: number,\n\t\t\tpackagePath?: readonly string[],\n\t\t) => void,\n\t\tprivate readonly isDataStoreDeleted: (nodePath: string) => boolean,\n\t\tprivate readonly aliasMap: Map<string, string>,\n\t\tprivate readonly contexts: DataStoreContexts = new DataStoreContexts(baseLogger),\n\t) {\n\t\tthis.mc = createChildMonitoringContext({ logger: baseLogger });\n\t\tthis.containerRuntimeHandle = new FluidObjectHandle(\n\t\t\tthis.runtime,\n\t\t\t\"/\",\n\t\t\tthis.runtime.IFluidHandleContext,\n\t\t);\n\n\t\t// Extract stores stored inside the snapshot\n\t\tconst fluidDataStores = new Map<string, ISnapshotTree>();\n\t\tif (baseSnapshot) {\n\t\t\tfor (const [key, value] of Object.entries(baseSnapshot.trees)) {\n\t\t\t\tfluidDataStores.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\tlet unreferencedDataStoreCount = 0;\n\t\t// Create a context for each of them\n\t\tfor (const [key, value] of fluidDataStores) {\n\t\t\tlet dataStoreContext: FluidDataStoreContext;\n\n\t\t\t// counting number of unreferenced data stores\n\t\t\tif (value.unreferenced) {\n\t\t\t\tunreferencedDataStoreCount++;\n\t\t\t}\n\t\t\t// If we have a detached container, then create local data store contexts.\n\t\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\t\tdataStoreContext = new RemoteFluidDataStoreContext({\n\t\t\t\t\tid: key,\n\t\t\t\t\tsnapshotTree: value,\n\t\t\t\t\truntime: this.runtime,\n\t\t\t\t\tstorage: this.runtime.storage,\n\t\t\t\t\tscope: this.runtime.scope,\n\t\t\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {\n\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (typeof value !== \"object\") {\n\t\t\t\t\tthrow new LoggingError(\"Snapshot should be there to load from!!\");\n\t\t\t\t}\n\t\t\t\tconst snapshotTree = value;\n\t\t\t\tdataStoreContext = new LocalFluidDataStoreContext({\n\t\t\t\t\tid: key,\n\t\t\t\t\tpkg: undefined,\n\t\t\t\t\truntime: this.runtime,\n\t\t\t\t\tstorage: this.runtime.storage,\n\t\t\t\t\tscope: this.runtime.scope,\n\t\t\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {\n\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t}),\n\t\t\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(key),\n\t\t\t\t\tsnapshotTree,\n\t\t\t\t\tisRootDataStore: undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.contexts.addBoundOrRemoted(dataStoreContext);\n\t\t}\n\t\tthis.containerLoadStats = {\n\t\t\tcontainerLoadDataStoreCount: fluidDataStores.size,\n\t\t\treferencedDataStoreCount: fluidDataStores.size - unreferencedDataStoreCount,\n\t\t};\n\t}\n\n\tpublic get aliases(): ReadonlyMap<string, string> {\n\t\treturn this.aliasMap;\n\t}\n\n\tpublic get pendingAliases(): Map<string, Promise<AliasResult>> {\n\t\treturn this.pendingAliasMap;\n\t}\n\n\tpublic async waitIfPendingAlias(maybeAlias: string): Promise<AliasResult> {\n\t\tconst pendingAliasPromise = this.pendingAliases.get(maybeAlias);\n\t\treturn pendingAliasPromise ?? \"Success\";\n\t}\n\n\tpublic processAttachMessage(message: ISequencedDocumentMessage, local: boolean) {\n\t\tconst attachMessage = message.contents as InboundAttachMessage;\n\n\t\tthis.dataStoresSinceLastGC.push(attachMessage.id);\n\n\t\t// The local object has already been attached\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tthis.pendingAttach.has(attachMessage.id),\n\t\t\t\t0x15e /* \"Local object does not have matching attach message id\" */,\n\t\t\t);\n\t\t\tthis.contexts.get(attachMessage.id)?.emit(\"attached\");\n\t\t\tthis.pendingAttach.delete(attachMessage.id);\n\t\t\treturn;\n\t\t}\n\n\t\t// If a non-local operation then go and create the object, otherwise mark it as officially attached.\n\t\tif (this.alreadyProcessed(attachMessage.id)) {\n\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\tconst error = new DataCorruptionError(\n\t\t\t\t// pre-0.58 error message: duplicateDataStoreCreatedWithExistingId\n\t\t\t\t\"Duplicate DataStore created with existing id\",\n\t\t\t\t{\n\t\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\t\t...tagCodeArtifacts({ dataStoreId: attachMessage.id }),\n\t\t\t\t},\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst flatAttachBlobs = new Map<string, ArrayBufferLike>();\n\t\tlet snapshotTree: ISnapshotTree | undefined;\n\t\tif (attachMessage.snapshot) {\n\t\t\tsnapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatAttachBlobs);\n\t\t}\n\n\t\t// Include the type of attach message which is the pkg of the store to be\n\t\t// used by RemoteFluidDataStoreContext in case it is not in the snapshot.\n\t\tconst pkg = [attachMessage.type];\n\t\tconst remoteFluidDataStoreContext = new RemoteFluidDataStoreContext({\n\t\t\tid: attachMessage.id,\n\t\t\tsnapshotTree,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: new StorageServiceWithAttachBlobs(this.runtime.storage, flatAttachBlobs),\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(attachMessage.id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.FromAttach,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\tsnapshot: attachMessage.snapshot ?? {\n\t\t\t\t\tentries: [createAttributesBlob(pkg, true /* isRootDataStore */)],\n\t\t\t\t},\n\t\t\t}),\n\t\t\tpkg,\n\t\t});\n\n\t\tthis.contexts.addBoundOrRemoted(remoteFluidDataStoreContext);\n\t}\n\n\tpublic processAliasMessage(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: unknown,\n\t\tlocal: boolean,\n\t): void {\n\t\tconst aliasMessage = message.contents as IDataStoreAliasMessage;\n\t\tif (!isDataStoreAliasMessage(aliasMessage)) {\n\t\t\tthrow new DataCorruptionError(\"malformedDataStoreAliasMessage\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t});\n\t\t}\n\n\t\tconst resolve = localOpMetadata as PendingAliasResolve;\n\t\tconst aliasResult = this.processAliasMessageCore(aliasMessage);\n\t\tif (local) {\n\t\t\tresolve(aliasResult);\n\t\t}\n\t}\n\n\tpublic processAliasMessageCore(aliasMessage: IDataStoreAliasMessage): boolean {\n\t\tif (this.alreadyProcessed(aliasMessage.alias)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst context = this.contexts.get(aliasMessage.internalId);\n\t\tif (context === undefined) {\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"AliasFluidDataStoreNotFound\",\n\t\t\t\tfluidDataStoreId: aliasMessage.internalId,\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst handle = new FluidObjectHandle(\n\t\t\tcontext,\n\t\t\taliasMessage.internalId,\n\t\t\tthis.runtime.IFluidHandleContext,\n\t\t);\n\t\tthis.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);\n\n\t\tthis.aliasMap.set(aliasMessage.alias, context.id);\n\t\tcontext.setInMemoryRoot();\n\t\treturn true;\n\t}\n\n\tprivate alreadyProcessed(id: string): boolean {\n\t\treturn this.aliasMap.get(id) !== undefined || this.contexts.get(id) !== undefined;\n\t}\n\n\t/**\n\t * Make the data stores locally visible in the container graph by moving the data store context from unbound to\n\t * bound list. This data store can now be reached from the root.\n\t * @param id - The id of the data store context to make visible.\n\t */\n\tprivate makeDataStoreLocallyVisible(id: string): void {\n\t\tconst localContext = this.contexts.getUnbound(id);\n\t\tassert(!!localContext, 0x15f /* \"Could not find unbound context to bind\" */);\n\n\t\t/**\n\t\t * If the container is not detached, it is globally visible to all clients. This data store should also be\n\t\t * globally visible. Move it to attaching state and send an \"attach\" op for it.\n\t\t * If the container is detached, this data store will be part of the summary that makes the container attached.\n\t\t */\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tlocalContext.emit(\"attaching\");\n\t\t\tconst message = localContext.generateAttachMessage();\n\n\t\t\tthis.pendingAttach.set(id, message);\n\t\t\tthis.submitAttachFn(message);\n\t\t\tthis.attachOpFiredForDataStore.add(id);\n\t\t}\n\n\t\tthis.contexts.bind(id);\n\t}\n\n\tpublic createDetachedDataStoreCore(\n\t\tpkg: Readonly<string[]>,\n\t\tisRoot: boolean,\n\t\tid = uuid(),\n\t): IFluidDataStoreContextDetached {\n\t\tassert(!id.includes(\"/\"), 0x30c /* Id cannot contain slashes */);\n\n\t\tconst context = new LocalDetachedFluidDataStoreContext({\n\t\t\tid,\n\t\t\tpkg,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: this.runtime.storage,\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.Local,\n\t\t\t}),\n\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),\n\t\t\tsnapshotTree: undefined,\n\t\t\tisRootDataStore: isRoot,\n\t\t});\n\t\tthis.contexts.addUnbound(context);\n\t\treturn context;\n\t}\n\n\tpublic _createFluidDataStoreContext(pkg: string[], id: string, props?: any) {\n\t\tassert(!id.includes(\"/\"), 0x30d /* Id cannot contain slashes */);\n\t\tconst context = new LocalFluidDataStoreContext({\n\t\t\tid,\n\t\t\tpkg,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: this.runtime.storage,\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.Local,\n\t\t\t}),\n\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),\n\t\t\tsnapshotTree: undefined,\n\t\t\tisRootDataStore: false,\n\t\t\tcreateProps: props,\n\t\t});\n\t\tthis.contexts.addUnbound(context);\n\t\treturn context;\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 resubmitDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x160 /* \"There should be a store context for the op\" */);\n\t\tcontext.reSubmit(envelope.contents, localOpMetadata);\n\t}\n\n\tpublic rollbackDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x2e8 /* \"There should be a store context for the op\" */);\n\t\tcontext.rollback(envelope.contents, localOpMetadata);\n\t}\n\n\tpublic async applyStashedOp(envelope: IEnvelope): Promise<unknown> {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x161 /* \"There should be a store context for the op\" */);\n\t\treturn context.applyStashedOp(envelope.contents);\n\t}\n\n\tpublic async applyStashedAttachOp(message: IAttachMessage) {\n\t\tthis.pendingAttach.set(message.id, message);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tthis.processAttachMessage({ contents: message } as ISequencedDocumentMessage, false);\n\t}\n\n\tpublic processFluidDataStoreOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalMessageMetadata: unknown,\n\t) {\n\t\tconst envelope = message.contents as IEnvelope;\n\t\tconst transformed = { ...message, contents: envelope.contents };\n\t\tthis.validateNotDeleted(envelope.address);\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x162 /* \"There should be a store context for the op\" */);\n\t\tcontext.process(transformed, local, localMessageMetadata);\n\n\t\t// Notify that a GC node for the data store changed. This is used to detect if a deleted data store is\n\t\t// being used.\n\t\tthis.gcNodeUpdated(\n\t\t\t`/${envelope.address}`,\n\t\t\tmessage.timestamp,\n\t\t\tcontext.isLoaded ? context.packagePath : undefined,\n\t\t);\n\t}\n\n\tpublic async getDataStore(\n\t\tid: string,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t): Promise<FluidDataStoreContext> {\n\t\tconst headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };\n\t\tthis.validateNotDeleted(id, headerData);\n\n\t\tconst context = await this.contexts.getBoundOrRemoted(id, headerData.wait);\n\t\tif (context === undefined) {\n\t\t\t// The requested data store does not exits. Throw a 404 response exception.\n\t\t\tconst request: IRequest = { url: id };\n\t\t\tthrow responseToException(create404Response(request), request);\n\t\t}\n\n\t\tthis.validateNotTombstoned(context, requestHeaderData);\n\n\t\treturn context;\n\t}\n\n\t/**\n\t * Returns the data store requested with the given id if available. Otherwise, returns undefined.\n\t */\n\tpublic async getDataStoreIfAvailable(\n\t\tid: string,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t): Promise<FluidDataStoreContext | undefined> {\n\t\t// If the data store has been deleted, return undefined.\n\t\tif (this.checkIfDeleted(id, requestHeaderData)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };\n\t\tconst context = await this.contexts.getBoundOrRemoted(id, headerData.wait);\n\t\tif (context === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// Check if the data store is tombstoned. If so, we want to log a telemetry event.\n\t\tthis.checkIfTombstoned(context, requestHeaderData);\n\t\treturn context;\n\t}\n\n\t/**\n\t * Checks if the data store has been deleted by GC.\n\t * @param id - data store id\n\t * @param request - the request information to log if the validation detects the data store has been deleted\n\t * @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted\n\t * @returns true if the data store is deleted. Otherwise, returns false.\n\t */\n\tprivate checkIfDeleted(id: string, requestHeaderData?: RuntimeHeaderData) {\n\t\tconst dataStoreNodePath = `/${id}`;\n\t\tif (!this.isDataStoreDeleted(dataStoreNodePath)) {\n\t\t\treturn false;\n\t\t}\n\t\tassert(\n\t\t\t!this.contexts.has(id),\n\t\t\t0x570 /* Inconsistent state! GC says the data store is deleted, but the data store is not deleted from the runtime. */,\n\t\t);\n\t\tsendGCUnexpectedUsageEvent(\n\t\t\tthis.mc,\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_DataStore_Requested\",\n\t\t\t\tcategory: \"error\",\n\t\t\t\tisSummarizerClient: this.runtime.clientDetails.type === summarizerClientType,\n\t\t\t\tid,\n\t\t\t\theaders: JSON.stringify(requestHeaderData),\n\t\t\t\tgcTombstoneEnforcementAllowed: this.runtime.gcTombstoneEnforcementAllowed,\n\t\t\t},\n\t\t\tundefined /* packagePath */,\n\t\t);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Validate that the data store had not been deleted by GC.\n\t * @param id - data store id\n\t * @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted\n\t */\n\tprivate validateNotDeleted(id: string, requestHeaderData?: RuntimeHeaderData) {\n\t\tif (this.checkIfDeleted(id, requestHeaderData)) {\n\t\t\t// The requested data store is removed by gc. Create a 404 gc response exception.\n\t\t\tconst request: IRequest = { url: id };\n\t\t\tthrow responseToException(\n\t\t\t\tcreateResponseError(404, \"DataStore was deleted\", request),\n\t\t\t\trequest,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the data store has not been marked as tombstone by GC or not.\n\t * @param context - the data store context in question\n\t * @param requestHeaderData - the request header information to log if the validation detects the data store has been tombstoned\n\t * @returns true if the data store is tombstoned. Otherwise, returns false.\n\t */\n\tprivate checkIfTombstoned(\n\t\tcontext: FluidDataStoreContext,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t) {\n\t\tif (!context.tombstoned) {\n\t\t\treturn false;\n\t\t}\n\t\tconst logErrorEvent =\n\t\t\tthis.runtime.gcThrowOnTombstoneLoad && !requestHeaderData.allowTombstone;\n\t\tsendGCUnexpectedUsageEvent(\n\t\t\tthis.mc,\n\t\t\t{\n\t\t\t\teventName: \"GC_Tombstone_DataStore_Requested\",\n\t\t\t\tcategory: logErrorEvent ? \"error\" : \"generic\",\n\t\t\t\tisSummarizerClient: this.runtime.clientDetails.type === summarizerClientType,\n\t\t\t\tid: context.id,\n\t\t\t\theaders: JSON.stringify(requestHeaderData),\n\t\t\t\tgcTombstoneEnforcementAllowed: this.runtime.gcTombstoneEnforcementAllowed,\n\t\t\t},\n\t\t\tcontext.isLoaded ? context.packagePath : undefined,\n\t\t);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Validates that the data store context requested has not been marked as tombstone by GC.\n\t * @param context - the data store context in question\n\t * @param request - the request information to log if the validation detects the data store has been tombstoned\n\t * @param requestHeaderData - the request header information to log if the validation detects the data store has been tombstoned\n\t */\n\tprivate validateNotTombstoned(\n\t\tcontext: FluidDataStoreContext,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t) {\n\t\tif (this.checkIfTombstoned(context, requestHeaderData)) {\n\t\t\t// The requested data store is removed by gc. Create a 404 gc response exception.\n\t\t\tconst request: IRequest = { url: context.id };\n\t\t\tconst error = responseToException(\n\t\t\t\tcreateResponseError(404, \"DataStore was deleted\", request, {\n\t\t\t\t\t[TombstoneResponseHeaderKey]: true,\n\t\t\t\t}),\n\t\t\t\trequest,\n\t\t\t);\n\t\t\t// Throw an error if configured via options and via request headers.\n\t\t\tif (this.runtime.gcThrowOnTombstoneLoad && !requestHeaderData.allowTombstone) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic processSignal(fluidDataStoreId: string, message: IInboundSignalMessage, local: boolean) {\n\t\tthis.validateNotDeleted(fluidDataStoreId);\n\t\tconst context = this.contexts.get(fluidDataStoreId);\n\t\tif (!context) {\n\t\t\t// Attach message may not have been processed yet\n\t\t\tassert(!local, 0x163 /* \"Missing datastore for local signal\" */);\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"SignalFluidDataStoreNotFound\",\n\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t}),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.processSignal(message, local);\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\tfor (const [fluidDataStoreId, context] of this.contexts) {\n\t\t\ttry {\n\t\t\t\tcontext.setConnectionState(connected, clientId);\n\t\t\t} catch (error) {\n\t\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"SetConnectionStateError\",\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\truntimeConnected: this.runtime.connected,\n\t\t\t\t\t\t\tconnected,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {\n\t\tconst eventName = attachState === AttachState.Attaching ? \"attaching\" : \"attached\";\n\t\tfor (const [, context] of this.contexts) {\n\t\t\t// Fire only for bounded stores.\n\t\t\tif (!this.contexts.isNotBound(context.id)) {\n\t\t\t\tcontext.emit(eventName);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.contexts.size;\n\t}\n\n\tpublic async summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Iterate over each store and ask it to snapshot\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([_, context]) => {\n\t\t\t\t\t// Summarizer works only with clients with no local changes. A data store in attaching\n\t\t\t\t\t// state indicates an op was sent to attach a local data store.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontext.attachState !== AttachState.Attaching,\n\t\t\t\t\t\t0x588 /* Local data store detected in attaching state during summarize */,\n\t\t\t\t\t);\n\t\t\t\t\treturn context.attachState === AttachState.Attached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextSummary = await context.summarize(\n\t\t\t\t\t\tfullTree,\n\t\t\t\t\t\ttrackState,\n\t\t\t\t\t\ttelemetryContext,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryBuilder.addWithStats(contextId, contextSummary);\n\t\t\t\t}),\n\t\t);\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic createSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\t// Attaching graph of some stores can cause other stores to get bound too.\n\t\t// So keep taking summary until no new stores get bound.\n\t\tlet notBoundContextsLength: number;\n\t\tdo {\n\t\t\tconst builderTree = builder.summary.tree;\n\t\t\tnotBoundContextsLength = this.contexts.notBoundLength();\n\t\t\t// Iterate over each data store and ask it to snapshot\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(\n\t\t\t\t\t([key, _]) =>\n\t\t\t\t\t\t// Take summary of bounded data stores only, make sure we haven't summarized them already\n\t\t\t\t\t\t// and no attach op has been fired for that data store because for loader versions <= 0.24\n\t\t\t\t\t\t// we set attach state as \"attaching\" before taking createNew summary.\n\t\t\t\t\t\t!(\n\t\t\t\t\t\t\tthis.contexts.isNotBound(key) ||\n\t\t\t\t\t\t\tbuilderTree[key] ||\n\t\t\t\t\t\t\tthis.attachOpFiredForDataStore.has(key)\n\t\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\tlet dataStoreSummary: ISummarizeResult;\n\t\t\t\t\tif (value.isLoaded) {\n\t\t\t\t\t\tconst snapshot = value.generateAttachMessage().snapshot;\n\t\t\t\t\t\tdataStoreSummary = convertToSummaryTree(snapshot, true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If this data store is not yet loaded, then there should be no changes in the snapshot from\n\t\t\t\t\t\t// which it was created as it is detached container. So just use the previous snapshot.\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t!!this.baseSnapshot,\n\t\t\t\t\t\t\t0x166 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdataStoreSummary = convertSnapshotTreeToSummaryTree(\n\t\t\t\t\t\t\tthis.baseSnapshot.trees[key],\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbuilder.addWithStats(key, dataStoreSummary);\n\t\t\t\t});\n\t\t} while (notBoundContextsLength !== this.contexts.notBoundLength());\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Before GC runs, called by the garbage collector to update any pending GC state.\n\t * The garbage collector needs to know all outbound references that are added. Since root data stores are not\n\t * explicitly marked as referenced, notify GC of new root data stores that were added since the last GC run.\n\t */\n\tpublic async updateStateBeforeGC(): Promise<void> {\n\t\tfor (const id of this.dataStoresSinceLastGC) {\n\t\t\tconst context = this.contexts.get(id);\n\t\t\tassert(context !== undefined, 0x2b6 /* Missing data store context */);\n\t\t\tif (await context.isRoot()) {\n\t\t\t\t// A root data store is basically a reference from the container runtime to the data store.\n\t\t\t\tconst handle = new FluidObjectHandle(context, id, this.runtime.IFluidHandleContext);\n\t\t\t\tthis.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);\n\t\t\t}\n\t\t}\n\t\tthis.dataStoresSinceLastGC = [];\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. It does the following:\n\t *\n\t * 1. Calls into each child data store context to get its GC data.\n\t *\n\t * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n\t * identified as belonging to the child.\n\t *\n\t * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n\t * the GC data of this channel.\n\t *\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst builder = new GCDataBuilder();\n\t\t// Iterate over each store and get their GC data.\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([_, context]) => {\n\t\t\t\t\t// Summarizer client and hence GC works only with clients with no local changes. A data store in\n\t\t\t\t\t// attaching state indicates an op was sent to attach a local data store.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontext.attachState !== AttachState.Attaching,\n\t\t\t\t\t\t0x589 /* Local data store detected in attaching state while running GC */,\n\t\t\t\t\t);\n\t\t\t\t\treturn context.attachState === AttachState.Attached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextGCData = await context.getGCData(fullGC);\n\t\t\t\t\t// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n\t\t\t\t\t// This also gradually builds the id of each node to be a path from the root.\n\t\t\t\t\tbuilder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n\t\t\t\t}),\n\t\t);\n\n\t\t// Get the outbound routes and add a GC node for this channel.\n\t\tbuilder.addNode(\"/\", await this.getOutboundRoutes());\n\t\treturn builder.getGCData();\n\t}\n\n\t/**\n\t * After GC has run, called to notify this Container's data stores of routes that are used in it.\n\t * @param usedRoutes - The routes that are used in all data stores in this Container.\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Get a map of data store ids to routes used in it.\n\t\tconst usedDataStoreRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n\t\t// Verify that the used routes are correct.\n\t\tfor (const [id] of usedDataStoreRoutes) {\n\t\t\tassert(\n\t\t\t\tthis.contexts.has(id),\n\t\t\t\t0x167 /* \"Used route does not belong to any known data store\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Update the used routes in each data store. Used routes is empty for unused data stores.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.updateUsedRoutes(usedDataStoreRoutes.get(contextId) ?? []);\n\t\t}\n\t}\n\n\t/**\n\t * This is called to update objects whose routes are unused. The unused objects are deleted.\n\t * @param unusedRoutes - The routes that are unused in all data stores in this Container.\n\t */\n\tpublic updateUnusedRoutes(unusedRoutes: string[]) {\n\t\tfor (const route of unusedRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\t// Delete data store only if its route (/datastoreId) is in unusedRoutes. We don't want to delete a data\n\t\t\t// store based on its DDS being unused.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst dataStoreId = pathParts[1];\n\t\t\tassert(this.contexts.has(dataStoreId), 0x2d7 /* No data store with specified id */);\n\t\t\t// Delete the contexts of unused data stores.\n\t\t\tthis.contexts.delete(dataStoreId);\n\t\t\t// Delete the summarizer node of the unused data stores.\n\t\t\tthis.deleteChildSummarizerNodeFn(dataStoreId);\n\t\t}\n\t}\n\n\t/**\n\t * Delete data stores and its objects that are sweep ready.\n\t * @param sweepReadyDataStoreRoutes - The routes of data stores and its objects that are sweep ready and should\n\t * be deleted.\n\t * @returns The routes of data stores and its objects that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyDataStoreRoutes: string[]): string[] {\n\t\t// If sweep for data stores is not enabled, return empty list indicating nothing is deleted.\n\t\tif (this.mc.config.getBoolean(disableDatastoreSweepKey) === true) {\n\t\t\treturn [];\n\t\t}\n\t\tfor (const route of sweepReadyDataStoreRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\tconst dataStoreId = pathParts[1];\n\n\t\t\t// TODO: GC:Validation - Skip any routes already deleted\n\t\t\t// Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only\n\t\t\t// need to delete the data store.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!this.contexts.has(dataStoreId)) {\n\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"DeletedDataStoreNotFound\",\n\t\t\t\t\tdataStoreId,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst dataStore = this.contexts.get(dataStoreId);\n\t\t\tassert(dataStore !== undefined, 0x571 /* Attempting to delete unknown dataStore */);\n\t\t\tdataStore.delete();\n\n\t\t\t// Delete the contexts of sweep ready data stores.\n\t\t\tthis.contexts.delete(dataStoreId);\n\t\t\t// Delete the summarizer node of the sweep ready data stores.\n\t\t\tthis.deleteChildSummarizerNodeFn(dataStoreId);\n\t\t}\n\t\treturn Array.from(sweepReadyDataStoreRoutes);\n\t}\n\n\t/**\n\t * This is called to update objects whose routes are tombstones. Tombstoned datastore contexts enable testing\n\t * scenarios with accessing deleted content without actually deleting content from summaries.\n\t * @param tombstonedRoutes - The routes that are tombstones in all data stores in this Container.\n\t */\n\tpublic updateTombstonedRoutes(tombstonedRoutes: string[]) {\n\t\tconst tombstonedDataStoresSet: Set<string> = new Set();\n\t\tfor (const route of tombstonedRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\t// Tombstone data store only if its route (/datastoreId) is directly in tombstoneRoutes.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst dataStoreId = pathParts[1];\n\t\t\tassert(this.contexts.has(dataStoreId), 0x510 /* No data store with specified id */);\n\t\t\ttombstonedDataStoresSet.add(dataStoreId);\n\t\t}\n\n\t\t// Update the used routes in each data store. Used routes is empty for unused data stores.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.setTombstone(tombstonedDataStoresSet.has(contextId));\n\t\t}\n\t}\n\n\t/**\n\t * Returns the outbound routes of this channel. Only root data stores are considered referenced and their paths are\n\t * part of outbound routes.\n\t */\n\tprivate async getOutboundRoutes(): Promise<string[]> {\n\t\tconst outboundRoutes: string[] = [];\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tconst isRootDataStore = await context.isRoot();\n\t\t\tif (isRootDataStore) {\n\t\t\t\toutboundRoutes.push(`/${contextId}`);\n\t\t\t}\n\t\t}\n\t\treturn outboundRoutes;\n\t}\n\n\t/**\n\t * Called by GC to retrieve the package path of a data store node with the given path.\n\t */\n\tpublic async getDataStorePackagePath(nodePath: string): Promise<readonly string[] | undefined> {\n\t\t// If the node belongs to a data store, return its package path. For DDSes, we return the package path of the\n\t\t// data store that contains it.\n\t\tconst context = this.contexts.get(nodePath.split(\"/\")[1]);\n\t\treturn (await context?.getInitialSnapshotDetails())?.pkg;\n\t}\n\n\t/**\n\t * Called by GC to determine if a node is for a data store or for an object within a data store (for e.g. DDS).\n\t * @returns the GC node type if the node belongs to a data store or object within data store, undefined otherwise.\n\t */\n\tpublic getGCNodeType(nodePath: string): GCNodeType | undefined {\n\t\tconst pathParts = nodePath.split(\"/\");\n\t\tif (!this.contexts.has(pathParts[1])) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Data stores paths are of the format \"/dataStoreId\".\n\t\t// Sub data store paths are of the format \"/dataStoreId/subPath/...\".\n\t\tif (pathParts.length === 2) {\n\t\t\treturn GCNodeType.DataStore;\n\t\t}\n\t\treturn GCNodeType.SubDataStore;\n\t}\n}\n\nexport function getSummaryForDatastores(\n\tsnapshot: ISnapshotTree | undefined,\n\tmetadata?: IContainerRuntimeMetadata,\n): ISnapshotTree | undefined {\n\tif (!snapshot) {\n\t\treturn undefined;\n\t}\n\n\tif (rootHasIsolatedChannels(metadata)) {\n\t\tconst datastoresSnapshot = snapshot.trees[channelsTreeName];\n\t\tassert(!!datastoresSnapshot, 0x168 /* Expected tree in snapshot not found */);\n\t\treturn datastoresSnapshot;\n\t} else {\n\t\t// back-compat: strip out all non-datastore paths before giving to DataStores object.\n\t\tconst datastoresTrees: ISnapshotTree[\"trees\"] = {};\n\t\tfor (const [key, value] of Object.entries(snapshot.trees)) {\n\t\t\tif (!nonDataStorePaths.includes(key)) {\n\t\t\t\tdatastoresTrees[key] = value;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...snapshot,\n\t\t\ttrees: datastoresTrees,\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataStores.js","sourceRoot":"","sources":["../src/dataStores.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,yDAA8D;AAE9D,6EAe6C;AAC7C,iEASuC;AACvC,qEAOyC;AACzC,iFAAoE;AACpE,+DAAiE;AACjE,2DAA0D;AAC1D,+BAAkC;AAClC,2DAAwD;AACxD,yDAAmG;AACnG,yDAM4B;AAC5B,mFAAgF;AAChF,2CAA8E;AAC9E,6BAAwF;AACxF,uCAKmB;AAInB;;;GAGG;AACH,MAAa,UAAU;IA4BtB,YACkB,YAAuC,E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M;QACN,qFAAqF;QACrF,MAAM,eAAe,GAA2B,EAAE,CAAC;QACnD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC1D,IAAI,CAAC,2BAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACrC,eAAe,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;aAC7B;SACD;QACD,OAAO;YACN,GAAG,QAAQ;YACX,KAAK,EAAE,eAAe;SACtB,CAAC;KACF;AACF,CAAC;AAzBD,0DAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tITelemetryBaseLogger,\n\tIDisposable,\n\tIFluidHandle,\n\tIRequest,\n} from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tAliasResult,\n\tchannelsTreeName,\n\tCreateChildSummarizerNodeFn,\n\tCreateChildSummarizerNodeParam,\n\tCreateSummarizerNodeSource,\n\tIAttachMessage,\n\tIEnvelope,\n\tIFluidDataStoreContextDetached,\n\tIGarbageCollectionData,\n\tIInboundSignalMessage,\n\tInboundAttachMessage,\n\tISummarizeResult,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertToSummaryTree,\n\tcreate404Response,\n\tcreateResponseError,\n\tGCDataBuilder,\n\tresponseToException,\n\tSummaryTreeBuilder,\n\tunpackChildNodesUsedRoutes,\n} from \"@fluidframework/runtime-utils\";\nimport {\n\tcreateChildMonitoringContext,\n\tDataCorruptionError,\n\textractSafePropertiesFromMessage,\n\tLoggingError,\n\tMonitoringContext,\n\ttagCodeArtifacts,\n} from \"@fluidframework/telemetry-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { buildSnapshotTree } from \"@fluidframework/driver-utils\";\nimport { assert, Lazy } from \"@fluidframework/core-utils\";\nimport { v4 as uuid } from \"uuid\";\nimport { DataStoreContexts } from \"./dataStoreContexts\";\nimport { ContainerRuntime, defaultRuntimeHeaderData, RuntimeHeaderData } from \"./containerRuntime\";\nimport {\n\tFluidDataStoreContext,\n\tRemoteFluidDataStoreContext,\n\tLocalFluidDataStoreContext,\n\tcreateAttributesBlob,\n\tLocalDetachedFluidDataStoreContext,\n} from \"./dataStoreContext\";\nimport { StorageServiceWithAttachBlobs } from \"./storageServiceWithAttachBlobs\";\nimport { IDataStoreAliasMessage, isDataStoreAliasMessage } from \"./dataStore\";\nimport { GCNodeType, disableDatastoreSweepKey, sendGCUnexpectedUsageEvent } from \"./gc\";\nimport {\n\tsummarizerClientType,\n\tIContainerRuntimeMetadata,\n\tnonDataStorePaths,\n\trootHasIsolatedChannels,\n} from \"./summary\";\n\ntype PendingAliasResolve = (success: boolean) => void;\n\n/**\n * This class encapsulates data store handling. Currently it is only used by the container runtime,\n * but eventually could be hosted on any channel once we formalize the channel api boundary.\n */\nexport class DataStores implements IDisposable {\n\t// Stores tracked by the Domain\n\tprivate readonly pendingAttach = new Map<string, IAttachMessage>();\n\t// 0.24 back-compat attachingBeforeSummary\n\tpublic readonly attachOpFiredForDataStore = new Set<string>();\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly disposeOnce = new Lazy<void>(() => this.contexts.dispose());\n\n\tpublic readonly containerLoadStats: {\n\t\t// number of dataStores during loadContainer\n\t\treadonly containerLoadDataStoreCount: number;\n\t\t// number of unreferenced dataStores during loadContainer\n\t\treadonly referencedDataStoreCount: number;\n\t};\n\n\t// Stores the ids of new data stores between two GC runs. This is used to notify the garbage collector of new\n\t// root data stores that are added.\n\tprivate dataStoresSinceLastGC: string[] = [];\n\t// The handle to the container runtime. This is used mainly for GC purposes to represent outbound reference from\n\t// the container runtime to other nodes.\n\tprivate readonly containerRuntimeHandle: IFluidHandle;\n\tprivate readonly pendingAliasMap: Map<string, Promise<AliasResult>> = new Map<\n\t\tstring,\n\t\tPromise<AliasResult>\n\t>();\n\n\tconstructor(\n\t\tprivate readonly baseSnapshot: ISnapshotTree | undefined,\n\t\tprivate readonly runtime: ContainerRuntime,\n\t\tprivate readonly submitAttachFn: (attachContent: IAttachMessage) => void,\n\t\tprivate readonly getCreateChildSummarizerNodeFn: (\n\t\t\tid: string,\n\t\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t\t) => CreateChildSummarizerNodeFn,\n\t\tprivate readonly deleteChildSummarizerNodeFn: (id: string) => void,\n\t\tbaseLogger: ITelemetryBaseLogger,\n\t\tprivate readonly gcNodeUpdated: (\n\t\t\tnodePath: string,\n\t\t\ttimestampMs: number,\n\t\t\tpackagePath?: readonly string[],\n\t\t) => void,\n\t\tprivate readonly isDataStoreDeleted: (nodePath: string) => boolean,\n\t\tprivate readonly aliasMap: Map<string, string>,\n\t\tprivate readonly contexts: DataStoreContexts = new DataStoreContexts(baseLogger),\n\t) {\n\t\tthis.mc = createChildMonitoringContext({ logger: baseLogger });\n\t\tthis.containerRuntimeHandle = new FluidObjectHandle(\n\t\t\tthis.runtime,\n\t\t\t\"/\",\n\t\t\tthis.runtime.IFluidHandleContext,\n\t\t);\n\n\t\t// Extract stores stored inside the snapshot\n\t\tconst fluidDataStores = new Map<string, ISnapshotTree>();\n\t\tif (baseSnapshot) {\n\t\t\tfor (const [key, value] of Object.entries(baseSnapshot.trees)) {\n\t\t\t\tfluidDataStores.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\tlet unreferencedDataStoreCount = 0;\n\t\t// Create a context for each of them\n\t\tfor (const [key, value] of fluidDataStores) {\n\t\t\tlet dataStoreContext: FluidDataStoreContext;\n\n\t\t\t// counting number of unreferenced data stores\n\t\t\tif (value.unreferenced) {\n\t\t\t\tunreferencedDataStoreCount++;\n\t\t\t}\n\t\t\t// If we have a detached container, then create local data store contexts.\n\t\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\t\tdataStoreContext = new RemoteFluidDataStoreContext({\n\t\t\t\t\tid: key,\n\t\t\t\t\tsnapshotTree: value,\n\t\t\t\t\truntime: this.runtime,\n\t\t\t\t\tstorage: this.runtime.storage,\n\t\t\t\t\tscope: this.runtime.scope,\n\t\t\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {\n\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t}),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (typeof value !== \"object\") {\n\t\t\t\t\tthrow new LoggingError(\"Snapshot should be there to load from!!\");\n\t\t\t\t}\n\t\t\t\tconst snapshotTree = value;\n\t\t\t\tdataStoreContext = new LocalFluidDataStoreContext({\n\t\t\t\t\tid: key,\n\t\t\t\t\tpkg: undefined,\n\t\t\t\t\truntime: this.runtime,\n\t\t\t\t\tstorage: this.runtime.storage,\n\t\t\t\t\tscope: this.runtime.scope,\n\t\t\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(key, {\n\t\t\t\t\t\ttype: CreateSummarizerNodeSource.FromSummary,\n\t\t\t\t\t}),\n\t\t\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(key),\n\t\t\t\t\tsnapshotTree,\n\t\t\t\t\tisRootDataStore: undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.contexts.addBoundOrRemoted(dataStoreContext);\n\t\t}\n\t\tthis.containerLoadStats = {\n\t\t\tcontainerLoadDataStoreCount: fluidDataStores.size,\n\t\t\treferencedDataStoreCount: fluidDataStores.size - unreferencedDataStoreCount,\n\t\t};\n\t}\n\n\tpublic get aliases(): ReadonlyMap<string, string> {\n\t\treturn this.aliasMap;\n\t}\n\n\tpublic get pendingAliases(): Map<string, Promise<AliasResult>> {\n\t\treturn this.pendingAliasMap;\n\t}\n\n\tpublic async waitIfPendingAlias(maybeAlias: string): Promise<AliasResult> {\n\t\tconst pendingAliasPromise = this.pendingAliases.get(maybeAlias);\n\t\treturn pendingAliasPromise ?? \"Success\";\n\t}\n\n\tpublic processAttachMessage(message: ISequencedDocumentMessage, local: boolean) {\n\t\tconst attachMessage = message.contents as InboundAttachMessage;\n\n\t\tthis.dataStoresSinceLastGC.push(attachMessage.id);\n\n\t\t// The local object has already been attached\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tthis.pendingAttach.has(attachMessage.id),\n\t\t\t\t0x15e /* \"Local object does not have matching attach message id\" */,\n\t\t\t);\n\t\t\tthis.contexts.get(attachMessage.id)?.emit(\"attached\");\n\t\t\tthis.pendingAttach.delete(attachMessage.id);\n\t\t\treturn;\n\t\t}\n\n\t\t// If a non-local operation then go and create the object, otherwise mark it as officially attached.\n\t\tif (this.alreadyProcessed(attachMessage.id)) {\n\t\t\t// TODO: dataStoreId may require a different tag from PackageData #7488\n\t\t\tconst error = new DataCorruptionError(\n\t\t\t\t// pre-0.58 error message: duplicateDataStoreCreatedWithExistingId\n\t\t\t\t\"Duplicate DataStore created with existing id\",\n\t\t\t\t{\n\t\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\t\t...tagCodeArtifacts({ dataStoreId: attachMessage.id }),\n\t\t\t\t},\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\n\t\tconst flatAttachBlobs = new Map<string, ArrayBufferLike>();\n\t\tlet snapshotTree: ISnapshotTree | undefined;\n\t\tif (attachMessage.snapshot) {\n\t\t\tsnapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatAttachBlobs);\n\t\t}\n\n\t\t// Include the type of attach message which is the pkg of the store to be\n\t\t// used by RemoteFluidDataStoreContext in case it is not in the snapshot.\n\t\tconst pkg = [attachMessage.type];\n\t\tconst remoteFluidDataStoreContext = new RemoteFluidDataStoreContext({\n\t\t\tid: attachMessage.id,\n\t\t\tsnapshotTree,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: new StorageServiceWithAttachBlobs(this.runtime.storage, flatAttachBlobs),\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(attachMessage.id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.FromAttach,\n\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\tsnapshot: attachMessage.snapshot ?? {\n\t\t\t\t\tentries: [createAttributesBlob(pkg, true /* isRootDataStore */)],\n\t\t\t\t},\n\t\t\t}),\n\t\t\tpkg,\n\t\t});\n\n\t\tthis.contexts.addBoundOrRemoted(remoteFluidDataStoreContext);\n\t}\n\n\tpublic processAliasMessage(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: unknown,\n\t\tlocal: boolean,\n\t): void {\n\t\tconst aliasMessage = message.contents as IDataStoreAliasMessage;\n\t\tif (!isDataStoreAliasMessage(aliasMessage)) {\n\t\t\tthrow new DataCorruptionError(\"malformedDataStoreAliasMessage\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t});\n\t\t}\n\n\t\tconst resolve = localOpMetadata as PendingAliasResolve;\n\t\tconst aliasResult = this.processAliasMessageCore(aliasMessage);\n\t\tif (local) {\n\t\t\tresolve(aliasResult);\n\t\t}\n\t}\n\n\tpublic processAliasMessageCore(aliasMessage: IDataStoreAliasMessage): boolean {\n\t\tif (this.alreadyProcessed(aliasMessage.alias)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst context = this.contexts.get(aliasMessage.internalId);\n\t\tif (context === undefined) {\n\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\teventName: \"AliasFluidDataStoreNotFound\",\n\t\t\t\tfluidDataStoreId: aliasMessage.internalId,\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\n\t\tconst handle = new FluidObjectHandle(\n\t\t\tcontext,\n\t\t\taliasMessage.internalId,\n\t\t\tthis.runtime.IFluidHandleContext,\n\t\t);\n\t\tthis.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);\n\n\t\tthis.aliasMap.set(aliasMessage.alias, context.id);\n\t\tcontext.setInMemoryRoot();\n\t\treturn true;\n\t}\n\n\tprivate alreadyProcessed(id: string): boolean {\n\t\treturn this.aliasMap.get(id) !== undefined || this.contexts.get(id) !== undefined;\n\t}\n\n\t/**\n\t * Make the data stores locally visible in the container graph by moving the data store context from unbound to\n\t * bound list. This data store can now be reached from the root.\n\t * @param id - The id of the data store context to make visible.\n\t */\n\tprivate makeDataStoreLocallyVisible(id: string): void {\n\t\tconst localContext = this.contexts.getUnbound(id);\n\t\tassert(!!localContext, 0x15f /* \"Could not find unbound context to bind\" */);\n\n\t\t/**\n\t\t * If the container is not detached, it is globally visible to all clients. This data store should also be\n\t\t * globally visible. Move it to attaching state and send an \"attach\" op for it.\n\t\t * If the container is detached, this data store will be part of the summary that makes the container attached.\n\t\t */\n\t\tif (this.runtime.attachState !== AttachState.Detached) {\n\t\t\tlocalContext.emit(\"attaching\");\n\t\t\tconst message = localContext.generateAttachMessage();\n\n\t\t\tthis.pendingAttach.set(id, message);\n\t\t\tthis.submitAttachFn(message);\n\t\t\tthis.attachOpFiredForDataStore.add(id);\n\t\t}\n\n\t\tthis.contexts.bind(id);\n\t}\n\n\tpublic createDetachedDataStoreCore(\n\t\tpkg: Readonly<string[]>,\n\t\tisRoot: boolean,\n\t\tid = uuid(),\n\t): IFluidDataStoreContextDetached {\n\t\tassert(!id.includes(\"/\"), 0x30c /* Id cannot contain slashes */);\n\n\t\tconst context = new LocalDetachedFluidDataStoreContext({\n\t\t\tid,\n\t\t\tpkg,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: this.runtime.storage,\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.Local,\n\t\t\t}),\n\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),\n\t\t\tsnapshotTree: undefined,\n\t\t\tisRootDataStore: isRoot,\n\t\t});\n\t\tthis.contexts.addUnbound(context);\n\t\treturn context;\n\t}\n\n\tpublic _createFluidDataStoreContext(pkg: string[], id: string, props?: any) {\n\t\tassert(!id.includes(\"/\"), 0x30d /* Id cannot contain slashes */);\n\t\tconst context = new LocalFluidDataStoreContext({\n\t\t\tid,\n\t\t\tpkg,\n\t\t\truntime: this.runtime,\n\t\t\tstorage: this.runtime.storage,\n\t\t\tscope: this.runtime.scope,\n\t\t\tcreateSummarizerNodeFn: this.getCreateChildSummarizerNodeFn(id, {\n\t\t\t\ttype: CreateSummarizerNodeSource.Local,\n\t\t\t}),\n\t\t\tmakeLocallyVisibleFn: () => this.makeDataStoreLocallyVisible(id),\n\t\t\tsnapshotTree: undefined,\n\t\t\tisRootDataStore: false,\n\t\t\tcreateProps: props,\n\t\t});\n\t\tthis.contexts.addUnbound(context);\n\t\treturn context;\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 resubmitDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x160 /* \"There should be a store context for the op\" */);\n\t\tcontext.reSubmit(envelope.contents, localOpMetadata);\n\t}\n\n\tpublic rollbackDataStoreOp(envelope: IEnvelope, localOpMetadata: unknown) {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x2e8 /* \"There should be a store context for the op\" */);\n\t\tcontext.rollback(envelope.contents, localOpMetadata);\n\t}\n\n\tpublic async applyStashedOp(envelope: IEnvelope): Promise<unknown> {\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x161 /* \"There should be a store context for the op\" */);\n\t\treturn context.applyStashedOp(envelope.contents);\n\t}\n\n\tpublic async applyStashedAttachOp(message: IAttachMessage) {\n\t\tthis.pendingAttach.set(message.id, message);\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tthis.processAttachMessage({ contents: message } as ISequencedDocumentMessage, false);\n\t}\n\n\tpublic processFluidDataStoreOp(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalMessageMetadata: unknown,\n\t) {\n\t\tconst envelope = message.contents as IEnvelope;\n\t\tconst transformed = { ...message, contents: envelope.contents };\n\t\tthis.validateNotDeleted(envelope.address);\n\t\tconst context = this.contexts.get(envelope.address);\n\t\tassert(!!context, 0x162 /* \"There should be a store context for the op\" */);\n\t\tcontext.process(transformed, local, localMessageMetadata);\n\n\t\t// Notify that a GC node for the data store changed. This is used to detect if a deleted data store is\n\t\t// being used.\n\t\tthis.gcNodeUpdated(\n\t\t\t`/${envelope.address}`,\n\t\t\tmessage.timestamp,\n\t\t\tcontext.isLoaded ? context.packagePath : undefined,\n\t\t);\n\t}\n\n\tpublic async getDataStore(\n\t\tid: string,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t): Promise<FluidDataStoreContext> {\n\t\tconst headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };\n\t\tthis.validateNotDeleted(id, headerData);\n\n\t\tconst context = await this.contexts.getBoundOrRemoted(id, headerData.wait);\n\t\tif (context === undefined) {\n\t\t\t// The requested data store does not exits. Throw a 404 response exception.\n\t\t\tconst request: IRequest = { url: id };\n\t\t\tthrow responseToException(create404Response(request), request);\n\t\t}\n\t\treturn context;\n\t}\n\n\t/**\n\t * Returns the data store requested with the given id if available. Otherwise, returns undefined.\n\t */\n\tpublic async getDataStoreIfAvailable(\n\t\tid: string,\n\t\trequestHeaderData: RuntimeHeaderData,\n\t): Promise<FluidDataStoreContext | undefined> {\n\t\t// If the data store has been deleted, return undefined.\n\t\tif (this.checkIfDeleted(id, requestHeaderData)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst headerData = { ...defaultRuntimeHeaderData, ...requestHeaderData };\n\t\tconst context = await this.contexts.getBoundOrRemoted(id, headerData.wait);\n\t\tif (context === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn context;\n\t}\n\n\t/**\n\t * Checks if the data store has been deleted by GC.\n\t * @param id - data store id\n\t * @param request - the request information to log if the validation detects the data store has been deleted\n\t * @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted\n\t * @returns true if the data store is deleted. Otherwise, returns false.\n\t */\n\tprivate checkIfDeleted(id: string, requestHeaderData?: RuntimeHeaderData) {\n\t\tconst dataStoreNodePath = `/${id}`;\n\t\tif (!this.isDataStoreDeleted(dataStoreNodePath)) {\n\t\t\treturn false;\n\t\t}\n\t\tassert(\n\t\t\t!this.contexts.has(id),\n\t\t\t0x570 /* Inconsistent state! GC says the data store is deleted, but the data store is not deleted from the runtime. */,\n\t\t);\n\t\tsendGCUnexpectedUsageEvent(\n\t\t\tthis.mc,\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_DataStore_Requested\",\n\t\t\t\tcategory: \"error\",\n\t\t\t\tisSummarizerClient: this.runtime.clientDetails.type === summarizerClientType,\n\t\t\t\tid,\n\t\t\t\theaders: JSON.stringify(requestHeaderData),\n\t\t\t\tgcTombstoneEnforcementAllowed: this.runtime.gcTombstoneEnforcementAllowed,\n\t\t\t},\n\t\t\tundefined /* packagePath */,\n\t\t);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Validate that the data store had not been deleted by GC.\n\t * @param id - data store id\n\t * @param requestHeaderData - the request header information to log if the validation detects the data store has been deleted\n\t */\n\tprivate validateNotDeleted(id: string, requestHeaderData?: RuntimeHeaderData) {\n\t\tif (this.checkIfDeleted(id, requestHeaderData)) {\n\t\t\t// The requested data store is removed by gc. Create a 404 gc response exception.\n\t\t\tconst request: IRequest = { url: id };\n\t\t\tthrow responseToException(\n\t\t\t\tcreateResponseError(404, \"DataStore was deleted\", request),\n\t\t\t\trequest,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic processSignal(fluidDataStoreId: string, message: IInboundSignalMessage, local: boolean) {\n\t\tthis.validateNotDeleted(fluidDataStoreId);\n\t\tconst context = this.contexts.get(fluidDataStoreId);\n\t\tif (!context) {\n\t\t\t// Attach message may not have been processed yet\n\t\t\tassert(!local, 0x163 /* \"Missing datastore for local signal\" */);\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"SignalFluidDataStoreNotFound\",\n\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t}),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tcontext.processSignal(message, local);\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\tfor (const [fluidDataStoreId, context] of this.contexts) {\n\t\t\ttry {\n\t\t\t\tcontext.setConnectionState(connected, clientId);\n\t\t\t} catch (error) {\n\t\t\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"SetConnectionStateError\",\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\t\t\tfluidDataStoreId,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\truntimeConnected: this.runtime.connected,\n\t\t\t\t\t\t\tconnected,\n\t\t\t\t\t\t}),\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {\n\t\tconst eventName = attachState === AttachState.Attaching ? \"attaching\" : \"attached\";\n\t\tfor (const [, context] of this.contexts) {\n\t\t\t// Fire only for bounded stores.\n\t\t\tif (!this.contexts.isNotBound(context.id)) {\n\t\t\t\tcontext.emit(eventName);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.contexts.size;\n\t}\n\n\tpublic async summarize(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummaryTreeWithStats> {\n\t\tconst summaryBuilder = new SummaryTreeBuilder();\n\n\t\t// Iterate over each store and ask it to snapshot\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([_, context]) => {\n\t\t\t\t\t// Summarizer works only with clients with no local changes. A data store in attaching\n\t\t\t\t\t// state indicates an op was sent to attach a local data store.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontext.attachState !== AttachState.Attaching,\n\t\t\t\t\t\t0x588 /* Local data store detected in attaching state during summarize */,\n\t\t\t\t\t);\n\t\t\t\t\treturn context.attachState === AttachState.Attached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextSummary = await context.summarize(\n\t\t\t\t\t\tfullTree,\n\t\t\t\t\t\ttrackState,\n\t\t\t\t\t\ttelemetryContext,\n\t\t\t\t\t);\n\t\t\t\t\tsummaryBuilder.addWithStats(contextId, contextSummary);\n\t\t\t\t}),\n\t\t);\n\n\t\treturn summaryBuilder.getSummaryTree();\n\t}\n\n\tpublic createSummary(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\t// Attaching graph of some stores can cause other stores to get bound too.\n\t\t// So keep taking summary until no new stores get bound.\n\t\tlet notBoundContextsLength: number;\n\t\tdo {\n\t\t\tconst builderTree = builder.summary.tree;\n\t\t\tnotBoundContextsLength = this.contexts.notBoundLength();\n\t\t\t// Iterate over each data store and ask it to snapshot\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(\n\t\t\t\t\t([key, _]) =>\n\t\t\t\t\t\t// Take summary of bounded data stores only, make sure we haven't summarized them already\n\t\t\t\t\t\t// and no attach op has been fired for that data store because for loader versions <= 0.24\n\t\t\t\t\t\t// we set attach state as \"attaching\" before taking createNew summary.\n\t\t\t\t\t\t!(\n\t\t\t\t\t\t\tthis.contexts.isNotBound(key) ||\n\t\t\t\t\t\t\tbuilderTree[key] ||\n\t\t\t\t\t\t\tthis.attachOpFiredForDataStore.has(key)\n\t\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\tlet dataStoreSummary: ISummarizeResult;\n\t\t\t\t\tif (value.isLoaded) {\n\t\t\t\t\t\tconst snapshot = value.generateAttachMessage().snapshot;\n\t\t\t\t\t\tdataStoreSummary = convertToSummaryTree(snapshot, true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If this data store is not yet loaded, then there should be no changes in the snapshot from\n\t\t\t\t\t\t// which it was created as it is detached container. So just use the previous snapshot.\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t!!this.baseSnapshot,\n\t\t\t\t\t\t\t0x166 /* \"BaseSnapshot should be there as detached container loaded from snapshot\" */,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdataStoreSummary = convertSnapshotTreeToSummaryTree(\n\t\t\t\t\t\t\tthis.baseSnapshot.trees[key],\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbuilder.addWithStats(key, dataStoreSummary);\n\t\t\t\t});\n\t\t} while (notBoundContextsLength !== this.contexts.notBoundLength());\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Before GC runs, called by the garbage collector to update any pending GC state.\n\t * The garbage collector needs to know all outbound references that are added. Since root data stores are not\n\t * explicitly marked as referenced, notify GC of new root data stores that were added since the last GC run.\n\t */\n\tpublic async updateStateBeforeGC(): Promise<void> {\n\t\tfor (const id of this.dataStoresSinceLastGC) {\n\t\t\tconst context = this.contexts.get(id);\n\t\t\tassert(context !== undefined, 0x2b6 /* Missing data store context */);\n\t\t\tif (await context.isRoot()) {\n\t\t\t\t// A root data store is basically a reference from the container runtime to the data store.\n\t\t\t\tconst handle = new FluidObjectHandle(context, id, this.runtime.IFluidHandleContext);\n\t\t\t\tthis.runtime.addedGCOutboundReference(this.containerRuntimeHandle, handle);\n\t\t\t}\n\t\t}\n\t\tthis.dataStoresSinceLastGC = [];\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. It does the following:\n\t *\n\t * 1. Calls into each child data store context to get its GC data.\n\t *\n\t * 2. Prefixes the child context's id to the GC nodes in the child's GC data. This makes sure that the node can be\n\t * identified as belonging to the child.\n\t *\n\t * 3. Adds a GC node for this channel to the nodes received from the children. All these nodes together represent\n\t * the GC data of this channel.\n\t *\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst builder = new GCDataBuilder();\n\t\t// Iterate over each store and get their GC data.\n\t\tawait Promise.all(\n\t\t\tArray.from(this.contexts)\n\t\t\t\t.filter(([_, context]) => {\n\t\t\t\t\t// Summarizer client and hence GC works only with clients with no local changes. A data store in\n\t\t\t\t\t// attaching state indicates an op was sent to attach a local data store.\n\t\t\t\t\tassert(\n\t\t\t\t\t\tcontext.attachState !== AttachState.Attaching,\n\t\t\t\t\t\t0x589 /* Local data store detected in attaching state while running GC */,\n\t\t\t\t\t);\n\t\t\t\t\treturn context.attachState === AttachState.Attached;\n\t\t\t\t})\n\t\t\t\t.map(async ([contextId, context]) => {\n\t\t\t\t\tconst contextGCData = await context.getGCData(fullGC);\n\t\t\t\t\t// Prefix the child's id to the ids of its GC nodes so they can be identified as belonging to the child.\n\t\t\t\t\t// This also gradually builds the id of each node to be a path from the root.\n\t\t\t\t\tbuilder.prefixAndAddNodes(contextId, contextGCData.gcNodes);\n\t\t\t\t}),\n\t\t);\n\n\t\t// Get the outbound routes and add a GC node for this channel.\n\t\tbuilder.addNode(\"/\", await this.getOutboundRoutes());\n\t\treturn builder.getGCData();\n\t}\n\n\t/**\n\t * After GC has run, called to notify this Container's data stores of routes that are used in it.\n\t * @param usedRoutes - The routes that are used in all data stores in this Container.\n\t */\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t// Get a map of data store ids to routes used in it.\n\t\tconst usedDataStoreRoutes = unpackChildNodesUsedRoutes(usedRoutes);\n\n\t\t// Verify that the used routes are correct.\n\t\tfor (const [id] of usedDataStoreRoutes) {\n\t\t\tassert(\n\t\t\t\tthis.contexts.has(id),\n\t\t\t\t0x167 /* \"Used route does not belong to any known data store\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Update the used routes in each data store. Used routes is empty for unused data stores.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.updateUsedRoutes(usedDataStoreRoutes.get(contextId) ?? []);\n\t\t}\n\t}\n\n\t/**\n\t * This is called to update objects whose routes are unused. The unused objects are deleted.\n\t * @param unusedRoutes - The routes that are unused in all data stores in this Container.\n\t */\n\tpublic updateUnusedRoutes(unusedRoutes: string[]) {\n\t\tfor (const route of unusedRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\t// Delete data store only if its route (/datastoreId) is in unusedRoutes. We don't want to delete a data\n\t\t\t// store based on its DDS being unused.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst dataStoreId = pathParts[1];\n\t\t\tassert(this.contexts.has(dataStoreId), 0x2d7 /* No data store with specified id */);\n\t\t\t// Delete the contexts of unused data stores.\n\t\t\tthis.contexts.delete(dataStoreId);\n\t\t\t// Delete the summarizer node of the unused data stores.\n\t\t\tthis.deleteChildSummarizerNodeFn(dataStoreId);\n\t\t}\n\t}\n\n\t/**\n\t * Delete data stores and its objects that are sweep ready.\n\t * @param sweepReadyDataStoreRoutes - The routes of data stores and its objects that are sweep ready and should\n\t * be deleted.\n\t * @returns The routes of data stores and its objects that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyDataStoreRoutes: string[]): string[] {\n\t\t// If sweep for data stores is not enabled, return empty list indicating nothing is deleted.\n\t\tif (this.mc.config.getBoolean(disableDatastoreSweepKey) === true) {\n\t\t\treturn [];\n\t\t}\n\t\tfor (const route of sweepReadyDataStoreRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\tconst dataStoreId = pathParts[1];\n\n\t\t\t// TODO: GC:Validation - Skip any routes already deleted\n\t\t\t// Ignore sub-data store routes because a data store and its sub-routes are deleted together, so, we only\n\t\t\t// need to delete the data store.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (!this.contexts.has(dataStoreId)) {\n\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"DeletedDataStoreNotFound\",\n\t\t\t\t\tdataStoreId,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst dataStore = this.contexts.get(dataStoreId);\n\t\t\tassert(dataStore !== undefined, 0x571 /* Attempting to delete unknown dataStore */);\n\t\t\tdataStore.delete();\n\n\t\t\t// Delete the contexts of sweep ready data stores.\n\t\t\tthis.contexts.delete(dataStoreId);\n\t\t\t// Delete the summarizer node of the sweep ready data stores.\n\t\t\tthis.deleteChildSummarizerNodeFn(dataStoreId);\n\t\t}\n\t\treturn Array.from(sweepReadyDataStoreRoutes);\n\t}\n\n\t/**\n\t * This is called to update objects whose routes are tombstones. Tombstoned datastore contexts enable testing\n\t * scenarios with accessing deleted content without actually deleting content from summaries.\n\t * @param tombstonedRoutes - The routes that are tombstones in all data stores in this Container.\n\t */\n\tpublic updateTombstonedRoutes(tombstonedRoutes: string[]) {\n\t\tconst tombstonedDataStoresSet: Set<string> = new Set();\n\t\tfor (const route of tombstonedRoutes) {\n\t\t\tconst pathParts = route.split(\"/\");\n\t\t\t// Tombstone data store only if its route (/datastoreId) is directly in tombstoneRoutes.\n\t\t\tif (pathParts.length > 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst dataStoreId = pathParts[1];\n\t\t\tassert(this.contexts.has(dataStoreId), 0x510 /* No data store with specified id */);\n\t\t\ttombstonedDataStoresSet.add(dataStoreId);\n\t\t}\n\n\t\t// Update the used routes in each data store. Used routes is empty for unused data stores.\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tcontext.setTombstone(tombstonedDataStoresSet.has(contextId));\n\t\t}\n\t}\n\n\t/**\n\t * Returns the outbound routes of this channel. Only root data stores are considered referenced and their paths are\n\t * part of outbound routes.\n\t */\n\tprivate async getOutboundRoutes(): Promise<string[]> {\n\t\tconst outboundRoutes: string[] = [];\n\t\tfor (const [contextId, context] of this.contexts) {\n\t\t\tconst isRootDataStore = await context.isRoot();\n\t\t\tif (isRootDataStore) {\n\t\t\t\toutboundRoutes.push(`/${contextId}`);\n\t\t\t}\n\t\t}\n\t\treturn outboundRoutes;\n\t}\n\n\t/**\n\t * Called by GC to retrieve the package path of a data store node with the given path.\n\t */\n\tpublic async getDataStorePackagePath(nodePath: string): Promise<readonly string[] | undefined> {\n\t\t// If the node belongs to a data store, return its package path. For DDSes, we return the package path of the\n\t\t// data store that contains it.\n\t\tconst context = this.contexts.get(nodePath.split(\"/\")[1]);\n\t\treturn (await context?.getInitialSnapshotDetails())?.pkg;\n\t}\n\n\t/**\n\t * Called by GC to determine if a node is for a data store or for an object within a data store (for e.g. DDS).\n\t * @returns the GC node type if the node belongs to a data store or object within data store, undefined otherwise.\n\t */\n\tpublic getGCNodeType(nodePath: string): GCNodeType | undefined {\n\t\tconst pathParts = nodePath.split(\"/\");\n\t\tif (!this.contexts.has(pathParts[1])) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Data stores paths are of the format \"/dataStoreId\".\n\t\t// Sub data store paths are of the format \"/dataStoreId/subPath/...\".\n\t\tif (pathParts.length === 2) {\n\t\t\treturn GCNodeType.DataStore;\n\t\t}\n\t\treturn GCNodeType.SubDataStore;\n\t}\n}\n\nexport function getSummaryForDatastores(\n\tsnapshot: ISnapshotTree | undefined,\n\tmetadata?: IContainerRuntimeMetadata,\n): ISnapshotTree | undefined {\n\tif (!snapshot) {\n\t\treturn undefined;\n\t}\n\n\tif (rootHasIsolatedChannels(metadata)) {\n\t\tconst datastoresSnapshot = snapshot.trees[channelsTreeName];\n\t\tassert(!!datastoresSnapshot, 0x168 /* Expected tree in snapshot not found */);\n\t\treturn datastoresSnapshot;\n\t} else {\n\t\t// back-compat: strip out all non-datastore paths before giving to DataStores object.\n\t\tconst datastoresTrees: ISnapshotTree[\"trees\"] = {};\n\t\tfor (const [key, value] of Object.entries(snapshot.trees)) {\n\t\t\tif (!nonDataStorePaths.includes(key)) {\n\t\t\t\tdatastoresTrees[key] = value;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\t...snapshot,\n\t\t\ttrees: datastoresTrees,\n\t\t};\n\t}\n}\n"]}
@@ -2,9 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IRequestHeader } from "@fluidframework/core-interfaces";
5
+ import { IRequest } from "@fluidframework/core-interfaces";
6
6
  import { IGarbageCollectionDetailsBase, ISummarizeResult, ITelemetryContext } from "@fluidframework/runtime-definitions";
7
7
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
8
+ import { RuntimeHeaderData } from "../containerRuntime";
8
9
  import { IRefreshSummaryResult } from "../summary";
9
10
  import { IGarbageCollector, IGarbageCollectorCreateParams, IGCStats, IGCMetadata } from "./gcDefinitions";
10
11
  /**
@@ -165,14 +166,16 @@ export declare class GarbageCollector implements IGarbageCollector {
165
166
  */
166
167
  refreshLatestSummary(result: IRefreshSummaryResult): Promise<void>;
167
168
  /**
168
- * Called when a node with the given id is updated. If the node is inactive, log an error.
169
+ * Called when a node with the given id is updated. If the node is inactive or tombstoned, this will log an error
170
+ * or throw an error if failing on incorrect usage is configured.
169
171
  * @param nodePath - The path of the node that changed.
170
172
  * @param reason - Whether the node was loaded or changed.
171
173
  * @param timestampMs - The timestamp when the node changed.
172
174
  * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.
175
+ * @param request - The original request for loads to preserve it in telemetry.
173
176
  * @param requestHeaders - If the node was loaded via request path, the headers in the request.
174
177
  */
175
- nodeUpdated(nodePath: string, reason: "Loaded" | "Changed", timestampMs?: number, packagePath?: readonly string[], requestHeaders?: IRequestHeader): void;
178
+ nodeUpdated(nodePath: string, reason: "Loaded" | "Changed", timestampMs?: number, packagePath?: readonly string[], request?: IRequest, headerData?: RuntimeHeaderData): void;
176
179
  /**
177
180
  * Called when an outbound reference is added to a node. This is used to identify all nodes that have been
178
181
  * referenced between summaries so that their unreferenced timestamp can be reset.
@@ -1 +1 @@
1
- {"version":3,"file":"garbageCollection.d.ts","sourceRoot":"","sources":["../../src/gc/garbageCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAY,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAGN,6BAA6B,EAC7B,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAIN,mBAAmB,EAGnB,MAAM,iCAAiC,CAAC;AAQzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAEN,iBAAiB,EACjB,6BAA6B,EAG7B,QAAQ,EAER,WAAW,EAEX,MAAM,iBAAiB,CAAC;AAQzB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;WAC3C,MAAM,CAAC,YAAY,EAAE,6BAA6B,GAAG,iBAAiB;IAIpF,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IAEvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IAEnD,IAAW,WAAW,IAAI,OAAO,CAEhC;IAGD,OAAO,CAAC,iBAAiB,CAAqC;IAG9D,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAoC;IAE9E,OAAO,CAAC,UAAU,CAAgB;IAElC,OAAO,CAAC,YAAY,CAA0B;IAG9C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAsD;IAExF,OAAO,CAAC,QAAQ,CAAC,kCAAkC,CAAgB;IAEnE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyC;IAExE,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAoD;IAE3F,OAAO,CAAC,kBAAkB,CA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IAI/E;;;;;;;;;OASG;IACI,WAAW,CACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,QAAQ,GAAG,SAAS,EAC5B,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,EAC/B,OAAO,CAAC,EAAE,QAAQ,EAClB,UAAU,CAAC,EAAE,iBAAiB;IAyD/B;;;;;;OAMG;IACI,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAqBtE;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIxC,OAAO,IAAI,IAAI;IAKtB;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAyDrB"}
@@ -628,17 +628,20 @@ class GarbageCollector {
628
628
  return this.summaryStateTracker.refreshLatestSummary(result);
629
629
  }
630
630
  /**
631
- * Called when a node with the given id is updated. If the node is inactive, log an error.
631
+ * Called when a node with the given id is updated. If the node is inactive or tombstoned, this will log an error
632
+ * or throw an error if failing on incorrect usage is configured.
632
633
  * @param nodePath - The path of the node that changed.
633
634
  * @param reason - Whether the node was loaded or changed.
634
635
  * @param timestampMs - The timestamp when the node changed.
635
636
  * @param packagePath - The package path of the node. This may not be available if the node hasn't been loaded yet.
637
+ * @param request - The original request for loads to preserve it in telemetry.
636
638
  * @param requestHeaders - If the node was loaded via request path, the headers in the request.
637
639
  */
638
- nodeUpdated(nodePath, reason, timestampMs, packagePath, requestHeaders) {
640
+ nodeUpdated(nodePath, reason, timestampMs, packagePath, request, headerData) {
639
641
  if (!this.configs.shouldRunGC) {
640
642
  return;
641
643
  }
644
+ const isTombstoned = this.tombstones.includes(nodePath);
642
645
  // This will log if appropriate
643
646
  this.telemetryTracker.nodeUsed({
644
647
  id: nodePath,
@@ -646,26 +649,33 @@ class GarbageCollector {
646
649
  currentReferenceTimestampMs: timestampMs ?? this.runtime.getCurrentReferenceTimestampMs(),
647
650
  packagePath,
648
651
  completedGCRuns: this.completedRuns,
649
- isTombstoned: this.tombstones.includes(nodePath),
652
+ isTombstoned,
650
653
  lastSummaryTime: this.getLastSummaryTimestampMs(),
651
- viaHandle: requestHeaders?.[containerRuntime_1.RuntimeHeaders.viaHandle],
654
+ headers: headerData,
652
655
  });
656
+ const nodeType = this.runtime.getNodeType(nodePath);
653
657
  // Unless this is a Loaded event for a Blob or DataStore, we're done after telemetry tracking
654
- if (reason !== "Loaded" ||
655
- ![gcDefinitions_1.GCNodeType.Blob, gcDefinitions_1.GCNodeType.DataStore].includes(this.runtime.getNodeType(nodePath))) {
658
+ if (reason !== "Loaded" || ![gcDefinitions_1.GCNodeType.Blob, gcDefinitions_1.GCNodeType.DataStore].includes(nodeType)) {
656
659
  return;
657
660
  }
658
- // We may throw when loading an Inactive object, depending on these preconditions
659
- const shouldThrowOnInactiveLoad = !this.isSummarizerClient &&
660
- this.configs.throwOnInactiveLoad === true &&
661
- requestHeaders?.[containerRuntime_1.AllowInactiveRequestHeaderKey] !== true;
662
- const state = this.unreferencedNodesState.get(nodePath)?.state;
663
- if (shouldThrowOnInactiveLoad && state === "Inactive") {
664
- const request = { url: nodePath };
665
- const error = (0, runtime_utils_1.responseToException)((0, runtime_utils_1.createResponseError)(404, "Object is inactive", request, {
666
- [containerRuntime_1.InactiveResponseHeaderKey]: true,
667
- }), request);
668
- throw error;
661
+ const errorRequest = request ?? { url: nodePath };
662
+ // If the object is tombstoned and tombstone enforcement is configured, throw an error.
663
+ if (isTombstoned && this.throwOnTombstoneLoad && headerData?.allowTombstone !== true) {
664
+ // The requested data store is removed by gc. Create a 404 gc response exception.
665
+ throw (0, runtime_utils_1.responseToException)((0, runtime_utils_1.createResponseError)(404, `${nodeType} was tombstoned`, errorRequest, {
666
+ [containerRuntime_1.TombstoneResponseHeaderKey]: true,
667
+ }), errorRequest);
668
+ }
669
+ // If the object is inactive and inactive enforcement is configured, throw an error.
670
+ if (this.unreferencedNodesState.get(nodePath)?.state === "Inactive") {
671
+ const shouldThrowOnInactiveLoad = !this.isSummarizerClient &&
672
+ this.configs.throwOnInactiveLoad === true &&
673
+ headerData?.allowInactive !== true;
674
+ if (shouldThrowOnInactiveLoad) {
675
+ throw (0, runtime_utils_1.responseToException)((0, runtime_utils_1.createResponseError)(404, `${nodeType} is inactive`, errorRequest, {
676
+ [containerRuntime_1.InactiveResponseHeaderKey]: true,
677
+ }), errorRequest);
678
+ }
669
679
  }
670
680
  }
671
681
  /**