@fluidframework/driver-utils 0.59.4000 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -1
- package/dist/blobAggregationStorage.d.ts +1 -2
- package/dist/blobAggregationStorage.d.ts.map +1 -1
- package/dist/blobAggregationStorage.js +0 -4
- package/dist/blobAggregationStorage.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +1 -2
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js +0 -3
- package/dist/documentStorageServiceProxy.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/lib/blobAggregationStorage.d.ts +1 -2
- package/lib/blobAggregationStorage.d.ts.map +1 -1
- package/lib/blobAggregationStorage.js +0 -4
- package/lib/blobAggregationStorage.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +1 -2
- package/lib/documentStorageServiceProxy.d.ts.map +1 -1
- package/lib/documentStorageServiceProxy.js +0 -3
- package/lib/documentStorageServiceProxy.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/package.json +34 -22
- package/src/blobAggregationStorage.ts +0 -6
- package/src/documentStorageServiceProxy.ts +0 -5
- package/src/packageVersion.ts +1 -1
package/.eslintrc.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion
|
|
6
|
+
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
8
|
export declare abstract class SnapshotExtractor {
|
|
9
9
|
protected readonly aggregatedBlobName = "__big";
|
|
@@ -33,7 +33,6 @@ export declare class BlobAggregationStorage extends SnapshotExtractor implements
|
|
|
33
33
|
get repositoryUrl(): string;
|
|
34
34
|
getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
|
|
35
35
|
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
36
|
-
write(root: ITree, parents: string[], message: string, ref: string): Promise<IVersion>;
|
|
37
36
|
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
|
|
38
37
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
39
38
|
readBlob(id: string): Promise<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobAggregationStorage.d.ts","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACF,uBAAuB,EACxB,+BAA+B,EAC9B,eAAe,EACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,
|
|
1
|
+
{"version":3,"file":"blobAggregationStorage.d.ts","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACF,uBAAuB,EACxB,+BAA+B,EAC9B,eAAe,EACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EAEX,MAAM,sCAAsC,CAAC;AAS9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAyCtE,8BAAsB,iBAAiB;IACnC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,WAAW;IAChD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O,EAAE,MAAM;IAIlD,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC;IAO/E,IAAW,aAAa,WAAyC;IACpD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM;IAInD,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAM9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI/D,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAQlE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAiB9C,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;YAiBzF,kBAAkB;IA0FhC,SAAS,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;CAGjD"}
|
|
@@ -175,10 +175,6 @@ class BlobAggregationStorage extends SnapshotExtractor {
|
|
|
175
175
|
async downloadSummary(handle) {
|
|
176
176
|
throw new Error("NYI");
|
|
177
177
|
}
|
|
178
|
-
// This is only used through Container.snapshot() for testing purposes
|
|
179
|
-
async write(root, parents, message, ref) {
|
|
180
|
-
return this.storage.write(root, parents, message, ref);
|
|
181
|
-
}
|
|
182
178
|
// for now we are not optimizing these blobs, with assumption that this API is used only
|
|
183
179
|
// for big blobs (images)
|
|
184
180
|
async createBlob(file) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobAggregationStorage.js","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,+EAQ8C;AAC9C,+DAOuC;AAEvC,qEAA4E;AAE5E;;;EAGE;AACF,SAAS,eAAe,CAAC,IAAqB,EA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W,CAAC,UAAU;oBACvB,IAAA,qBAAM,EAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;oBACjF,MAAM;gBACV;oBACI,IAAA,8BAAe,EAAC,GAAG,EAAE,iBAAkB,GAAW,CAAC,IAAI,EAAE,CAAC,CAAC;aAClE;SACJ;QAED,IAAA,qBAAM,EAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACvG,IAAI,cAAc,EAAE;YAChB,yFAAyF;YACzF,4FAA4F;YAC5F,qGAAqG;YACrG,iEAAiE;YACjE,+CAA+C;YAC/C,IAAA,qBAAM,EAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAC5D,MAAM,OAAO,GAAG,UAAU,CAAC,wBAAwB,EAAE,CAAC;YACtD,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG;oBACvC,IAAI,EAAE,kCAAW,CAAC,IAAI;oBACtB,OAAO;iBACV,CAAC;aACL;SACJ;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,eAAe,CAAC,EAAU;QAChC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC;;AAvOL,wDAwOC;AAvOG,4FAA4F;AAC5F,8BAA8B;AAC9B,uGAAuG;AACvG,yGAAyG;AACzG,4FAA4F;AAC5F,qGAAqG;AACrG,oGAAoG;AACpG,mCAAmC;AACnC,yGAAyG;AACzG,mFAAmF;AACnE,6CAAsB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n SummaryType,\n ITree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n assert,\n bufferToString,\n stringToBuffer,\n unreachableCase,\n fromUtf8ToBase64,\n Uint8ArrayToString,\n } from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils\";\n\n/*\n * Work around for bufferToString having a bug - it can't consume IsoBuffer!\n * To be removed once bufferToString is fixed!\n*/\nfunction bufferToString2(blob: ArrayBufferLike, encoding: \"utf-8\" | \"base64\"): string {\n if (blob instanceof Uint8Array) { // IsoBuffer does not have ctor, so it's not in proto chain :(\n return Uint8ArrayToString(blob, encoding);\n }\n return bufferToString(blob, encoding);\n}\n\n /**\n * Class responsible for aggregating smaller blobs into one and unpacking it later on.\n */\nclass BlobAggregator {\n private readonly content: [string, string][] = [];\n\n public addBlob(key: string, content: string) {\n this.content.push([key, content]);\n }\n\n public getAggregatedBlobContent() {\n if (this.content.length === 0) {\n return undefined;\n }\n return JSON.stringify(this.content);\n }\n\n static load(input: ArrayBufferLike) {\n const data = bufferToString2(input, \"utf-8\");\n return JSON.parse(data) as [string, string][];\n }\n}\n\n/*\n * Base class that deals with unpacking snapshots (in place) containing aggregated blobs\n * It relies on abstract methods for reads and storing unpacked blobs.\n */\nexport abstract class SnapshotExtractor {\n protected readonly aggregatedBlobName = \"__big\";\n protected readonly virtualIdPrefix = \"__\";\n\n // counter for generation of virtual storage IDs\n protected virtualIdCounter = 0;\n protected getNextVirtualId() {\n return `${this.virtualIdPrefix}${++this.virtualIdCounter}`;\n }\n\n abstract getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;\n abstract setBlob(id: string, tree: ISnapshotTree, content: string);\n\n public async unpackSnapshotCore(snapshot: ISnapshotTree, level = 0): Promise<void> {\n for (const key of Object.keys(snapshot.trees)) {\n const obj = snapshot.trees[key];\n await this.unpackSnapshotCore(obj, level + 1);\n }\n\n // For future proof, we will support multiple aggregated blobs with any name\n // that starts with this.aggregatedBlobName\n for (const key of Object.keys(snapshot.blobs)) {\n if (!key.startsWith(this.aggregatedBlobName)) { continue; }\n const blobId = snapshot.blobs[key];\n if (blobId !== undefined) {\n const blob = await this.getBlob(blobId, snapshot);\n for (const [path, value] of BlobAggregator.load(blob)) {\n const id = this.getNextVirtualId();\n this.setBlob(id, snapshot, value);\n const pathSplit = path.split(\"/\");\n let subTree = snapshot;\n for (const subPath of pathSplit.slice(0, pathSplit.length - 1)) {\n if (subTree.trees[subPath] === undefined) {\n subTree.trees[subPath] = { blobs: {}, trees: {} };\n }\n subTree = subTree.trees[subPath];\n }\n const blobName = pathSplit[pathSplit.length - 1];\n assert(subTree.blobs[blobName] === undefined, 0x0f6 /* \"real blob ID exists\" */);\n subTree.blobs[blobName] = id;\n }\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshot.blobs[this.aggregatedBlobName];\n }\n }\n }\n}\n\n/*\n * Snapshot extractor class that works in place, i.e. patches snapshot that has\n * blob content in ISnapshotTree.blobs itself, not in storage.\n * As result, it implements reading and writing of blobs to/from snapshot itself.\n * It follows existing pattern that mixes concerns - ISnapshotTree.blobs is used for two\n * purposes:\n * 1. map path name to blob ID\n * 2. map blob ID to blob content\n * #2 is what storage (IDocumentStorageService) is for, but in places where we do not have it\n * (like loading serialized earlier draft content), blob content is put directly into snapshot.\n * Ideally this should be fixed by using BlobCacheStorageService or something similar and\n * fixing existing flows to allow switching of storage.\n */\nclass SnapshotExtractorInPlace extends SnapshotExtractor {\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n const blob = tree.blobs[id];\n assert(blob !== undefined, 0x0f7 /* \"aggregate blob missing\" */);\n return stringToBuffer(blob, \"base64\");\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n assert(tree.blobs[id] === undefined, 0x0f8 /* \"blob from aggregate blob exists on its own\" */);\n tree.blobs[id] = fromUtf8ToBase64(content);\n }\n}\n\n/*\n * Snapshot packer and extractor.\n * When summary is written it will find and aggregate small blobs into bigger blobs\n * When snapshot is read, it will unpack aggregated blobs and provide them transparently to caller.\n */\nexport class BlobAggregationStorage extends SnapshotExtractor implements IDocumentStorageService {\n // Tells data store if it can use incremental summary (i.e. reuse DDSs from previous summary\n // when only one DDS changed).\n // The answer has to be know long before we enable actual packing. The reason for the is the following:\n // A the moment when we enable packing, we should assume that all clients out there wil already have bits\n // that can unpack properly (i.e. enough time passed since we deployed bits that can unpack)\n // But we can still have clients where some of them already pack, and some do not. If one summary was\n // using packing, then it relies on non-incremental summaries going forward, even if next client who\n // produced summary is not packing!\n // This can have slight improvement by enabling it per file (based on \"did summary we loaded from contain\n // aggregated blobs\"), but that's harder to make reliable, so going for simplicity.\n static readonly fullDataStoreSummaries = true;\n\n protected loadedFromSummary = false;\n\n protected virtualBlobs = new Map<string, ArrayBufferLike>();\n\n static wrap(\n storage: IDocumentStorageService,\n logger: ITelemetryLogger,\n allowPacking?: boolean,\n packingLevel = 2,\n ) {\n if (storage instanceof BlobAggregationStorage) {\n return storage;\n }\n const mc = loggerToMonitoringContext(logger);\n const realAllowPackaging = mc.config.getBoolean(\"FluidAggregateBlobs\") ?? allowPacking ?? false;\n\n // Always create BlobAggregationStorage even if storage is not asking for packing.\n // This is mostly to avoid cases where future changes in policy would result in inability to\n // load old files that were created with aggregation on.\n const minBlobSize = storage.policies?.minBlobSize;\n return new BlobAggregationStorage(storage, logger, realAllowPackaging, packingLevel, minBlobSize);\n }\n\n static async unpackSnapshot(snapshot: ISnapshotTree) {\n const converter = new SnapshotExtractorInPlace();\n await converter.unpackSnapshotCore(snapshot);\n }\n\n public get policies(): IDocumentStorageServicePolicies | undefined {\n const policies = this.storage.policies;\n if (policies) {\n return { ...policies, minBlobSize: undefined };\n }\n }\n\n public async unpackSnapshot(snapshot: ISnapshotTree) {\n // SummarizerNodeWithGC.refreshLatestSummary can call it when this.loadedFromSummary === false\n // (I assumed after file was created)\n // assert(!this.loadedFromSummary, \"unpack without summary\");\n\n this.loadedFromSummary = true;\n await this.unpackSnapshotCore(snapshot);\n }\n\n protected constructor(\n private readonly storage: IDocumentStorageService,\n private readonly logger: ITelemetryLogger,\n private readonly allowPacking: boolean,\n private readonly packingLevel: number,\n private readonly blobCutOffSize?: number) {\n super();\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n this.virtualBlobs.set(id, stringToBuffer(content, \"utf-8\"));\n }\n\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n return this.readBlob(id).catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"BlobDedupNoAggregateBlob\" }, error);\n throw error;\n });\n }\n\n public get repositoryUrl() { return this.storage.repositoryUrl; }\n public async getVersions(versionId: string | null, count: number) {\n return this.storage.getVersions(versionId, count);\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n throw new Error(\"NYI\");\n }\n\n // This is only used through Container.snapshot() for testing purposes\n public async write(root: ITree, parents: string[], message: string, ref: string) {\n return this.storage.write(root, parents, message, ref);\n }\n\n // for now we are not optimizing these blobs, with assumption that this API is used only\n // for big blobs (images)\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.storage.createBlob(file);\n }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n const tree = await this.storage.getSnapshotTree(version);\n if (tree) {\n await this.unpackSnapshot(tree);\n }\n return tree;\n }\n\n public async readBlob(id: string): Promise<ArrayBufferLike> {\n if (this.isRealStorageId(id)) {\n return this.storage.readBlob(id);\n }\n // We support only reading blobs from the summary we loaded from.\n // This may need to be extended to any general summary in the future as runtime usage pattern\n // of storage changes (for example, data stores start to load from recent summary, not from original\n // summary whole container loaded from)\n\n // are there other ways we can get here? createFile is one flow, but we should not be reading blobs\n // in such flow\n assert(this.loadedFromSummary, 0x0f9 /* \"never read summary\" */);\n const blob = this.virtualBlobs.get(id);\n assert(blob !== undefined, 0x0fa /* \"virtual blob not found\" */);\n return blob;\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n const summaryNew = this.allowPacking ? await this.compressSmallBlobs(summary) : summary;\n return this.storage.uploadSummaryWithContext(summaryNew, context);\n }\n\n // For simplification, we assume that\n // - blob aggregation is done at data store level only for now\n // - data store either reuses previous summary, or generates full summary, i.e. there is no partial (some DDS)\n // summary produced by data stores.\n // These simplifications allow us not to touch handles, as they are self-contained (either do not use aggregated\n // blob Or contain aggregated blob that stays relevant for that sub-tree)\n // Note:\n // From perf perspective, it makes sense to place aggregated blobs one level up in the tree not to create extra\n // tree nodes (i.e. have shallow tree with less edges). But that creates problems with reusability of trees at\n // incremental summary time - we would need to understand handles and parse them. In current design we can skip\n // that step because if data store is reused, the hole sub-tree is reused included aggregated blob embedded into it\n // and that means we can do nothing and be correct!\n private async compressSmallBlobs(\n summary: ISummaryTree,\n path = \"\",\n level = 0,\n aggregatorArg?: BlobAggregator): Promise<ISummaryTree> {\n if (this.blobCutOffSize === undefined || this.blobCutOffSize < 0) {\n return summary;\n }\n\n let shouldCompress: boolean = false;\n\n let aggregator = aggregatorArg;\n // checking if this is a dataStore tree, since we only pack at data store level\n if (Object.keys(summary.tree).includes(\".component\")) {\n assert(aggregator === undefined, 0x0fb /* \"logic err with aggregator\" */);\n assert(level === this.packingLevel, 0x23b /* \"we are not packing at the right level\" */);\n aggregator = new BlobAggregator();\n shouldCompress = true;\n } else {\n assert(level !== this.packingLevel, 0x23c /* \"we are not packing at the right level\" */);\n }\n\n const newSummary: ISummaryTree = { ...summary };\n newSummary.tree = { ...newSummary.tree };\n for (const key of Object.keys(summary.tree)) {\n const obj = summary.tree[key];\n // Get path relative to root of data store (where we do aggregation)\n const newPath = shouldCompress ? key : `${path}/${key}`;\n switch (obj.type) {\n case SummaryType.Tree:\n // If client created empty tree, keep it as is\n // Also do not package search blobs - they are part of storage contract\n if (obj.tree !== {} && key !== \"__search\") {\n const tree = await this.compressSmallBlobs(obj, newPath, level + 1, aggregator);\n newSummary.tree[key] = tree;\n if (tree.tree === {}) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n }\n break;\n case SummaryType.Blob:\n if (aggregator && typeof obj.content == \"string\" && obj.content.length < this.blobCutOffSize) {\n aggregator.addBlob(newPath, obj.content);\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n break;\n case SummaryType.Handle: {\n // Would be nice to:\n // Trees: expand the tree\n // Blobs: parse handle and ensure it points to real blob, not virtual blob.\n // We can avoid it for now given data store is the granularity of incremental summaries.\n let handlePath = obj.handle;\n if (handlePath.startsWith(\"/\")) {\n handlePath = handlePath.substr(1);\n }\n // Ensure only whole data stores can be reused, no reusing at deeper level!\n assert(level === 0, 0x0fc /* \"tree reuse at lower level\" */);\n assert(!handlePath.includes(\"/\"),\n 0x0fd /* \"data stores are writing incremental summaries!\" */);\n break;\n }\n case SummaryType.Attachment:\n assert(this.isRealStorageId(obj.id), 0x0fe /* \"attachment is aggregate blob\" */);\n break;\n default:\n unreachableCase(obj, `Unknown type: ${(obj as any).type}`);\n }\n }\n\n assert(newSummary.tree[this.aggregatedBlobName] === undefined, 0x0ff /* \"duplicate aggregate blob\" */);\n if (shouldCompress) {\n // Note: It would be great to add code here to unpack aggregate blob back to normal blobs\n // If only one blob made it into aggregate. Currently that does not happen as we always have\n // at least one .component blob and at least one DDS that has .attributes blob, so it's not an issue.\n // But it's possible that in future that would be great addition!\n // Good news - it's backward compatible change.\n assert(aggregator !== undefined, 0x100 /* \"logic error\" */);\n const content = aggregator.getAggregatedBlobContent();\n if (content !== undefined) {\n newSummary.tree[this.aggregatedBlobName] = {\n type: SummaryType.Blob,\n content,\n };\n }\n }\n return newSummary;\n }\n\n protected isRealStorageId(id: string): boolean {\n return !id.startsWith(this.virtualIdPrefix);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"blobAggregationStorage.js","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,+EAO8C;AAC9C,+DAOuC;AAEvC,qEAA4E;AAE5E;;;EAGE;AACF,SAAS,eAAe,CAAC,IAAqB,EAAE,QAA4B;IACxE,IAAI,IAAI,YAAY,UAAU,EAAE,EAAE,8DAA8D;QAC5F,OAAO,IAAA,iCAAkB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KAC7C;IACD,OAAO,IAAA,6BAAc,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAEA;;GAEG;AACJ,MAAM,cAAc;IAApB;QACqB,YAAO,GAAuB,EAAE,CAAC;IAiBtD,CAAC;IAfU,OAAO,CAAC,GAAW,EAAE,OAAe;QACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IACtC,CAAC;IAEM,wBAAwB;QAC3B,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,OAAO,SAAS,CAAC;SACpB;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,KAAsB;QAC9B,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAuB,CAAC;IAClD,CAAC;CACJ;AAED;;;GAGG;AACH,MAAsB,iBAAiB;IAAvC;QACuB,uBAAkB,GAAG,OAAO,CAAC;QAC7B,oBAAe,GAAG,IAAI,CAAC;QAE1C,gDAAgD;QACtC,qBAAgB,GAAG,CAAC,CAAC;IAyCnC,CAAC;IAxCa,gBAAgB;QACtB,OAAO,GAAG,IAAI,CAA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,MAAM;iBACT;gBACD,KAAK,kCAAW,CAAC,UAAU;oBACvB,IAAA,qBAAM,EAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,oCAAoC,CAAC,CAAC;oBACjF,MAAM;gBACV;oBACI,IAAA,8BAAe,EAAC,GAAG,EAAE,iBAAkB,GAAW,CAAC,IAAI,EAAE,CAAC,CAAC;aAClE;SACJ;QAED,IAAA,qBAAM,EAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACvG,IAAI,cAAc,EAAE;YAChB,yFAAyF;YACzF,4FAA4F;YAC5F,qGAAqG;YACrG,iEAAiE;YACjE,+CAA+C;YAC/C,IAAA,qBAAM,EAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAC5D,MAAM,OAAO,GAAG,UAAU,CAAC,wBAAwB,EAAE,CAAC;YACtD,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG;oBACvC,IAAI,EAAE,kCAAW,CAAC,IAAI;oBACtB,OAAO;iBACV,CAAC;aACL;SACJ;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,eAAe,CAAC,EAAU;QAChC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC;;AAlOL,wDAmOC;AAlOG,4FAA4F;AAC5F,8BAA8B;AAC9B,uGAAuG;AACvG,yGAAyG;AACzG,4FAA4F;AAC5F,qGAAqG;AACrG,oGAAoG;AACpG,mCAAmC;AACnC,yGAAyG;AACzG,mFAAmF;AACnE,6CAAsB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n SummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n assert,\n bufferToString,\n stringToBuffer,\n unreachableCase,\n fromUtf8ToBase64,\n Uint8ArrayToString,\n } from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils\";\n\n/*\n * Work around for bufferToString having a bug - it can't consume IsoBuffer!\n * To be removed once bufferToString is fixed!\n*/\nfunction bufferToString2(blob: ArrayBufferLike, encoding: \"utf-8\" | \"base64\"): string {\n if (blob instanceof Uint8Array) { // IsoBuffer does not have ctor, so it's not in proto chain :(\n return Uint8ArrayToString(blob, encoding);\n }\n return bufferToString(blob, encoding);\n}\n\n /**\n * Class responsible for aggregating smaller blobs into one and unpacking it later on.\n */\nclass BlobAggregator {\n private readonly content: [string, string][] = [];\n\n public addBlob(key: string, content: string) {\n this.content.push([key, content]);\n }\n\n public getAggregatedBlobContent() {\n if (this.content.length === 0) {\n return undefined;\n }\n return JSON.stringify(this.content);\n }\n\n static load(input: ArrayBufferLike) {\n const data = bufferToString2(input, \"utf-8\");\n return JSON.parse(data) as [string, string][];\n }\n}\n\n/*\n * Base class that deals with unpacking snapshots (in place) containing aggregated blobs\n * It relies on abstract methods for reads and storing unpacked blobs.\n */\nexport abstract class SnapshotExtractor {\n protected readonly aggregatedBlobName = \"__big\";\n protected readonly virtualIdPrefix = \"__\";\n\n // counter for generation of virtual storage IDs\n protected virtualIdCounter = 0;\n protected getNextVirtualId() {\n return `${this.virtualIdPrefix}${++this.virtualIdCounter}`;\n }\n\n abstract getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;\n abstract setBlob(id: string, tree: ISnapshotTree, content: string);\n\n public async unpackSnapshotCore(snapshot: ISnapshotTree, level = 0): Promise<void> {\n for (const key of Object.keys(snapshot.trees)) {\n const obj = snapshot.trees[key];\n await this.unpackSnapshotCore(obj, level + 1);\n }\n\n // For future proof, we will support multiple aggregated blobs with any name\n // that starts with this.aggregatedBlobName\n for (const key of Object.keys(snapshot.blobs)) {\n if (!key.startsWith(this.aggregatedBlobName)) { continue; }\n const blobId = snapshot.blobs[key];\n if (blobId !== undefined) {\n const blob = await this.getBlob(blobId, snapshot);\n for (const [path, value] of BlobAggregator.load(blob)) {\n const id = this.getNextVirtualId();\n this.setBlob(id, snapshot, value);\n const pathSplit = path.split(\"/\");\n let subTree = snapshot;\n for (const subPath of pathSplit.slice(0, pathSplit.length - 1)) {\n if (subTree.trees[subPath] === undefined) {\n subTree.trees[subPath] = { blobs: {}, trees: {} };\n }\n subTree = subTree.trees[subPath];\n }\n const blobName = pathSplit[pathSplit.length - 1];\n assert(subTree.blobs[blobName] === undefined, 0x0f6 /* \"real blob ID exists\" */);\n subTree.blobs[blobName] = id;\n }\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshot.blobs[this.aggregatedBlobName];\n }\n }\n }\n}\n\n/*\n * Snapshot extractor class that works in place, i.e. patches snapshot that has\n * blob content in ISnapshotTree.blobs itself, not in storage.\n * As result, it implements reading and writing of blobs to/from snapshot itself.\n * It follows existing pattern that mixes concerns - ISnapshotTree.blobs is used for two\n * purposes:\n * 1. map path name to blob ID\n * 2. map blob ID to blob content\n * #2 is what storage (IDocumentStorageService) is for, but in places where we do not have it\n * (like loading serialized earlier draft content), blob content is put directly into snapshot.\n * Ideally this should be fixed by using BlobCacheStorageService or something similar and\n * fixing existing flows to allow switching of storage.\n */\nclass SnapshotExtractorInPlace extends SnapshotExtractor {\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n const blob = tree.blobs[id];\n assert(blob !== undefined, 0x0f7 /* \"aggregate blob missing\" */);\n return stringToBuffer(blob, \"base64\");\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n assert(tree.blobs[id] === undefined, 0x0f8 /* \"blob from aggregate blob exists on its own\" */);\n tree.blobs[id] = fromUtf8ToBase64(content);\n }\n}\n\n/*\n * Snapshot packer and extractor.\n * When summary is written it will find and aggregate small blobs into bigger blobs\n * When snapshot is read, it will unpack aggregated blobs and provide them transparently to caller.\n */\nexport class BlobAggregationStorage extends SnapshotExtractor implements IDocumentStorageService {\n // Tells data store if it can use incremental summary (i.e. reuse DDSs from previous summary\n // when only one DDS changed).\n // The answer has to be know long before we enable actual packing. The reason for the is the following:\n // A the moment when we enable packing, we should assume that all clients out there wil already have bits\n // that can unpack properly (i.e. enough time passed since we deployed bits that can unpack)\n // But we can still have clients where some of them already pack, and some do not. If one summary was\n // using packing, then it relies on non-incremental summaries going forward, even if next client who\n // produced summary is not packing!\n // This can have slight improvement by enabling it per file (based on \"did summary we loaded from contain\n // aggregated blobs\"), but that's harder to make reliable, so going for simplicity.\n static readonly fullDataStoreSummaries = true;\n\n protected loadedFromSummary = false;\n\n protected virtualBlobs = new Map<string, ArrayBufferLike>();\n\n static wrap(\n storage: IDocumentStorageService,\n logger: ITelemetryLogger,\n allowPacking?: boolean,\n packingLevel = 2,\n ) {\n if (storage instanceof BlobAggregationStorage) {\n return storage;\n }\n const mc = loggerToMonitoringContext(logger);\n const realAllowPackaging = mc.config.getBoolean(\"FluidAggregateBlobs\") ?? allowPacking ?? false;\n\n // Always create BlobAggregationStorage even if storage is not asking for packing.\n // This is mostly to avoid cases where future changes in policy would result in inability to\n // load old files that were created with aggregation on.\n const minBlobSize = storage.policies?.minBlobSize;\n return new BlobAggregationStorage(storage, logger, realAllowPackaging, packingLevel, minBlobSize);\n }\n\n static async unpackSnapshot(snapshot: ISnapshotTree) {\n const converter = new SnapshotExtractorInPlace();\n await converter.unpackSnapshotCore(snapshot);\n }\n\n public get policies(): IDocumentStorageServicePolicies | undefined {\n const policies = this.storage.policies;\n if (policies) {\n return { ...policies, minBlobSize: undefined };\n }\n }\n\n public async unpackSnapshot(snapshot: ISnapshotTree) {\n // SummarizerNodeWithGC.refreshLatestSummary can call it when this.loadedFromSummary === false\n // (I assumed after file was created)\n // assert(!this.loadedFromSummary, \"unpack without summary\");\n\n this.loadedFromSummary = true;\n await this.unpackSnapshotCore(snapshot);\n }\n\n protected constructor(\n private readonly storage: IDocumentStorageService,\n private readonly logger: ITelemetryLogger,\n private readonly allowPacking: boolean,\n private readonly packingLevel: number,\n private readonly blobCutOffSize?: number) {\n super();\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n this.virtualBlobs.set(id, stringToBuffer(content, \"utf-8\"));\n }\n\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n return this.readBlob(id).catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"BlobDedupNoAggregateBlob\" }, error);\n throw error;\n });\n }\n\n public get repositoryUrl() { return this.storage.repositoryUrl; }\n public async getVersions(versionId: string | null, count: number) {\n return this.storage.getVersions(versionId, count);\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n throw new Error(\"NYI\");\n }\n\n // for now we are not optimizing these blobs, with assumption that this API is used only\n // for big blobs (images)\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.storage.createBlob(file);\n }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n const tree = await this.storage.getSnapshotTree(version);\n if (tree) {\n await this.unpackSnapshot(tree);\n }\n return tree;\n }\n\n public async readBlob(id: string): Promise<ArrayBufferLike> {\n if (this.isRealStorageId(id)) {\n return this.storage.readBlob(id);\n }\n // We support only reading blobs from the summary we loaded from.\n // This may need to be extended to any general summary in the future as runtime usage pattern\n // of storage changes (for example, data stores start to load from recent summary, not from original\n // summary whole container loaded from)\n\n // are there other ways we can get here? createFile is one flow, but we should not be reading blobs\n // in such flow\n assert(this.loadedFromSummary, 0x0f9 /* \"never read summary\" */);\n const blob = this.virtualBlobs.get(id);\n assert(blob !== undefined, 0x0fa /* \"virtual blob not found\" */);\n return blob;\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n const summaryNew = this.allowPacking ? await this.compressSmallBlobs(summary) : summary;\n return this.storage.uploadSummaryWithContext(summaryNew, context);\n }\n\n // For simplification, we assume that\n // - blob aggregation is done at data store level only for now\n // - data store either reuses previous summary, or generates full summary, i.e. there is no partial (some DDS)\n // summary produced by data stores.\n // These simplifications allow us not to touch handles, as they are self-contained (either do not use aggregated\n // blob Or contain aggregated blob that stays relevant for that sub-tree)\n // Note:\n // From perf perspective, it makes sense to place aggregated blobs one level up in the tree not to create extra\n // tree nodes (i.e. have shallow tree with less edges). But that creates problems with reusability of trees at\n // incremental summary time - we would need to understand handles and parse them. In current design we can skip\n // that step because if data store is reused, the hole sub-tree is reused included aggregated blob embedded into it\n // and that means we can do nothing and be correct!\n private async compressSmallBlobs(\n summary: ISummaryTree,\n path = \"\",\n level = 0,\n aggregatorArg?: BlobAggregator): Promise<ISummaryTree> {\n if (this.blobCutOffSize === undefined || this.blobCutOffSize < 0) {\n return summary;\n }\n\n let shouldCompress: boolean = false;\n\n let aggregator = aggregatorArg;\n // checking if this is a dataStore tree, since we only pack at data store level\n if (Object.keys(summary.tree).includes(\".component\")) {\n assert(aggregator === undefined, 0x0fb /* \"logic err with aggregator\" */);\n assert(level === this.packingLevel, 0x23b /* \"we are not packing at the right level\" */);\n aggregator = new BlobAggregator();\n shouldCompress = true;\n } else {\n assert(level !== this.packingLevel, 0x23c /* \"we are not packing at the right level\" */);\n }\n\n const newSummary: ISummaryTree = { ...summary };\n newSummary.tree = { ...newSummary.tree };\n for (const key of Object.keys(summary.tree)) {\n const obj = summary.tree[key];\n // Get path relative to root of data store (where we do aggregation)\n const newPath = shouldCompress ? key : `${path}/${key}`;\n switch (obj.type) {\n case SummaryType.Tree:\n // If client created empty tree, keep it as is\n // Also do not package search blobs - they are part of storage contract\n if (obj.tree !== {} && key !== \"__search\") {\n const tree = await this.compressSmallBlobs(obj, newPath, level + 1, aggregator);\n newSummary.tree[key] = tree;\n if (tree.tree === {}) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n }\n break;\n case SummaryType.Blob:\n if (aggregator && typeof obj.content == \"string\" && obj.content.length < this.blobCutOffSize) {\n aggregator.addBlob(newPath, obj.content);\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n break;\n case SummaryType.Handle: {\n // Would be nice to:\n // Trees: expand the tree\n // Blobs: parse handle and ensure it points to real blob, not virtual blob.\n // We can avoid it for now given data store is the granularity of incremental summaries.\n let handlePath = obj.handle;\n if (handlePath.startsWith(\"/\")) {\n handlePath = handlePath.substr(1);\n }\n // Ensure only whole data stores can be reused, no reusing at deeper level!\n assert(level === 0, 0x0fc /* \"tree reuse at lower level\" */);\n assert(!handlePath.includes(\"/\"),\n 0x0fd /* \"data stores are writing incremental summaries!\" */);\n break;\n }\n case SummaryType.Attachment:\n assert(this.isRealStorageId(obj.id), 0x0fe /* \"attachment is aggregate blob\" */);\n break;\n default:\n unreachableCase(obj, `Unknown type: ${(obj as any).type}`);\n }\n }\n\n assert(newSummary.tree[this.aggregatedBlobName] === undefined, 0x0ff /* \"duplicate aggregate blob\" */);\n if (shouldCompress) {\n // Note: It would be great to add code here to unpack aggregate blob back to normal blobs\n // If only one blob made it into aggregate. Currently that does not happen as we always have\n // at least one .component blob and at least one DDS that has .attributes blob, so it's not an issue.\n // But it's possible that in future that would be great addition!\n // Good news - it's backward compatible change.\n assert(aggregator !== undefined, 0x100 /* \"logic error\" */);\n const content = aggregator.getAggregatedBlobContent();\n if (content !== undefined) {\n newSummary.tree[this.aggregatedBlobName] = {\n type: SummaryType.Blob,\n content,\n };\n }\n }\n return newSummary;\n }\n\n protected isRealStorageId(id: string): boolean {\n return !id.startsWith(this.virtualIdPrefix);\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree,
|
|
6
|
+
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
7
7
|
export declare class DocumentStorageServiceProxy implements IDocumentStorageService {
|
|
8
8
|
protected readonly internalStorageService: IDocumentStorageService;
|
|
9
9
|
private _policies;
|
|
@@ -13,7 +13,6 @@ export declare class DocumentStorageServiceProxy implements IDocumentStorageServ
|
|
|
13
13
|
constructor(internalStorageService: IDocumentStorageService);
|
|
14
14
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
15
15
|
getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
|
|
16
|
-
write(tree: ITree, parents: string[], message: string, ref: string): Promise<IVersion>;
|
|
17
16
|
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
18
17
|
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
19
18
|
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"documentStorageServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACX,MAAM,sCAAsC,CAAC;AAE9C,qBAAa,2BAA4B,YAAW,uBAAuB;IAe3D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,uBAAuB;IAd9E,OAAO,CAAC,SAAS,CAA8C;IAE/D,IAAW,QAAQ,CAAC,QAAQ,EAAE,+BAA+B,GAAG,SAAS,EAExE;IAED,IAAW,QAAQ,IAJW,+BAA+B,GAAG,SAAS,CAMxE;IAED,IAAW,aAAa,IAAI,MAAM,CAEjC;gBAE8B,sBAAsB,EAAE,uBAAuB;IAEjE,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAIlE,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIzE,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1F,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAI9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI/D,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAGlE"}
|
|
@@ -25,9 +25,6 @@ class DocumentStorageServiceProxy {
|
|
|
25
25
|
async getVersions(versionId, count) {
|
|
26
26
|
return this.internalStorageService.getVersions(versionId, count);
|
|
27
27
|
}
|
|
28
|
-
async write(tree, parents, message, ref) {
|
|
29
|
-
return this.internalStorageService.write(tree, parents, message, ref);
|
|
30
|
-
}
|
|
31
28
|
async uploadSummaryWithContext(summary, context) {
|
|
32
29
|
return this.internalStorageService.uploadSummaryWithContext(summary, context);
|
|
33
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceProxy.js","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"documentStorageServiceProxy.js","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH,MAAa,2BAA2B;IAepC,YAA+B,sBAA+C;QAA/C,2BAAsB,GAAtB,sBAAsB,CAAyB;IAAI,CAAC;IAZnF,IAAW,QAAQ,CAAC,QAAqD;QACrE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED,IAAW,QAAQ;;QACf,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAClE,CAAC;IAED,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;IACrD,CAAC;IAIM,KAAK,CAAC,eAAe,CAAC,OAAkB;QAC3C,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAAwB,EAAE,KAAa;QAC5D,OAAO,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC;IAEM,KAAK,CAAC,wBAAwB,CAAC,OAAqB,EAAE,OAAwB;QACjF,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAC/C,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QACzC,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAc;QAChC,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;CACJ;AAxCD,kEAwCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n} from \"@fluidframework/protocol-definitions\";\n\nexport class DocumentStorageServiceProxy implements IDocumentStorageService {\n private _policies: IDocumentStorageServicePolicies | undefined;\n\n public set policies(policies: IDocumentStorageServicePolicies | undefined) {\n this._policies = policies;\n }\n\n public get policies() {\n return this._policies ?? this.internalStorageService.policies;\n }\n\n public get repositoryUrl(): string {\n return this.internalStorageService.repositoryUrl;\n }\n\n constructor(protected readonly internalStorageService: IDocumentStorageService) { }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n return this.internalStorageService.getSnapshotTree(version);\n }\n\n public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n return this.internalStorageService.getVersions(versionId, count);\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n return this.internalStorageService.uploadSummaryWithContext(summary, context);\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n return this.internalStorageService.downloadSummary(handle);\n }\n\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.internalStorageService.createBlob(file);\n }\n\n public async readBlob(blobId: string): Promise<ArrayBufferLike> {\n return this.internalStorageService.readBlob(blobId);\n }\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/driver-utils";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "1.0.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,UAAU,CAAC"}
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/driver-utils";
|
|
11
|
-
exports.pkgVersion = "0.
|
|
11
|
+
exports.pkgVersion = "1.0.1";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"1.0.1\";\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion
|
|
6
|
+
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
8
|
export declare abstract class SnapshotExtractor {
|
|
9
9
|
protected readonly aggregatedBlobName = "__big";
|
|
@@ -33,7 +33,6 @@ export declare class BlobAggregationStorage extends SnapshotExtractor implements
|
|
|
33
33
|
get repositoryUrl(): string;
|
|
34
34
|
getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
|
|
35
35
|
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
36
|
-
write(root: ITree, parents: string[], message: string, ref: string): Promise<IVersion>;
|
|
37
36
|
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
|
|
38
37
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
39
38
|
readBlob(id: string): Promise<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobAggregationStorage.d.ts","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACF,uBAAuB,EACxB,+BAA+B,EAC9B,eAAe,EACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EAC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
|
174
|
-
// This is only used through Container.snapshot() for testing purposes
|
|
175
|
-
async write(root, parents, message, ref) {
|
|
176
|
-
return this.storage.write(root, parents, message, ref);
|
|
177
|
-
}
|
|
178
174
|
// for now we are not optimizing these blobs, with assumption that this API is used only
|
|
179
175
|
// for big blobs (images)
|
|
180
176
|
async createBlob(file) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blobAggregationStorage.js","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAMH,WAAW,GAEd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,MAAM,EACN,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GACpB,MAAM,8BAA8B,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;EAGE;AACF,SAAS,eAAe,CAAC,IAAqB,EAAE,QAA4B;IACxE,IAAI,IAAI,YAAY,UAAU,EAAE,EAAE,8DAA8D;QAC5F,OAAO,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KAC7C;IACD,OAAO,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAEA;;GAEG;AACJ,MAAM,cAAc;IAApB;QACqB,YAAO,GAAuB,EAAE,CAAC;IAiBtD,CAAC;IAfU,OAAO,CAAC,GAAW,EAAE,OAAe;QACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IACtC,CAAC;IAEM,wBAAwB;QAC3B,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,OAAO,SAAS,CAAC;SACpB;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,KAAsB;QAC9B,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,UAAU,CAAC;IACtB,CAAC;IAES,eAAe,CAAC,EAAU;QAChC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC;;AAtOD,4FAA4F;AAC5F,8BAA8B;AAC9B,uGAAuG;AACvG,yGAAyG;AACzG,4FAA4F;AAC5F,qGAAqG;AACrG,oGAAoG;AACpG,mCAAmC;AACnC,yGAAyG;AACzG,mFAAmF;AACnE,6CAAsB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n SummaryType,\n ITree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n assert,\n bufferToString,\n stringToBuffer,\n unreachableCase,\n fromUtf8ToBase64,\n Uint8ArrayToString,\n } from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils\";\n\n/*\n * Work around for bufferToString having a bug - it can't consume IsoBuffer!\n * To be removed once bufferToString is fixed!\n*/\nfunction bufferToString2(blob: ArrayBufferLike, encoding: \"utf-8\" | \"base64\"): string {\n if (blob instanceof Uint8Array) { // IsoBuffer does not have ctor, so it's not in proto chain :(\n return Uint8ArrayToString(blob, encoding);\n }\n return bufferToString(blob, encoding);\n}\n\n /**\n * Class responsible for aggregating smaller blobs into one and unpacking it later on.\n */\nclass BlobAggregator {\n private readonly content: [string, string][] = [];\n\n public addBlob(key: string, content: string) {\n this.content.push([key, content]);\n }\n\n public getAggregatedBlobContent() {\n if (this.content.length === 0) {\n return undefined;\n }\n return JSON.stringify(this.content);\n }\n\n static load(input: ArrayBufferLike) {\n const data = bufferToString2(input, \"utf-8\");\n return JSON.parse(data) as [string, string][];\n }\n}\n\n/*\n * Base class that deals with unpacking snapshots (in place) containing aggregated blobs\n * It relies on abstract methods for reads and storing unpacked blobs.\n */\nexport abstract class SnapshotExtractor {\n protected readonly aggregatedBlobName = \"__big\";\n protected readonly virtualIdPrefix = \"__\";\n\n // counter for generation of virtual storage IDs\n protected virtualIdCounter = 0;\n protected getNextVirtualId() {\n return `${this.virtualIdPrefix}${++this.virtualIdCounter}`;\n }\n\n abstract getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;\n abstract setBlob(id: string, tree: ISnapshotTree, content: string);\n\n public async unpackSnapshotCore(snapshot: ISnapshotTree, level = 0): Promise<void> {\n for (const key of Object.keys(snapshot.trees)) {\n const obj = snapshot.trees[key];\n await this.unpackSnapshotCore(obj, level + 1);\n }\n\n // For future proof, we will support multiple aggregated blobs with any name\n // that starts with this.aggregatedBlobName\n for (const key of Object.keys(snapshot.blobs)) {\n if (!key.startsWith(this.aggregatedBlobName)) { continue; }\n const blobId = snapshot.blobs[key];\n if (blobId !== undefined) {\n const blob = await this.getBlob(blobId, snapshot);\n for (const [path, value] of BlobAggregator.load(blob)) {\n const id = this.getNextVirtualId();\n this.setBlob(id, snapshot, value);\n const pathSplit = path.split(\"/\");\n let subTree = snapshot;\n for (const subPath of pathSplit.slice(0, pathSplit.length - 1)) {\n if (subTree.trees[subPath] === undefined) {\n subTree.trees[subPath] = { blobs: {}, trees: {} };\n }\n subTree = subTree.trees[subPath];\n }\n const blobName = pathSplit[pathSplit.length - 1];\n assert(subTree.blobs[blobName] === undefined, 0x0f6 /* \"real blob ID exists\" */);\n subTree.blobs[blobName] = id;\n }\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshot.blobs[this.aggregatedBlobName];\n }\n }\n }\n}\n\n/*\n * Snapshot extractor class that works in place, i.e. patches snapshot that has\n * blob content in ISnapshotTree.blobs itself, not in storage.\n * As result, it implements reading and writing of blobs to/from snapshot itself.\n * It follows existing pattern that mixes concerns - ISnapshotTree.blobs is used for two\n * purposes:\n * 1. map path name to blob ID\n * 2. map blob ID to blob content\n * #2 is what storage (IDocumentStorageService) is for, but in places where we do not have it\n * (like loading serialized earlier draft content), blob content is put directly into snapshot.\n * Ideally this should be fixed by using BlobCacheStorageService or something similar and\n * fixing existing flows to allow switching of storage.\n */\nclass SnapshotExtractorInPlace extends SnapshotExtractor {\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n const blob = tree.blobs[id];\n assert(blob !== undefined, 0x0f7 /* \"aggregate blob missing\" */);\n return stringToBuffer(blob, \"base64\");\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n assert(tree.blobs[id] === undefined, 0x0f8 /* \"blob from aggregate blob exists on its own\" */);\n tree.blobs[id] = fromUtf8ToBase64(content);\n }\n}\n\n/*\n * Snapshot packer and extractor.\n * When summary is written it will find and aggregate small blobs into bigger blobs\n * When snapshot is read, it will unpack aggregated blobs and provide them transparently to caller.\n */\nexport class BlobAggregationStorage extends SnapshotExtractor implements IDocumentStorageService {\n // Tells data store if it can use incremental summary (i.e. reuse DDSs from previous summary\n // when only one DDS changed).\n // The answer has to be know long before we enable actual packing. The reason for the is the following:\n // A the moment when we enable packing, we should assume that all clients out there wil already have bits\n // that can unpack properly (i.e. enough time passed since we deployed bits that can unpack)\n // But we can still have clients where some of them already pack, and some do not. If one summary was\n // using packing, then it relies on non-incremental summaries going forward, even if next client who\n // produced summary is not packing!\n // This can have slight improvement by enabling it per file (based on \"did summary we loaded from contain\n // aggregated blobs\"), but that's harder to make reliable, so going for simplicity.\n static readonly fullDataStoreSummaries = true;\n\n protected loadedFromSummary = false;\n\n protected virtualBlobs = new Map<string, ArrayBufferLike>();\n\n static wrap(\n storage: IDocumentStorageService,\n logger: ITelemetryLogger,\n allowPacking?: boolean,\n packingLevel = 2,\n ) {\n if (storage instanceof BlobAggregationStorage) {\n return storage;\n }\n const mc = loggerToMonitoringContext(logger);\n const realAllowPackaging = mc.config.getBoolean(\"FluidAggregateBlobs\") ?? allowPacking ?? false;\n\n // Always create BlobAggregationStorage even if storage is not asking for packing.\n // This is mostly to avoid cases where future changes in policy would result in inability to\n // load old files that were created with aggregation on.\n const minBlobSize = storage.policies?.minBlobSize;\n return new BlobAggregationStorage(storage, logger, realAllowPackaging, packingLevel, minBlobSize);\n }\n\n static async unpackSnapshot(snapshot: ISnapshotTree) {\n const converter = new SnapshotExtractorInPlace();\n await converter.unpackSnapshotCore(snapshot);\n }\n\n public get policies(): IDocumentStorageServicePolicies | undefined {\n const policies = this.storage.policies;\n if (policies) {\n return { ...policies, minBlobSize: undefined };\n }\n }\n\n public async unpackSnapshot(snapshot: ISnapshotTree) {\n // SummarizerNodeWithGC.refreshLatestSummary can call it when this.loadedFromSummary === false\n // (I assumed after file was created)\n // assert(!this.loadedFromSummary, \"unpack without summary\");\n\n this.loadedFromSummary = true;\n await this.unpackSnapshotCore(snapshot);\n }\n\n protected constructor(\n private readonly storage: IDocumentStorageService,\n private readonly logger: ITelemetryLogger,\n private readonly allowPacking: boolean,\n private readonly packingLevel: number,\n private readonly blobCutOffSize?: number) {\n super();\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n this.virtualBlobs.set(id, stringToBuffer(content, \"utf-8\"));\n }\n\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n return this.readBlob(id).catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"BlobDedupNoAggregateBlob\" }, error);\n throw error;\n });\n }\n\n public get repositoryUrl() { return this.storage.repositoryUrl; }\n public async getVersions(versionId: string | null, count: number) {\n return this.storage.getVersions(versionId, count);\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n throw new Error(\"NYI\");\n }\n\n // This is only used through Container.snapshot() for testing purposes\n public async write(root: ITree, parents: string[], message: string, ref: string) {\n return this.storage.write(root, parents, message, ref);\n }\n\n // for now we are not optimizing these blobs, with assumption that this API is used only\n // for big blobs (images)\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.storage.createBlob(file);\n }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n const tree = await this.storage.getSnapshotTree(version);\n if (tree) {\n await this.unpackSnapshot(tree);\n }\n return tree;\n }\n\n public async readBlob(id: string): Promise<ArrayBufferLike> {\n if (this.isRealStorageId(id)) {\n return this.storage.readBlob(id);\n }\n // We support only reading blobs from the summary we loaded from.\n // This may need to be extended to any general summary in the future as runtime usage pattern\n // of storage changes (for example, data stores start to load from recent summary, not from original\n // summary whole container loaded from)\n\n // are there other ways we can get here? createFile is one flow, but we should not be reading blobs\n // in such flow\n assert(this.loadedFromSummary, 0x0f9 /* \"never read summary\" */);\n const blob = this.virtualBlobs.get(id);\n assert(blob !== undefined, 0x0fa /* \"virtual blob not found\" */);\n return blob;\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n const summaryNew = this.allowPacking ? await this.compressSmallBlobs(summary) : summary;\n return this.storage.uploadSummaryWithContext(summaryNew, context);\n }\n\n // For simplification, we assume that\n // - blob aggregation is done at data store level only for now\n // - data store either reuses previous summary, or generates full summary, i.e. there is no partial (some DDS)\n // summary produced by data stores.\n // These simplifications allow us not to touch handles, as they are self-contained (either do not use aggregated\n // blob Or contain aggregated blob that stays relevant for that sub-tree)\n // Note:\n // From perf perspective, it makes sense to place aggregated blobs one level up in the tree not to create extra\n // tree nodes (i.e. have shallow tree with less edges). But that creates problems with reusability of trees at\n // incremental summary time - we would need to understand handles and parse them. In current design we can skip\n // that step because if data store is reused, the hole sub-tree is reused included aggregated blob embedded into it\n // and that means we can do nothing and be correct!\n private async compressSmallBlobs(\n summary: ISummaryTree,\n path = \"\",\n level = 0,\n aggregatorArg?: BlobAggregator): Promise<ISummaryTree> {\n if (this.blobCutOffSize === undefined || this.blobCutOffSize < 0) {\n return summary;\n }\n\n let shouldCompress: boolean = false;\n\n let aggregator = aggregatorArg;\n // checking if this is a dataStore tree, since we only pack at data store level\n if (Object.keys(summary.tree).includes(\".component\")) {\n assert(aggregator === undefined, 0x0fb /* \"logic err with aggregator\" */);\n assert(level === this.packingLevel, 0x23b /* \"we are not packing at the right level\" */);\n aggregator = new BlobAggregator();\n shouldCompress = true;\n } else {\n assert(level !== this.packingLevel, 0x23c /* \"we are not packing at the right level\" */);\n }\n\n const newSummary: ISummaryTree = { ...summary };\n newSummary.tree = { ...newSummary.tree };\n for (const key of Object.keys(summary.tree)) {\n const obj = summary.tree[key];\n // Get path relative to root of data store (where we do aggregation)\n const newPath = shouldCompress ? key : `${path}/${key}`;\n switch (obj.type) {\n case SummaryType.Tree:\n // If client created empty tree, keep it as is\n // Also do not package search blobs - they are part of storage contract\n if (obj.tree !== {} && key !== \"__search\") {\n const tree = await this.compressSmallBlobs(obj, newPath, level + 1, aggregator);\n newSummary.tree[key] = tree;\n if (tree.tree === {}) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n }\n break;\n case SummaryType.Blob:\n if (aggregator && typeof obj.content == \"string\" && obj.content.length < this.blobCutOffSize) {\n aggregator.addBlob(newPath, obj.content);\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n break;\n case SummaryType.Handle: {\n // Would be nice to:\n // Trees: expand the tree\n // Blobs: parse handle and ensure it points to real blob, not virtual blob.\n // We can avoid it for now given data store is the granularity of incremental summaries.\n let handlePath = obj.handle;\n if (handlePath.startsWith(\"/\")) {\n handlePath = handlePath.substr(1);\n }\n // Ensure only whole data stores can be reused, no reusing at deeper level!\n assert(level === 0, 0x0fc /* \"tree reuse at lower level\" */);\n assert(!handlePath.includes(\"/\"),\n 0x0fd /* \"data stores are writing incremental summaries!\" */);\n break;\n }\n case SummaryType.Attachment:\n assert(this.isRealStorageId(obj.id), 0x0fe /* \"attachment is aggregate blob\" */);\n break;\n default:\n unreachableCase(obj, `Unknown type: ${(obj as any).type}`);\n }\n }\n\n assert(newSummary.tree[this.aggregatedBlobName] === undefined, 0x0ff /* \"duplicate aggregate blob\" */);\n if (shouldCompress) {\n // Note: It would be great to add code here to unpack aggregate blob back to normal blobs\n // If only one blob made it into aggregate. Currently that does not happen as we always have\n // at least one .component blob and at least one DDS that has .attributes blob, so it's not an issue.\n // But it's possible that in future that would be great addition!\n // Good news - it's backward compatible change.\n assert(aggregator !== undefined, 0x100 /* \"logic error\" */);\n const content = aggregator.getAggregatedBlobContent();\n if (content !== undefined) {\n newSummary.tree[this.aggregatedBlobName] = {\n type: SummaryType.Blob,\n content,\n };\n }\n }\n return newSummary;\n }\n\n protected isRealStorageId(id: string): boolean {\n return !id.startsWith(this.virtualIdPrefix);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"blobAggregationStorage.js","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAMH,WAAW,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,MAAM,EACN,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GACpB,MAAM,8BAA8B,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;EAGE;AACF,SAAS,eAAe,CAAC,IAAqB,EAAE,QAA4B;IACxE,IAAI,IAAI,YAAY,UAAU,EAAE,EAAE,8DAA8D;QAC5F,OAAO,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KAC7C;IACD,OAAO,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAEA;;GAEG;AACJ,MAAM,cAAc;IAApB;QACqB,YAAO,GAAuB,EAAE,CAAC;IAiBtD,CAAC;IAfU,OAAO,CAAC,GAAW,EAAE,OAAe;QACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IACtC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ACV,CAAC;aACL;SACJ;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,eAAe,CAAC,EAAU;QAChC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC;;AAjOD,4FAA4F;AAC5F,8BAA8B;AAC9B,uGAAuG;AACvG,yGAAyG;AACzG,4FAA4F;AAC5F,qGAAqG;AACrG,oGAAoG;AACpG,mCAAmC;AACnC,yGAAyG;AACzG,mFAAmF;AACnE,6CAAsB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n SummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n assert,\n bufferToString,\n stringToBuffer,\n unreachableCase,\n fromUtf8ToBase64,\n Uint8ArrayToString,\n } from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils\";\n\n/*\n * Work around for bufferToString having a bug - it can't consume IsoBuffer!\n * To be removed once bufferToString is fixed!\n*/\nfunction bufferToString2(blob: ArrayBufferLike, encoding: \"utf-8\" | \"base64\"): string {\n if (blob instanceof Uint8Array) { // IsoBuffer does not have ctor, so it's not in proto chain :(\n return Uint8ArrayToString(blob, encoding);\n }\n return bufferToString(blob, encoding);\n}\n\n /**\n * Class responsible for aggregating smaller blobs into one and unpacking it later on.\n */\nclass BlobAggregator {\n private readonly content: [string, string][] = [];\n\n public addBlob(key: string, content: string) {\n this.content.push([key, content]);\n }\n\n public getAggregatedBlobContent() {\n if (this.content.length === 0) {\n return undefined;\n }\n return JSON.stringify(this.content);\n }\n\n static load(input: ArrayBufferLike) {\n const data = bufferToString2(input, \"utf-8\");\n return JSON.parse(data) as [string, string][];\n }\n}\n\n/*\n * Base class that deals with unpacking snapshots (in place) containing aggregated blobs\n * It relies on abstract methods for reads and storing unpacked blobs.\n */\nexport abstract class SnapshotExtractor {\n protected readonly aggregatedBlobName = \"__big\";\n protected readonly virtualIdPrefix = \"__\";\n\n // counter for generation of virtual storage IDs\n protected virtualIdCounter = 0;\n protected getNextVirtualId() {\n return `${this.virtualIdPrefix}${++this.virtualIdCounter}`;\n }\n\n abstract getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;\n abstract setBlob(id: string, tree: ISnapshotTree, content: string);\n\n public async unpackSnapshotCore(snapshot: ISnapshotTree, level = 0): Promise<void> {\n for (const key of Object.keys(snapshot.trees)) {\n const obj = snapshot.trees[key];\n await this.unpackSnapshotCore(obj, level + 1);\n }\n\n // For future proof, we will support multiple aggregated blobs with any name\n // that starts with this.aggregatedBlobName\n for (const key of Object.keys(snapshot.blobs)) {\n if (!key.startsWith(this.aggregatedBlobName)) { continue; }\n const blobId = snapshot.blobs[key];\n if (blobId !== undefined) {\n const blob = await this.getBlob(blobId, snapshot);\n for (const [path, value] of BlobAggregator.load(blob)) {\n const id = this.getNextVirtualId();\n this.setBlob(id, snapshot, value);\n const pathSplit = path.split(\"/\");\n let subTree = snapshot;\n for (const subPath of pathSplit.slice(0, pathSplit.length - 1)) {\n if (subTree.trees[subPath] === undefined) {\n subTree.trees[subPath] = { blobs: {}, trees: {} };\n }\n subTree = subTree.trees[subPath];\n }\n const blobName = pathSplit[pathSplit.length - 1];\n assert(subTree.blobs[blobName] === undefined, 0x0f6 /* \"real blob ID exists\" */);\n subTree.blobs[blobName] = id;\n }\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshot.blobs[this.aggregatedBlobName];\n }\n }\n }\n}\n\n/*\n * Snapshot extractor class that works in place, i.e. patches snapshot that has\n * blob content in ISnapshotTree.blobs itself, not in storage.\n * As result, it implements reading and writing of blobs to/from snapshot itself.\n * It follows existing pattern that mixes concerns - ISnapshotTree.blobs is used for two\n * purposes:\n * 1. map path name to blob ID\n * 2. map blob ID to blob content\n * #2 is what storage (IDocumentStorageService) is for, but in places where we do not have it\n * (like loading serialized earlier draft content), blob content is put directly into snapshot.\n * Ideally this should be fixed by using BlobCacheStorageService or something similar and\n * fixing existing flows to allow switching of storage.\n */\nclass SnapshotExtractorInPlace extends SnapshotExtractor {\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n const blob = tree.blobs[id];\n assert(blob !== undefined, 0x0f7 /* \"aggregate blob missing\" */);\n return stringToBuffer(blob, \"base64\");\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n assert(tree.blobs[id] === undefined, 0x0f8 /* \"blob from aggregate blob exists on its own\" */);\n tree.blobs[id] = fromUtf8ToBase64(content);\n }\n}\n\n/*\n * Snapshot packer and extractor.\n * When summary is written it will find and aggregate small blobs into bigger blobs\n * When snapshot is read, it will unpack aggregated blobs and provide them transparently to caller.\n */\nexport class BlobAggregationStorage extends SnapshotExtractor implements IDocumentStorageService {\n // Tells data store if it can use incremental summary (i.e. reuse DDSs from previous summary\n // when only one DDS changed).\n // The answer has to be know long before we enable actual packing. The reason for the is the following:\n // A the moment when we enable packing, we should assume that all clients out there wil already have bits\n // that can unpack properly (i.e. enough time passed since we deployed bits that can unpack)\n // But we can still have clients where some of them already pack, and some do not. If one summary was\n // using packing, then it relies on non-incremental summaries going forward, even if next client who\n // produced summary is not packing!\n // This can have slight improvement by enabling it per file (based on \"did summary we loaded from contain\n // aggregated blobs\"), but that's harder to make reliable, so going for simplicity.\n static readonly fullDataStoreSummaries = true;\n\n protected loadedFromSummary = false;\n\n protected virtualBlobs = new Map<string, ArrayBufferLike>();\n\n static wrap(\n storage: IDocumentStorageService,\n logger: ITelemetryLogger,\n allowPacking?: boolean,\n packingLevel = 2,\n ) {\n if (storage instanceof BlobAggregationStorage) {\n return storage;\n }\n const mc = loggerToMonitoringContext(logger);\n const realAllowPackaging = mc.config.getBoolean(\"FluidAggregateBlobs\") ?? allowPacking ?? false;\n\n // Always create BlobAggregationStorage even if storage is not asking for packing.\n // This is mostly to avoid cases where future changes in policy would result in inability to\n // load old files that were created with aggregation on.\n const minBlobSize = storage.policies?.minBlobSize;\n return new BlobAggregationStorage(storage, logger, realAllowPackaging, packingLevel, minBlobSize);\n }\n\n static async unpackSnapshot(snapshot: ISnapshotTree) {\n const converter = new SnapshotExtractorInPlace();\n await converter.unpackSnapshotCore(snapshot);\n }\n\n public get policies(): IDocumentStorageServicePolicies | undefined {\n const policies = this.storage.policies;\n if (policies) {\n return { ...policies, minBlobSize: undefined };\n }\n }\n\n public async unpackSnapshot(snapshot: ISnapshotTree) {\n // SummarizerNodeWithGC.refreshLatestSummary can call it when this.loadedFromSummary === false\n // (I assumed after file was created)\n // assert(!this.loadedFromSummary, \"unpack without summary\");\n\n this.loadedFromSummary = true;\n await this.unpackSnapshotCore(snapshot);\n }\n\n protected constructor(\n private readonly storage: IDocumentStorageService,\n private readonly logger: ITelemetryLogger,\n private readonly allowPacking: boolean,\n private readonly packingLevel: number,\n private readonly blobCutOffSize?: number) {\n super();\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n this.virtualBlobs.set(id, stringToBuffer(content, \"utf-8\"));\n }\n\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n return this.readBlob(id).catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"BlobDedupNoAggregateBlob\" }, error);\n throw error;\n });\n }\n\n public get repositoryUrl() { return this.storage.repositoryUrl; }\n public async getVersions(versionId: string | null, count: number) {\n return this.storage.getVersions(versionId, count);\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n throw new Error(\"NYI\");\n }\n\n // for now we are not optimizing these blobs, with assumption that this API is used only\n // for big blobs (images)\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.storage.createBlob(file);\n }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n const tree = await this.storage.getSnapshotTree(version);\n if (tree) {\n await this.unpackSnapshot(tree);\n }\n return tree;\n }\n\n public async readBlob(id: string): Promise<ArrayBufferLike> {\n if (this.isRealStorageId(id)) {\n return this.storage.readBlob(id);\n }\n // We support only reading blobs from the summary we loaded from.\n // This may need to be extended to any general summary in the future as runtime usage pattern\n // of storage changes (for example, data stores start to load from recent summary, not from original\n // summary whole container loaded from)\n\n // are there other ways we can get here? createFile is one flow, but we should not be reading blobs\n // in such flow\n assert(this.loadedFromSummary, 0x0f9 /* \"never read summary\" */);\n const blob = this.virtualBlobs.get(id);\n assert(blob !== undefined, 0x0fa /* \"virtual blob not found\" */);\n return blob;\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n const summaryNew = this.allowPacking ? await this.compressSmallBlobs(summary) : summary;\n return this.storage.uploadSummaryWithContext(summaryNew, context);\n }\n\n // For simplification, we assume that\n // - blob aggregation is done at data store level only for now\n // - data store either reuses previous summary, or generates full summary, i.e. there is no partial (some DDS)\n // summary produced by data stores.\n // These simplifications allow us not to touch handles, as they are self-contained (either do not use aggregated\n // blob Or contain aggregated blob that stays relevant for that sub-tree)\n // Note:\n // From perf perspective, it makes sense to place aggregated blobs one level up in the tree not to create extra\n // tree nodes (i.e. have shallow tree with less edges). But that creates problems with reusability of trees at\n // incremental summary time - we would need to understand handles and parse them. In current design we can skip\n // that step because if data store is reused, the hole sub-tree is reused included aggregated blob embedded into it\n // and that means we can do nothing and be correct!\n private async compressSmallBlobs(\n summary: ISummaryTree,\n path = \"\",\n level = 0,\n aggregatorArg?: BlobAggregator): Promise<ISummaryTree> {\n if (this.blobCutOffSize === undefined || this.blobCutOffSize < 0) {\n return summary;\n }\n\n let shouldCompress: boolean = false;\n\n let aggregator = aggregatorArg;\n // checking if this is a dataStore tree, since we only pack at data store level\n if (Object.keys(summary.tree).includes(\".component\")) {\n assert(aggregator === undefined, 0x0fb /* \"logic err with aggregator\" */);\n assert(level === this.packingLevel, 0x23b /* \"we are not packing at the right level\" */);\n aggregator = new BlobAggregator();\n shouldCompress = true;\n } else {\n assert(level !== this.packingLevel, 0x23c /* \"we are not packing at the right level\" */);\n }\n\n const newSummary: ISummaryTree = { ...summary };\n newSummary.tree = { ...newSummary.tree };\n for (const key of Object.keys(summary.tree)) {\n const obj = summary.tree[key];\n // Get path relative to root of data store (where we do aggregation)\n const newPath = shouldCompress ? key : `${path}/${key}`;\n switch (obj.type) {\n case SummaryType.Tree:\n // If client created empty tree, keep it as is\n // Also do not package search blobs - they are part of storage contract\n if (obj.tree !== {} && key !== \"__search\") {\n const tree = await this.compressSmallBlobs(obj, newPath, level + 1, aggregator);\n newSummary.tree[key] = tree;\n if (tree.tree === {}) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n }\n break;\n case SummaryType.Blob:\n if (aggregator && typeof obj.content == \"string\" && obj.content.length < this.blobCutOffSize) {\n aggregator.addBlob(newPath, obj.content);\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n break;\n case SummaryType.Handle: {\n // Would be nice to:\n // Trees: expand the tree\n // Blobs: parse handle and ensure it points to real blob, not virtual blob.\n // We can avoid it for now given data store is the granularity of incremental summaries.\n let handlePath = obj.handle;\n if (handlePath.startsWith(\"/\")) {\n handlePath = handlePath.substr(1);\n }\n // Ensure only whole data stores can be reused, no reusing at deeper level!\n assert(level === 0, 0x0fc /* \"tree reuse at lower level\" */);\n assert(!handlePath.includes(\"/\"),\n 0x0fd /* \"data stores are writing incremental summaries!\" */);\n break;\n }\n case SummaryType.Attachment:\n assert(this.isRealStorageId(obj.id), 0x0fe /* \"attachment is aggregate blob\" */);\n break;\n default:\n unreachableCase(obj, `Unknown type: ${(obj as any).type}`);\n }\n }\n\n assert(newSummary.tree[this.aggregatedBlobName] === undefined, 0x0ff /* \"duplicate aggregate blob\" */);\n if (shouldCompress) {\n // Note: It would be great to add code here to unpack aggregate blob back to normal blobs\n // If only one blob made it into aggregate. Currently that does not happen as we always have\n // at least one .component blob and at least one DDS that has .attributes blob, so it's not an issue.\n // But it's possible that in future that would be great addition!\n // Good news - it's backward compatible change.\n assert(aggregator !== undefined, 0x100 /* \"logic error\" */);\n const content = aggregator.getAggregatedBlobContent();\n if (content !== undefined) {\n newSummary.tree[this.aggregatedBlobName] = {\n type: SummaryType.Blob,\n content,\n };\n }\n }\n return newSummary;\n }\n\n protected isRealStorageId(id: string): boolean {\n return !id.startsWith(this.virtualIdPrefix);\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree,
|
|
6
|
+
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
7
7
|
export declare class DocumentStorageServiceProxy implements IDocumentStorageService {
|
|
8
8
|
protected readonly internalStorageService: IDocumentStorageService;
|
|
9
9
|
private _policies;
|
|
@@ -13,7 +13,6 @@ export declare class DocumentStorageServiceProxy implements IDocumentStorageServ
|
|
|
13
13
|
constructor(internalStorageService: IDocumentStorageService);
|
|
14
14
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
15
15
|
getVersions(versionId: string | null, count: number): Promise<IVersion[]>;
|
|
16
|
-
write(tree: ITree, parents: string[], message: string, ref: string): Promise<IVersion>;
|
|
17
16
|
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
18
17
|
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
19
18
|
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"documentStorageServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACX,MAAM,sCAAsC,CAAC;AAE9C,qBAAa,2BAA4B,YAAW,uBAAuB;IAe3D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,uBAAuB;IAd9E,OAAO,CAAC,SAAS,CAA8C;IAE/D,IAAW,QAAQ,CAAC,QAAQ,EAAE,+BAA+B,GAAG,SAAS,EAExE;IAED,IAAW,QAAQ,IAJW,+BAA+B,GAAG,SAAS,CAMxE;IAED,IAAW,aAAa,IAAI,MAAM,CAEjC;gBAE8B,sBAAsB,EAAE,uBAAuB;IAEjE,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAIlE,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIzE,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1F,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAI9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI/D,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAGlE"}
|
|
@@ -22,9 +22,6 @@ export class DocumentStorageServiceProxy {
|
|
|
22
22
|
async getVersions(versionId, count) {
|
|
23
23
|
return this.internalStorageService.getVersions(versionId, count);
|
|
24
24
|
}
|
|
25
|
-
async write(tree, parents, message, ref) {
|
|
26
|
-
return this.internalStorageService.write(tree, parents, message, ref);
|
|
27
|
-
}
|
|
28
25
|
async uploadSummaryWithContext(summary, context) {
|
|
29
26
|
return this.internalStorageService.uploadSummaryWithContext(summary, context);
|
|
30
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceProxy.js","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"documentStorageServiceProxy.js","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,MAAM,OAAO,2BAA2B;IAepC,YAA+B,sBAA+C;QAA/C,2BAAsB,GAAtB,sBAAsB,CAAyB;IAAI,CAAC;IAZnF,IAAW,QAAQ,CAAC,QAAqD;QACrE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED,IAAW,QAAQ;;QACf,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAClE,CAAC;IAED,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;IACrD,CAAC;IAIM,KAAK,CAAC,eAAe,CAAC,OAAkB;QAC3C,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAAwB,EAAE,KAAa;QAC5D,OAAO,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC;IAEM,KAAK,CAAC,wBAAwB,CAAC,OAAqB,EAAE,OAAwB;QACjF,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAC/C,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QACzC,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAc;QAChC,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n} from \"@fluidframework/protocol-definitions\";\n\nexport class DocumentStorageServiceProxy implements IDocumentStorageService {\n private _policies: IDocumentStorageServicePolicies | undefined;\n\n public set policies(policies: IDocumentStorageServicePolicies | undefined) {\n this._policies = policies;\n }\n\n public get policies() {\n return this._policies ?? this.internalStorageService.policies;\n }\n\n public get repositoryUrl(): string {\n return this.internalStorageService.repositoryUrl;\n }\n\n constructor(protected readonly internalStorageService: IDocumentStorageService) { }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n return this.internalStorageService.getSnapshotTree(version);\n }\n\n public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n return this.internalStorageService.getVersions(versionId, count);\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n return this.internalStorageService.uploadSummaryWithContext(summary, context);\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n return this.internalStorageService.downloadSummary(handle);\n }\n\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.internalStorageService.createBlob(file);\n }\n\n public async readBlob(blobId: string): Promise<ArrayBufferLike> {\n return this.internalStorageService.readBlob(blobId);\n }\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/driver-utils";
|
|
8
|
-
export declare const pkgVersion = "0.
|
|
8
|
+
export declare const pkgVersion = "1.0.1";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,UAAU,CAAC"}
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"1.0.1\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -62,43 +62,30 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
64
64
|
"@fluidframework/common-utils": "^0.32.1",
|
|
65
|
-
"@fluidframework/core-interfaces": "^0.
|
|
66
|
-
"@fluidframework/driver-definitions": "^0.
|
|
65
|
+
"@fluidframework/core-interfaces": "^1.0.1",
|
|
66
|
+
"@fluidframework/driver-definitions": "^1.0.1",
|
|
67
67
|
"@fluidframework/gitresources": "^0.1036.4000",
|
|
68
68
|
"@fluidframework/protocol-base": "^0.1036.4000",
|
|
69
69
|
"@fluidframework/protocol-definitions": "^0.1028.2000",
|
|
70
|
-
"@fluidframework/telemetry-utils": "^0.
|
|
70
|
+
"@fluidframework/telemetry-utils": "^1.0.1",
|
|
71
71
|
"axios": "^0.26.0",
|
|
72
72
|
"uuid": "^8.3.1"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@fluidframework/build-common": "^0.23.0",
|
|
76
|
-
"@fluidframework/build-tools": "^0.2.
|
|
76
|
+
"@fluidframework/build-tools": "^0.2.71273",
|
|
77
77
|
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@0.59.3000",
|
|
78
78
|
"@fluidframework/eslint-config-fluid": "^0.28.2000",
|
|
79
|
-
"@fluidframework/mocha-test-setup": "^0.
|
|
80
|
-
"@fluidframework/runtime-utils": "^0.
|
|
79
|
+
"@fluidframework/mocha-test-setup": "^1.0.1",
|
|
80
|
+
"@fluidframework/runtime-utils": "^1.0.1",
|
|
81
81
|
"@microsoft/api-extractor": "^7.22.2",
|
|
82
82
|
"@rushstack/eslint-config": "^2.5.1",
|
|
83
83
|
"@types/mocha": "^9.1.1",
|
|
84
84
|
"@types/node": "^14.18.0",
|
|
85
|
-
"@typescript-eslint/eslint-plugin": "~5.9.0",
|
|
86
|
-
"@typescript-eslint/parser": "~5.9.0",
|
|
87
85
|
"concurrently": "^6.2.0",
|
|
88
86
|
"copyfiles": "^2.1.0",
|
|
89
87
|
"cross-env": "^7.0.2",
|
|
90
88
|
"eslint": "~8.6.0",
|
|
91
|
-
"eslint-plugin-editorconfig": "~3.2.0",
|
|
92
|
-
"eslint-plugin-eslint-comments": "~3.2.0",
|
|
93
|
-
"eslint-plugin-import": "~2.25.4",
|
|
94
|
-
"eslint-plugin-jest": "~26.1.3",
|
|
95
|
-
"eslint-plugin-jsdoc": "~39.3.0",
|
|
96
|
-
"eslint-plugin-mocha": "~10.0.3",
|
|
97
|
-
"eslint-plugin-promise": "~6.0.0",
|
|
98
|
-
"eslint-plugin-react": "~7.28.0",
|
|
99
|
-
"eslint-plugin-tsdoc": "~0.2.14",
|
|
100
|
-
"eslint-plugin-unicorn": "~40.0.0",
|
|
101
|
-
"eslint-plugin-unused-imports": "~2.0.0",
|
|
102
89
|
"mocha": "^10.0.0",
|
|
103
90
|
"nyc": "^15.0.0",
|
|
104
91
|
"rimraf": "^2.6.2",
|
|
@@ -106,7 +93,32 @@
|
|
|
106
93
|
"typescript-formatter": "7.1.0"
|
|
107
94
|
},
|
|
108
95
|
"typeValidation": {
|
|
109
|
-
"version": "0.
|
|
110
|
-
"broken": {
|
|
96
|
+
"version": "1.0.0",
|
|
97
|
+
"broken": {
|
|
98
|
+
"ClassDeclaration_BlobAggregationStorage": {
|
|
99
|
+
"backCompat": false
|
|
100
|
+
},
|
|
101
|
+
"ClassDeclaration_BlobCacheStorageService": {
|
|
102
|
+
"backCompat": false
|
|
103
|
+
},
|
|
104
|
+
"ClassDeclaration_DocumentStorageServiceProxy": {
|
|
105
|
+
"backCompat": false
|
|
106
|
+
},
|
|
107
|
+
"ClassDeclaration_PrefetchDocumentStorageService": {
|
|
108
|
+
"backCompat": false
|
|
109
|
+
},
|
|
110
|
+
"RemovedFunctionDeclaration_convertSnapshotAndBlobsToSummaryTree": {
|
|
111
|
+
"forwardCompat": false,
|
|
112
|
+
"backCompat": false
|
|
113
|
+
},
|
|
114
|
+
"RemovedInterfaceDeclaration_ISummaryTreeAssemblerProps": {
|
|
115
|
+
"forwardCompat": false,
|
|
116
|
+
"backCompat": false
|
|
117
|
+
},
|
|
118
|
+
"RemovedClassDeclaration_SummaryTreeAssembler": {
|
|
119
|
+
"forwardCompat": false,
|
|
120
|
+
"backCompat": false
|
|
121
|
+
}
|
|
122
|
+
}
|
|
111
123
|
}
|
|
112
124
|
}
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
ISummaryTree,
|
|
16
16
|
IVersion,
|
|
17
17
|
SummaryType,
|
|
18
|
-
ITree,
|
|
19
18
|
} from "@fluidframework/protocol-definitions";
|
|
20
19
|
import {
|
|
21
20
|
assert,
|
|
@@ -231,11 +230,6 @@ export class BlobAggregationStorage extends SnapshotExtractor implements IDocume
|
|
|
231
230
|
throw new Error("NYI");
|
|
232
231
|
}
|
|
233
232
|
|
|
234
|
-
// This is only used through Container.snapshot() for testing purposes
|
|
235
|
-
public async write(root: ITree, parents: string[], message: string, ref: string) {
|
|
236
|
-
return this.storage.write(root, parents, message, ref);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
233
|
// for now we are not optimizing these blobs, with assumption that this API is used only
|
|
240
234
|
// for big blobs (images)
|
|
241
235
|
public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
ISnapshotTree,
|
|
14
14
|
ISummaryHandle,
|
|
15
15
|
ISummaryTree,
|
|
16
|
-
ITree,
|
|
17
16
|
IVersion,
|
|
18
17
|
} from "@fluidframework/protocol-definitions";
|
|
19
18
|
|
|
@@ -42,10 +41,6 @@ export class DocumentStorageServiceProxy implements IDocumentStorageService {
|
|
|
42
41
|
return this.internalStorageService.getVersions(versionId, count);
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
public async write(tree: ITree, parents: string[], message: string, ref: string): Promise<IVersion> {
|
|
46
|
-
return this.internalStorageService.write(tree, parents, message, ref);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
44
|
public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {
|
|
50
45
|
return this.internalStorageService.uploadSummaryWithContext(summary, context);
|
|
51
46
|
}
|
package/src/packageVersion.ts
CHANGED