@fluidframework/container-runtime 1.2.7 → 2.0.0-dev.1.3.0.96595
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/.mocharc.js +12 -0
- package/dist/batchManager.d.ts +37 -0
- package/dist/batchManager.d.ts.map +1 -0
- package/dist/batchManager.js +73 -0
- package/dist/batchManager.js.map +1 -0
- package/dist/batchTracker.d.ts +1 -2
- package/dist/batchTracker.d.ts.map +1 -1
- package/dist/batchTracker.js +2 -3
- package/dist/batchTracker.js.map +1 -1
- package/dist/blobManager.d.ts +87 -25
- package/dist/blobManager.d.ts.map +1 -1
- package/dist/blobManager.js +317 -99
- package/dist/blobManager.js.map +1 -1
- package/dist/containerRuntime.d.ts +109 -124
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +349 -542
- package/dist/containerRuntime.js.map +1 -1
- package/dist/dataStore.js +29 -24
- package/dist/dataStore.js.map +1 -1
- package/dist/dataStoreContext.d.ts +20 -14
- package/dist/dataStoreContext.d.ts.map +1 -1
- package/dist/dataStoreContext.js +49 -58
- package/dist/dataStoreContext.js.map +1 -1
- package/dist/dataStores.d.ts +12 -5
- package/dist/dataStores.d.ts.map +1 -1
- package/dist/dataStores.js +21 -20
- package/dist/dataStores.js.map +1 -1
- package/dist/deltaScheduler.d.ts +6 -4
- package/dist/deltaScheduler.d.ts.map +1 -1
- package/dist/deltaScheduler.js +6 -4
- package/dist/deltaScheduler.js.map +1 -1
- package/dist/garbageCollection.d.ts +74 -14
- package/dist/garbageCollection.d.ts.map +1 -1
- package/dist/garbageCollection.js +249 -170
- package/dist/garbageCollection.js.map +1 -1
- package/dist/gcSweepReadyUsageDetection.d.ts +53 -0
- package/dist/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/dist/gcSweepReadyUsageDetection.js +126 -0
- package/dist/gcSweepReadyUsageDetection.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/opProperties.d.ts +7 -0
- package/dist/opProperties.d.ts.map +1 -0
- package/dist/opProperties.js +20 -0
- package/dist/opProperties.js.map +1 -0
- package/dist/orderedClientElection.d.ts +28 -10
- package/dist/orderedClientElection.d.ts.map +1 -1
- package/dist/orderedClientElection.js +14 -4
- package/dist/orderedClientElection.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/pendingStateManager.d.ts +0 -11
- package/dist/pendingStateManager.d.ts.map +1 -1
- package/dist/pendingStateManager.js +24 -46
- package/dist/pendingStateManager.js.map +1 -1
- package/dist/runningSummarizer.d.ts +14 -4
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +68 -26
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/scheduleManager.d.ts +31 -0
- package/dist/scheduleManager.d.ts.map +1 -0
- package/dist/scheduleManager.js +243 -0
- package/dist/scheduleManager.js.map +1 -0
- package/dist/summarizer.d.ts +0 -2
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +1 -12
- package/dist/summarizer.js.map +1 -1
- package/dist/summarizerHeuristics.d.ts +26 -4
- package/dist/summarizerHeuristics.d.ts.map +1 -1
- package/dist/summarizerHeuristics.js +95 -18
- package/dist/summarizerHeuristics.js.map +1 -1
- package/dist/summarizerTypes.d.ts +45 -18
- package/dist/summarizerTypes.d.ts.map +1 -1
- package/dist/summarizerTypes.js +1 -1
- package/dist/summarizerTypes.js.map +1 -1
- package/dist/summaryCollection.d.ts +1 -0
- package/dist/summaryCollection.d.ts.map +1 -1
- package/dist/summaryCollection.js +31 -15
- package/dist/summaryCollection.js.map +1 -1
- package/dist/summaryFormat.d.ts +0 -5
- package/dist/summaryFormat.d.ts.map +1 -1
- package/dist/summaryFormat.js.map +1 -1
- package/dist/summaryGenerator.d.ts +1 -0
- package/dist/summaryGenerator.d.ts.map +1 -1
- package/dist/summaryGenerator.js +11 -9
- package/dist/summaryGenerator.js.map +1 -1
- package/dist/summaryManager.d.ts +2 -2
- package/dist/summaryManager.d.ts.map +1 -1
- package/dist/summaryManager.js +22 -7
- package/dist/summaryManager.js.map +1 -1
- package/lib/batchManager.d.ts +37 -0
- package/lib/batchManager.d.ts.map +1 -0
- package/lib/batchManager.js +69 -0
- package/lib/batchManager.js.map +1 -0
- package/lib/batchTracker.d.ts +1 -2
- package/lib/batchTracker.d.ts.map +1 -1
- package/lib/batchTracker.js +2 -3
- package/lib/batchTracker.js.map +1 -1
- package/lib/blobManager.d.ts +87 -25
- package/lib/blobManager.d.ts.map +1 -1
- package/lib/blobManager.js +319 -101
- package/lib/blobManager.js.map +1 -1
- package/lib/containerRuntime.d.ts +109 -124
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +355 -547
- package/lib/containerRuntime.js.map +1 -1
- package/lib/dataStore.js +29 -24
- package/lib/dataStore.js.map +1 -1
- package/lib/dataStoreContext.d.ts +20 -14
- package/lib/dataStoreContext.d.ts.map +1 -1
- package/lib/dataStoreContext.js +46 -55
- package/lib/dataStoreContext.js.map +1 -1
- package/lib/dataStores.d.ts +12 -5
- package/lib/dataStores.d.ts.map +1 -1
- package/lib/dataStores.js +21 -20
- package/lib/dataStores.js.map +1 -1
- package/lib/deltaScheduler.d.ts +6 -4
- package/lib/deltaScheduler.d.ts.map +1 -1
- package/lib/deltaScheduler.js +6 -4
- package/lib/deltaScheduler.js.map +1 -1
- package/lib/garbageCollection.d.ts +74 -14
- package/lib/garbageCollection.d.ts.map +1 -1
- package/lib/garbageCollection.js +238 -160
- package/lib/garbageCollection.js.map +1 -1
- package/lib/gcSweepReadyUsageDetection.d.ts +53 -0
- package/lib/gcSweepReadyUsageDetection.d.ts.map +1 -0
- package/lib/gcSweepReadyUsageDetection.js +121 -0
- package/lib/gcSweepReadyUsageDetection.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/opProperties.d.ts +7 -0
- package/lib/opProperties.d.ts.map +1 -0
- package/lib/opProperties.js +16 -0
- package/lib/opProperties.js.map +1 -0
- package/lib/orderedClientElection.d.ts +28 -10
- package/lib/orderedClientElection.d.ts.map +1 -1
- package/lib/orderedClientElection.js +14 -4
- package/lib/orderedClientElection.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/pendingStateManager.d.ts +0 -11
- package/lib/pendingStateManager.d.ts.map +1 -1
- package/lib/pendingStateManager.js +24 -46
- package/lib/pendingStateManager.js.map +1 -1
- package/lib/runningSummarizer.d.ts +14 -4
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +68 -26
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/scheduleManager.d.ts +31 -0
- package/lib/scheduleManager.d.ts.map +1 -0
- package/lib/scheduleManager.js +239 -0
- package/lib/scheduleManager.js.map +1 -0
- package/lib/summarizer.d.ts +0 -2
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +1 -12
- package/lib/summarizer.js.map +1 -1
- package/lib/summarizerHeuristics.d.ts +26 -4
- package/lib/summarizerHeuristics.d.ts.map +1 -1
- package/lib/summarizerHeuristics.js +95 -18
- package/lib/summarizerHeuristics.js.map +1 -1
- package/lib/summarizerTypes.d.ts +45 -18
- package/lib/summarizerTypes.d.ts.map +1 -1
- package/lib/summarizerTypes.js +1 -1
- package/lib/summarizerTypes.js.map +1 -1
- package/lib/summaryCollection.d.ts +1 -0
- package/lib/summaryCollection.d.ts.map +1 -1
- package/lib/summaryCollection.js +31 -15
- package/lib/summaryCollection.js.map +1 -1
- package/lib/summaryFormat.d.ts +0 -5
- package/lib/summaryFormat.d.ts.map +1 -1
- package/lib/summaryFormat.js.map +1 -1
- package/lib/summaryGenerator.d.ts +1 -0
- package/lib/summaryGenerator.d.ts.map +1 -1
- package/lib/summaryGenerator.js +11 -9
- package/lib/summaryGenerator.js.map +1 -1
- package/lib/summaryManager.d.ts +2 -2
- package/lib/summaryManager.d.ts.map +1 -1
- package/lib/summaryManager.js +22 -7
- package/lib/summaryManager.js.map +1 -1
- package/package.json +65 -24
- package/src/batchManager.ts +91 -0
- package/src/batchTracker.ts +2 -3
- package/src/blobManager.ts +385 -118
- package/src/containerRuntime.ts +529 -740
- package/src/dataStore.ts +49 -37
- package/src/dataStoreContext.ts +44 -56
- package/src/dataStores.ts +34 -30
- package/src/deltaScheduler.ts +6 -4
- package/src/garbageCollection.ts +297 -206
- package/src/gcSweepReadyUsageDetection.ts +139 -0
- package/src/index.ts +1 -2
- package/src/opProperties.ts +19 -0
- package/src/orderedClientElection.ts +31 -10
- package/src/packageVersion.ts +1 -1
- package/src/pendingStateManager.ts +27 -59
- package/src/runningSummarizer.ts +75 -22
- package/src/scheduleManager.ts +314 -0
- package/src/summarizer.ts +1 -18
- package/src/summarizerHeuristics.ts +133 -19
- package/src/summarizerTypes.ts +53 -18
- package/src/summaryCollection.ts +33 -18
- package/src/summaryFormat.ts +0 -6
- package/src/summaryGenerator.ts +40 -22
- package/src/summaryManager.ts +22 -7
- package/dist/opTelemetry.d.ts +0 -22
- package/dist/opTelemetry.d.ts.map +0 -1
- package/dist/opTelemetry.js +0 -59
- package/dist/opTelemetry.js.map +0 -1
- package/lib/opTelemetry.d.ts +0 -22
- package/lib/opTelemetry.d.ts.map +0 -1
- package/lib/opTelemetry.js +0 -55
- package/lib/opTelemetry.js.map +0 -1
- package/src/opTelemetry.ts +0 -71
package/lib/blobManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobManager.js","sourceRoot":"","sources":["../src/blobManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAA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;IAEM,gBAAgB,CAAC,KAA0B;QAC9C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EACpD,KAAK,CAAC,4DAA4D,CAAC,CAAC;QACxE,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzE,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE;YACtC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC9F,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;SAC/B;QACD,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACjG,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;;AAlQsB,oBAAQ,GAAG,QAAQ,CAAC;AACnB,iCAAqB,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle, IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { generateHandleContextPath, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, Deferred } from \"@fluidframework/common-utils\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n IGarbageCollectionData,\n ISummaryTreeWithStats,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\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 implements IFluidHandle<ArrayBufferLike> {\n private attached: boolean = false;\n\n public get IFluidHandle(): IFluidHandle { return this; }\n\n public get isAttached(): boolean {\n return this.attached;\n }\n\n public readonly absolutePath: string;\n\n constructor(\n public readonly path: string,\n public readonly routeContext: IFluidHandleContext,\n public get: () => Promise<any>,\n ) {\n this.absolutePath = generateHandleContextPath(path, this.routeContext);\n }\n\n public attachGraph() {\n this.attached = true;\n }\n\n public bind(handle: IFluidHandle) {\n throw new Error(\"Cannot bind to blob handle\");\n }\n}\n\n/**\n * Information from a snapshot needed to load BlobManager\n */\nexport interface IBlobManagerLoadInfo {\n ids?: string[];\n redirectTable?: [string, string][];\n}\n\nexport class BlobManager {\n public static readonly basePath = \"_blobs\";\n private static readonly redirectTableBlobName = \".redirectTable\";\n // uploaded blob IDs\n private readonly blobIds: Set<string> = new Set();\n // blobs for which upload is pending. maps to a promise that will resolve once the blob has been uploaded and a\n // BlobAttach op has round-tripped.\n private readonly pendingBlobIds: Map<string, Deferred<void>> = new Map();\n // blobs uploaded while detached; cleared upon attach\n private readonly detachedBlobIds: Set<string> = new Set();\n // map of detached blob IDs to IDs used by storage. used to support blob handles given out while detached\n private redirectTable: Map<string, string> | undefined;\n\n constructor(\n private readonly routeContext: IFluidHandleContext,\n snapshot: IBlobManagerLoadInfo,\n private readonly getStorage: () => IDocumentStorageService,\n private readonly attachBlobCallback: (blobId: string) => void,\n // To be called when a blob node is requested. blobPath is the path of the blob's node in GC's graph. It's\n // of the format `/<BlobManager.basePath>/<blobId>`.\n private readonly gcNodeUpdated: (blobPath: string) => void,\n private readonly runtime: IContainerRuntime,\n private readonly logger: ITelemetryLogger,\n ) {\n this.runtime.once(\"dispose\", () => {\n for (const promise of this.pendingBlobIds.values()) {\n promise.reject(new Error(\"runtime disposed while blobAttach op in flight\"));\n }\n });\n this.load(snapshot);\n }\n\n private hasBlob(id: string): boolean {\n return this.blobIds.has(id) || this.detachedBlobIds.has(id);\n }\n\n /**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<BlobManager.basePath>/<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 */\n private getBlobGCNodePath(blobId: string) {\n return `/${BlobManager.basePath}/${blobId}`;\n }\n\n public async getBlob(blobId: string): Promise<IFluidHandle<ArrayBufferLike>> {\n const storageId = this.redirectTable?.get(blobId) ?? blobId;\n assert(this.hasBlob(storageId), 0x11f /* \"requesting unknown blobs\" */);\n\n // When this blob is retrieved, let the container runtime know that the corresponding GC node got updated.\n this.gcNodeUpdated(this.getBlobGCNodePath(blobId));\n\n return new BlobHandle(\n `${BlobManager.basePath}/${storageId}`,\n this.routeContext,\n async () => PerformanceEvent.timedExecAsync(\n this.logger,\n { eventName: \"AttachmentReadBlob\", id: storageId },\n async () => {\n return this.getStorage().readBlob(storageId);\n },\n { end: true, cancel: \"error\" },\n ),\n );\n }\n\n public async createBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n if (this.runtime.attachState === AttachState.Attaching) {\n // blob upload is not supported in \"Attaching\" state\n this.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n await new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n }\n\n if (!this.runtime.connected && this.runtime.attachState === AttachState.Attached) {\n // see https://github.com/microsoft/FluidFramework/issues/8246\n // Avoid getting storage if we are offline since it might be undefined. In the future we will return\n // handles immediately while offline\n await new Promise((resolve) => this.runtime.once(\"connected\", resolve));\n }\n\n const response = await PerformanceEvent.timedExecAsync(\n this.logger,\n { eventName: \"createBlob\" },\n async () => this.getStorage().createBlob(blob),\n { end: true, cancel: \"error\" },\n );\n\n const handle = new BlobHandle(\n `${BlobManager.basePath}/${response.id}`,\n this.routeContext,\n // get() should go through BlobManager.getBlob() so handles created while detached can be redirected\n // to the correct storage id after they are uploaded\n async () => this.getBlob(response.id).then(async (h) => h.get()),\n );\n\n if (this.runtime.attachState === AttachState.Detached) {\n this.detachedBlobIds.add(response.id);\n return handle;\n }\n\n // Note - server will de-dup blobs, so we might get existing blobId!\n if (this.pendingBlobIds.has(response.id)) {\n await this.pendingBlobIds.get(response.id)?.promise;\n } else if (!this.blobIds.has(response.id)) {\n this.pendingBlobIds.set(response.id, new Deferred<void>());\n\n // send blob attach op and wait until we see it to return the handle\n this.attachBlobCallback(response.id);\n await this.pendingBlobIds.get(response.id)?.promise;\n }\n\n return handle;\n }\n\n public processBlobAttachOp(blobId: string, local: boolean) {\n if (local) {\n const pendingBlobP = this.pendingBlobIds.get(blobId);\n assert(pendingBlobP !== undefined, 0x1f8 /* \"local BlobAttach op with no pending blob\" */);\n pendingBlobP.resolve();\n this.pendingBlobIds.delete(blobId);\n }\n this.blobIds.add(blobId);\n }\n\n /**\n * Reads blobs needed to load BlobManager from storage.\n */\n public static async load(\n blobsTree: ISnapshotTree | undefined,\n tryFetchBlob: (id: string) => Promise<[string, string][]>,\n ): Promise<IBlobManagerLoadInfo> {\n if (!blobsTree) {\n return {};\n }\n let redirectTable;\n const tableId = blobsTree.blobs[this.redirectTableBlobName];\n if (tableId) {\n redirectTable = await tryFetchBlob(tableId);\n }\n const ids = Object.entries(blobsTree.blobs)\n .filter(([k, _]) => k !== this.redirectTableBlobName).map(([_, v]) => v);\n return { ids, redirectTable };\n }\n\n /**\n * Load a set of previously attached blob IDs from a previous snapshot. Note\n * that BlobManager tracking and reporting attached blobs is a temporary\n * solution since storage expects attached blobs to be reported and any that\n * are not reported as attached may be GCed. In the future attached blob\n * IDs will be collected at summarization time, and runtime will not care\n * about the existence or specific formatting of this tree in returned\n * snapshots.\n *\n * @param blobsTree - Tree containing IDs of previously attached blobs. This\n * corresponds to snapshot() below. We look for the IDs in the blob entries\n * of the tree since the both the r11s and SPO drivers replace the\n * attachment types returned in snapshot() with blobs.\n */\n private load(snapshot: IBlobManagerLoadInfo): void {\n if (snapshot.ids) {\n const detached = this.runtime.attachState === AttachState.Detached;\n snapshot.ids.map((entry) => detached ? this.detachedBlobIds.add(entry) : this.blobIds.add(entry));\n }\n if (snapshot.redirectTable) {\n this.redirectTable = new Map(snapshot.redirectTable);\n }\n this.logger.sendTelemetryEvent({\n eventName: \"AttachmentBlobsLoaded\",\n count: snapshot.ids?.length ?? 0,\n redirectTable: snapshot.redirectTable?.length,\n });\n }\n\n /**\n * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n * about this for now because the data is a simple list of blob ids.\n */\n public getGCData(fullGC: boolean = false): IGarbageCollectionData {\n const gcData: IGarbageCollectionData = { gcNodes: {} };\n\n this.blobIds.forEach((blobId: string) => {\n gcData.gcNodes[this.getBlobGCNodePath(blobId)] = [];\n });\n\n /**\n * For all blobs in the redirect table, the handle returned on creation is based off of the localId. So, these\n * nodes can be referenced by storing the localId handle. When that happens, the corresponding storageId node\n * must also be marked referenced. So, we add a route from the localId node to the storageId node.\n * Note that because of de-duping, there can be multiple localIds that all redirect to the same storageId or\n * a blob may be referenced via its storageId handle.\n */\n if (this.redirectTable !== undefined) {\n for (const [localId, storageId] of this.redirectTable) {\n // Add node for the localId and add a route to the storageId node. The storageId node will have been\n // added above when adding nodes for this.blobIds.\n gcData.gcNodes[this.getBlobGCNodePath(localId)] = [this.getBlobGCNodePath(storageId)];\n }\n }\n\n return gcData;\n }\n\n /**\n * When running GC in test mode, this is called to delete blobs that are unused.\n * @param unusedRoutes - These are the blob node ids that are unused and should be deleted.\n */\n public deleteUnusedRoutes(unusedRoutes: string[]): void {\n // The routes or blob node paths are in the same format as returned in getGCData -\n // `/<BlobManager.basePath>/<blobId>`.\n for (const route of unusedRoutes) {\n const pathParts = route.split(\"/\");\n assert(\n pathParts.length === 3 && pathParts[1] === BlobManager.basePath,\n 0x2d5 /* \"Invalid blob node id in unused routes.\" */,\n );\n const blobId = pathParts[2];\n\n // The unused blobId could be a localId. If so, remove it from the redirect table and continue. The\n // corresponding storageId may still be used either directly or via other localIds.\n if (this.redirectTable?.has(blobId)) {\n this.redirectTable.delete(blobId);\n continue;\n }\n this.blobIds.delete(blobId);\n }\n }\n\n public summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n // If we have a redirect table it means the container is about to transition to \"Attaching\" state, so we need\n // to return an actual snapshot containing all the real storage IDs we know about.\n const attachingOrAttached = !!this.redirectTable || this.runtime.attachState !== AttachState.Detached;\n const blobIds = attachingOrAttached ? this.blobIds : this.detachedBlobIds;\n const builder = new SummaryTreeBuilder();\n blobIds.forEach((blobId) => {\n builder.addAttachment(blobId);\n });\n\n if (this.redirectTable && this.redirectTable.size > 0) {\n builder.addBlob(\n BlobManager.redirectTableBlobName,\n JSON.stringify(Array.from(this.redirectTable.entries())),\n );\n }\n\n return builder.getSummaryTree();\n }\n\n public setRedirectTable(table: Map<string, string>) {\n assert(this.runtime.attachState === AttachState.Detached,\n 0x252 /* \"redirect table can only be set in detached container\" */);\n assert(!this.redirectTable, 0x253 /* \"redirect table already exists\" */);\n for (const [localId, storageId] of table) {\n assert(this.detachedBlobIds.delete(localId), 0x254 /* \"unrecognized id in redirect table\" */);\n this.blobIds.add(storageId);\n }\n assert(this.detachedBlobIds.size === 0, 0x255 /* \"detached blob id absent in redirect table\" */);\n this.redirectTable = table;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"blobManager.js","sourceRoot":"","sources":["../src/blobManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAE9F,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAA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KAAK,WAAW,CAAC,QAAQ,EACpD,KAAK,CAAC,4DAA4D,CAAC,CAAC;QACxE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,EACzC,KAAK,CAAC,iEAAiE,CAAC,CAAC;QAC7E,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,KAAK,EAAE;YACtC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;YACzF,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAC3C,gCAAgC;YAChC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;SAChD;IACL,CAAC;IAEM,eAAe;QAClB,MAAM,KAAK,GAAG,EAAE,CAAC;QACjB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE;YAC1C,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;SAC/D;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;;AAlesB,oBAAQ,GAAG,QAAQ,CAAC;AACnB,iCAAqB,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { IFluidHandle, IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport { ICreateBlobResponse, ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { generateHandleContextPath, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, bufferToString, Deferred, stringToBuffer, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { IContainerRuntime, IContainerRuntimeEvents } from \"@fluidframework/container-runtime-definitions\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { ChildLogger, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n IGarbageCollectionData,\n ISummaryTreeWithStats,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { Throttler, formExponentialFn, IThrottler } from \"./throttler\";\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 implements IFluidHandle<ArrayBufferLike> {\n private attached: boolean = false;\n\n public get IFluidHandle(): IFluidHandle { return this; }\n\n public get isAttached(): boolean {\n return this.attached;\n }\n\n public readonly absolutePath: string;\n\n constructor(\n public readonly path: string,\n public readonly routeContext: IFluidHandleContext,\n public get: () => Promise<any>,\n ) {\n this.absolutePath = generateHandleContextPath(path, this.routeContext);\n }\n\n public attachGraph() {\n this.attached = true;\n }\n\n public bind(handle: IFluidHandle) {\n throw new Error(\"Cannot bind to blob handle\");\n }\n}\n\nclass CancellableThrottler {\n constructor(private readonly throttler: IThrottler) { }\n private cancelP = new Deferred<void>();\n\n public async getDelay(): Promise<void> {\n return Promise.race([\n this.cancelP.promise,\n new Promise<void>((resolve) => setTimeout(resolve, this.throttler.getDelay())),\n ]);\n }\n\n public cancel() {\n this.cancelP.resolve();\n this.cancelP = new Deferred<void>();\n }\n}\n\n/**\n * Information from a snapshot needed to load BlobManager\n */\nexport interface IBlobManagerLoadInfo {\n ids?: string[];\n redirectTable?: [string, string][];\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 =\n Pick<IContainerRuntime, \"attachState\" | \"connected\" | \"logger\"> & TypedEventEmitter<IContainerRuntimeEvents>;\n\n// Note that while offline we \"submit\" an op before uploading the blob, but we always\n// expect blobs to be uploaded before we actually see the op round-trip\nenum PendingBlobStatus {\n OnlinePendingUpload,\n OnlinePendingOp,\n OfflinePendingUpload,\n OfflinePendingOp,\n}\n\ninterface PendingBlob {\n blob: ArrayBufferLike;\n status: PendingBlobStatus;\n storageId?: string;\n handleP: Deferred<IFluidHandle<ArrayBufferLike>>;\n uploadP: Promise<ICreateBlobResponse>;\n}\n\nexport interface IPendingBlobs { [id: string]: { blob: string; }; }\n\nexport class BlobManager {\n public static readonly basePath = \"_blobs\";\n private static readonly redirectTableBlobName = \".redirectTable\";\n private readonly logger: ITelemetryLogger;\n\n /**\n * Map of local (offline/detached) IDs to storage IDs. Contains identity entries\n * (id → id) for storage IDs, so all requested IDs should be a key in this map.\n * Blobs created while the container is detached are stored in IDetachedBlobStorage\n * which gives local IDs; the storage IDs are filled in at attach time.\n */\n private readonly redirectTable: Map<string, string | undefined>;\n\n /**\n * Blobs which have not been uploaded or for which we have not yet seen a BlobAttach op round-trip.\n * Until we see the op round-trip, there is a possibility we may need to re-upload the blob, so\n * we must save it. This is true for both the online and offline flow.\n */\n private readonly pendingBlobs: Map<string, PendingBlob> = new Map();\n\n /**\n * Track ops in flight for online flow. Used to avoid searching pendingBlobs since BlobAttach ops\n * don't include local ID in online flow.\n */\n private readonly opsInFlight: Map<string, string[]> = new Map();\n\n private readonly retryThrottler = new CancellableThrottler(new Throttler(\n 60 * 1000, // 60 sec delay window\n 30 * 1000, // 30 sec max delay\n // throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)\n formExponentialFn({ coefficient: 20, initialDelay: 0 }),\n ));\n\n constructor(\n private readonly routeContext: IFluidHandleContext,\n snapshot: IBlobManagerLoadInfo,\n private readonly getStorage: () => IDocumentStorageService,\n /**\n * Submit a BlobAttach op. When a blob is uploaded, there is a short grace period before which\n * the blob is deleted. The BlobAttach op notifies the server that blob is in use. The server\n * will then not delete the blob as long as it is listed as referenced in future summaries.\n * The summarizing client will know to include the storage ID in the summary when it sees the op.\n *\n * The op may also include a local ID to inform all clients of the relation to the storage\n * ID, without knowledge of which they cannot request the blob from storage. This is also\n * included in the redirect table in the summary.\n */\n private readonly sendBlobAttachOp: (storageId?: string, localId?: string) => void,\n // To be called when a blob node is requested. blobPath is the path of the blob's node in GC's graph. It's\n // of the format `/<BlobManager.basePath>/<blobId>`.\n private readonly gcNodeUpdated: (blobPath: string) => void,\n private readonly runtime: IBlobManagerRuntime,\n stashedBlobs: IPendingBlobs = {},\n ) {\n this.logger = ChildLogger.create(this.runtime.logger, \"BlobManager\");\n this.runtime.on(\"disconnected\", () => this.onDisconnected());\n this.redirectTable = this.load(snapshot);\n\n // Begin uploading stashed blobs from previous container instance\n Object.entries(stashedBlobs).forEach(([localId, entry]) => {\n const blob = stringToBuffer(entry.blob, \"base64\");\n this.pendingBlobs.set(localId, {\n blob,\n status: PendingBlobStatus.OfflinePendingUpload,\n handleP: new Deferred(),\n uploadP: this.uploadBlob(localId, blob),\n });\n });\n }\n\n private get pendingOfflineUploads() {\n return Array.from(this.pendingBlobs.values())\n .filter((e) => e.status === PendingBlobStatus.OfflinePendingUpload);\n }\n\n public get hasPendingOfflineUploads(): boolean {\n return this.pendingOfflineUploads.length > 0;\n }\n\n /**\n * Upload blobs added while offline. This must be completed before connecting and resubmitting ops.\n */\n public async onConnected() {\n this.retryThrottler.cancel();\n const pendingUploads = this.pendingOfflineUploads.map(async (e) => e.uploadP);\n await PerformanceEvent.timedExecAsync(this.logger, {\n eventName: \"BlobUploadOnConnected\",\n count: pendingUploads.length,\n }, async () => Promise.all(pendingUploads),\n { start: true, end: true },\n );\n }\n\n /**\n * Transition online blobs waiting for BlobAttach op round-trip since we will not see the op until we are connected\n * again\n */\n private onDisconnected() {\n for (const [localId, entry] of this.pendingBlobs) {\n if (entry.status === PendingBlobStatus.OnlinePendingOp) {\n // This will submit another BlobAttach op for this blob. This is necessary because the one we sent\n // already didn't have the local ID.\n this.transitionToOffline(localId);\n }\n }\n }\n\n /**\n * For a blobId, returns its path in GC's graph. The node path is of the format `/<BlobManager.basePath>/<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 */\n private getBlobGCNodePath(blobId: string) {\n return `/${BlobManager.basePath}/${blobId}`;\n }\n\n /**\n * Set of actual storage IDs (i.e., IDs that can be requested from storage). This will be empty if the container is\n * detached or there are no (non-pending) attachment blobs in the document\n */\n private get storageIds(): Set<string> {\n const ids = new Set<string | undefined>(this.redirectTable.values());\n\n // If we are detached, we will not have storage IDs, only undefined\n const undefinedValueInTable = ids.delete(undefined);\n\n // For a detached container, entries are inserted into the redirect table with an undefined storage ID.\n // For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.\n assert(!undefinedValueInTable || this.runtime.attachState === AttachState.Detached && ids.size === 0,\n 0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */);\n\n return ids as Set<string>;\n }\n\n public async getBlob(blobId: string): Promise<ArrayBufferLike> {\n const pending = this.pendingBlobs.get(blobId);\n if (pending) {\n return pending.blob;\n }\n let storageId;\n if (this.runtime.attachState === AttachState.Detached) {\n assert(this.redirectTable.has(blobId), 0x383 /* requesting unknown blobs */);\n\n // Blobs created while the container is detached are stored in IDetachedBlobStorage.\n // The 'IDocumentStorageService.readBlob()' call below will retrieve these via localId.\n storageId = blobId;\n } else {\n storageId = this.redirectTable.get(blobId);\n assert(!!storageId, 0x11f /* \"requesting unknown blobs\" */);\n }\n\n // When a GC-able (not pending) blob is retrieved, let runtime know that the corresponding GC node got updated.\n this.gcNodeUpdated(this.getBlobGCNodePath(blobId));\n\n return PerformanceEvent.timedExecAsync(\n this.logger,\n { eventName: \"AttachmentReadBlob\", id: storageId },\n async () => {\n return this.getStorage().readBlob(storageId);\n },\n { end: true, cancel: \"error\" },\n );\n }\n\n private getBlobHandle(id: string): IFluidHandle<ArrayBufferLike> {\n assert(this.redirectTable.has(id) || this.pendingBlobs.has(id),\n 0x384 /* requesting handle for unknown blob */);\n return new BlobHandle(\n `${BlobManager.basePath}/${id}`,\n this.routeContext,\n async () => this.getBlob(id),\n );\n }\n\n private async createBlobDetached(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n // Blobs created while the container is detached are stored in IDetachedBlobStorage.\n // The 'IDocumentStorageService.createBlob()' call below will respond with a localId.\n const response = await this.getStorage().createBlob(blob);\n this.redirectTable.set(response.id, undefined);\n return this.getBlobHandle(response.id);\n }\n\n public async createBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>> {\n if (this.runtime.attachState === AttachState.Detached) {\n return this.createBlobDetached(blob);\n }\n if (this.runtime.attachState === AttachState.Attaching) {\n // blob upload is not supported in \"Attaching\" state\n this.logger.sendTelemetryEvent({ eventName: \"CreateBlobWhileAttaching\" });\n await new Promise<void>((resolve) => this.runtime.once(\"attached\", resolve));\n }\n assert(this.runtime.attachState === AttachState.Attached,\n 0x385 /* For clarity and paranoid defense against adding future attachment states */);\n\n // Create a local ID for each blob. This is used to support blobs if/when the client goes\n // offline since we don't have the ID from storage yet. If online flow succeeds this won't be used.\n const localId = uuid();\n const pendingEntry: PendingBlob = {\n blob,\n status: PendingBlobStatus.OnlinePendingUpload,\n handleP: new Deferred(),\n uploadP: this.uploadBlob(localId, blob),\n };\n this.pendingBlobs.set(localId, pendingEntry);\n\n return pendingEntry.handleP.promise;\n }\n\n private async uploadBlob(localId: string, blob: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return PerformanceEvent.timedExecAsync(\n this.logger,\n { eventName: \"createBlob\" },\n async () => this.getStorage().createBlob(blob),\n { end: true, cancel: this.runtime.connected ? \"error\" : \"generic\" },\n ).then(\n (response) => this.onUploadResolve(localId, response),\n async (err) => this.onUploadReject(localId, err),\n );\n }\n\n private onUploadResolve(localId: string, response: ICreateBlobResponse) {\n const entry = this.pendingBlobs.get(localId);\n assert(entry?.status === PendingBlobStatus.OnlinePendingUpload ||\n entry?.status === PendingBlobStatus.OfflinePendingUpload,\n 0x386 /* Must have pending blob entry for uploaded blob */);\n entry.storageId = response.id;\n if (this.runtime.connected) {\n if (entry.status === PendingBlobStatus.OnlinePendingUpload) {\n if (this.storageIds.has(response.id)) {\n // Storage may dedupe blobs and give us an ID we already know\n // no need to submit BlobAttach op in this case\n entry.handleP.resolve(this.getBlobHandle(response.id));\n this.pendingBlobs.delete(localId);\n } else {\n // Check for still-pending duplicates too; if an op is already in flight we can wait for that one\n if (!this.opsInFlight.has(response.id)) {\n this.sendBlobAttachOp(response.id);\n }\n this.opsInFlight.set(response.id, (this.opsInFlight.get(response.id) ?? []).concat(localId));\n entry.status = PendingBlobStatus.OnlinePendingOp;\n }\n } else if (entry.status === PendingBlobStatus.OfflinePendingUpload) {\n // We already submitted a BlobAttach op for this blob when it was transitioned to offline flow\n entry.status = PendingBlobStatus.OfflinePendingOp;\n }\n } else {\n // connected to storage but not ordering service?\n this.logger.sendTelemetryEvent({ eventName: \"BlobUploadSuccessWhileDisconnected\" });\n if (entry.status === PendingBlobStatus.OnlinePendingUpload) {\n this.transitionToOffline(localId);\n }\n entry.status = PendingBlobStatus.OfflinePendingOp;\n }\n return response;\n }\n\n private async onUploadReject(localId: string, error) {\n const entry = this.pendingBlobs.get(localId);\n assert(!!entry, 0x387 /* Must have pending blob entry for blob which failed to upload */);\n if (!this.runtime.connected) {\n if (entry.status === PendingBlobStatus.OnlinePendingUpload) {\n this.transitionToOffline(localId);\n }\n // we are probably not connected to storage but start another upload request in case we are\n entry.uploadP = this.retryThrottler.getDelay().then(async () => this.uploadBlob(localId, entry.blob));\n return entry.uploadP;\n } else {\n entry.handleP.reject(error);\n throw error;\n }\n }\n\n private transitionToOffline(localId: string) {\n assert(!this.runtime.connected, 0x388 /* Must only transition to offline flow while runtime is disconnected */);\n const entry = this.pendingBlobs.get(localId);\n assert(!!entry, 0x389 /* No pending blob entry */);\n assert([PendingBlobStatus.OnlinePendingUpload, PendingBlobStatus.OnlinePendingOp].includes(entry.status),\n 0x38a /* Blob must be in online flow to transition to offline flow */);\n\n entry.status = entry.status === PendingBlobStatus.OnlinePendingUpload\n ? PendingBlobStatus.OfflinePendingUpload\n : PendingBlobStatus.OfflinePendingOp;\n\n // Submit a BlobAttach op. It's important we submit this op now before returning the blob handle so the\n // BlobAttach op is sequenced prior to any ops referencing the handle. Otherwise an invalid handle could be\n // added to the document if the ops are not all successfully submitted upon reconnection.\n // storageId may be undefined but since we are not connected we will have a chance to add it when reSubmit()\n // is called\n this.sendBlobAttachOp(entry.storageId, localId);\n entry.handleP.resolve(this.getBlobHandle(localId));\n }\n\n /**\n * Resubmit a BlobAttach op. Used to add storage IDs to ops that were\n * submitted to runtime while disconnected.\n * @param metadata - op metadata containing storage and/or local IDs\n */\n public reSubmit(metadata: Record<string, unknown> | undefined) {\n assert(!!metadata, 0x38b /* Resubmitted ops must have metadata */);\n const { blobId, localId }: { blobId?: string; localId?: string; } = metadata;\n if (!blobId) {\n assert(!!localId, 0x38c /* Submitted BlobAttach ops must have a blobId or localId */);\n // We submitted this op while offline. The blob should have been uploaded by now.\n const pendingEntry = this.pendingBlobs.get(localId);\n assert(pendingEntry?.status === PendingBlobStatus.OfflinePendingOp &&\n !!pendingEntry?.storageId, 0x38d /* blob must be uploaded before resubmitting BlobAttach op */);\n return this.sendBlobAttachOp(pendingEntry.storageId, localId);\n }\n return this.sendBlobAttachOp(blobId, localId);\n }\n\n public processBlobAttachOp(message: ISequencedDocumentMessage, local: boolean) {\n assert(message?.metadata?.blobId, 0x12a /* \"Missing blob id on metadata\" */);\n if (message.metadata.localId !== undefined) {\n this.redirectTable.set(message.metadata.localId, message.metadata.blobId);\n }\n // set identity (id -> id) entry\n this.redirectTable.set(message.metadata.blobId, message.metadata.blobId);\n\n if (local) {\n if (message.metadata.localId === undefined) {\n // Since there is no local ID, we know this op was submitted while online.\n const waitingBlobs = this.opsInFlight.get(message.metadata.blobId);\n assert(!!waitingBlobs, 0x38e /* local online BlobAttach op with no pending blob */);\n waitingBlobs.forEach((localId) => {\n const pendingBlobEntry = this.pendingBlobs.get(localId);\n assert(\n pendingBlobEntry !== undefined,\n 0x38f, /* local online BlobAttach op with no pending blob entry */\n );\n\n // It's possible we transitioned to offline flow while waiting for this op.\n if (pendingBlobEntry.status === PendingBlobStatus.OnlinePendingOp) {\n pendingBlobEntry.handleP.resolve(this.getBlobHandle(message.metadata.blobId));\n this.pendingBlobs.delete(localId);\n }\n });\n } else {\n // Each local ID is unique; get the pending blob entry and delete it\n assert(this.pendingBlobs.get(message.metadata.localId)?.status === PendingBlobStatus.OfflinePendingOp,\n 0x1f8 /* \"local BlobAttach op with no pending blob\" */);\n this.pendingBlobs.delete(message.metadata.localId);\n }\n }\n }\n\n /**\n * Reads blobs needed to load BlobManager from storage.\n * @param blobsTree - Tree containing IDs of previously attached blobs. We\n * look for the IDs in the blob entries of the tree since the both the r11s\n * and SPO drivers replace the attachment types returned in snapshot() with blobs.\n */\n public static async load(\n blobsTree: ISnapshotTree | undefined,\n tryFetchBlob: (id: string) => Promise<[string, string][]>,\n ): Promise<IBlobManagerLoadInfo> {\n if (!blobsTree) {\n return {};\n }\n let redirectTable;\n const tableId = blobsTree.blobs[this.redirectTableBlobName];\n if (tableId) {\n redirectTable = await tryFetchBlob(tableId);\n }\n const ids = Object.entries(blobsTree.blobs)\n .filter(([k, _]) => k !== this.redirectTableBlobName).map(([_, v]) => v);\n return { ids, redirectTable };\n }\n\n /**\n * Load a set of previously attached blob IDs and redirect table from a previous snapshot.\n */\n private load(snapshot: IBlobManagerLoadInfo): Map<string, string | undefined> {\n this.logger.sendTelemetryEvent({\n eventName: \"AttachmentBlobsLoaded\",\n count: snapshot.ids?.length ?? 0,\n redirectTable: snapshot.redirectTable?.length,\n });\n const table = new Map<string, string | undefined>(snapshot.redirectTable);\n if (snapshot.ids) {\n const detached = this.runtime.attachState === AttachState.Detached;\n // If we are detached, we don't have storage IDs yet, so set to undefined\n // Otherwise, set identity (id -> id) entries\n snapshot.ids.forEach((entry) => table.set(entry, detached ? undefined : entry));\n }\n return table;\n }\n\n /**\n * Generates data used for garbage collection. Each blob uploaded represents a node in the GC graph as it can be\n * individually referenced by storing its handle in a referenced DDS. Returns the list of blob ids as GC nodes.\n * @param fullGC - true to bypass optimizations and force full generation of GC data. BlobManager doesn't care\n * about this for now because the data is a simple list of blob ids.\n */\n public getGCData(fullGC: boolean = false): IGarbageCollectionData {\n const gcData: IGarbageCollectionData = { gcNodes: {} };\n /**\n * The node path is of the format `/_blobs/blobId`. This path must match the path of the blob handle returned\n * by the createBlob API because blobs are marked referenced by storing these handles in a referenced DDS.\n */\n this.storageIds.forEach((blobId: string) => {\n gcData.gcNodes[this.getBlobGCNodePath(blobId)] = [];\n });\n\n // For some blobs, the handle returned on creation is based off of the localId. So, these\n // nodes can be referenced by storing the localId handle. When that happens, the corresponding storageId node\n // must also be marked referenced. So, we add a route from the localId node to the storageId node.\n // Note that because of de-duping, there can be multiple localIds that all redirect to the same storageId or\n // a blob may be referenced via its storageId handle.\n for (const [localId, storageId] of this.redirectTable) {\n assert(!!storageId, 0x390 /* Must be attached to get GC data */);\n // Add node for the localId and add a route to the storageId node. The storageId node will have been\n // added above when adding nodes for this.blobIds.\n gcData.gcNodes[this.getBlobGCNodePath(localId)] = [this.getBlobGCNodePath(storageId)];\n }\n\n return gcData;\n }\n\n /**\n * When running GC in test mode, this is called to delete blobs that are unused.\n * @param unusedRoutes - These are the blob node ids that are unused and should be deleted.\n */\n public deleteUnusedRoutes(unusedRoutes: string[]): void {\n // The routes or blob node paths are in the same format as returned in getGCData -\n // `/<BlobManager.basePath>/<blobId>`.\n for (const route of unusedRoutes) {\n const pathParts = route.split(\"/\");\n assert(\n pathParts.length === 3 && pathParts[1] === BlobManager.basePath,\n 0x2d5 /* \"Invalid blob node id in unused routes.\" */,\n );\n const blobId = pathParts[2];\n\n // The unused blobId could be a localId. If so, remove it from the redirect table and continue. The\n // corresponding storageId may still be used either directly or via other localIds.\n if (this.redirectTable?.has(blobId)) {\n this.redirectTable.delete(blobId);\n continue;\n }\n }\n }\n\n public summarize(telemetryContext?: ITelemetryContext): ISummaryTreeWithStats {\n // if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached\n const blobIds = this.storageIds.size > 0 ? Array.from(this.storageIds) : Array.from(this.redirectTable.keys());\n const builder = new SummaryTreeBuilder();\n blobIds.forEach((blobId) => {\n builder.addAttachment(blobId);\n });\n\n // Any non-identity entries in the table need to be saved in the summary\n if (this.redirectTable.size > blobIds.length) {\n builder.addBlob(\n BlobManager.redirectTableBlobName,\n // filter out identity entries\n JSON.stringify(Array.from(this.redirectTable.entries())\n .filter(([localId, storageId]) => localId !== storageId)),\n );\n }\n\n return builder.getSummaryTree();\n }\n\n public setRedirectTable(table: Map<string, string>) {\n assert(this.runtime.attachState === AttachState.Detached,\n 0x252 /* \"redirect table can only be set in detached container\" */);\n assert(this.redirectTable.size === table.size,\n 0x391 /* Redirect table size must match BlobManager's local ID count */);\n for (const [localId, storageId] of table) {\n assert(this.redirectTable.has(localId), 0x254 /* \"unrecognized id in redirect table\" */);\n this.redirectTable.set(localId, storageId);\n // set identity (id -> id) entry\n this.redirectTable.set(storageId, storageId);\n }\n }\n\n public getPendingBlobs(): IPendingBlobs {\n const blobs = {};\n for (const [key, entry] of this.pendingBlobs) {\n blobs[key] = { blob: bufferToString(entry.blob, \"base64\") };\n }\n return blobs;\n }\n}\n"]}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/*!
|
|
3
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
3
|
* Licensed under the MIT License.
|
|
5
4
|
*/
|
|
6
|
-
import { EventEmitter } from "events";
|
|
7
5
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
6
|
import { FluidObject, IFluidHandle, IFluidHandleContext, IFluidRouter, IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
9
7
|
import { IAudience, IFluidTokenProvider, IContainerContext, IDeltaManager, IRuntime, ICriticalContainerError, AttachState, ILoaderOptions, ISnapshotTreeWithBlobContents } from "@fluidframework/container-definitions";
|
|
10
8
|
import { IContainerRuntime, IContainerRuntimeEvents } from "@fluidframework/container-runtime-definitions";
|
|
11
9
|
import { TypedEventEmitter } from "@fluidframework/common-utils";
|
|
12
10
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
13
|
-
import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISignalMessage,
|
|
11
|
+
import { IClientDetails, IDocumentMessage, IQuorumClients, ISequencedDocumentMessage, ISignalMessage, ISummaryTree, MessageType } from "@fluidframework/protocol-definitions";
|
|
14
12
|
import { FlushMode, IFluidDataStoreContextDetached, IFluidDataStoreRegistry, IGarbageCollectionData, NamedFluidDataStoreRegistryEntries, ISummaryTreeWithStats, IDataStore, ITelemetryContext } from "@fluidframework/runtime-definitions";
|
|
15
|
-
import {
|
|
13
|
+
import { BatchMessage } from "./batchManager";
|
|
16
14
|
import { SubmitSummaryResult, ISubmitSummaryOptions, ISummarizer, ISummarizerInternalsProvider, ISummarizerOptions, ISummarizerRuntime } from "./summarizerTypes";
|
|
17
15
|
import { GCNodeType, IGarbageCollectionRuntime, IGCStats } from "./garbageCollection";
|
|
18
|
-
import { ISerializedBaseSnapshotBlobs } from "./serializedSnapshotStorage";
|
|
19
16
|
export declare enum ContainerMessageType {
|
|
20
17
|
FluidDataStoreOp = "component",
|
|
21
18
|
Attach = "attach",
|
|
@@ -36,7 +33,7 @@ export interface ContainerRuntimeMessage {
|
|
|
36
33
|
}
|
|
37
34
|
export interface ISummaryBaseConfiguration {
|
|
38
35
|
/**
|
|
39
|
-
*
|
|
36
|
+
* Delay before first attempt to spawn summarizing container.
|
|
40
37
|
*/
|
|
41
38
|
initialSummarizerDelayMs: number;
|
|
42
39
|
/**
|
|
@@ -59,12 +56,15 @@ export interface ISummaryBaseConfiguration {
|
|
|
59
56
|
export interface ISummaryConfigurationHeuristics extends ISummaryBaseConfiguration {
|
|
60
57
|
state: "enabled";
|
|
61
58
|
/**
|
|
62
|
-
*
|
|
59
|
+
* @deprecated Please move all implementations to {@link ISummaryConfigurationHeuristics.minIdleTime} and
|
|
60
|
+
* {@link ISummaryConfigurationHeuristics.maxIdleTime} instead.
|
|
63
61
|
*/
|
|
64
62
|
idleTime: number;
|
|
65
63
|
/**
|
|
66
|
-
* Defines the maximum allowed time, since the last received Ack,
|
|
64
|
+
* Defines the maximum allowed time, since the last received Ack, before running the summary
|
|
67
65
|
* with reason maxTime.
|
|
66
|
+
* For example, say we receive ops one by one just before the idle time is triggered.
|
|
67
|
+
* In this case, we still want to run a summary since it's been a while since the last summary.
|
|
68
68
|
*/
|
|
69
69
|
maxTime: number;
|
|
70
70
|
/**
|
|
@@ -77,6 +77,34 @@ export interface ISummaryConfigurationHeuristics extends ISummaryBaseConfigurati
|
|
|
77
77
|
* before running the last summary.
|
|
78
78
|
*/
|
|
79
79
|
minOpsForLastSummaryAttempt: number;
|
|
80
|
+
/**
|
|
81
|
+
* Defines the lower boundary for the allowed time in between summarizations.
|
|
82
|
+
* Pairs with maxIdleTime to form a range.
|
|
83
|
+
* For example, if we only receive 1 op, we don't want to have the same idle time as say 100 ops.
|
|
84
|
+
* Based on the boundaries we set in minIdleTime and maxIdleTime, the idle time will change
|
|
85
|
+
* linearly depending on the number of ops we receive.
|
|
86
|
+
*/
|
|
87
|
+
minIdleTime: number;
|
|
88
|
+
/**
|
|
89
|
+
* Defines the upper boundary for the allowed time in between summarizations.
|
|
90
|
+
* Pairs with minIdleTime to form a range.
|
|
91
|
+
* For example, if we only receive 1 op, we don't want to have the same idle time as say 100 ops.
|
|
92
|
+
* Based on the boundaries we set in minIdleTime and maxIdleTime, the idle time will change
|
|
93
|
+
* linearly depending on the number of ops we receive.
|
|
94
|
+
*/
|
|
95
|
+
maxIdleTime: number;
|
|
96
|
+
/**
|
|
97
|
+
* Runtime op weight to use in heuristic summarizing.
|
|
98
|
+
* This number is a multiplier on the number of runtime ops we process when running summarize heuristics.
|
|
99
|
+
* For example: (multiplier) * (number of runtime ops) = weighted number of runtime ops
|
|
100
|
+
*/
|
|
101
|
+
runtimeOpWeight: number;
|
|
102
|
+
/**
|
|
103
|
+
* Non-runtime op weight to use in heuristic summarizing
|
|
104
|
+
* This number is a multiplier on the number of non-runtime ops we process when running summarize heuristics.
|
|
105
|
+
* For example: (multiplier) * (number of non-runtime ops) = weighted number of non-runtime ops
|
|
106
|
+
*/
|
|
107
|
+
nonRuntimeOpWeight: number;
|
|
80
108
|
}
|
|
81
109
|
export interface ISummaryConfigurationDisableSummarizer {
|
|
82
110
|
state: "disabled";
|
|
@@ -88,23 +116,28 @@ export declare type ISummaryConfiguration = ISummaryConfigurationDisableSummariz
|
|
|
88
116
|
export declare const DefaultSummaryConfiguration: ISummaryConfiguration;
|
|
89
117
|
export interface IGCRuntimeOptions {
|
|
90
118
|
/**
|
|
91
|
-
* Flag that if true, will enable running garbage collection (GC)
|
|
92
|
-
*
|
|
93
|
-
* mark phase.
|
|
119
|
+
* Flag that if true, will enable running garbage collection (GC) for a new container.
|
|
120
|
+
*
|
|
121
|
+
* GC has mark phase and sweep phase. In mark phase, unreferenced objects are identified
|
|
122
|
+
* and marked as such in the summary. This option enables the mark phase.
|
|
94
123
|
* In sweep phase, unreferenced objects are eventually deleted from the container if they meet certain conditions.
|
|
95
124
|
* Sweep phase can be enabled via the "sweepAllowed" option.
|
|
96
|
-
*
|
|
125
|
+
*
|
|
126
|
+
* Note: This setting is persisted in the container's summary and cannot be changed.
|
|
97
127
|
*/
|
|
98
128
|
gcAllowed?: boolean;
|
|
99
129
|
/**
|
|
100
|
-
* Flag that if true, enables GC's sweep phase
|
|
130
|
+
* Flag that if true, enables GC's sweep phase for a new container.
|
|
131
|
+
*
|
|
132
|
+
* This will allow GC to eventually delete unreferenced objects from the container.
|
|
101
133
|
* This flag should only be set to true if "gcAllowed" is true.
|
|
102
|
-
*
|
|
134
|
+
*
|
|
135
|
+
* Note: This setting is persisted in the container's summary and cannot be changed.
|
|
103
136
|
*/
|
|
104
137
|
sweepAllowed?: boolean;
|
|
105
138
|
/**
|
|
106
|
-
* Flag that will disable garbage collection
|
|
107
|
-
* is allowed via the gcAllowed option.
|
|
139
|
+
* Flag that if true, will disable garbage collection for the session.
|
|
140
|
+
* Can be used to disable running GC on containers where it is allowed via the gcAllowed option.
|
|
108
141
|
*/
|
|
109
142
|
disableGC?: boolean;
|
|
110
143
|
/**
|
|
@@ -112,6 +145,12 @@ export interface IGCRuntimeOptions {
|
|
|
112
145
|
* changed or not.
|
|
113
146
|
*/
|
|
114
147
|
runFullGC?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Maximum session duration for a new container. If not present, a default value will be used.
|
|
150
|
+
*
|
|
151
|
+
* Note: This setting is persisted in the container's summary and cannot be changed.
|
|
152
|
+
*/
|
|
153
|
+
sessionExpiryTimeoutMs?: number;
|
|
115
154
|
/**
|
|
116
155
|
* Allows additional GC options to be passed.
|
|
117
156
|
*/
|
|
@@ -120,31 +159,42 @@ export interface IGCRuntimeOptions {
|
|
|
120
159
|
export interface ISummaryRuntimeOptions {
|
|
121
160
|
/** Override summary configurations set by the server. */
|
|
122
161
|
summaryConfigOverrides?: ISummaryConfiguration;
|
|
123
|
-
disableIsolatedChannels?: boolean;
|
|
124
162
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
|
|
163
|
+
* Delay before first attempt to spawn summarizing container.
|
|
164
|
+
*
|
|
165
|
+
* @deprecated Use {@link ISummaryRuntimeOptions.summaryConfigOverrides}'s
|
|
166
|
+
* {@link ISummaryBaseConfiguration.initialSummarizerDelayMs} instead.
|
|
167
|
+
*/
|
|
128
168
|
initialSummarizerDelayMs?: number;
|
|
129
169
|
/**
|
|
130
|
-
* @deprecated - use `summaryConfigOverrides.disableSummaries` instead.
|
|
131
170
|
* Flag that disables summaries if it is set to true.
|
|
171
|
+
*
|
|
172
|
+
* @deprecated Use {@link ISummaryRuntimeOptions.summaryConfigOverrides}'s
|
|
173
|
+
* {@link ISummaryConfigurationDisableSummarizer.state} instead.
|
|
132
174
|
*/
|
|
133
175
|
disableSummaries?: boolean;
|
|
134
176
|
/**
|
|
135
|
-
* @
|
|
136
|
-
*
|
|
177
|
+
* @defaultValue 7000 operations (ops)
|
|
178
|
+
*
|
|
179
|
+
* @deprecated Use {@link ISummaryRuntimeOptions.summaryConfigOverrides}'s
|
|
180
|
+
* {@link ISummaryBaseConfiguration.maxOpsSinceLastSummary} instead.
|
|
137
181
|
*/
|
|
138
182
|
maxOpsSinceLastSummary?: number;
|
|
139
183
|
/**
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
184
|
+
* Flag that will enable changing elected summarizer client after maxOpsSinceLastSummary.
|
|
185
|
+
*
|
|
186
|
+
* @defaultValue `false` (disabled) and must be explicitly set to true to enable.
|
|
187
|
+
*
|
|
188
|
+
* @deprecated Use {@link ISummaryRuntimeOptions.summaryConfigOverrides}'s
|
|
189
|
+
* {@link ISummaryBaseConfiguration.summarizerClientElection} instead.
|
|
190
|
+
*/
|
|
144
191
|
summarizerClientElection?: boolean;
|
|
145
192
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
193
|
+
* Options that control the running summarizer behavior.
|
|
194
|
+
*
|
|
195
|
+
* @deprecated Use {@link ISummaryRuntimeOptions.summaryConfigOverrides}'s
|
|
196
|
+
* `{@link ISummaryConfiguration.state} = "DisableHeuristics"` instead.
|
|
197
|
+
* */
|
|
148
198
|
summarizerOptions?: Readonly<Partial<ISummarizerOptions>>;
|
|
149
199
|
}
|
|
150
200
|
/**
|
|
@@ -162,12 +212,6 @@ export interface IContainerRuntimeOptions {
|
|
|
162
212
|
* 3. "bypass" will skip the check entirely. This is not recommended.
|
|
163
213
|
*/
|
|
164
214
|
readonly loadSequenceNumberVerification?: "close" | "log" | "bypass";
|
|
165
|
-
/**
|
|
166
|
-
* Should the runtime use data store aliasing for creating root datastores.
|
|
167
|
-
* In case of aliasing conflicts, the runtime will raise an exception which does
|
|
168
|
-
* not effect the status of the container.
|
|
169
|
-
*/
|
|
170
|
-
readonly useDataStoreAliasing?: boolean;
|
|
171
215
|
/**
|
|
172
216
|
* Sets the flush mode for the runtime. In Immediate flush mode the runtime will immediately
|
|
173
217
|
* send all operations to the driver layer, while in TurnBased the operations will be buffered
|
|
@@ -202,31 +246,8 @@ export declare enum RuntimeHeaders {
|
|
|
202
246
|
viaHandle = "viaHandle"
|
|
203
247
|
}
|
|
204
248
|
/**
|
|
205
|
-
*
|
|
206
|
-
* instantiated runtime in a new instance of the container, so it can load to the
|
|
207
|
-
* same state
|
|
249
|
+
* @deprecated - use ContainerRuntimeMessage instead
|
|
208
250
|
*/
|
|
209
|
-
export interface IPendingRuntimeState {
|
|
210
|
-
/**
|
|
211
|
-
* Pending ops from PendingStateManager
|
|
212
|
-
*/
|
|
213
|
-
pending?: IPendingLocalState;
|
|
214
|
-
/**
|
|
215
|
-
* A base snapshot at a sequence number prior to the first pending op
|
|
216
|
-
*/
|
|
217
|
-
baseSnapshot: ISnapshotTree;
|
|
218
|
-
/**
|
|
219
|
-
* Serialized blobs from the base snapshot. Used to load offline since
|
|
220
|
-
* storage is not available.
|
|
221
|
-
*/
|
|
222
|
-
snapshotBlobs: ISerializedBaseSnapshotBlobs;
|
|
223
|
-
/**
|
|
224
|
-
* All runtime ops since base snapshot sequence number up to the latest op
|
|
225
|
-
* seen when the container was closed. Used to apply stashed (saved pending)
|
|
226
|
-
* ops at the same sequence number at which they were made.
|
|
227
|
-
*/
|
|
228
|
-
savedOps: ISequencedDocumentMessage[];
|
|
229
|
-
}
|
|
230
251
|
export declare enum RuntimeMessage {
|
|
231
252
|
FluidDataStoreOp = "component",
|
|
232
253
|
Attach = "attach",
|
|
@@ -236,26 +257,20 @@ export declare enum RuntimeMessage {
|
|
|
236
257
|
Alias = "alias",
|
|
237
258
|
Operation = "op"
|
|
238
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* @deprecated - please use version in driver-utils
|
|
262
|
+
*/
|
|
239
263
|
export declare function isRuntimeMessage(message: ISequencedDocumentMessage): boolean;
|
|
240
|
-
export declare function unpackRuntimeMessage(message: ISequencedDocumentMessage): ISequencedDocumentMessage;
|
|
241
264
|
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
265
|
+
* Unpacks runtime messages
|
|
266
|
+
*
|
|
267
|
+
* @remarks This API makes no promises regarding backward-compatability. This is internal API.
|
|
268
|
+
* @param message - message (as it observed in storage / service)
|
|
269
|
+
* @returns unpacked runtime message
|
|
270
|
+
*
|
|
271
|
+
* @internal
|
|
247
272
|
*/
|
|
248
|
-
export declare
|
|
249
|
-
private readonly deltaManager;
|
|
250
|
-
private readonly emitter;
|
|
251
|
-
private readonly logger;
|
|
252
|
-
private readonly deltaScheduler;
|
|
253
|
-
private batchClientId;
|
|
254
|
-
private hitError;
|
|
255
|
-
constructor(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, emitter: EventEmitter, logger: ITelemetryLogger);
|
|
256
|
-
beforeOpProcessing(message: ISequencedDocumentMessage): void;
|
|
257
|
-
afterOpProcessing(error: any | undefined, message: ISequencedDocumentMessage): void;
|
|
258
|
-
}
|
|
273
|
+
export declare function unpackRuntimeMessage(message: ISequencedDocumentMessage): boolean;
|
|
259
274
|
/**
|
|
260
275
|
* Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a
|
|
261
276
|
* special-case for document dirty state. Ultimately we should have no special-cases from the
|
|
@@ -316,18 +331,20 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
316
331
|
private readonly summaryManager?;
|
|
317
332
|
private readonly summaryCollection;
|
|
318
333
|
private readonly summarizerNode;
|
|
319
|
-
private readonly _aliasingEnabled;
|
|
320
|
-
private readonly _maxOpSizeInBytes;
|
|
321
334
|
private readonly maxConsecutiveReconnects;
|
|
322
335
|
private readonly defaultMaxConsecutiveReconnects;
|
|
323
336
|
private _orderSequentiallyCalls;
|
|
324
337
|
private _flushMode;
|
|
325
|
-
private needsFlush;
|
|
326
338
|
private flushTrigger;
|
|
327
339
|
private _connected;
|
|
328
340
|
private readonly savedOps;
|
|
329
341
|
private baseSnapshotBlobs?;
|
|
330
342
|
private consecutiveReconnects;
|
|
343
|
+
/**
|
|
344
|
+
* Used to delay transition to "connected" state while we upload
|
|
345
|
+
* attachment blobs that were added while disconnected
|
|
346
|
+
*/
|
|
347
|
+
private delayConnectClientId?;
|
|
331
348
|
get connected(): boolean;
|
|
332
349
|
/** clientId of parent (non-summarizing) container that owns summarizer container */
|
|
333
350
|
get summarizerClientId(): string | undefined;
|
|
@@ -347,17 +364,14 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
347
364
|
private readonly scheduleManager;
|
|
348
365
|
private readonly blobManager;
|
|
349
366
|
private readonly pendingStateManager;
|
|
367
|
+
private readonly pendingAttachBatch;
|
|
368
|
+
private readonly pendingBatch;
|
|
350
369
|
private readonly garbageCollector;
|
|
351
370
|
private readonly chunkMap;
|
|
352
371
|
private readonly dataStores;
|
|
353
|
-
/**
|
|
354
|
-
* True if generating summaries with isolated channels is
|
|
355
|
-
* explicitly disabled. This only affects how summaries are written,
|
|
356
|
-
* and is the single source of truth for this container.
|
|
357
|
-
*/
|
|
358
|
-
readonly disableIsolatedChannels: boolean;
|
|
359
372
|
/** The last message processed at the time of the last summary. */
|
|
360
373
|
private messageAtLastSummary;
|
|
374
|
+
private get emptyBatch();
|
|
361
375
|
private get summarizer();
|
|
362
376
|
private readonly summariesDisabled;
|
|
363
377
|
private isSummariesDisabled;
|
|
@@ -375,7 +389,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
375
389
|
* a summary is generated.
|
|
376
390
|
*/
|
|
377
391
|
private nextSummaryNumber;
|
|
378
|
-
private readonly opTracker;
|
|
379
392
|
private constructor();
|
|
380
393
|
dispose(error?: Error): void;
|
|
381
394
|
get IFluidTokenProvider(): IFluidTokenProvider | undefined;
|
|
@@ -399,6 +412,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
399
412
|
private replayPendingStates;
|
|
400
413
|
private applyStashedOp;
|
|
401
414
|
setConnectionState(connected: boolean, clientId?: string): void;
|
|
415
|
+
private setConnectionStateCore;
|
|
402
416
|
process(messageArg: ISequencedDocumentMessage, local: boolean): void;
|
|
403
417
|
private processAliasMessage;
|
|
404
418
|
/**
|
|
@@ -408,44 +422,16 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
408
422
|
private sendSignalTelemetryEvent;
|
|
409
423
|
processSignal(message: ISignalMessage, local: boolean): void;
|
|
410
424
|
getRootDataStore(id: string, wait?: boolean): Promise<IFluidRouter>;
|
|
425
|
+
private getRootDataStoreChannel;
|
|
411
426
|
setFlushMode(mode: FlushMode): void;
|
|
412
427
|
flush(): void;
|
|
428
|
+
protected flushBatch(batch: BatchMessage[]): void;
|
|
413
429
|
orderSequentially(callback: () => void): void;
|
|
414
430
|
private trackOrderSequentiallyCalls;
|
|
415
431
|
createDataStore(pkg: string | string[]): Promise<IDataStore>;
|
|
416
|
-
/**
|
|
417
|
-
* Creates a root datastore directly with a user generated id and attaches it to storage.
|
|
418
|
-
* It is vulnerable to name collisions and should not be used.
|
|
419
|
-
*
|
|
420
|
-
* This method will be removed. See #6465.
|
|
421
|
-
*/
|
|
422
|
-
private createRootDataStoreLegacy;
|
|
423
|
-
/**
|
|
424
|
-
* @deprecated - will be removed in an upcoming release. See #9660.
|
|
425
|
-
*/
|
|
426
|
-
createRootDataStore(pkg: string | string[], rootDataStoreId: string): Promise<IFluidRouter>;
|
|
427
|
-
/**
|
|
428
|
-
* Creates a data store then attempts to alias it.
|
|
429
|
-
* If aliasing fails, it will raise an exception.
|
|
430
|
-
*
|
|
431
|
-
* This method will be removed. See #6465.
|
|
432
|
-
*
|
|
433
|
-
* @param pkg - Package name of the data store
|
|
434
|
-
* @param alias - Alias to be assigned to the data store
|
|
435
|
-
* @param props - Properties for the data store
|
|
436
|
-
* @returns - An aliased data store which can can be found / loaded by alias.
|
|
437
|
-
*/
|
|
438
|
-
private createAndAliasDataStore;
|
|
439
432
|
createDetachedRootDataStore(pkg: Readonly<string[]>, rootDataStoreId: string): IFluidDataStoreContextDetached;
|
|
440
433
|
createDetachedDataStore(pkg: Readonly<string[]>): IFluidDataStoreContextDetached;
|
|
441
|
-
|
|
442
|
-
* Creates a possibly root datastore directly with a possibly user generated id and attaches it to storage.
|
|
443
|
-
* It is vulnerable to name collisions if both aforementioned conditions are true, and should not be used.
|
|
444
|
-
*
|
|
445
|
-
* This method will be removed. See #6465.
|
|
446
|
-
*/
|
|
447
|
-
private _createDataStoreWithPropsLegacy;
|
|
448
|
-
_createDataStoreWithProps(pkg: string | string[], props?: any, id?: string, isRoot?: boolean): Promise<IDataStore>;
|
|
434
|
+
_createDataStoreWithProps(pkg: string | string[], props?: any, id?: string): Promise<IDataStore>;
|
|
449
435
|
private _createDataStore;
|
|
450
436
|
private canSendOps;
|
|
451
437
|
getQuorum(): IQuorumClients;
|
|
@@ -540,7 +526,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
540
526
|
private isBlobPath;
|
|
541
527
|
/**
|
|
542
528
|
* Runs garbage collection and updates the reference / used state of the nodes in the container.
|
|
543
|
-
* @returns the statistics of the garbage collection run.
|
|
529
|
+
* @returns the statistics of the garbage collection run; undefined if GC did not run.
|
|
544
530
|
*/
|
|
545
531
|
collectGarbage(options: {
|
|
546
532
|
/** Logger to use for logging GC events */
|
|
@@ -549,7 +535,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
549
535
|
runSweep?: boolean;
|
|
550
536
|
/** True to generate full GC data */
|
|
551
537
|
fullGC?: boolean;
|
|
552
|
-
}): Promise<IGCStats>;
|
|
538
|
+
}): Promise<IGCStats | undefined>;
|
|
553
539
|
/**
|
|
554
540
|
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
555
541
|
* all references added in the system.
|
|
@@ -569,15 +555,13 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
569
555
|
private processRemoteChunkedMessage;
|
|
570
556
|
private addChunk;
|
|
571
557
|
private clearPartialChunks;
|
|
558
|
+
private hasPendingMessages;
|
|
572
559
|
private updateDocumentDirtyState;
|
|
573
560
|
submitDataStoreOp(id: string, contents: any, localOpMetadata?: unknown): void;
|
|
574
561
|
submitDataStoreAliasOp(contents: any, localOpMetadata: unknown): void;
|
|
575
562
|
uploadBlob(blob: ArrayBufferLike): Promise<IFluidHandle<ArrayBufferLike>>;
|
|
576
563
|
private submit;
|
|
577
|
-
private
|
|
578
|
-
private submitChunkedMessage;
|
|
579
|
-
private submitSystemMessage;
|
|
580
|
-
private submitRuntimeMessage;
|
|
564
|
+
private submitSummaryMessage;
|
|
581
565
|
/**
|
|
582
566
|
* Throw an error if the runtime is closed. Methods that are expected to potentially
|
|
583
567
|
* be called after dispose due to asynchrony should not call this.
|
|
@@ -603,7 +587,7 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
603
587
|
private fetchSnapshotFromStorage;
|
|
604
588
|
notifyAttaching(snapshot: ISnapshotTreeWithBlobContents): void;
|
|
605
589
|
getSnapshotBlobs(): Promise<void>;
|
|
606
|
-
getPendingLocalState():
|
|
590
|
+
getPendingLocalState(): unknown;
|
|
607
591
|
readonly summarizeOnDemand: ISummarizer["summarizeOnDemand"];
|
|
608
592
|
readonly enqueueSummarize: ISummarizer["enqueueSummarize"];
|
|
609
593
|
/**
|
|
@@ -612,5 +596,6 @@ export declare class ContainerRuntime extends TypedEventEmitter<IContainerRuntim
|
|
|
612
596
|
* */
|
|
613
597
|
private formRequestSummarizerFn;
|
|
614
598
|
private processSavedOps;
|
|
599
|
+
private validateSummaryHeuristicConfiguration;
|
|
615
600
|
}
|
|
616
601
|
//# sourceMappingURL=containerRuntime.d.ts.map
|