@fluidframework/container-runtime 2.51.0-347100 → 2.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/api-report/container-runtime.legacy.alpha.api.md +1 -2
- package/container-runtime.test-files.tar +0 -0
- package/dist/blobManager/blobManager.d.ts +15 -7
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +72 -186
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/containerCompatibility.d.ts +34 -0
- package/dist/containerCompatibility.d.ts.map +1 -0
- package/dist/containerCompatibility.js +125 -0
- package/dist/containerCompatibility.js.map +1 -0
- package/dist/containerRuntime.d.ts +27 -15
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +175 -136
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStoreContext.d.ts +6 -6
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +3 -2
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +7 -1
- package/dist/metadata.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/storageServiceWithAttachBlobs.d.ts +40 -5
- package/dist/storageServiceWithAttachBlobs.d.ts.map +1 -1
- package/dist/storageServiceWithAttachBlobs.js +56 -5
- package/dist/storageServiceWithAttachBlobs.js.map +1 -1
- package/dist/summary/documentSchema.d.ts +1 -1
- package/dist/summary/documentSchema.d.ts.map +1 -1
- package/dist/summary/documentSchema.js.map +1 -1
- package/dist/summary/summaryFormat.d.ts +3 -3
- package/dist/summary/summaryFormat.d.ts.map +1 -1
- package/dist/summary/summaryFormat.js.map +1 -1
- package/lib/blobManager/blobManager.d.ts +15 -7
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +39 -153
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/containerCompatibility.d.ts +34 -0
- package/lib/containerCompatibility.d.ts.map +1 -0
- package/lib/containerCompatibility.js +120 -0
- package/lib/containerCompatibility.js.map +1 -0
- package/lib/containerRuntime.d.ts +27 -15
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +103 -64
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStoreContext.d.ts +6 -6
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +1 -1
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/metadata.d.ts +3 -2
- package/lib/metadata.d.ts.map +1 -1
- package/lib/metadata.js +5 -0
- package/lib/metadata.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/storageServiceWithAttachBlobs.d.ts +40 -5
- package/lib/storageServiceWithAttachBlobs.d.ts.map +1 -1
- package/lib/storageServiceWithAttachBlobs.js +56 -5
- package/lib/storageServiceWithAttachBlobs.js.map +1 -1
- package/lib/summary/documentSchema.d.ts +1 -1
- package/lib/summary/documentSchema.d.ts.map +1 -1
- package/lib/summary/documentSchema.js.map +1 -1
- package/lib/summary/summaryFormat.d.ts +3 -3
- package/lib/summary/summaryFormat.d.ts.map +1 -1
- package/lib/summary/summaryFormat.js.map +1 -1
- package/package.json +20 -20
- package/src/blobManager/blobManager.ts +53 -195
- package/src/containerCompatibility.ts +176 -0
- package/src/containerRuntime.ts +157 -122
- package/src/dataStoreContext.ts +13 -5
- package/src/index.ts +6 -1
- package/src/metadata.ts +10 -2
- package/src/packageVersion.ts +1 -1
- package/src/storageServiceWithAttachBlobs.ts +92 -10
- package/src/summary/documentSchema.ts +1 -1
- package/src/summary/summaryFormat.ts +2 -2
- package/dist/compatUtils.d.ts +0 -106
- package/dist/compatUtils.d.ts.map +0 -1
- package/dist/compatUtils.js +0 -251
- package/dist/compatUtils.js.map +0 -1
- package/lib/compatUtils.d.ts +0 -106
- package/lib/compatUtils.d.ts.map +0 -1
- package/lib/compatUtils.js +0 -242
- package/lib/compatUtils.js.map +0 -1
- package/src/compatUtils.ts +0 -365
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobManager.js","sourceRoot":"","sources":["../../src/blobManager/blobManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA6F;AAC7F,iFAAoE;AAepE,kEAAuE;AAKvE,oEAAsF;AAOtF,qEAKgD;AAChD,uEAMkD;AAClD,+BAAkC;AAIlC,mEAKiC;AAEjC;;;;;;GAMG;AACH,MAAa,UACZ,SAAQ,0BAAgC;IAOxC,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC;IACtD,CAAC;IAKD,IAAW,MAAM;QAChB,OAAO,CAAC,IAAI,CAAC,OAAO,KAAK,IAAA,4BAAa,GAA2B,CAAC,CAAC;IACpE,CAAC;IAGD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAOD,IAAW,iBAAiB;QAC3B,OAAO,IAAI,CAAC,kBAAkB,CAAC;IAChC,CAAC;IAID,YACiB,IAAY,EACZ,YAAiC,EAC1C,GAAmC,EAC1B,cAAuB,EACtB,aAA0B;QAE3C,KAAK,EAAE,CAAC;QANQ,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAqB;QAC1C,QAAG,GAAH,GAAG,CAAgC;QAC1B,mBAAc,GAAd,cAAc,CAAS;QACtB,kBAAa,GAAb,aAAa,CAAa;QAlCpC,aAAQ,G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B,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACxE,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC;AAEF;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,IAAY,EAAsD,EAAE,CAC9F,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AADtB,QAAA,UAAU,cACY;AAEnC,MAAM,gBAAgB,GAAG,CACxB,SAAmB,EACqC,EAAE,CAC1D,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,2BAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, createEmitter, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport {\n\tIContainerRuntime,\n\tIContainerRuntimeEvents,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tIEmitter,\n\tIEventProvider,\n\tIFluidHandleContext,\n\tIFluidHandleInternalPayloadPending,\n\tILocalFluidHandle,\n\tILocalFluidHandleEvents,\n\tListenable,\n\tPayloadState,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIDocumentStorageService,\n\tICreateBlobResponse,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { canRetryOnError, runWithRetry } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\ttype ISequencedMessageEnvelope,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tFluidHandleBase,\n\tcreateResponseError,\n\tgenerateHandleContextPath,\n\tresponseToException,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tLoggingError,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n\twrapError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { IBlobMetadata } from \"../metadata.js\";\n\nimport {\n\tgetStorageIds,\n\tsummarizeBlobManagerState,\n\ttoRedirectTable,\n\ttype IBlobManagerLoadInfo,\n} from \"./blobManagerSnapSum.js\";\n\n/**\n * This class represents blob (long string)\n * This object is used only when creating (writing) new blob and serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * DataObject.request() recognizes requests in the form of `/blobs/<id>`\n * and loads blob.\n */\nexport class BlobHandle\n\textends FluidHandleBase<ArrayBufferLike>\n\timplements\n\t\tILocalFluidHandle<ArrayBufferLike>,\n\t\tIFluidHandleInternalPayloadPending<ArrayBufferLike>\n{\n\tprivate attached: boolean = false;\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.routeContext.isAttached && this.attached;\n\t}\n\n\tprivate _events:\n\t\t| (Listenable<ILocalFluidHandleEvents> & IEmitter<ILocalFluidHandleEvents>)\n\t\t| undefined;\n\tpublic get events(): Listenable<ILocalFluidHandleEvents> {\n\t\treturn (this._events ??= createEmitter<ILocalFluidHandleEvents>());\n\t}\n\n\tprivate _state: PayloadState = \"pending\";\n\tpublic get payloadState(): PayloadState {\n\t\treturn this._state;\n\t}\n\n\t/**\n\t * The error property starts undefined, signalling that there has been no error yet.\n\t * If an error occurs, the property will contain the error.\n\t */\n\tprivate _payloadShareError: unknown;\n\tpublic get payloadShareError(): unknown {\n\t\treturn this._payloadShareError;\n\t}\n\n\tpublic readonly absolutePath: string;\n\n\tpublic constructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t\tpublic get: () => Promise<ArrayBufferLike>,\n\t\tpublic readonly payloadPending: boolean,\n\t\tprivate readonly onAttachGraph?: () => void,\n\t) {\n\t\tsuper();\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\tpublic readonly notifyShared = (): void => {\n\t\tthis._state = \"shared\";\n\t\tthis._events?.emit(\"payloadShared\");\n\t};\n\n\tpublic readonly notifyFailed = (error: unknown): void => {\n\t\tthis._payloadShareError = error;\n\t\tthis._events?.emit(\"payloadShareFailed\", error);\n\t};\n\n\tpublic attachGraph(): void {\n\t\tif (!this.attached) {\n\t\t\tthis.attached = true;\n\t\t\tthis.onAttachGraph?.();\n\t\t}\n\t}\n}\n\n// Restrict the IContainerRuntime interface to the subset required by BlobManager. This helps to make\n// the contract explicit and reduces the amount of mocking required for tests.\nexport type IBlobManagerRuntime = Pick<\n\tIContainerRuntime,\n\t\"attachState\" | \"connected\" | \"baseLogger\" | \"clientDetails\" | \"disposed\"\n> &\n\tIEventProvider<IContainerRuntimeEvents>;\n\ntype ICreateBlobResponseWithTTL = ICreateBlobResponse &\n\tPartial<Record<\"minTTLInSeconds\", number>>;\n\ninterface PendingBlob {\n\tblob: ArrayBufferLike;\n\topsent?: boolean;\n\tstorageId?: string;\n\thandleP: Deferred<BlobHandle>;\n\tuploadP?: Promise<ICreateBlobResponse | void>;\n\tuploadTime?: number;\n\tminTTLInSeconds?: number;\n\tattached?: boolean;\n\tacked?: boolean;\n\tabortSignal?: AbortSignal;\n\tstashedUpload?: boolean;\n}\n\nexport interface IPendingBlobs {\n\t[localId: string]: {\n\t\tblob: string;\n\t\tstorageId?: string;\n\t\tuploadTime?: number;\n\t\tminTTLInSeconds?: number;\n\t\tacked?: boolean;\n\t};\n}\n\nexport interface IBlobManagerEvents {\n\tnoPendingBlobs: () => void;\n}\n\ninterface IBlobManagerInternalEvents {\n\tuploadFailed: (localId: string, error: unknown) => void;\n\thandleAttached: (pending: PendingBlob) => void;\n\tprocessedBlobAttach: (localId: string, storageId: string) => void;\n}\n\nconst stashedPendingBlobOverrides: Pick<\n\tPendingBlob,\n\t\"stashedUpload\" | \"storageId\" | \"minTTLInSeconds\" | \"uploadTime\"\n> = {\n\tstashedUpload: true,\n\tstorageId: undefined,\n\tminTTLInSeconds: undefined,\n\tuploadTime: undefined,\n} as const;\n\nexport const blobManagerBasePath = \"_blobs\" as const;\n\nexport class BlobManager {\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly publicEvents = createEmitter<IBlobManagerEvents>();\n\tpublic get events(): Listenable<IBlobManagerEvents> {\n\t\treturn this.publicEvents;\n\t}\n\tprivate readonly internalEvents = createEmitter<IBlobManagerInternalEvents>();\n\n\t/**\n\t * Map of local IDs to storage IDs. Contains identity entries (storageId → storageId) for storage IDs. All requested IDs should\n\t * be a key in this map. Blobs created while the container is detached are stored in IDetachedBlobStorage which\n\t * gives local IDs; the storage IDs are filled in at attach time.\n\t * Note: It contains mappings from all clients, i.e., from remote clients as well. local ID comes from the client\n\t * that uploaded the blob but its mapping to storage ID is needed in all clients in order to retrieve the blob.\n\t */\n\tprivate readonly redirectTable: Map<string, string | undefined>;\n\n\t/**\n\t * Blobs which we have not yet seen a BlobAttach op round-trip and not yet attached to a DDS.\n\t */\n\tprivate readonly pendingBlobs: Map<string, PendingBlob> = new Map();\n\n\t/**\n\t * Track ops in flight for online flow. This is used for optimizations where if we receive an ack for a storage ID,\n\t * we can resolve all pending blobs with the same storage ID even though they may have different local IDs. That's\n\t * because we know that the server will not delete the blob corresponding to that storage ID.\n\t */\n\tprivate readonly opsInFlight: Map<string, Set<string>> = new Map();\n\n\tprivate readonly sendBlobAttachOp: (localId: string, storageId?: string) => void;\n\tprivate stopAttaching: boolean = false;\n\n\tprivate readonly routeContext: IFluidHandleContext;\n\tprivate readonly storage: IDocumentStorageService;\n\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t// blobPath's format - `/<basePath>/<blobId>`.\n\tprivate readonly blobRequested: (blobPath: string) => void;\n\t// Called to check if a blob has been deleted by GC.\n\t// blobPath's format - `/<basePath>/<blobId>`.\n\tprivate readonly isBlobDeleted: (blobPath: string) => boolean;\n\tprivate readonly runtime: IBlobManagerRuntime;\n\tprivate readonly localBlobIdGenerator: () => string;\n\tprivate readonly pendingStashedBlobs: Map<string, Promise<ICreateBlobResponse | void>> =\n\t\tnew Map();\n\tpublic readonly stashedBlobsUploadP: Promise<(void | ICreateBlobResponse)[]>;\n\n\tprivate readonly createBlobPayloadPending: boolean;\n\n\tpublic constructor(props: {\n\t\treadonly routeContext: IFluidHandleContext;\n\n\t\tblobManagerLoadInfo: IBlobManagerLoadInfo;\n\t\treadonly storage: IDocumentStorageService;\n\t\t/**\n\t\t * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which the blob is\n\t\t * deleted. The BlobAttach op notifies the server that blob is in use. The server will then not delete the\n\t\t * the blob as long as it is listed as referenced in future summaries. The summarizing client will know to\n\t\t * include the storage ID in the summary when it sees the op.\n\t\t *\n\t\t * The op will also include a local ID to inform all clients of the relation to the storage ID, without\n\t\t * knowledge of which they cannot request the blob from storage. It's important that this op is sequenced\n\t\t * before any ops that reference the local ID, otherwise, an invalid handle could be added to the document.\n\t\t */\n\t\tsendBlobAttachOp: (localId: string, storageId?: string) => void;\n\t\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t\t// blobPath's format - `/<basePath>/<blobId>`.\n\t\treadonly blobRequested: (blobPath: string) => void;\n\t\t// Called to check if a blob has been deleted by GC.\n\t\t// blobPath's format - `/<basePath>/<blobId>`.\n\t\treadonly isBlobDeleted: (blobPath: string) => boolean;\n\t\treadonly runtime: IBlobManagerRuntime;\n\t\tstashedBlobs: IPendingBlobs | undefined;\n\t\treadonly localBlobIdGenerator?: (() => string) | undefined;\n\t\treadonly createBlobPayloadPending: boolean;\n\t}) {\n\t\tconst {\n\t\t\trouteContext,\n\t\t\tblobManagerLoadInfo,\n\t\t\tstorage,\n\t\t\tsendBlobAttachOp,\n\t\t\tblobRequested,\n\t\t\tisBlobDeleted,\n\t\t\truntime,\n\t\t\tstashedBlobs,\n\t\t\tlocalBlobIdGenerator,\n\t\t\tcreateBlobPayloadPending,\n\t\t} = props;\n\t\tthis.routeContext = routeContext;\n\t\tthis.storage = storage;\n\t\tthis.blobRequested = blobRequested;\n\t\tthis.isBlobDeleted = isBlobDeleted;\n\t\tthis.runtime = runtime;\n\t\tthis.localBlobIdGenerator = localBlobIdGenerator ?? uuid;\n\t\tthis.createBlobPayloadPending = createBlobPayloadPending;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.runtime.baseLogger,\n\t\t\tnamespace: \"BlobManager\",\n\t\t});\n\n\t\tthis.redirectTable = toRedirectTable(\n\t\t\tblobManagerLoadInfo,\n\t\t\tthis.mc.logger,\n\t\t\tthis.runtime.attachState,\n\t\t);\n\n\t\t// Begin uploading stashed blobs from previous container instance\n\t\tfor (const [localId, entry] of Object.entries(stashedBlobs ?? {})) {\n\t\t\tconst { acked, storageId, minTTLInSeconds, uploadTime } = entry;\n\t\t\tconst blob = stringToBuffer(entry.blob, \"base64\");\n\t\t\tconst pendingEntry: PendingBlob = {\n\t\t\t\tblob,\n\t\t\t\topsent: true,\n\t\t\t\thandleP: new Deferred(),\n\t\t\t\tstorageId,\n\t\t\t\tuploadP: undefined,\n\t\t\t\tuploadTime,\n\t\t\t\tminTTLInSeconds,\n\t\t\t\tattached: true,\n\t\t\t\tacked,\n\t\t\t};\n\t\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\n\t\t\tif (storageId !== undefined && minTTLInSeconds && uploadTime) {\n\t\t\t\tconst timeLapseSinceLocalUpload = (Date.now() - uploadTime) / 1000;\n\t\t\t\t// stashed entries with more than half-life in storage will not be reuploaded\n\t\t\t\tif (minTTLInSeconds - timeLapseSinceLocalUpload > minTTLInSeconds / 2) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.pendingStashedBlobs.set(localId, this.uploadBlob(localId, blob));\n\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\t...pendingEntry,\n\t\t\t\t...stashedPendingBlobOverrides,\n\t\t\t\tuploadP: this.pendingStashedBlobs.get(localId),\n\t\t\t});\n\t\t}\n\n\t\tthis.stashedBlobsUploadP = PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"BlobUploadProcessStashedChanges\", count: this.pendingStashedBlobs.size },\n\t\t\tasync () => Promise.all(this.pendingStashedBlobs.values()),\n\t\t\t{ start: true, end: true },\n\t\t).finally(() => {\n\t\t\tthis.pendingStashedBlobs.clear();\n\t\t});\n\n\t\tthis.sendBlobAttachOp = (localId: string, blobId?: string) => {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined,\n\t\t\t\t0x725 /* Must have pending blob entry for upcoming op */,\n\t\t\t);\n\t\t\tif (pendingEntry?.uploadTime && pendingEntry?.minTTLInSeconds) {\n\t\t\t\tconst secondsSinceUpload = (Date.now() - pendingEntry.uploadTime) / 1000;\n\t\t\t\tconst expired = pendingEntry.minTTLInSeconds - secondsSinceUpload < 0;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"sendBlobAttach\",\n\t\t\t\t\tsecondsSinceUpload,\n\t\t\t\t\tminTTLInSeconds: pendingEntry.minTTLInSeconds,\n\t\t\t\t\texpired,\n\t\t\t\t});\n\t\t\t\tif (expired) {\n\t\t\t\t\t// reupload blob and reset previous fields\n\t\t\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\t\t\t...pendingEntry,\n\t\t\t\t\t\tstorageId: undefined,\n\t\t\t\t\t\tuploadTime: undefined,\n\t\t\t\t\t\tminTTLInSeconds: undefined,\n\t\t\t\t\t\topsent: false,\n\t\t\t\t\t\tuploadP: this.uploadBlob(localId, pendingEntry.blob),\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpendingEntry.opsent = true;\n\t\t\tsendBlobAttachOp(localId, blobId);\n\t\t};\n\t}\n\n\tpublic get allBlobsAttached(): boolean {\n\t\tfor (const entry of this.pendingBlobs.values()) {\n\t\t\tif (entry.attached === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic get hasPendingBlobs(): boolean {\n\t\treturn (\n\t\t\t(this.runtime.attachState !== AttachState.Attached && this.redirectTable.size > 0) ||\n\t\t\tthis.pendingBlobs.size > 0\n\t\t);\n\t}\n\n\tprivate createAbortError(pending?: PendingBlob): LoggingError {\n\t\treturn new LoggingError(\"uploadBlob aborted\", {\n\t\t\tacked: pending?.acked,\n\t\t\tuploadTime: pending?.uploadTime,\n\t\t});\n\t}\n\n\tpublic hasPendingStashedUploads(): boolean {\n\t\treturn [...this.pendingBlobs.values()].some((e) => e.stashedUpload === true);\n\t}\n\n\tpublic hasBlob(blobId: string): boolean {\n\t\treturn this.redirectTable.get(blobId) !== undefined;\n\t}\n\n\t/**\n\t * Retrieve the blob with the given local blob id.\n\t * @param blobId - The local blob id. Likely coming from a handle.\n\t * @param payloadPending - Whether we suspect the payload may be pending and not available yet.\n\t * @returns A promise which resolves to the blob contents\n\t */\n\tpublic async getBlob(blobId: string, payloadPending: boolean): Promise<ArrayBufferLike> {\n\t\t// Verify that the blob is not deleted, i.e., it has not been garbage collected. If it is, this will throw\n\t\t// an error, failing the call.\n\t\tthis.verifyBlobNotDeleted(blobId);\n\t\t// Let runtime know that the corresponding GC node was requested.\n\t\t// Note that this will throw if the blob is inactive or tombstoned and throwing on incorrect usage\n\t\t// is configured.\n\t\tthis.blobRequested(getGCNodePathFromBlobId(blobId));\n\n\t\tconst pending = this.pendingBlobs.get(blobId);\n\t\tif (pending) {\n\t\t\treturn pending.blob;\n\t\t}\n\n\t\tlet storageId: string;\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tassert(this.redirectTable.has(blobId), 0x383 /* requesting unknown blobs */);\n\n\t\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t\t// The 'IDocumentStorageService.readBlob()' call below will retrieve these via localId.\n\t\t\tstorageId = blobId;\n\t\t} else {\n\t\t\tconst attachedStorageId = this.redirectTable.get(blobId);\n\t\t\tif (!payloadPending) {\n\t\t\t\t// Only blob handles explicitly marked with pending payload are permitted to exist without\n\t\t\t\t// yet knowing their storage id. Otherwise they must already be associated with a storage id.\n\t\t\t\tassert(attachedStorageId !== undefined, 0x11f /* \"requesting unknown blobs\" */);\n\t\t\t}\n\t\t\t// If we didn't find it in the redirectTable, assume the attach op is coming eventually and wait.\n\t\t\t// We do this even if the local client doesn't have the blob payloadPending flag enabled, in case a\n\t\t\t// remote client does have it enabled. This wait may be infinite if the uploading client failed\n\t\t\t// the upload and doesn't exist anymore.\n\t\t\tstorageId =\n\t\t\t\tattachedStorageId ??\n\t\t\t\t(await new Promise<string>((resolve) => {\n\t\t\t\t\tconst onProcessBlobAttach = (localId: string, _storageId: string): void => {\n\t\t\t\t\t\tif (localId === blobId) {\n\t\t\t\t\t\t\tthis.internalEvents.off(\"processedBlobAttach\", onProcessBlobAttach);\n\t\t\t\t\t\t\tresolve(_storageId);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tthis.internalEvents.on(\"processedBlobAttach\", onProcessBlobAttach);\n\t\t\t\t}));\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"AttachmentReadBlob\", id: storageId },\n\t\t\tasync (event) => {\n\t\t\t\treturn this.storage.readBlob(storageId).catch((error) => {\n\t\t\t\t\tif (this.runtime.disposed) {\n\t\t\t\t\t\t// If the runtime is disposed, this is not an error we care to track, it's expected behavior.\n\t\t\t\t\t\tevent.cancel({ category: \"generic\" });\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\tprivate getBlobHandle(localId: string): BlobHandle {\n\t\tassert(\n\t\t\tthis.redirectTable.has(localId) || this.pendingBlobs.has(localId),\n\t\t\t0x384 /* requesting handle for unknown blob */,\n\t\t);\n\t\tconst pending = this.pendingBlobs.get(localId);\n\t\t// Create a callback function for once the handle has been attached\n\t\tconst callback = pending\n\t\t\t? () => {\n\t\t\t\t\tpending.attached = true;\n\t\t\t\t\t// Notify listeners (e.g. serialization process) that handle has been attached\n\t\t\t\t\tthis.internalEvents.emit(\"handleAttached\", pending);\n\t\t\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t\t\t}\n\t\t\t: undefined;\n\t\treturn new BlobHandle(\n\t\t\tgetGCNodePathFromBlobId(localId),\n\t\t\tthis.routeContext,\n\t\t\tasync () => this.getBlob(localId, false),\n\t\t\tfalse, // payloadPending\n\t\t\tcallback,\n\t\t);\n\t}\n\n\tprivate async createBlobDetached(\n\t\tblob: ArrayBufferLike,\n\t): Promise<IFluidHandleInternalPayloadPending<ArrayBufferLike>> {\n\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t// The 'IDocumentStorageService.createBlob()' call below will respond with a localId.\n\t\tconst response = await this.storage.createBlob(blob);\n\t\tthis.setRedirection(response.id, undefined);\n\t\treturn this.getBlobHandle(response.id);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandleInternalPayloadPending<ArrayBufferLike>> {\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn this.createBlobDetached(blob);\n\t\t}\n\t\tif (this.runtime.attachState === AttachState.Attaching) {\n\t\t\t// blob upload is not supported in \"Attaching\" state\n\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n\t\t\tawait new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n\t\t}\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Attached,\n\t\t\t0x385 /* For clarity and paranoid defense against adding future attachment states */,\n\t\t);\n\n\t\treturn this.createBlobPayloadPending\n\t\t\t? this.createBlobWithPayloadPending(blob)\n\t\t\t: this.createBlobLegacy(blob, signal);\n\t}\n\n\tprivate async createBlobLegacy(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandleInternalPayloadPending<ArrayBufferLike>> {\n\t\tif (signal?.aborted) {\n\t\t\tthrow this.createAbortError();\n\t\t}\n\n\t\t// Create a local ID for the blob. After uploading it to storage and before returning it, a local ID to\n\t\t// storage ID mapping is created.\n\t\tconst localId = this.localBlobIdGenerator();\n\t\tconst pendingEntry: PendingBlob = {\n\t\t\tblob,\n\t\t\thandleP: new Deferred(),\n\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\tattached: false,\n\t\t\tacked: false,\n\t\t\tabortSignal: signal,\n\t\t\topsent: false,\n\t\t};\n\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\n\t\tconst abortListener = (): void => {\n\t\t\tif (!pendingEntry.acked) {\n\t\t\t\tpendingEntry.handleP.reject(this.createAbortError(pendingEntry));\n\t\t\t}\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", abortListener, { once: true });\n\n\t\treturn pendingEntry.handleP.promise.finally(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", abortListener);\n\t\t});\n\t}\n\n\tprivate createBlobWithPayloadPending(\n\t\tblob: ArrayBufferLike,\n\t): IFluidHandleInternalPayloadPending<ArrayBufferLike> {\n\t\tconst localId = this.localBlobIdGenerator();\n\n\t\tconst blobHandle = new BlobHandle(\n\t\t\tgetGCNodePathFromBlobId(localId),\n\t\t\tthis.routeContext,\n\t\t\tasync () => blob,\n\t\t\ttrue, // payloadPending\n\t\t\t() => {\n\t\t\t\tconst pendingEntry: PendingBlob = {\n\t\t\t\t\tblob,\n\t\t\t\t\thandleP: new Deferred(),\n\t\t\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\t\t\tattached: true,\n\t\t\t\t\tacked: false,\n\t\t\t\t\topsent: false,\n\t\t\t\t};\n\t\t\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\t\t\t},\n\t\t);\n\n\t\tconst onProcessedBlobAttach = (_localId: string, _storageId: string): void => {\n\t\t\tif (_localId === localId) {\n\t\t\t\tthis.internalEvents.off(\"processedBlobAttach\", onProcessedBlobAttach);\n\t\t\t\tblobHandle.notifyShared();\n\t\t\t}\n\t\t};\n\t\tthis.internalEvents.on(\"processedBlobAttach\", onProcessedBlobAttach);\n\n\t\tconst onUploadFailed = (_localId: string, error: unknown): void => {\n\t\t\tif (_localId === localId) {\n\t\t\t\tthis.internalEvents.off(\"uploadFailed\", onUploadFailed);\n\t\t\t\tblobHandle.notifyFailed(error);\n\t\t\t}\n\t\t};\n\t\tthis.internalEvents.on(\"uploadFailed\", onUploadFailed);\n\n\t\treturn blobHandle;\n\t}\n\n\tprivate async uploadBlob(\n\t\tlocalId: string,\n\t\tblob: ArrayBufferLike,\n\t): Promise<ICreateBlobResponse | void> {\n\t\treturn runWithRetry(\n\t\t\tasync () => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.storage.createBlob(blob);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(localId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!entry,\n\t\t\t\t\t\t0x387 /* Must have pending blob entry for blob which failed to upload */,\n\t\t\t\t\t);\n\t\t\t\t\tif (entry.opsent && !canRetryOnError(error)) {\n\t\t\t\t\t\tthrow wrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t() => new LoggingError(`uploadBlob error`, { canRetry: true }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"createBlob\",\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\tcancel: this.pendingBlobs.get(localId)?.abortSignal,\n\t\t\t},\n\t\t).then(\n\t\t\t(response) => this.onUploadResolve(localId, response),\n\t\t\t(error) => {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"UploadBlobReject\",\n\t\t\t\t\t// TODO: better typing\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\terror,\n\t\t\t\t\tlocalId,\n\t\t\t\t});\n\t\t\t\t// it will only reject if we haven't sent an op\n\t\t\t\t// and is a non-retriable error. It will only reject\n\t\t\t\t// the promise but not throw any error outside.\n\t\t\t\tthis.pendingBlobs.get(localId)?.handleP.reject(error);\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t\tthis.internalEvents.emit(\"uploadFailed\", localId, error);\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Set up a mapping in the redirect table from fromId to toId. Also, notify the runtime that a reference is added\n\t * which is required for GC.\n\t */\n\tprivate setRedirection(fromId: string, toId: string | undefined): void {\n\t\tthis.redirectTable.set(fromId, toId);\n\t}\n\n\tprivate deletePendingBlobMaybe(localId: string): void {\n\t\tif (this.pendingBlobs.has(localId)) {\n\t\t\tconst entry = this.pendingBlobs.get(localId);\n\t\t\tif (entry?.attached && entry?.acked) {\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate deletePendingBlob(id: string): void {\n\t\tif (this.pendingBlobs.delete(id) && !this.hasPendingBlobs) {\n\t\t\tthis.publicEvents.emit(\"noPendingBlobs\");\n\t\t}\n\t}\n\n\tprivate onUploadResolve(\n\t\tlocalId: string,\n\t\tresponse: ICreateBlobResponseWithTTL,\n\t): ICreateBlobResponseWithTTL | undefined {\n\t\tconst entry = this.pendingBlobs.get(localId);\n\t\tif (entry === undefined && this.pendingStashedBlobs.has(localId)) {\n\t\t\t// The blob was already processed and deleted. This can happen if the blob was reuploaded by\n\t\t\t// the stashing process and the original upload was processed before the stashed upload.\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"StashedBlobAlreadyProcessed\",\n\t\t\t\tlocalId,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tassert(entry !== undefined, 0x6c8 /* pending blob entry not found for uploaded blob */);\n\t\tif ((entry.abortSignal?.aborted === true && !entry.opsent) || this.stopAttaching) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"BlobAborted\",\n\t\t\t\tlocalId,\n\t\t\t});\n\t\t\tthis.deletePendingBlob(localId);\n\t\t\treturn;\n\t\t}\n\t\tassert(\n\t\t\tentry.storageId === undefined,\n\t\t\t0x386 /* Must have pending blob entry for uploaded blob */,\n\t\t);\n\t\tentry.stashedUpload = undefined;\n\t\tentry.storageId = response.id;\n\t\tentry.uploadTime = Date.now();\n\t\tentry.minTTLInSeconds = response.minTTLInSeconds;\n\t\t// Send a blob attach op. This serves two purposes:\n\t\t// 1. If its a new blob, i.e., it isn't de-duped, the server will keep the blob alive if it sees this op\n\t\t// until its storage ID is added to the next summary.\n\t\t// 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the\n\t\t// blob from the server via the storage ID.\n\t\tif (!entry.opsent) {\n\t\t\tthis.sendBlobAttachOp(localId, response.id);\n\t\t}\n\t\tconst storageIds = getStorageIds(this.redirectTable, this.runtime.attachState);\n\t\tif (storageIds.has(response.id)) {\n\t\t\t// The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is\n\t\t\t// an existing blob, we don't have to wait for the op to be ack'd since this step has already\n\t\t\t// happened before and so, the server won't delete it.\n\t\t\tthis.setRedirection(localId, response.id);\n\t\t\tconst blobHandle = this.getBlobHandle(localId);\n\t\t\tblobHandle.notifyShared();\n\t\t\tentry.handleP.resolve(blobHandle);\n\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t} else {\n\t\t\t// If there is already an op for this storage ID, append the local ID to the list. Once any op for\n\t\t\t// this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the\n\t\t\t// blob alive in storage.\n\t\t\tlet setForRemoteId = this.opsInFlight.get(response.id);\n\t\t\tif (setForRemoteId === undefined) {\n\t\t\t\tsetForRemoteId = new Set();\n\t\t\t\tthis.opsInFlight.set(response.id, setForRemoteId);\n\t\t\t}\n\t\t\t// seeing the same localId twice can happen if a blob is being reuploaded and stashed.\n\t\t\t// TODO: review stashing logic and see if we can avoid this, as well in tests.\n\t\t\tsetForRemoteId.add(localId);\n\t\t}\n\t\treturn response;\n\t}\n\n\t/**\n\t * Resubmit a BlobAttach op. Used to add storage IDs to ops that were\n\t * submitted to runtime while disconnected.\n\t * @param metadata - op metadata containing storage and/or local IDs\n\t */\n\tpublic reSubmit(metadata: Record<string, unknown> | undefined): void {\n\t\tassert(!!metadata, 0x38b /* Resubmitted ops must have metadata */);\n\t\tconst { localId, blobId }: { localId?: string; blobId?: string } = metadata;\n\t\tassert(localId !== undefined, 0x50d /* local ID not available on reSubmit */);\n\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\n\t\tif (!blobId) {\n\t\t\t// We submitted this op while offline. The blob should have been uploaded by now.\n\t\t\tassert(\n\t\t\t\tpendingEntry?.opsent === true && !!pendingEntry?.storageId,\n\t\t\t\t0x38d /* blob must be uploaded before resubmitting BlobAttach op */,\n\t\t\t);\n\t\t\treturn this.sendBlobAttachOp(localId, pendingEntry?.storageId);\n\t\t}\n\t\treturn this.sendBlobAttachOp(localId, blobId);\n\t}\n\n\tpublic processBlobAttachMessage(message: ISequencedMessageEnvelope, local: boolean): void {\n\t\tconst localId = (message.metadata as IBlobMetadata | undefined)?.localId;\n\t\tconst blobId = (message.metadata as IBlobMetadata | undefined)?.blobId;\n\n\t\tif (localId) {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tif (pendingEntry?.abortSignal?.aborted) {\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tassert(blobId !== undefined, 0x12a /* \"Missing blob id on metadata\" */);\n\n\t\t// Set up a mapping from local ID to storage ID. This is crucial since without this the blob cannot be\n\t\t// requested from the server.\n\t\t// Note: The check for undefined is needed for back-compat when localId was not part of the BlobAttach op that\n\t\t// was sent when online.\n\t\tif (localId !== undefined) {\n\t\t\tthis.setRedirection(localId, blobId);\n\t\t}\n\t\t// set identity (id -> id) entry\n\t\tthis.setRedirection(blobId, blobId);\n\n\t\tassert(localId !== undefined, 0x50e /* local ID not present in blob attach message */);\n\t\tif (local) {\n\t\t\tconst waitingBlobs = this.opsInFlight.get(blobId);\n\t\t\tif (waitingBlobs !== undefined) {\n\t\t\t\t// For each op corresponding to this storage ID that we are waiting for, resolve the pending blob.\n\t\t\t\t// This is safe because the server will keep the blob alive and the op containing the local ID to\n\t\t\t\t// storage ID is already in flight and any op containing this local ID will be sequenced after that.\n\t\t\t\tfor (const pendingLocalId of waitingBlobs) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(pendingLocalId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x38f /* local online BlobAttach op with no pending blob entry */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.setRedirection(pendingLocalId, blobId);\n\t\t\t\t\tentry.acked = true;\n\t\t\t\t\tconst blobHandle = this.getBlobHandle(pendingLocalId);\n\t\t\t\t\tblobHandle.notifyShared();\n\t\t\t\t\tentry.handleP.resolve(blobHandle);\n\t\t\t\t\tthis.deletePendingBlobMaybe(pendingLocalId);\n\t\t\t\t}\n\t\t\t\tthis.opsInFlight.delete(blobId);\n\t\t\t}\n\t\t\tconst localEntry = this.pendingBlobs.get(localId);\n\t\t\tif (localEntry) {\n\t\t\t\tlocalEntry.acked = true;\n\t\t\t\tconst blobHandle = this.getBlobHandle(localId);\n\t\t\t\tblobHandle.notifyShared();\n\t\t\t\tlocalEntry.handleP.resolve(blobHandle);\n\t\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t\t}\n\t\t}\n\t\tthis.internalEvents.emit(\"processedBlobAttach\", localId, blobId);\n\t}\n\n\tpublic summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\treturn summarizeBlobManagerState(this.redirectTable, this.runtime.attachState);\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n\t * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n\t * about this for now because the data is a simple list of blob ids.\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\tconst gcData: IGarbageCollectionData = { gcNodes: {} };\n\t\tfor (const [localId, storageId] of this.redirectTable) {\n\t\t\tassert(!!storageId, 0x390 /* Must be attached to get GC data */);\n\t\t\t// Only return local ids as GC nodes because a blob can only be referenced via its local id. The storage\n\t\t\t// id entries have the same key and value, ignore them.\n\t\t\t// The outbound routes are empty because a blob node cannot reference other nodes. It can only be referenced\n\t\t\t// by adding its handle to a referenced DDS.\n\t\t\tif (localId !== storageId) {\n\t\t\t\tgcData.gcNodes[getGCNodePathFromBlobId(localId)] = [];\n\t\t\t}\n\t\t}\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Delete attachment blobs that are sweep ready.\n\t * @param sweepReadyBlobRoutes - The routes of blobs that are sweep ready and should be deleted. These routes will\n\t * be based off of local ids.\n\t * @returns The routes of blobs that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyBlobRoutes: readonly string[]): readonly string[] {\n\t\tthis.deleteBlobsFromRedirectTable(sweepReadyBlobRoutes);\n\t\treturn [...sweepReadyBlobRoutes];\n\t}\n\n\t/**\n\t * Delete blobs with the given routes from the redirect table.\n\t *\n\t * @remarks\n\t * The routes are GC nodes paths of format -`/<blobManagerBasePath>/<blobId>`. The blob ids are all local ids.\n\t * Deleting the blobs involves 2 steps:\n\t *\n\t * 1. The redirect table entry for the local ids are deleted.\n\t *\n\t * 2. If the storage ids corresponding to the deleted local ids are not in-use anymore, the redirect table entries\n\t * for the storage ids are deleted as well.\n\t *\n\t * Note that this does not delete the blobs from storage service immediately. Deleting the blobs from redirect table\n\t * will remove them the next summary. The service would them delete them some time in the future.\n\t */\n\tprivate deleteBlobsFromRedirectTable(blobRoutes: readonly string[]): void {\n\t\tif (blobRoutes.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This tracks the storage ids of local ids that are deleted. After the local ids have been deleted, if any of\n\t\t// these storage ids are unused, they will be deleted as well.\n\t\tconst maybeUnusedStorageIds: Set<string> = new Set();\n\t\tfor (const route of blobRoutes) {\n\t\t\tconst blobId = getBlobIdFromGCNodePath(route);\n\t\t\t// If the blob hasn't already been deleted, log an error because this should never happen.\n\t\t\t// If the blob has already been deleted, log a telemetry event. This can happen because multiple GC\n\t\t\t// sweep ops can contain the same data store. It would be interesting to track how often this happens.\n\t\t\tconst alreadyDeleted = this.isBlobDeleted(route);\n\t\t\tif (!this.redirectTable.has(blobId)) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeletedAttachmentBlobNotFound\",\n\t\t\t\t\tcategory: alreadyDeleted ? \"generic\" : \"error\",\n\t\t\t\t\tblobId,\n\t\t\t\t\tdetails: { alreadyDeleted },\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!storageId, 0x5bb /* Must be attached to run GC */);\n\t\t\tmaybeUnusedStorageIds.add(storageId);\n\t\t\tthis.redirectTable.delete(blobId);\n\t\t}\n\n\t\t// Find out storage ids that are in-use and remove them from maybeUnusedStorageIds. A storage id is in-use if\n\t\t// the redirect table has a local id -> storage id entry for it.\n\t\tfor (const [localId, storageId] of this.redirectTable.entries()) {\n\t\t\tassert(!!storageId, 0x5bc /* Must be attached to run GC */);\n\t\t\t// For every storage id, the redirect table has a id -> id entry. These do not make the storage id in-use.\n\t\t\tif (maybeUnusedStorageIds.has(storageId) && localId !== storageId) {\n\t\t\t\tmaybeUnusedStorageIds.delete(storageId);\n\t\t\t}\n\t\t}\n\n\t\t// For unused storage ids, delete their id -> id entries from the redirect table.\n\t\t// This way they'll be absent from the next summary, and the service is free to delete them from storage.\n\t\tfor (const storageId of maybeUnusedStorageIds) {\n\t\t\tthis.redirectTable.delete(storageId);\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that the blob with given id is not deleted, i.e., it has not been garbage collected. If the blob is GC'd,\n\t * log an error and throw if necessary.\n\t */\n\tprivate verifyBlobNotDeleted(blobId: string): void {\n\t\tif (!this.isBlobDeleted(getGCNodePathFromBlobId(blobId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst request = { url: blobId };\n\t\tconst error = responseToException(\n\t\t\tcreateResponseError(404, `Blob was deleted`, request),\n\t\t\trequest,\n\t\t);\n\t\t// Only log deleted events. Tombstone events are logged by garbage collector.\n\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_Blob_Requested\",\n\t\t\t\tpkg: blobManagerBasePath,\n\t\t\t},\n\t\t\terror,\n\t\t);\n\t\tthrow error;\n\t}\n\n\tpublic setRedirectTable(table: Map<string, string>): void {\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Detached,\n\t\t\t0x252 /* \"redirect table can only be set in detached container\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.redirectTable.size === table.size,\n\t\t\t0x391 /* Redirect table size must match BlobManager's local ID count */,\n\t\t);\n\t\tfor (const [localId, storageId] of table) {\n\t\t\tassert(this.redirectTable.has(localId), 0x254 /* \"unrecognized id in redirect table\" */);\n\t\t\tthis.setRedirection(localId, storageId);\n\t\t\t// set identity (id -> id) entry\n\t\t\tthis.setRedirection(storageId, storageId);\n\t\t}\n\t}\n\n\t/**\n\t * Part of container serialization when imminent closure is enabled (Currently when calling closeAndGetPendingLocalState).\n\t * This asynchronous function resolves all pending createBlob calls and waits for each blob\n\t * to be attached. It will also send BlobAttach ops for each pending blob that hasn't sent it\n\t * yet so that serialized container can resubmit them when rehydrated.\n\t *\n\t * @param stopBlobAttachingSignal - Optional signal to abort the blob attaching process.\n\t * @returns - A promise that resolves with the details of the attached blobs,\n\t * or undefined if no blobs were processed.\n\t */\n\tpublic async attachAndGetPendingBlobs(\n\t\tstopBlobAttachingSignal?: AbortSignal,\n\t): Promise<IPendingBlobs | undefined> {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"GetPendingBlobs\" },\n\t\t\tasync () => {\n\t\t\t\tif (this.pendingBlobs.size === 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst blobs = {};\n\t\t\t\tconst localBlobs = new Set<PendingBlob>();\n\t\t\t\t// This while is used to stash blobs created while attaching and getting blobs\n\t\t\t\twhile (localBlobs.size < this.pendingBlobs.size) {\n\t\t\t\t\tconst attachHandlesP: Promise<void>[] = [];\n\t\t\t\t\tfor (const [localId, entry] of this.pendingBlobs) {\n\t\t\t\t\t\tif (!localBlobs.has(entry)) {\n\t\t\t\t\t\t\tlocalBlobs.add(entry);\n\t\t\t\t\t\t\t// In order to follow natural blob creation flow we need to:\n\t\t\t\t\t\t\t// 1 send the blob attach op\n\t\t\t\t\t\t\t// 2 resolve the blob handle\n\t\t\t\t\t\t\t// 3 wait for op referencing the blob\n\t\t\t\t\t\t\tif (!entry.opsent) {\n\t\t\t\t\t\t\t\tthis.sendBlobAttachOp(localId, entry.storageId);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Resolving the blob handle to let hosts continue with their operations (it will resolve\n\t\t\t\t\t\t\t// original createBlob call) and let them attach the blob. This is a lie we told since the upload\n\t\t\t\t\t\t\t// hasn't finished yet, but it's fine since we will retry on rehydration.\n\t\t\t\t\t\t\tentry.handleP.resolve(this.getBlobHandle(localId));\n\t\t\t\t\t\t\t// Array of promises that will resolve when handles get attached.\n\t\t\t\t\t\t\tattachHandlesP.push(\n\t\t\t\t\t\t\t\tnew Promise<void>((resolve, reject) => {\n\t\t\t\t\t\t\t\t\tstopBlobAttachingSignal?.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\"abort\",\n\t\t\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\t\t\tthis.stopAttaching = true;\n\t\t\t\t\t\t\t\t\t\t\treject(new Error(\"Operation aborted\"));\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t{ once: true },\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tconst onHandleAttached = (attachedEntry: PendingBlob): void => {\n\t\t\t\t\t\t\t\t\t\tif (attachedEntry === entry) {\n\t\t\t\t\t\t\t\t\t\t\tthis.internalEvents.off(\"handleAttached\", onHandleAttached);\n\t\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tif (entry.attached) {\n\t\t\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tthis.internalEvents.on(\"handleAttached\", onHandleAttached);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Wait for all blobs to be attached. This is important, otherwise serialized container\n\t\t\t\t\t// could send the blobAttach op without any op that references the blob, making it useless.\n\t\t\t\t\tawait Promise.allSettled(attachHandlesP);\n\t\t\t\t}\n\n\t\t\t\tfor (const [localId, entry] of this.pendingBlobs) {\n\t\t\t\t\tif (stopBlobAttachingSignal?.aborted && !entry.attached) {\n\t\t\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"UnableToStashBlob\",\n\t\t\t\t\t\t\tid: localId,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tassert(entry.attached === true, 0x790 /* stashed blob should be attached */);\n\t\t\t\t\tblobs[localId] = {\n\t\t\t\t\t\tblob: bufferToString(entry.blob, \"base64\"),\n\t\t\t\t\t\tstorageId: entry.storageId,\n\t\t\t\t\t\tacked: entry.acked,\n\t\t\t\t\t\tminTTLInSeconds: entry.minTTLInSeconds,\n\t\t\t\t\t\tuploadTime: entry.uploadTime,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn Object.keys(blobs).length > 0 ? blobs : undefined;\n\t\t\t},\n\t\t);\n\t}\n}\n\n/**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<blobManagerBasePath>/<blobId>`.\n * This path must match the path of the blob handle returned by the createBlob API because blobs are marked\n * referenced by storing these handles in a referenced DDS.\n */\nconst getGCNodePathFromBlobId = (blobId: string): string =>\n\t`/${blobManagerBasePath}/${blobId}`;\n\n/**\n * For a given GC node path, return the blobId. The node path is of the format `/<basePath>/<blobId>`.\n */\nconst getBlobIdFromGCNodePath = (nodePath: string): string => {\n\tconst pathParts = nodePath.split(\"/\");\n\tassert(areBlobPathParts(pathParts), 0x5bd /* Invalid blob node path */);\n\treturn pathParts[2];\n};\n\n/**\n * Returns whether a given path is for attachment blobs that are in the format - \"/blobManagerBasePath/...\".\n */\nexport const isBlobPath = (path: string): path is `/${typeof blobManagerBasePath}/${string}` =>\n\tareBlobPathParts(path.split(\"/\"));\n\nconst areBlobPathParts = (\n\tpathParts: string[],\n): pathParts is [\"\", typeof blobManagerBasePath, string] =>\n\tpathParts.length === 3 && pathParts[1] === blobManagerBasePath;\n"]}
|
|
1
|
+
{"version":3,"file":"blobManager.js","sourceRoot":"","sources":["../../src/blobManager/blobManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA6D;AAC7D,6EAGwD;AAexD,kEAAuE;AAEvE,oEAAsF;AAOtF,qEAKgD;AAChD,uEAOkD;AAClD,+BAAkC;AAElC,gDAAgD;AAEhD,mEAKiC;AAEjC;;;;;;GAMG;AACH,MAAa,UACZ,SAAQ,0BAAgC;IAOxC,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC;IACtD,CAAC;IAKD,IAAW,MAAM;QAChB,OAAO,CAAC,IAAI,CAAC,OAAO,KAAK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AEF;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,IAAY,EAAsD,EAAE,CAC9F,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AADtB,QAAA,UAAU,cACY;AAEnC,MAAM,gBAAgB,GAAG,CACxB,SAAmB,EACqC,EAAE,CAC1D,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,KAAK,2BAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tAttachState,\n\ttype IContainerStorageService,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tIContainerRuntime,\n\tIContainerRuntimeEvents,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tIEmitter,\n\tIEventProvider,\n\tIFluidHandleContext,\n\tIFluidHandleInternalPayloadPending,\n\tILocalFluidHandle,\n\tILocalFluidHandleEvents,\n\tListenable,\n\tPayloadState,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport { ICreateBlobResponse } from \"@fluidframework/driver-definitions/internal\";\nimport { canRetryOnError, runWithRetry } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIGarbageCollectionData,\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\ttype ISequencedMessageEnvelope,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tFluidHandleBase,\n\tcreateResponseError,\n\tgenerateHandleContextPath,\n\tresponseToException,\n} from \"@fluidframework/runtime-utils/internal\";\nimport {\n\tLoggingError,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tUsageError,\n\tcreateChildMonitoringContext,\n\twrapError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { isBlobMetadata } from \"../metadata.js\";\n\nimport {\n\tgetStorageIds,\n\tsummarizeBlobManagerState,\n\ttoRedirectTable,\n\ttype IBlobManagerLoadInfo,\n} from \"./blobManagerSnapSum.js\";\n\n/**\n * This class represents blob (long string)\n * This object is used only when creating (writing) new blob and serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * DataObject.request() recognizes requests in the form of `/blobs/<id>`\n * and loads blob.\n */\nexport class BlobHandle\n\textends FluidHandleBase<ArrayBufferLike>\n\timplements\n\t\tILocalFluidHandle<ArrayBufferLike>,\n\t\tIFluidHandleInternalPayloadPending<ArrayBufferLike>\n{\n\tprivate attached: boolean = false;\n\n\tpublic get isAttached(): boolean {\n\t\treturn this.routeContext.isAttached && this.attached;\n\t}\n\n\tprivate _events:\n\t\t| (Listenable<ILocalFluidHandleEvents> & IEmitter<ILocalFluidHandleEvents>)\n\t\t| undefined;\n\tpublic get events(): Listenable<ILocalFluidHandleEvents> {\n\t\treturn (this._events ??= createEmitter<ILocalFluidHandleEvents>());\n\t}\n\n\tprivate _state: PayloadState = \"pending\";\n\tpublic get payloadState(): PayloadState {\n\t\treturn this._state;\n\t}\n\n\t/**\n\t * The error property starts undefined, signalling that there has been no error yet.\n\t * If an error occurs, the property will contain the error.\n\t */\n\tprivate _payloadShareError: unknown;\n\tpublic get payloadShareError(): unknown {\n\t\treturn this._payloadShareError;\n\t}\n\n\tpublic readonly absolutePath: string;\n\n\tpublic constructor(\n\t\tpublic readonly path: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t\tpublic get: () => Promise<ArrayBufferLike>,\n\t\tpublic readonly payloadPending: boolean,\n\t\tprivate readonly onAttachGraph?: () => void,\n\t) {\n\t\tsuper();\n\t\tthis.absolutePath = generateHandleContextPath(path, this.routeContext);\n\t}\n\n\tpublic readonly notifyShared = (): void => {\n\t\tthis._state = \"shared\";\n\t\tthis._events?.emit(\"payloadShared\");\n\t};\n\n\tpublic readonly notifyFailed = (error: unknown): void => {\n\t\tthis._payloadShareError = error;\n\t\tthis._events?.emit(\"payloadShareFailed\", error);\n\t};\n\n\tpublic attachGraph(): void {\n\t\tif (!this.attached) {\n\t\t\tthis.attached = true;\n\t\t\tthis.onAttachGraph?.();\n\t\t}\n\t}\n}\n\n// Restrict the IContainerRuntime interface to the subset required by BlobManager. This helps to make\n// the contract explicit and reduces the amount of mocking required for tests.\nexport type IBlobManagerRuntime = Pick<\n\tIContainerRuntime,\n\t\"attachState\" | \"connected\" | \"baseLogger\" | \"clientDetails\" | \"disposed\"\n> &\n\tIEventProvider<IContainerRuntimeEvents>;\n\ntype ICreateBlobResponseWithTTL = ICreateBlobResponse &\n\tPartial<Record<\"minTTLInSeconds\", number>>;\n\ninterface PendingBlob {\n\tblob: ArrayBufferLike;\n\topsent?: boolean;\n\tstorageId?: string;\n\thandleP: Deferred<BlobHandle>;\n\tuploadP?: Promise<ICreateBlobResponse | void>;\n\tuploadTime?: number;\n\tminTTLInSeconds?: number;\n\tattached?: boolean;\n\tacked?: boolean;\n\tabortSignal?: AbortSignal;\n}\n\nexport interface IPendingBlobs {\n\t[localId: string]: {\n\t\tblob: string;\n\t\tstorageId?: string;\n\t\tuploadTime?: number;\n\t\tminTTLInSeconds?: number;\n\t\tacked?: boolean;\n\t};\n}\n\nexport interface IBlobManagerEvents {\n\tnoPendingBlobs: () => void;\n}\n\ninterface IBlobManagerInternalEvents {\n\tuploadFailed: (localId: string, error: unknown) => void;\n\thandleAttached: (pending: PendingBlob) => void;\n\tprocessedBlobAttach: (localId: string, storageId: string) => void;\n}\n\nexport const blobManagerBasePath = \"_blobs\" as const;\n\nexport class BlobManager {\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly publicEvents = createEmitter<IBlobManagerEvents>();\n\tpublic get events(): Listenable<IBlobManagerEvents> {\n\t\treturn this.publicEvents;\n\t}\n\tprivate readonly internalEvents = createEmitter<IBlobManagerInternalEvents>();\n\n\t/**\n\t * Map of local IDs to storage IDs. Contains identity entries (storageId → storageId) for storage IDs. All requested IDs should\n\t * be a key in this map. Blobs created while the container is detached are stored in IDetachedBlobStorage which\n\t * gives local IDs; the storage IDs are filled in at attach time.\n\t * Note: It contains mappings from all clients, i.e., from remote clients as well. local ID comes from the client\n\t * that uploaded the blob but its mapping to storage ID is needed in all clients in order to retrieve the blob.\n\t */\n\tprivate readonly redirectTable: Map<string, string | undefined>;\n\n\t/**\n\t * Blobs which we have not yet seen a BlobAttach op round-trip and not yet attached to a DDS.\n\t */\n\tprivate readonly pendingBlobs: Map<string, PendingBlob> = new Map();\n\n\t/**\n\t * Track ops in flight for online flow. This is used for optimizations where if we receive an ack for a storage ID,\n\t * we can resolve all pending blobs with the same storage ID even though they may have different local IDs. That's\n\t * because we know that the server will not delete the blob corresponding to that storage ID.\n\t */\n\tprivate readonly opsInFlight: Map<string, Set<string>> = new Map();\n\n\tprivate readonly sendBlobAttachOp: (localId: string, storageId: string) => void;\n\n\tprivate readonly routeContext: IFluidHandleContext;\n\tprivate readonly storage: Pick<IContainerStorageService, \"createBlob\" | \"readBlob\">;\n\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t// blobPath's format - `/<basePath>/<blobId>`.\n\tprivate readonly blobRequested: (blobPath: string) => void;\n\t// Called to check if a blob has been deleted by GC.\n\t// blobPath's format - `/<basePath>/<blobId>`.\n\tprivate readonly isBlobDeleted: (blobPath: string) => boolean;\n\tprivate readonly runtime: IBlobManagerRuntime;\n\tprivate readonly localBlobIdGenerator: () => string;\n\n\tprivate readonly createBlobPayloadPending: boolean;\n\n\tpublic constructor(props: {\n\t\treadonly routeContext: IFluidHandleContext;\n\n\t\tblobManagerLoadInfo: IBlobManagerLoadInfo;\n\t\treadonly storage: Pick<IContainerStorageService, \"createBlob\" | \"readBlob\">;\n\t\t/**\n\t\t * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which the blob is\n\t\t * deleted. The BlobAttach op notifies the server that blob is in use. The server will then not delete the\n\t\t * the blob as long as it is listed as referenced in future summaries. The summarizing client will know to\n\t\t * include the storage ID in the summary when it sees the op.\n\t\t *\n\t\t * The op will also include a local ID to inform all clients of the relation to the storage ID, without\n\t\t * knowledge of which they cannot request the blob from storage. It's important that this op is sequenced\n\t\t * before any ops that reference the local ID, otherwise, an invalid handle could be added to the document.\n\t\t */\n\t\tsendBlobAttachOp: (localId: string, storageId: string) => void;\n\t\t// Called when a blob node is requested. blobPath is the path of the blob's node in GC's graph.\n\t\t// blobPath's format - `/<basePath>/<blobId>`.\n\t\treadonly blobRequested: (blobPath: string) => void;\n\t\t// Called to check if a blob has been deleted by GC.\n\t\t// blobPath's format - `/<basePath>/<blobId>`.\n\t\treadonly isBlobDeleted: (blobPath: string) => boolean;\n\t\treadonly runtime: IBlobManagerRuntime;\n\t\tstashedBlobs: IPendingBlobs | undefined;\n\t\treadonly localBlobIdGenerator?: (() => string) | undefined;\n\t\treadonly createBlobPayloadPending: boolean;\n\t}) {\n\t\tconst {\n\t\t\trouteContext,\n\t\t\tblobManagerLoadInfo,\n\t\t\tstorage,\n\t\t\tsendBlobAttachOp,\n\t\t\tblobRequested,\n\t\t\tisBlobDeleted,\n\t\t\truntime,\n\t\t\tlocalBlobIdGenerator,\n\t\t\tcreateBlobPayloadPending,\n\t\t} = props;\n\t\tthis.routeContext = routeContext;\n\t\tthis.storage = storage;\n\t\tthis.blobRequested = blobRequested;\n\t\tthis.isBlobDeleted = isBlobDeleted;\n\t\tthis.runtime = runtime;\n\t\tthis.localBlobIdGenerator = localBlobIdGenerator ?? uuid;\n\t\tthis.createBlobPayloadPending = createBlobPayloadPending;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.runtime.baseLogger,\n\t\t\tnamespace: \"BlobManager\",\n\t\t});\n\n\t\tthis.redirectTable = toRedirectTable(\n\t\t\tblobManagerLoadInfo,\n\t\t\tthis.mc.logger,\n\t\t\tthis.runtime.attachState,\n\t\t);\n\n\t\tthis.sendBlobAttachOp = (localId: string, blobId: string) => {\n\t\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined,\n\t\t\t\t0x725 /* Must have pending blob entry for upcoming op */,\n\t\t\t);\n\t\t\tif (pendingEntry?.uploadTime && pendingEntry?.minTTLInSeconds) {\n\t\t\t\tconst secondsSinceUpload = (Date.now() - pendingEntry.uploadTime) / 1000;\n\t\t\t\tconst expired = pendingEntry.minTTLInSeconds - secondsSinceUpload < 0;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"sendBlobAttach\",\n\t\t\t\t\tsecondsSinceUpload,\n\t\t\t\t\tminTTLInSeconds: pendingEntry.minTTLInSeconds,\n\t\t\t\t\texpired,\n\t\t\t\t});\n\t\t\t\tif (expired) {\n\t\t\t\t\t// reupload blob and reset previous fields\n\t\t\t\t\tthis.pendingBlobs.set(localId, {\n\t\t\t\t\t\t...pendingEntry,\n\t\t\t\t\t\tstorageId: undefined,\n\t\t\t\t\t\tuploadTime: undefined,\n\t\t\t\t\t\tminTTLInSeconds: undefined,\n\t\t\t\t\t\topsent: false,\n\t\t\t\t\t\tuploadP: this.uploadBlob(localId, pendingEntry.blob),\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tpendingEntry.opsent = true;\n\t\t\tsendBlobAttachOp(localId, blobId);\n\t\t};\n\t}\n\n\tpublic get allBlobsAttached(): boolean {\n\t\tfor (const entry of this.pendingBlobs.values()) {\n\t\t\tif (entry.attached === false) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic get hasPendingBlobs(): boolean {\n\t\treturn (\n\t\t\t(this.runtime.attachState !== AttachState.Attached && this.redirectTable.size > 0) ||\n\t\t\tthis.pendingBlobs.size > 0\n\t\t);\n\t}\n\n\tprivate createAbortError(pending?: PendingBlob): LoggingError {\n\t\treturn new LoggingError(\"uploadBlob aborted\", {\n\t\t\tacked: pending?.acked,\n\t\t\tuploadTime: pending?.uploadTime,\n\t\t});\n\t}\n\n\tpublic hasBlob(blobId: string): boolean {\n\t\treturn this.redirectTable.get(blobId) !== undefined;\n\t}\n\n\t/**\n\t * Retrieve the blob with the given local blob id.\n\t * @param blobId - The local blob id. Likely coming from a handle.\n\t * @param payloadPending - Whether we suspect the payload may be pending and not available yet.\n\t * @returns A promise which resolves to the blob contents\n\t */\n\tpublic async getBlob(blobId: string, payloadPending: boolean): Promise<ArrayBufferLike> {\n\t\t// Verify that the blob is not deleted, i.e., it has not been garbage collected. If it is, this will throw\n\t\t// an error, failing the call.\n\t\tthis.verifyBlobNotDeleted(blobId);\n\t\t// Let runtime know that the corresponding GC node was requested.\n\t\t// Note that this will throw if the blob is inactive or tombstoned and throwing on incorrect usage\n\t\t// is configured.\n\t\tthis.blobRequested(getGCNodePathFromBlobId(blobId));\n\n\t\tconst pending = this.pendingBlobs.get(blobId);\n\t\tif (pending) {\n\t\t\treturn pending.blob;\n\t\t}\n\n\t\tlet storageId: string;\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\tassert(this.redirectTable.has(blobId), 0x383 /* requesting unknown blobs */);\n\n\t\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t\t// The 'IContainerStorageService.readBlob()' call below will retrieve these via localId.\n\t\t\tstorageId = blobId;\n\t\t} else {\n\t\t\tconst attachedStorageId = this.redirectTable.get(blobId);\n\t\t\tif (!payloadPending) {\n\t\t\t\t// Only blob handles explicitly marked with pending payload are permitted to exist without\n\t\t\t\t// yet knowing their storage id. Otherwise they must already be associated with a storage id.\n\t\t\t\tassert(attachedStorageId !== undefined, 0x11f /* \"requesting unknown blobs\" */);\n\t\t\t}\n\t\t\t// If we didn't find it in the redirectTable, assume the attach op is coming eventually and wait.\n\t\t\t// We do this even if the local client doesn't have the blob payloadPending flag enabled, in case a\n\t\t\t// remote client does have it enabled. This wait may be infinite if the uploading client failed\n\t\t\t// the upload and doesn't exist anymore.\n\t\t\tstorageId =\n\t\t\t\tattachedStorageId ??\n\t\t\t\t(await new Promise<string>((resolve) => {\n\t\t\t\t\tconst onProcessBlobAttach = (localId: string, _storageId: string): void => {\n\t\t\t\t\t\tif (localId === blobId) {\n\t\t\t\t\t\t\tthis.internalEvents.off(\"processedBlobAttach\", onProcessBlobAttach);\n\t\t\t\t\t\t\tresolve(_storageId);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tthis.internalEvents.on(\"processedBlobAttach\", onProcessBlobAttach);\n\t\t\t\t}));\n\t\t}\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.mc.logger,\n\t\t\t{ eventName: \"AttachmentReadBlob\", id: storageId },\n\t\t\tasync (event) => {\n\t\t\t\treturn this.storage.readBlob(storageId).catch((error) => {\n\t\t\t\t\tif (this.runtime.disposed) {\n\t\t\t\t\t\t// If the runtime is disposed, this is not an error we care to track, it's expected behavior.\n\t\t\t\t\t\tevent.cancel({ category: \"generic\" });\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t}\n\n\tprivate getBlobHandle(localId: string): BlobHandle {\n\t\tassert(\n\t\t\tthis.redirectTable.has(localId) || this.pendingBlobs.has(localId),\n\t\t\t0x384 /* requesting handle for unknown blob */,\n\t\t);\n\t\tconst pending = this.pendingBlobs.get(localId);\n\t\t// Create a callback function for once the handle has been attached\n\t\tconst callback = pending\n\t\t\t? () => {\n\t\t\t\t\tpending.attached = true;\n\t\t\t\t\t// Notify listeners (e.g. serialization process) that handle has been attached\n\t\t\t\t\tthis.internalEvents.emit(\"handleAttached\", pending);\n\t\t\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t\t\t}\n\t\t\t: undefined;\n\t\treturn new BlobHandle(\n\t\t\tgetGCNodePathFromBlobId(localId),\n\t\t\tthis.routeContext,\n\t\t\tasync () => this.getBlob(localId, false),\n\t\t\tfalse, // payloadPending\n\t\t\tcallback,\n\t\t);\n\t}\n\n\tprivate async createBlobDetached(\n\t\tblob: ArrayBufferLike,\n\t): Promise<IFluidHandleInternalPayloadPending<ArrayBufferLike>> {\n\t\t// Blobs created while the container is detached are stored in IDetachedBlobStorage.\n\t\t// The 'IContainerStorageService.createBlob()' call below will respond with a localId.\n\t\tconst response = await this.storage.createBlob(blob);\n\t\tthis.setRedirection(response.id, undefined);\n\t\treturn this.getBlobHandle(response.id);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandleInternalPayloadPending<ArrayBufferLike>> {\n\t\tif (this.runtime.attachState === AttachState.Detached) {\n\t\t\treturn this.createBlobDetached(blob);\n\t\t}\n\t\tif (this.runtime.attachState === AttachState.Attaching) {\n\t\t\t// blob upload is not supported in \"Attaching\" state\n\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n\t\t\tawait new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n\t\t}\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Attached,\n\t\t\t0x385 /* For clarity and paranoid defense against adding future attachment states */,\n\t\t);\n\n\t\treturn this.createBlobPayloadPending\n\t\t\t? this.createBlobWithPayloadPending(blob)\n\t\t\t: this.createBlobLegacy(blob, signal);\n\t}\n\n\tprivate async createBlobLegacy(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandleInternalPayloadPending<ArrayBufferLike>> {\n\t\tif (signal?.aborted) {\n\t\t\tthrow this.createAbortError();\n\t\t}\n\n\t\t// Create a local ID for the blob. After uploading it to storage and before returning it, a local ID to\n\t\t// storage ID mapping is created.\n\t\tconst localId = this.localBlobIdGenerator();\n\t\tconst pendingEntry: PendingBlob = {\n\t\t\tblob,\n\t\t\thandleP: new Deferred(),\n\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\tattached: false,\n\t\t\tacked: false,\n\t\t\tabortSignal: signal,\n\t\t\topsent: false,\n\t\t};\n\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\n\t\tconst abortListener = (): void => {\n\t\t\tif (!pendingEntry.acked) {\n\t\t\t\tpendingEntry.handleP.reject(this.createAbortError(pendingEntry));\n\t\t\t}\n\t\t};\n\t\tsignal?.addEventListener(\"abort\", abortListener, { once: true });\n\n\t\treturn pendingEntry.handleP.promise.finally(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", abortListener);\n\t\t});\n\t}\n\n\tprivate createBlobWithPayloadPending(\n\t\tblob: ArrayBufferLike,\n\t): IFluidHandleInternalPayloadPending<ArrayBufferLike> {\n\t\tconst localId = this.localBlobIdGenerator();\n\n\t\tconst blobHandle = new BlobHandle(\n\t\t\tgetGCNodePathFromBlobId(localId),\n\t\t\tthis.routeContext,\n\t\t\tasync () => blob,\n\t\t\ttrue, // payloadPending\n\t\t\t() => {\n\t\t\t\tconst pendingEntry: PendingBlob = {\n\t\t\t\t\tblob,\n\t\t\t\t\thandleP: new Deferred(),\n\t\t\t\t\tuploadP: this.uploadBlob(localId, blob),\n\t\t\t\t\tattached: true,\n\t\t\t\t\tacked: false,\n\t\t\t\t\topsent: false,\n\t\t\t\t};\n\t\t\t\tthis.pendingBlobs.set(localId, pendingEntry);\n\t\t\t},\n\t\t);\n\n\t\tconst onProcessedBlobAttach = (_localId: string, _storageId: string): void => {\n\t\t\tif (_localId === localId) {\n\t\t\t\tthis.internalEvents.off(\"processedBlobAttach\", onProcessedBlobAttach);\n\t\t\t\tblobHandle.notifyShared();\n\t\t\t}\n\t\t};\n\t\tthis.internalEvents.on(\"processedBlobAttach\", onProcessedBlobAttach);\n\n\t\tconst onUploadFailed = (_localId: string, error: unknown): void => {\n\t\t\tif (_localId === localId) {\n\t\t\t\tthis.internalEvents.off(\"uploadFailed\", onUploadFailed);\n\t\t\t\tblobHandle.notifyFailed(error);\n\t\t\t}\n\t\t};\n\t\tthis.internalEvents.on(\"uploadFailed\", onUploadFailed);\n\n\t\treturn blobHandle;\n\t}\n\n\tprivate async uploadBlob(\n\t\tlocalId: string,\n\t\tblob: ArrayBufferLike,\n\t): Promise<ICreateBlobResponse | void> {\n\t\treturn runWithRetry(\n\t\t\tasync () => {\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.storage.createBlob(blob);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(localId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!entry,\n\t\t\t\t\t\t0x387 /* Must have pending blob entry for blob which failed to upload */,\n\t\t\t\t\t);\n\t\t\t\t\tif (entry.opsent && !canRetryOnError(error)) {\n\t\t\t\t\t\tthrow wrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t() => new LoggingError(`uploadBlob error`, { canRetry: true }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"createBlob\",\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\tcancel: this.pendingBlobs.get(localId)?.abortSignal,\n\t\t\t},\n\t\t).then(\n\t\t\t(response) => this.onUploadResolve(localId, response),\n\t\t\t(error) => {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"UploadBlobReject\",\n\t\t\t\t\t// TODO: better typing\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\terror,\n\t\t\t\t\tlocalId,\n\t\t\t\t});\n\t\t\t\t// it will only reject if we haven't sent an op\n\t\t\t\t// and is a non-retriable error. It will only reject\n\t\t\t\t// the promise but not throw any error outside.\n\t\t\t\tthis.pendingBlobs.get(localId)?.handleP.reject(error);\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t\tthis.internalEvents.emit(\"uploadFailed\", localId, error);\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Set up a mapping in the redirect table from fromId to toId. Also, notify the runtime that a reference is added\n\t * which is required for GC.\n\t */\n\tprivate setRedirection(fromId: string, toId: string | undefined): void {\n\t\tthis.redirectTable.set(fromId, toId);\n\t}\n\n\tprivate deletePendingBlobMaybe(localId: string): void {\n\t\tif (this.pendingBlobs.has(localId)) {\n\t\t\tconst entry = this.pendingBlobs.get(localId);\n\t\t\tif (entry?.attached && entry?.acked) {\n\t\t\t\tthis.deletePendingBlob(localId);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate deletePendingBlob(id: string): void {\n\t\tif (this.pendingBlobs.delete(id) && !this.hasPendingBlobs) {\n\t\t\tthis.publicEvents.emit(\"noPendingBlobs\");\n\t\t}\n\t}\n\n\tprivate onUploadResolve(\n\t\tlocalId: string,\n\t\tresponse: ICreateBlobResponseWithTTL,\n\t): ICreateBlobResponseWithTTL | undefined {\n\t\tconst entry = this.pendingBlobs.get(localId);\n\n\t\tassert(entry !== undefined, 0x6c8 /* pending blob entry not found for uploaded blob */);\n\t\tif (entry.abortSignal?.aborted === true && !entry.opsent) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"BlobAborted\",\n\t\t\t\tlocalId,\n\t\t\t});\n\t\t\tthis.deletePendingBlob(localId);\n\t\t\treturn;\n\t\t}\n\t\tassert(\n\t\t\tentry.storageId === undefined,\n\t\t\t0x386 /* Must have pending blob entry for uploaded blob */,\n\t\t);\n\t\tentry.storageId = response.id;\n\t\tentry.uploadTime = Date.now();\n\t\tentry.minTTLInSeconds = response.minTTLInSeconds;\n\t\t// Send a blob attach op. This serves two purposes:\n\t\t// 1. If its a new blob, i.e., it isn't de-duped, the server will keep the blob alive if it sees this op\n\t\t// until its storage ID is added to the next summary.\n\t\t// 2. It will create a local ID to storage ID mapping in all clients which is needed to retrieve the\n\t\t// blob from the server via the storage ID.\n\t\tif (!entry.opsent) {\n\t\t\tthis.sendBlobAttachOp(localId, response.id);\n\t\t}\n\t\tconst storageIds = getStorageIds(this.redirectTable, this.runtime.attachState);\n\t\tif (storageIds.has(response.id)) {\n\t\t\t// The blob is de-duped. Set up a local ID to storage ID mapping and return the blob. Since this is\n\t\t\t// an existing blob, we don't have to wait for the op to be ack'd since this step has already\n\t\t\t// happened before and so, the server won't delete it.\n\t\t\tthis.setRedirection(localId, response.id);\n\t\t\tconst blobHandle = this.getBlobHandle(localId);\n\t\t\tblobHandle.notifyShared();\n\t\t\tentry.handleP.resolve(blobHandle);\n\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t} else {\n\t\t\t// If there is already an op for this storage ID, append the local ID to the list. Once any op for\n\t\t\t// this storage ID is ack'd, all pending blobs for it can be resolved since the op will keep the\n\t\t\t// blob alive in storage.\n\t\t\tlet setForRemoteId = this.opsInFlight.get(response.id);\n\t\t\tif (setForRemoteId === undefined) {\n\t\t\t\tsetForRemoteId = new Set();\n\t\t\t\tthis.opsInFlight.set(response.id, setForRemoteId);\n\t\t\t}\n\t\t\t// seeing the same localId twice can happen if a blob is being reuploaded and stashed.\n\t\t\t// TODO: review stashing logic and see if we can avoid this, as well in tests.\n\t\t\tsetForRemoteId.add(localId);\n\t\t}\n\t\treturn response;\n\t}\n\n\t/**\n\t * Resubmit a BlobAttach op. Used to add storage IDs to ops that were\n\t * submitted to runtime while disconnected.\n\t * @param metadata - op metadata containing storage and/or local IDs\n\t */\n\tpublic reSubmit(metadata: Record<string, unknown> | undefined): void {\n\t\tassert(isBlobMetadata(metadata), 0xc01 /* Expected blob metadata for a BlobAttach op */);\n\t\tconst { localId, blobId } = metadata;\n\t\t// Any blob that we're actively trying to advance to attached state must have a\n\t\t// pendingBlobs entry. Decline to resubmit for anything else.\n\t\t// For example, we might be asked to resubmit stashed ops for blobs that never had\n\t\t// their handle attached - these won't have a pendingBlobs entry and we shouldn't\n\t\t// try to attach them since they won't be accessible to the customer and would just\n\t\t// be considered garbage immediately.\n\t\tif (this.pendingBlobs.has(localId)) {\n\t\t\tthis.sendBlobAttachOp(localId, blobId);\n\t\t}\n\t}\n\n\tpublic processBlobAttachMessage(message: ISequencedMessageEnvelope, local: boolean): void {\n\t\tassert(\n\t\t\tisBlobMetadata(message.metadata),\n\t\t\t0xc02 /* Expected blob metadata for a BlobAttach op */,\n\t\t);\n\t\tconst { localId, blobId } = message.metadata;\n\t\tconst pendingEntry = this.pendingBlobs.get(localId);\n\t\tif (pendingEntry?.abortSignal?.aborted) {\n\t\t\tthis.deletePendingBlob(localId);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.setRedirection(localId, blobId);\n\t\t// set identity (id -> id) entry\n\t\tthis.setRedirection(blobId, blobId);\n\n\t\tif (local) {\n\t\t\tconst waitingBlobs = this.opsInFlight.get(blobId);\n\t\t\tif (waitingBlobs !== undefined) {\n\t\t\t\t// For each op corresponding to this storage ID that we are waiting for, resolve the pending blob.\n\t\t\t\t// This is safe because the server will keep the blob alive and the op containing the local ID to\n\t\t\t\t// storage ID is already in flight and any op containing this local ID will be sequenced after that.\n\t\t\t\tfor (const pendingLocalId of waitingBlobs) {\n\t\t\t\t\tconst entry = this.pendingBlobs.get(pendingLocalId);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tentry !== undefined,\n\t\t\t\t\t\t0x38f /* local online BlobAttach op with no pending blob entry */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.setRedirection(pendingLocalId, blobId);\n\t\t\t\t\tentry.acked = true;\n\t\t\t\t\tconst blobHandle = this.getBlobHandle(pendingLocalId);\n\t\t\t\t\tblobHandle.notifyShared();\n\t\t\t\t\tentry.handleP.resolve(blobHandle);\n\t\t\t\t\tthis.deletePendingBlobMaybe(pendingLocalId);\n\t\t\t\t}\n\t\t\t\tthis.opsInFlight.delete(blobId);\n\t\t\t}\n\t\t\tconst localEntry = this.pendingBlobs.get(localId);\n\t\t\tif (localEntry) {\n\t\t\t\tlocalEntry.acked = true;\n\t\t\t\tconst blobHandle = this.getBlobHandle(localId);\n\t\t\t\tblobHandle.notifyShared();\n\t\t\t\tlocalEntry.handleP.resolve(blobHandle);\n\t\t\t\tthis.deletePendingBlobMaybe(localId);\n\t\t\t}\n\t\t}\n\t\tthis.internalEvents.emit(\"processedBlobAttach\", localId, blobId);\n\t}\n\n\tpublic summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n\t\treturn summarizeBlobManagerState(this.redirectTable, this.runtime.attachState);\n\t}\n\n\t/**\n\t * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n\t * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n\t * about this for now because the data is a simple list of blob ids.\n\t */\n\tpublic getGCData(fullGC: boolean = false): IGarbageCollectionData {\n\t\tconst gcData: IGarbageCollectionData = { gcNodes: {} };\n\t\tfor (const [localId, storageId] of this.redirectTable) {\n\t\t\tassert(!!storageId, 0x390 /* Must be attached to get GC data */);\n\t\t\t// Only return local ids as GC nodes because a blob can only be referenced via its local id. The storage\n\t\t\t// id entries have the same key and value, ignore them.\n\t\t\t// The outbound routes are empty because a blob node cannot reference other nodes. It can only be referenced\n\t\t\t// by adding its handle to a referenced DDS.\n\t\t\tif (localId !== storageId) {\n\t\t\t\tgcData.gcNodes[getGCNodePathFromBlobId(localId)] = [];\n\t\t\t}\n\t\t}\n\t\treturn gcData;\n\t}\n\n\t/**\n\t * Delete attachment blobs that are sweep ready.\n\t * @param sweepReadyBlobRoutes - The routes of blobs that are sweep ready and should be deleted. These routes will\n\t * be based off of local ids.\n\t * @returns The routes of blobs that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyBlobRoutes: readonly string[]): readonly string[] {\n\t\tthis.deleteBlobsFromRedirectTable(sweepReadyBlobRoutes);\n\t\treturn [...sweepReadyBlobRoutes];\n\t}\n\n\t/**\n\t * Delete blobs with the given routes from the redirect table.\n\t *\n\t * @remarks\n\t * The routes are GC nodes paths of format -`/<blobManagerBasePath>/<blobId>`. The blob ids are all local ids.\n\t * Deleting the blobs involves 2 steps:\n\t *\n\t * 1. The redirect table entry for the local ids are deleted.\n\t *\n\t * 2. If the storage ids corresponding to the deleted local ids are not in-use anymore, the redirect table entries\n\t * for the storage ids are deleted as well.\n\t *\n\t * Note that this does not delete the blobs from storage service immediately. Deleting the blobs from redirect table\n\t * will remove them the next summary. The service would them delete them some time in the future.\n\t */\n\tprivate deleteBlobsFromRedirectTable(blobRoutes: readonly string[]): void {\n\t\tif (blobRoutes.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// This tracks the storage ids of local ids that are deleted. After the local ids have been deleted, if any of\n\t\t// these storage ids are unused, they will be deleted as well.\n\t\tconst maybeUnusedStorageIds: Set<string> = new Set();\n\t\tfor (const route of blobRoutes) {\n\t\t\tconst blobId = getBlobIdFromGCNodePath(route);\n\t\t\t// If the blob hasn't already been deleted, log an error because this should never happen.\n\t\t\t// If the blob has already been deleted, log a telemetry event. This can happen because multiple GC\n\t\t\t// sweep ops can contain the same data store. It would be interesting to track how often this happens.\n\t\t\tconst alreadyDeleted = this.isBlobDeleted(route);\n\t\t\tif (!this.redirectTable.has(blobId)) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeletedAttachmentBlobNotFound\",\n\t\t\t\t\tcategory: alreadyDeleted ? \"generic\" : \"error\",\n\t\t\t\t\tblobId,\n\t\t\t\t\tdetails: { alreadyDeleted },\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst storageId = this.redirectTable.get(blobId);\n\t\t\tassert(!!storageId, 0x5bb /* Must be attached to run GC */);\n\t\t\tmaybeUnusedStorageIds.add(storageId);\n\t\t\tthis.redirectTable.delete(blobId);\n\t\t}\n\n\t\t// Find out storage ids that are in-use and remove them from maybeUnusedStorageIds. A storage id is in-use if\n\t\t// the redirect table has a local id -> storage id entry for it.\n\t\tfor (const [localId, storageId] of this.redirectTable.entries()) {\n\t\t\tassert(!!storageId, 0x5bc /* Must be attached to run GC */);\n\t\t\t// For every storage id, the redirect table has a id -> id entry. These do not make the storage id in-use.\n\t\t\tif (maybeUnusedStorageIds.has(storageId) && localId !== storageId) {\n\t\t\t\tmaybeUnusedStorageIds.delete(storageId);\n\t\t\t}\n\t\t}\n\n\t\t// For unused storage ids, delete their id -> id entries from the redirect table.\n\t\t// This way they'll be absent from the next summary, and the service is free to delete them from storage.\n\t\tfor (const storageId of maybeUnusedStorageIds) {\n\t\t\tthis.redirectTable.delete(storageId);\n\t\t}\n\t}\n\n\t/**\n\t * Verifies that the blob with given id is not deleted, i.e., it has not been garbage collected. If the blob is GC'd,\n\t * log an error and throw if necessary.\n\t */\n\tprivate verifyBlobNotDeleted(blobId: string): void {\n\t\tif (!this.isBlobDeleted(getGCNodePathFromBlobId(blobId))) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst request = { url: blobId };\n\t\tconst error = responseToException(\n\t\t\tcreateResponseError(404, `Blob was deleted`, request),\n\t\t\trequest,\n\t\t);\n\t\t// Only log deleted events. Tombstone events are logged by garbage collector.\n\t\tthis.mc.logger.sendErrorEvent(\n\t\t\t{\n\t\t\t\teventName: \"GC_Deleted_Blob_Requested\",\n\t\t\t\tpkg: blobManagerBasePath,\n\t\t\t},\n\t\t\terror,\n\t\t);\n\t\tthrow error;\n\t}\n\n\tpublic setRedirectTable(table: Map<string, string>): void {\n\t\tassert(\n\t\t\tthis.runtime.attachState === AttachState.Detached,\n\t\t\t0x252 /* \"redirect table can only be set in detached container\" */,\n\t\t);\n\t\tassert(\n\t\t\tthis.redirectTable.size === table.size,\n\t\t\t0x391 /* Redirect table size must match BlobManager's local ID count */,\n\t\t);\n\t\tfor (const [localId, storageId] of table) {\n\t\t\tassert(this.redirectTable.has(localId), 0x254 /* \"unrecognized id in redirect table\" */);\n\t\t\tthis.setRedirection(localId, storageId);\n\t\t\t// set identity (id -> id) entry\n\t\t\tthis.setRedirection(storageId, storageId);\n\t\t}\n\t}\n\n\t/**\n\t * To be used in getPendingLocalState flow. Get a serializable record of the blobs that are\n\t * pending upload and/or their BlobAttach op, which can be given to a new BlobManager to\n\t * resume work.\n\t *\n\t * @privateRemarks\n\t * For now, we don't track any pending blobs since the getPendingBlobs flow doesn't enable\n\t * restoring to a state where an accessible handle has been stored by the customer (and we'll\n\t * just drop any BlobAttach ops on the ground during reSubmit). However, once we add support\n\t * for payload-pending handles, this will return the blobs associated with those handles.\n\t */\n\tpublic getPendingBlobs(): IPendingBlobs | undefined {\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Part of container serialization when imminent closure is enabled (Currently when calling closeAndGetPendingLocalState).\n\t * This asynchronous function resolves all pending createBlob calls and waits for each blob\n\t * to be attached. It will also send BlobAttach ops for each pending blob that hasn't sent it\n\t * yet so that serialized container can resubmit them when rehydrated.\n\t *\n\t * @param stopBlobAttachingSignal - Optional signal to abort the blob attaching process.\n\t * @returns - A promise that resolves with the details of the attached blobs,\n\t * or undefined if no blobs were processed.\n\t */\n\tpublic async attachAndGetPendingBlobs(\n\t\tstopBlobAttachingSignal?: AbortSignal,\n\t): Promise<IPendingBlobs | undefined> {\n\t\tthrow new UsageError(\"attachAndGetPendingBlobs is no longer supported\");\n\t}\n}\n\n/**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<blobManagerBasePath>/<blobId>`.\n * This path must match the path of the blob handle returned by the createBlob API because blobs are marked\n * referenced by storing these handles in a referenced DDS.\n */\nconst getGCNodePathFromBlobId = (blobId: string): string =>\n\t`/${blobManagerBasePath}/${blobId}`;\n\n/**\n * For a given GC node path, return the blobId. The node path is of the format `/<basePath>/<blobId>`.\n */\nconst getBlobIdFromGCNodePath = (nodePath: string): string => {\n\tconst pathParts = nodePath.split(\"/\");\n\tassert(areBlobPathParts(pathParts), 0x5bd /* Invalid blob node path */);\n\treturn pathParts[2];\n};\n\n/**\n * Returns whether a given path is for attachment blobs that are in the format - \"/blobManagerBasePath/...\".\n */\nexport const isBlobPath = (path: string): path is `/${typeof blobManagerBasePath}/${string}` =>\n\tareBlobPathParts(path.split(\"/\"));\n\nconst areBlobPathParts = (\n\tpathParts: string[],\n): pathParts is [\"\", typeof blobManagerBasePath, string] =>\n\tpathParts.length === 3 && pathParts[1] === blobManagerBasePath;\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { type MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
6
|
+
import type { ContainerRuntimeOptionsInternal } from "./containerRuntime.js";
|
|
7
|
+
/**
|
|
8
|
+
* Subset of the {@link ContainerRuntimeOptionsInternal} properties which
|
|
9
|
+
* affect {@link IDocumentSchemaFeatures}.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* When a new option is added to {@link ContainerRuntimeOptionsInternal}, we
|
|
13
|
+
* must consider if it changes the DocumentSchema. If so, then a corresponding
|
|
14
|
+
* entry must be added to {@link runtimeOptionsAffectingDocSchemaConfigMap}
|
|
15
|
+
* below. If not, then it must be omitted from this type.
|
|
16
|
+
*
|
|
17
|
+
* Note: `Omit` is used instead of `Pick` to ensure that all new options are
|
|
18
|
+
* included in this type by default. If any new properties are added to
|
|
19
|
+
* {@link ContainerRuntimeOptionsInternal}, they will be included in this
|
|
20
|
+
* type unless explicitly omitted. This will prevent us from forgetting to
|
|
21
|
+
* account for any new properties in the future.
|
|
22
|
+
*/
|
|
23
|
+
export type RuntimeOptionsAffectingDocSchema = Omit<ContainerRuntimeOptionsInternal, "chunkSizeInBytes" | "maxBatchSizeInBytes" | "loadSequenceNumberVerification" | "summaryOptions">;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the default RuntimeOptionsAffectingDocSchema configuration for a given minVersionForCollab.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getMinVersionForCollabDefaults(minVersionForCollab: MinimumVersionForCollab): RuntimeOptionsAffectingDocSchema;
|
|
28
|
+
/**
|
|
29
|
+
* Validates if the runtime options passed in from the user are compatible with the minVersionForCollab.
|
|
30
|
+
* For example, if a user sets the `enableGroupedBatching` option to true, but the minVersionForCollab
|
|
31
|
+
* is set to "1.0.0", then we should throw a UsageError since 1.x clients do not support batching.
|
|
32
|
+
* */
|
|
33
|
+
export declare function validateRuntimeOptions(minVersionForCollab: MinimumVersionForCollab, runtimeOptions: Partial<ContainerRuntimeOptionsInternal>): void;
|
|
34
|
+
//# sourceMappingURL=containerCompatibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerCompatibility.d.ts","sourceRoot":"","sources":["../src/containerCompatibility.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,KAAK,uBAAuB,EAC5B,MAAM,8CAA8C,CAAC;AAatD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAE7E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAClD,+BAA+B,EAC7B,kBAAkB,GAClB,qBAAqB,GACrB,gCAAgC,GAChC,gBAAgB,CAClB,CAAC;AAsGF;;GAEG;AACH,wBAAgB,8BAA8B,CAC7C,mBAAmB,EAAE,uBAAuB,GAC1C,gCAAgC,CAOlC;AAED;;;;KAIK;AACL,wBAAgB,sBAAsB,CACrC,mBAAmB,EAAE,uBAAuB,EAC5C,cAAc,EAAE,OAAO,CAAC,+BAA+B,CAAC,GACtD,IAAI,CAMN"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.validateRuntimeOptions = exports.getMinVersionForCollabDefaults = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/runtime-definitions/internal");
|
|
9
|
+
const internal_2 = require("@fluidframework/runtime-utils/internal");
|
|
10
|
+
const compressionDefinitions_js_1 = require("./compressionDefinitions.js");
|
|
11
|
+
/**
|
|
12
|
+
* Mapping of RuntimeOptionsAffectingDocSchema to their compatibility related configs.
|
|
13
|
+
*
|
|
14
|
+
* Each key in this map corresponds to a property in RuntimeOptionsAffectingDocSchema. The value is an object that maps MinimumVersionForCollab
|
|
15
|
+
* to the appropriate default value for that property to supporting that MinimumVersionForCollab. If clients running MinimumVersionForCollab X are able to understand
|
|
16
|
+
* the format changes introduced by the property, then the default value for that MinimumVersionForCollab will enable the feature associated with the property.
|
|
17
|
+
* Otherwise, the feature will be disabled.
|
|
18
|
+
*
|
|
19
|
+
* For example if the minVersionForCollab is a 1.x version (i.e. "1.5.0"), then the default value for `enableGroupedBatching` will be false since 1.x
|
|
20
|
+
* clients do not understand the document format when batching is enabled. If the minVersionForCollab is a 2.x client (i.e. "2.0.0" or later), then the
|
|
21
|
+
* default value for `enableGroupedBatching` will be true because clients running 2.0 or later will be able to understand the format changes associated
|
|
22
|
+
* with the batching feature.
|
|
23
|
+
*/
|
|
24
|
+
const runtimeOptionsAffectingDocSchemaConfigMap = {
|
|
25
|
+
enableGroupedBatching: {
|
|
26
|
+
"1.0.0": false,
|
|
27
|
+
"2.0.0-defaults": true,
|
|
28
|
+
},
|
|
29
|
+
compressionOptions: {
|
|
30
|
+
"1.0.0": compressionDefinitions_js_1.disabledCompressionConfig,
|
|
31
|
+
"2.0.0-defaults": compressionDefinitions_js_1.enabledCompressionConfig,
|
|
32
|
+
},
|
|
33
|
+
enableRuntimeIdCompressor: {
|
|
34
|
+
// For IdCompressorMode, `undefined` represents a logical state (off).
|
|
35
|
+
// However, to satisfy the Required<> constraint while
|
|
36
|
+
// `exactOptionalPropertyTypes` is `false` (TODO: AB#8215), we need
|
|
37
|
+
// to have it defined, so we trick the type checker here.
|
|
38
|
+
"1.0.0": undefined,
|
|
39
|
+
// We do not yet want to enable idCompressor by default since it will
|
|
40
|
+
// increase bundle sizes, and not all customers will benefit from it.
|
|
41
|
+
// Therefore, we will require customers to explicitly enable it. We
|
|
42
|
+
// are keeping it as a DocSchema affecting option for now as this may
|
|
43
|
+
// change in the future.
|
|
44
|
+
},
|
|
45
|
+
explicitSchemaControl: {
|
|
46
|
+
"1.0.0": false,
|
|
47
|
+
// This option's intention is to prevent 1.x clients from joining sessions
|
|
48
|
+
// when enabled. This is set to true when the minVersionForCollab is set
|
|
49
|
+
// to >=2.0.0 (explicitly). This is different than other 2.0 defaults
|
|
50
|
+
// because it was not enabled by default prior to the implementation of
|
|
51
|
+
// `minVersionForCollab`.
|
|
52
|
+
// `defaultMinVersionForCollab` is set to "2.0.0-defaults" which "2.0.0"
|
|
53
|
+
// does not satisfy to avoiding enabling this option by default as of
|
|
54
|
+
// `minVersionForCollab` introduction, which could be unexpected.
|
|
55
|
+
// Only enable as a default when `minVersionForCollab` is specified at
|
|
56
|
+
// 2.0.0+.
|
|
57
|
+
"2.0.0": true,
|
|
58
|
+
},
|
|
59
|
+
flushMode: {
|
|
60
|
+
// Note: 1.x clients are compatible with TurnBased flushing, but here we elect to remain on Immediate flush mode
|
|
61
|
+
// as a work-around for inability to send batches larger than 1Mb. Immediate flushing keeps batches smaller as
|
|
62
|
+
// fewer messages will be included per flush.
|
|
63
|
+
"1.0.0": internal_1.FlushMode.Immediate,
|
|
64
|
+
"2.0.0-defaults": internal_1.FlushMode.TurnBased,
|
|
65
|
+
},
|
|
66
|
+
gcOptions: {
|
|
67
|
+
"1.0.0": {},
|
|
68
|
+
// Although sweep is supported in 2.x, it is disabled by default until minVersionForCollab>=3.0.0 to be extra safe.
|
|
69
|
+
"3.0.0": { enableGCSweep: true },
|
|
70
|
+
},
|
|
71
|
+
createBlobPayloadPending: {
|
|
72
|
+
// This feature is new and disabled by default. In the future we will enable it by default, but we have not
|
|
73
|
+
// closed on the version where that will happen yet. Probably a .10 release since blob functionality is not
|
|
74
|
+
// exposed on the `@public` API surface.
|
|
75
|
+
"1.0.0": undefined,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
const runtimeOptionsAffectingDocSchemaConfigValidationMap = {
|
|
79
|
+
enableGroupedBatching: (0, internal_2.configValueToMinVersionForCollab)([
|
|
80
|
+
[false, "1.0.0"],
|
|
81
|
+
[true, "2.0.0-defaults"],
|
|
82
|
+
]),
|
|
83
|
+
compressionOptions: (0, internal_2.configValueToMinVersionForCollab)([
|
|
84
|
+
[{ ...compressionDefinitions_js_1.disabledCompressionConfig }, "1.0.0"],
|
|
85
|
+
[{ ...compressionDefinitions_js_1.enabledCompressionConfig }, "2.0.0-defaults"],
|
|
86
|
+
]),
|
|
87
|
+
enableRuntimeIdCompressor: (0, internal_2.configValueToMinVersionForCollab)([
|
|
88
|
+
[undefined, "1.0.0"],
|
|
89
|
+
["on", "2.0.0-defaults"],
|
|
90
|
+
["delayed", "2.0.0-defaults"],
|
|
91
|
+
]),
|
|
92
|
+
explicitSchemaControl: (0, internal_2.configValueToMinVersionForCollab)([
|
|
93
|
+
[false, "1.0.0"],
|
|
94
|
+
[true, "2.0.0-defaults"],
|
|
95
|
+
]),
|
|
96
|
+
flushMode: (0, internal_2.configValueToMinVersionForCollab)([
|
|
97
|
+
[internal_1.FlushMode.Immediate, "1.0.0"],
|
|
98
|
+
[internal_1.FlushMode.TurnBased, "2.0.0-defaults"],
|
|
99
|
+
]),
|
|
100
|
+
gcOptions: (0, internal_2.configValueToMinVersionForCollab)([
|
|
101
|
+
[{ enableGCSweep: undefined }, "1.0.0"],
|
|
102
|
+
[{ enableGCSweep: true }, "2.0.0-defaults"],
|
|
103
|
+
]),
|
|
104
|
+
createBlobPayloadPending: (0, internal_2.configValueToMinVersionForCollab)([
|
|
105
|
+
[undefined, "1.0.0"],
|
|
106
|
+
[true, "2.40.0"],
|
|
107
|
+
]),
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Returns the default RuntimeOptionsAffectingDocSchema configuration for a given minVersionForCollab.
|
|
111
|
+
*/
|
|
112
|
+
function getMinVersionForCollabDefaults(minVersionForCollab) {
|
|
113
|
+
return (0, internal_2.getConfigsForMinVersionForCollab)(minVersionForCollab, runtimeOptionsAffectingDocSchemaConfigMap);
|
|
114
|
+
}
|
|
115
|
+
exports.getMinVersionForCollabDefaults = getMinVersionForCollabDefaults;
|
|
116
|
+
/**
|
|
117
|
+
* Validates if the runtime options passed in from the user are compatible with the minVersionForCollab.
|
|
118
|
+
* For example, if a user sets the `enableGroupedBatching` option to true, but the minVersionForCollab
|
|
119
|
+
* is set to "1.0.0", then we should throw a UsageError since 1.x clients do not support batching.
|
|
120
|
+
* */
|
|
121
|
+
function validateRuntimeOptions(minVersionForCollab, runtimeOptions) {
|
|
122
|
+
(0, internal_2.getValidationForRuntimeOptions)(minVersionForCollab, runtimeOptions, runtimeOptionsAffectingDocSchemaConfigValidationMap);
|
|
123
|
+
}
|
|
124
|
+
exports.validateRuntimeOptions = validateRuntimeOptions;
|
|
125
|
+
//# sourceMappingURL=containerCompatibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"containerCompatibility.js","sourceRoot":"","sources":["../src/containerCompatibility.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAGsD;AACtD,qEAMgD;AAEhD,2EAGqC;AA2BrC;;;;;;;;;;;;GAYG;AACH,MAAM,yCAAyC,GAAG;IACjD,qBAAqB,EAAE;QACtB,OAAO,EAAE,KAAK;QACd,gBAAgB,EAAE,IAAI;KACtB;IACD,kBAAkB,EAAE;QACnB,OAAO,EAAE,qDAAyB;QAClC,gBAAgB,EAAE,oDAAwB;KAC1C;IACD,yBAAyB,EAAE;QAC1B,sEAAsE;QACtE,sDAAsD;QACtD,mEAAmE;QACnE,yDAAyD;QACzD,OAAO,EAAE,SAAS;QAClB,qEAAqE;QACrE,qEAAqE;QACrE,mEAAmE;QACnE,qEAAqE;QACrE,wBAAwB;KACxB;IACD,qBAAqB,EAAE;QACtB,OAAO,EAAE,KAAK;QACd,0EAA0E;QAC1E,wEAAwE;QACxE,qEAAqE;QACrE,uEA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AAC;KACvC,CAAC;IACF,SAAS,EAAE,IAAA,2CAAgC,EAAC;QAC3C,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC;QACvC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,gBAAgB,CAAC;KAC3C,CAAC;IACF,wBAAwB,EAAE,IAAA,2CAAgC,EAAC;QAC1D,CAAC,SAAS,EAAE,OAAO,CAAC;QACpB,CAAC,IAAI,EAAE,QAAQ,CAAC;KAChB,CAAC;CACuE,CAAC;AAE3E;;GAEG;AACH,SAAgB,8BAA8B,CAC7C,mBAA4C;IAE5C,OAAO,IAAA,2CAAgC,EACtC,mBAAmB,EACnB,yCAAyC,CAGL,CAAC;AACvC,CAAC;AATD,wEASC;AAED;;;;KAIK;AACL,SAAgB,sBAAsB,CACrC,mBAA4C,EAC5C,cAAwD;IAExD,IAAA,yCAA8B,EAC7B,mBAAmB,EACnB,cAA2D,EAC3D,mDAAmD,CACnD,CAAC;AACH,CAAC;AATD,wDASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tFlushMode,\n\ttype MinimumVersionForCollab,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tconfigValueToMinVersionForCollab,\n\tgetConfigsForMinVersionForCollab,\n\tgetValidationForRuntimeOptions,\n\ttype ConfigMap,\n\ttype ConfigValidationMap,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport {\n\tdisabledCompressionConfig,\n\tenabledCompressionConfig,\n} from \"./compressionDefinitions.js\";\nimport type { ContainerRuntimeOptionsInternal } from \"./containerRuntime.js\";\n\n/**\n * Subset of the {@link ContainerRuntimeOptionsInternal} properties which\n * affect {@link IDocumentSchemaFeatures}.\n *\n * @remarks\n * When a new option is added to {@link ContainerRuntimeOptionsInternal}, we\n * must consider if it changes the DocumentSchema. If so, then a corresponding\n * entry must be added to {@link runtimeOptionsAffectingDocSchemaConfigMap}\n * below. If not, then it must be omitted from this type.\n *\n * Note: `Omit` is used instead of `Pick` to ensure that all new options are\n * included in this type by default. If any new properties are added to\n * {@link ContainerRuntimeOptionsInternal}, they will be included in this\n * type unless explicitly omitted. This will prevent us from forgetting to\n * account for any new properties in the future.\n */\nexport type RuntimeOptionsAffectingDocSchema = Omit<\n\tContainerRuntimeOptionsInternal,\n\t| \"chunkSizeInBytes\"\n\t| \"maxBatchSizeInBytes\"\n\t| \"loadSequenceNumberVerification\"\n\t| \"summaryOptions\"\n>;\n\n/**\n * Mapping of RuntimeOptionsAffectingDocSchema to their compatibility related configs.\n *\n * Each key in this map corresponds to a property in RuntimeOptionsAffectingDocSchema. The value is an object that maps MinimumVersionForCollab\n * to the appropriate default value for that property to supporting that MinimumVersionForCollab. If clients running MinimumVersionForCollab X are able to understand\n * the format changes introduced by the property, then the default value for that MinimumVersionForCollab will enable the feature associated with the property.\n * Otherwise, the feature will be disabled.\n *\n * For example if the minVersionForCollab is a 1.x version (i.e. \"1.5.0\"), then the default value for `enableGroupedBatching` will be false since 1.x\n * clients do not understand the document format when batching is enabled. If the minVersionForCollab is a 2.x client (i.e. \"2.0.0\" or later), then the\n * default value for `enableGroupedBatching` will be true because clients running 2.0 or later will be able to understand the format changes associated\n * with the batching feature.\n */\nconst runtimeOptionsAffectingDocSchemaConfigMap = {\n\tenableGroupedBatching: {\n\t\t\"1.0.0\": false,\n\t\t\"2.0.0-defaults\": true,\n\t},\n\tcompressionOptions: {\n\t\t\"1.0.0\": disabledCompressionConfig,\n\t\t\"2.0.0-defaults\": enabledCompressionConfig,\n\t},\n\tenableRuntimeIdCompressor: {\n\t\t// For IdCompressorMode, `undefined` represents a logical state (off).\n\t\t// However, to satisfy the Required<> constraint while\n\t\t// `exactOptionalPropertyTypes` is `false` (TODO: AB#8215), we need\n\t\t// to have it defined, so we trick the type checker here.\n\t\t\"1.0.0\": undefined,\n\t\t// We do not yet want to enable idCompressor by default since it will\n\t\t// increase bundle sizes, and not all customers will benefit from it.\n\t\t// Therefore, we will require customers to explicitly enable it. We\n\t\t// are keeping it as a DocSchema affecting option for now as this may\n\t\t// change in the future.\n\t},\n\texplicitSchemaControl: {\n\t\t\"1.0.0\": false,\n\t\t// This option's intention is to prevent 1.x clients from joining sessions\n\t\t// when enabled. This is set to true when the minVersionForCollab is set\n\t\t// to >=2.0.0 (explicitly). This is different than other 2.0 defaults\n\t\t// because it was not enabled by default prior to the implementation of\n\t\t// `minVersionForCollab`.\n\t\t// `defaultMinVersionForCollab` is set to \"2.0.0-defaults\" which \"2.0.0\"\n\t\t// does not satisfy to avoiding enabling this option by default as of\n\t\t// `minVersionForCollab` introduction, which could be unexpected.\n\t\t// Only enable as a default when `minVersionForCollab` is specified at\n\t\t// 2.0.0+.\n\t\t\"2.0.0\": true,\n\t},\n\tflushMode: {\n\t\t// Note: 1.x clients are compatible with TurnBased flushing, but here we elect to remain on Immediate flush mode\n\t\t// as a work-around for inability to send batches larger than 1Mb. Immediate flushing keeps batches smaller as\n\t\t// fewer messages will be included per flush.\n\t\t\"1.0.0\": FlushMode.Immediate,\n\t\t\"2.0.0-defaults\": FlushMode.TurnBased,\n\t},\n\tgcOptions: {\n\t\t\"1.0.0\": {},\n\t\t// Although sweep is supported in 2.x, it is disabled by default until minVersionForCollab>=3.0.0 to be extra safe.\n\t\t\"3.0.0\": { enableGCSweep: true },\n\t},\n\tcreateBlobPayloadPending: {\n\t\t// This feature is new and disabled by default. In the future we will enable it by default, but we have not\n\t\t// closed on the version where that will happen yet. Probably a .10 release since blob functionality is not\n\t\t// exposed on the `@public` API surface.\n\t\t\"1.0.0\": undefined,\n\t},\n} as const satisfies ConfigMap<RuntimeOptionsAffectingDocSchema>;\n\nconst runtimeOptionsAffectingDocSchemaConfigValidationMap = {\n\tenableGroupedBatching: configValueToMinVersionForCollab([\n\t\t[false, \"1.0.0\"],\n\t\t[true, \"2.0.0-defaults\"],\n\t]),\n\tcompressionOptions: configValueToMinVersionForCollab([\n\t\t[{ ...disabledCompressionConfig }, \"1.0.0\"],\n\t\t[{ ...enabledCompressionConfig }, \"2.0.0-defaults\"],\n\t]),\n\tenableRuntimeIdCompressor: configValueToMinVersionForCollab([\n\t\t[undefined, \"1.0.0\"],\n\t\t[\"on\", \"2.0.0-defaults\"],\n\t\t[\"delayed\", \"2.0.0-defaults\"],\n\t]),\n\texplicitSchemaControl: configValueToMinVersionForCollab([\n\t\t[false, \"1.0.0\"],\n\t\t[true, \"2.0.0-defaults\"],\n\t]),\n\tflushMode: configValueToMinVersionForCollab([\n\t\t[FlushMode.Immediate, \"1.0.0\"],\n\t\t[FlushMode.TurnBased, \"2.0.0-defaults\"],\n\t]),\n\tgcOptions: configValueToMinVersionForCollab([\n\t\t[{ enableGCSweep: undefined }, \"1.0.0\"],\n\t\t[{ enableGCSweep: true }, \"2.0.0-defaults\"],\n\t]),\n\tcreateBlobPayloadPending: configValueToMinVersionForCollab([\n\t\t[undefined, \"1.0.0\"],\n\t\t[true, \"2.40.0\"],\n\t]),\n} as const satisfies ConfigValidationMap<RuntimeOptionsAffectingDocSchema>;\n\n/**\n * Returns the default RuntimeOptionsAffectingDocSchema configuration for a given minVersionForCollab.\n */\nexport function getMinVersionForCollabDefaults(\n\tminVersionForCollab: MinimumVersionForCollab,\n): RuntimeOptionsAffectingDocSchema {\n\treturn getConfigsForMinVersionForCollab(\n\t\tminVersionForCollab,\n\t\truntimeOptionsAffectingDocSchemaConfigMap,\n\t\t// This is a bad cast away from Partial that getConfigsForCompatMode provides.\n\t\t// ConfigMap should be restructured to provide RuntimeOptionsAffectingDocSchema guarantee.\n\t) as RuntimeOptionsAffectingDocSchema;\n}\n\n/**\n * Validates if the runtime options passed in from the user are compatible with the minVersionForCollab.\n * For example, if a user sets the `enableGroupedBatching` option to true, but the minVersionForCollab\n * is set to \"1.0.0\", then we should throw a UsageError since 1.x clients do not support batching.\n * */\nexport function validateRuntimeOptions(\n\tminVersionForCollab: MinimumVersionForCollab,\n\truntimeOptions: Partial<ContainerRuntimeOptionsInternal>,\n): void {\n\tgetValidationForRuntimeOptions<RuntimeOptionsAffectingDocSchema>(\n\t\tminVersionForCollab,\n\t\truntimeOptions as Partial<RuntimeOptionsAffectingDocSchema>,\n\t\truntimeOptionsAffectingDocSchemaConfigValidationMap,\n\t);\n}\n"]}
|
|
@@ -6,20 +6,20 @@ import type { ILayerCompatDetails, IProvideLayerCompatDetails } from "@fluid-int
|
|
|
6
6
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
7
7
|
import type { IAudience, ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
8
8
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
9
|
-
import type { IContainerContext, IGetPendingLocalStateProps, IRuntime, IDeltaManager } from "@fluidframework/container-definitions/internal";
|
|
9
|
+
import type { IContainerContext, IGetPendingLocalStateProps, IRuntime, IDeltaManager, IContainerStorageService } from "@fluidframework/container-definitions/internal";
|
|
10
10
|
import type { ContainerExtensionFactory, ContainerExtensionId, ExtensionRuntimeProperties, IContainerRuntime, IContainerRuntimeEvents, IContainerRuntimeInternal, IContainerRuntimeWithResolveHandle_Deprecated } from "@fluidframework/container-runtime-definitions/internal";
|
|
11
11
|
import type { FluidObject, IFluidHandle, IRequest, IResponse, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
12
|
-
import type { IFluidHandleContext, IFluidHandleInternal, IProvideFluidHandleContext, ISignalEnvelope,
|
|
12
|
+
import type { IFluidHandleContext, IFluidHandleInternal, IProvideFluidHandleContext, ISignalEnvelope, OpaqueJsonDeserialized, TypedMessage } from "@fluidframework/core-interfaces/internal";
|
|
13
13
|
import type { IClientDetails, IQuorumClients, ISummaryTree } from "@fluidframework/driver-definitions";
|
|
14
|
-
import type {
|
|
14
|
+
import type { IDocumentMessage, ISequencedDocumentMessage, ISignalMessage, ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
15
15
|
import { MessageType } from "@fluidframework/driver-definitions/internal";
|
|
16
16
|
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
17
17
|
import type { IIdCompressorCore, SerializedIdCompressorWithOngoingSession } from "@fluidframework/id-compressor/internal";
|
|
18
18
|
import type { ISummaryTreeWithStats, ITelemetryContext, IGarbageCollectionData, CreateChildSummarizerNodeParam, IDataStore, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, NamedFluidDataStoreRegistryEntries, SummarizeInternalFn, ISummarizerNodeWithGC, StageControlsExperimental, IContainerRuntimeBaseExperimental, IFluidParentContext } from "@fluidframework/runtime-definitions/internal";
|
|
19
|
-
import { FlushMode } from "@fluidframework/runtime-definitions/internal";
|
|
19
|
+
import { FlushMode, type MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
|
|
20
|
+
import { type SemanticVersion } from "@fluidframework/runtime-utils/internal";
|
|
20
21
|
import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
21
22
|
import { IPendingBlobs, type IBlobManagerLoadInfo } from "./blobManager/index.js";
|
|
22
|
-
import { type MinimumVersionForCollab, type SemanticVersion } from "./compatUtils.js";
|
|
23
23
|
import type { ICompressionRuntimeOptions } from "./compressionDefinitions.js";
|
|
24
24
|
import { GCNodeType, IGCRuntimeOptions, IGCStats, type IGarbageCollectionRuntime } from "./gc/index.js";
|
|
25
25
|
import { ContainerMessageType, type LocalContainerRuntimeMessage } from "./messageTypes.js";
|
|
@@ -52,7 +52,7 @@ export interface ISummaryRuntimeOptions {
|
|
|
52
52
|
*
|
|
53
53
|
* @privateRemarks If any new properties are added to this interface (or
|
|
54
54
|
* {@link IContainerRuntimeOptionsInternal}), then we will also need to make
|
|
55
|
-
* changes in {@link file://./
|
|
55
|
+
* changes in {@link file://./containerCompatibility.ts}.
|
|
56
56
|
* If the new property does not change the DocumentSchema, then it must be
|
|
57
57
|
* explicity omitted from {@link RuntimeOptionsAffectingDocSchema}.
|
|
58
58
|
* If it does change the DocumentSchema, then a corresponding entry must be
|
|
@@ -264,6 +264,13 @@ export declare const makeLegacySendBatchFn: (submitFn: (type: MessageType, conte
|
|
|
264
264
|
* We only want to log this once, to avoid spamming telemetry if we are wrong and these cases are hit commonly.
|
|
265
265
|
*/
|
|
266
266
|
export declare let getSingleUseLegacyLogCallback: (logger: ITelemetryLoggerExt, type: string) => (codePath: string) => void;
|
|
267
|
+
/**
|
|
268
|
+
* A {@link TypedMessage} that has unknown content explicitly
|
|
269
|
+
* noted as deserialized JSON.
|
|
270
|
+
*/
|
|
271
|
+
export interface UnknownIncomingTypedMessage extends TypedMessage {
|
|
272
|
+
content: OpaqueJsonDeserialized<unknown>;
|
|
273
|
+
}
|
|
267
274
|
type UnsequencedSignalEnvelope = Omit<ISignalEnvelope, "clientBroadcastSignalSequenceNumber">;
|
|
268
275
|
/**
|
|
269
276
|
* This object holds the parameters necessary for the {@link loadContainerRuntime} function.
|
|
@@ -380,12 +387,11 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
380
387
|
minVersionForCollab?: MinimumVersionForCollab;
|
|
381
388
|
}): Promise<ContainerRuntime>;
|
|
382
389
|
readonly options: Record<string | number, unknown>;
|
|
383
|
-
private imminentClosure;
|
|
384
390
|
private readonly _getClientId;
|
|
385
391
|
get clientId(): string | undefined;
|
|
386
392
|
readonly clientDetails: IClientDetails;
|
|
387
393
|
private readonly isSummarizerClient;
|
|
388
|
-
get storage():
|
|
394
|
+
get storage(): IContainerStorageService;
|
|
389
395
|
get containerRuntime(): ContainerRuntime;
|
|
390
396
|
private readonly submitSummaryFn;
|
|
391
397
|
private readonly submitSignalFn;
|
|
@@ -451,12 +457,9 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
451
457
|
private readonly offlineEnabled;
|
|
452
458
|
private flushScheduled;
|
|
453
459
|
private canSendOps;
|
|
460
|
+
private canSendSignals;
|
|
461
|
+
private readonly getConnectionState?;
|
|
454
462
|
private consecutiveReconnects;
|
|
455
|
-
/**
|
|
456
|
-
* Used to delay transition to "connected" state while we upload
|
|
457
|
-
* attachment blobs that were added while disconnected
|
|
458
|
-
*/
|
|
459
|
-
private delayConnectClientId?;
|
|
460
463
|
private readonly dataModelChangeRunner;
|
|
461
464
|
/**
|
|
462
465
|
* Invokes the given callback and expects that no ops are submitted
|
|
@@ -549,7 +552,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
549
552
|
private readonly skipSafetyFlushDuringProcessStack;
|
|
550
553
|
private readonly extensions;
|
|
551
554
|
/***/
|
|
552
|
-
protected constructor(context: IContainerContext, registry: IFluidDataStoreRegistry, metadata: IContainerRuntimeMetadata | undefined, electedSummarizerData: ISerializedElection | undefined, chunks: [string, string[]][], dataStoreAliasMap: [string, string][], runtimeOptions: Readonly<ContainerRuntimeOptionsInternal>, containerScope: FluidObject, baseLogger: ITelemetryBaseLogger, existing: boolean, blobManagerLoadInfo: IBlobManagerLoadInfo, _storage:
|
|
555
|
+
protected constructor(context: IContainerContext, registry: IFluidDataStoreRegistry, metadata: IContainerRuntimeMetadata | undefined, electedSummarizerData: ISerializedElection | undefined, chunks: [string, string[]][], dataStoreAliasMap: [string, string][], runtimeOptions: Readonly<ContainerRuntimeOptionsInternal>, containerScope: FluidObject, baseLogger: ITelemetryBaseLogger, existing: boolean, blobManagerLoadInfo: IBlobManagerLoadInfo, _storage: IContainerStorageService, createIdCompressorFn: () => IIdCompressor & IIdCompressorCore, documentsSchemaController: DocumentsSchemaController, featureGatesForTelemetry: Record<string, boolean | number | undefined>, provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>, minVersionForCollab: SemanticVersion, requestHandler?: ((request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>) | undefined, summaryConfiguration?: ISummaryConfiguration, recentBatchInfo?: [number, string][]);
|
|
553
556
|
onSchemaChange(schema: IDocumentSchemaCurrent): void;
|
|
554
557
|
getCreateChildSummarizerNodeFn(id: string, createParam: CreateChildSummarizerNodeParam): (summarizeInternal: SummarizeInternalFn, getGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>) => ISummarizerNodeWithGC;
|
|
555
558
|
deleteChildSummarizerNode(id: string): void;
|
|
@@ -620,6 +623,14 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
620
623
|
* @remarks The connection state from container context used here when raising connected events.
|
|
621
624
|
*/
|
|
622
625
|
private setConnectionStateCore;
|
|
626
|
+
/**
|
|
627
|
+
* Emits service connection events based on connection state changes.
|
|
628
|
+
*
|
|
629
|
+
* @remarks
|
|
630
|
+
* "connectedToService" is emitted when container connection state transitions to 'Connected' regardless of connection mode.
|
|
631
|
+
* "disconnectedFromService" excludes false "disconnected" events that happen when readonly client transitions to 'Connected'.
|
|
632
|
+
*/
|
|
633
|
+
private emitServiceConnectionEvents;
|
|
623
634
|
notifyOpReplay(message: ISequencedDocumentMessage): Promise<void>;
|
|
624
635
|
/**
|
|
625
636
|
* Processes the op.
|
|
@@ -667,7 +678,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
667
678
|
type: string;
|
|
668
679
|
content: ISignalEnvelope<{
|
|
669
680
|
type: string;
|
|
670
|
-
content:
|
|
681
|
+
content: OpaqueJsonDeserialized<unknown>;
|
|
671
682
|
}>;
|
|
672
683
|
}>, local: boolean): void;
|
|
673
684
|
private routeNonContainerSignal;
|
|
@@ -942,6 +953,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
942
953
|
summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults;
|
|
943
954
|
enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult;
|
|
944
955
|
private readonly lazyEventsForExtensions;
|
|
956
|
+
private getJoinedStatus;
|
|
945
957
|
private readonly submitExtensionSignal;
|
|
946
958
|
acquireExtension<T, TRuntimeProperties extends ExtensionRuntimeProperties, TUseContext extends unknown[]>(id: ContainerExtensionId, factory: ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>, ...useContext: TUseContext): T;
|
|
947
959
|
private get groupedBatchingEnabled();
|