@fluidframework/driver-utils 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/api-report/driver-utils.api.md +18 -18
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts +1 -1
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +2 -2
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +7 -7
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +1 -1
- package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
- package/dist/adapters/predefinedAdapters.js +2 -2
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/blob.d.ts +1 -1
- package/dist/blob.d.ts.map +1 -1
- package/dist/blob.js.map +1 -1
- package/dist/buildSnapshotTree.d.ts.map +1 -1
- package/dist/buildSnapshotTree.js +3 -3
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/documentServiceFactoryProxy.d.ts +1 -1
- package/dist/documentServiceFactoryProxy.d.ts.map +1 -1
- package/dist/documentServiceFactoryProxy.js.map +1 -1
- package/dist/documentServiceProxy.d.ts +1 -1
- package/dist/documentServiceProxy.d.ts.map +1 -1
- package/dist/documentServiceProxy.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +1 -1
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js +2 -2
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/error.d.ts +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +2 -2
- package/dist/error.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts +1 -1
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/insecureUrlResolver.js +5 -5
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/legacy.d.ts +18 -0
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +2 -2
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +3 -2
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +8 -8
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +1 -1
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/parallelRequests.d.ts +6 -2
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +31 -31
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts +1 -1
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/prefetchDocumentStorageService.js +4 -4
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/public.d.ts +15 -0
- package/dist/rateLimiter.js +2 -2
- package/dist/rateLimiter.js.map +1 -1
- package/dist/readAndParse.d.ts +1 -1
- package/dist/readAndParse.d.ts.map +1 -1
- package/dist/readAndParse.js.map +1 -1
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/runWithRetry.js +4 -4
- package/dist/runWithRetry.js.map +1 -1
- package/dist/storageUtils.d.ts +1 -1
- package/dist/storageUtils.d.ts.map +1 -1
- package/dist/storageUtils.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +1 -1
- package/dist/summaryForCreateNew.d.ts.map +1 -1
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/treeConversions.js +2 -2
- package/dist/treeConversions.js.map +1 -1
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts +1 -1
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +2 -2
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +2 -2
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/adapters/predefinedAdapters.d.ts +1 -1
- package/lib/adapters/predefinedAdapters.d.ts.map +1 -1
- package/lib/adapters/predefinedAdapters.js +2 -2
- package/lib/adapters/predefinedAdapters.js.map +1 -1
- package/lib/blob.d.ts +1 -1
- package/lib/blob.d.ts.map +1 -1
- package/lib/blob.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts.map +1 -1
- package/lib/buildSnapshotTree.js +2 -2
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/documentServiceFactoryProxy.d.ts +1 -1
- package/lib/documentServiceFactoryProxy.d.ts.map +1 -1
- package/lib/documentServiceFactoryProxy.js.map +1 -1
- package/lib/documentServiceProxy.d.ts +1 -1
- package/lib/documentServiceProxy.d.ts.map +1 -1
- package/lib/documentServiceProxy.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +1 -1
- package/lib/documentStorageServiceProxy.d.ts.map +1 -1
- package/lib/documentStorageServiceProxy.js +1 -1
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/error.d.ts +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +1 -1
- package/lib/error.js.map +1 -1
- package/lib/insecureUrlResolver.d.ts +1 -1
- package/lib/insecureUrlResolver.d.ts.map +1 -1
- package/lib/insecureUrlResolver.js +2 -2
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/legacy.d.ts +18 -0
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +3 -2
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +2 -2
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +1 -1
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +1 -1
- package/lib/networkUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/parallelRequests.d.ts +6 -2
- package/lib/parallelRequests.d.ts.map +1 -1
- package/lib/parallelRequests.js +3 -3
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts +1 -1
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
- package/lib/prefetchDocumentStorageService.js +1 -1
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/public.d.ts +15 -0
- package/lib/rateLimiter.js +1 -1
- package/lib/rateLimiter.js.map +1 -1
- package/lib/readAndParse.d.ts +1 -1
- package/lib/readAndParse.d.ts.map +1 -1
- package/lib/readAndParse.js.map +1 -1
- package/lib/runWithRetry.d.ts.map +1 -1
- package/lib/runWithRetry.js +3 -3
- package/lib/runWithRetry.js.map +1 -1
- package/lib/storageUtils.d.ts +1 -1
- package/lib/storageUtils.d.ts.map +1 -1
- package/lib/storageUtils.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +1 -1
- package/lib/summaryForCreateNew.d.ts.map +1 -1
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts.map +1 -1
- package/lib/treeConversions.js +1 -1
- package/lib/treeConversions.js.map +1 -1
- package/package.json +29 -50
- package/src/adapters/compression/documentServiceCompressionAdapter.ts +7 -2
- package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +4 -2
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +7 -3
- package/src/adapters/predefinedAdapters.ts +4 -3
- package/src/blob.ts +1 -1
- package/src/buildSnapshotTree.ts +2 -2
- package/src/documentServiceFactoryProxy.ts +1 -1
- package/src/documentServiceProxy.ts +1 -1
- package/src/documentStorageServiceProxy.ts +2 -2
- package/src/error.ts +1 -1
- package/src/insecureUrlResolver.ts +6 -2
- package/src/messageRecognition.ts +1 -0
- package/src/network.ts +5 -6
- package/src/networkUtils.ts +3 -2
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +11 -4
- package/src/prefetchDocumentStorageService.ts +3 -1
- package/src/rateLimiter.ts +1 -1
- package/src/readAndParse.ts +1 -1
- package/src/runWithRetry.ts +5 -3
- package/src/storageUtils.ts +1 -1
- package/src/summaryForCreateNew.ts +3 -3
- package/src/treeConversions.ts +2 -1
- package/api-extractor-cjs.json +0 -8
- package/dist/driver-utils-alpha.d.ts +0 -167
- package/dist/driver-utils-beta.d.ts +0 -186
- package/dist/driver-utils-public.d.ts +0 -186
- package/dist/driver-utils-untrimmed.d.ts +0 -603
- package/lib/driver-utils-alpha.d.ts +0 -167
- package/lib/driver-utils-beta.d.ts +0 -186
- package/lib/driver-utils-public.d.ts +0 -186
- package/lib/driver-utils-untrimmed.d.ts +0 -603
- package/lib/test/insecureUrlResolverTest.spec.js +0 -101
- package/lib/test/insecureUrlResolverTest.spec.js.map +0 -1
- package/lib/test/parallelRequests.spec.js +0 -186
- package/lib/test/parallelRequests.spec.js.map +0 -1
- package/lib/test/rateLimiter.spec.js +0 -85
- package/lib/test/rateLimiter.spec.js.map +0 -1
- package/lib/test/runWithRetry.spec.js +0 -180
- package/lib/test/runWithRetry.spec.js.map +0 -1
- package/lib/test/summaryCompressionData.js +0 -170
- package/lib/test/summaryCompressionData.js.map +0 -1
- package/lib/test/summaryCompresssionTester.spec.js +0 -429
- package/lib/test/summaryCompresssionTester.spec.js.map +0 -1
- package/lib/test/types/validateDriverUtilsPrevious.generated.js +0 -108
- package/lib/test/types/validateDriverUtilsPrevious.generated.js.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runWithRetry.spec.js","sourceRoot":"","sources":["../../src/test/runWithRetry.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;AACtC,MAAM,cAAc,GAAQ,CAAC,QAAoC,EAAE,EAAU,EAAE,GAAG,IAAW,EAAE,EAAE,CAChG,WAAW,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;AAC7C,KAAK,UAAU,qBAAqB,CAAI,QAA0B;IACjE,MAAM,CAAC,UAAU,GAAG,cAAc,CAAC;IACnC,OAAO,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;QAC9B,MAAM,CAAC,UAAU,GAAG,WAAW,CAAC;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AAS,CAAC,CAAC;YAClC,KAAa,CAAC,QAAQ,GAAG,IAAI,CAAC;YAC/B,MAAM,KAAK,CAAC;QACb,CAAC,CAAC;QACF,IAAI;YACH,MAAM,qBAAqB,CAAC,KAAK,IAAI,EAAE,CACtC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE;gBACjC,MAAM,EAAE,eAAe,CAAC,MAAM;aAC9B,CAAC,CACF,CAAC;YACF,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;SAClC;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,CAAC,WAAW,CAAE,KAAa,CAAC,OAAO,EAAE,0BAA0B,CAAC,CAAC;YACvE,MAAM,CAAC,WAAW,CAAE,KAAa,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;SACjE;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { runWithRetry } from \"../runWithRetry.js\";\n\nconst _setTimeout = global.setTimeout;\nconst fastSetTimeout: any = (callback: (...cbArgs: any[]) => void, ms: number, ...args: any[]) =>\n\t_setTimeout(callback, ms / 1000.0, ...args);\nasync function runWithFastSetTimeout<T>(callback: () => Promise<T>): Promise<T> {\n\tglobal.setTimeout = fastSetTimeout;\n\treturn callback().finally(() => {\n\t\tglobal.setTimeout = _setTimeout;\n\t});\n}\n\ndescribe(\"runWithRetry Tests\", () => {\n\tconst logger = createChildLogger();\n\n\tit(\"Should succeed at first time\", async () => {\n\t\tlet retryTimes: number = 1;\n\t\tlet success = false;\n\t\tconst api = async () => {\n\t\t\tretryTimes -= 1;\n\t\t\treturn true;\n\t\t};\n\n\t\tlet emitDelayInfoTimes: number = 0;\n\t\tsuccess = await runWithFastSetTimeout(async () =>\n\t\t\trunWithRetry(api, \"test\", logger, {\n\t\t\t\tonRetry: () => {\n\t\t\t\t\temitDelayInfoTimes += 1;\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t\tassert.strictEqual(retryTimes, 0, \"Should succeed at first time\");\n\t\tassert.strictEqual(success, true, \"Retry should succeed ultimately\");\n\t\tassert.strictEqual(emitDelayInfoTimes, 0, \"Should not emit delay at first time\");\n\t});\n\n\tit(\"Check that it retries infinitely\", async () => {\n\t\tconst maxTries: number = 5;\n\t\tlet retryTimes: number = maxTries;\n\t\tlet success = false;\n\t\tconst api = async () => {\n\t\t\tif (retryTimes > 0) {\n\t\t\t\tretryTimes -= 1;\n\t\t\t\tconst error = new Error(\"Throw error\");\n\t\t\t\t(error as any).retryAfterSeconds = 10;\n\t\t\t\t(error as any).canRetry = true;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\n\t\tlet emitDelayInfoTimes: number = 0;\n\t\tsuccess = await runWithFastSetTimeout(async () =>\n\t\t\trunWithRetry(api, \"test\", logger, {\n\t\t\t\tonRetry: () => {\n\t\t\t\t\temitDelayInfoTimes += 1;\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t\tassert.strictEqual(retryTimes, 0, \"Should keep retrying until success\");\n\t\tassert.strictEqual(success, true, \"Retry should succeed ultimately\");\n\t\tassert.strictEqual(emitDelayInfoTimes, maxTries, \"Should emit delay at each try\");\n\t});\n\n\tit(\"Check that it retries after retry seconds\", async () => {\n\t\tlet retryTimes: number = 1;\n\t\tlet success = false;\n\t\tconst api = async () => {\n\t\t\tif (retryTimes > 0) {\n\t\t\t\tretryTimes -= 1;\n\t\t\t\tconst error = new Error(\"Throttle Error\");\n\t\t\t\t(error as any).errorType = DriverErrorTypes.throttlingError;\n\t\t\t\t(error as any).retryAfterSeconds = 400;\n\t\t\t\t(error as any).canRetry = true;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\tsuccess = await runWithFastSetTimeout(async () => runWithRetry(api, \"test\", logger, {}));\n\t\tassert.strictEqual(retryTimes, 0, \"Should retry once\");\n\t\tassert.strictEqual(success, true, \"Retry should succeed ultimately\");\n\t});\n\n\tit(\"If error is just a string, should retry as canRetry is not false\", async () => {\n\t\tlet retryTimes: number = 1;\n\t\tlet success = false;\n\t\tconst api = async () => {\n\t\t\tif (retryTimes > 0) {\n\t\t\t\tretryTimes -= 1;\n\t\t\t\tconst err = new Error(\"error\");\n\t\t\t\t(err as any).canRetry = true;\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\ttry {\n\t\t\tsuccess = await runWithFastSetTimeout(async () =>\n\t\t\t\trunWithRetry(api, \"test\", logger, {}),\n\t\t\t);\n\t\t} catch (error) {}\n\t\tassert.strictEqual(retryTimes, 0, \"Should retry\");\n\t\tassert.strictEqual(success, true, \"Should succeed as retry should be successful\");\n\t});\n\n\tit(\"Should not retry if canRetry is set as false\", async () => {\n\t\tlet retryTimes: number = 1;\n\t\tlet success = false;\n\t\tconst api = async () => {\n\t\t\tif (retryTimes > 0) {\n\t\t\t\tretryTimes -= 1;\n\t\t\t\tconst error = new Error(\"error\");\n\t\t\t\t(error as any).canRetry = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\ttry {\n\t\t\tsuccess = await runWithFastSetTimeout(async () =>\n\t\t\t\trunWithRetry(api, \"test\", logger, {}),\n\t\t\t);\n\t\t\tassert.fail(\"Should not succeed\");\n\t\t} catch (error) {}\n\t\tassert.strictEqual(retryTimes, 0, \"Should not retry\");\n\t\tassert.strictEqual(success, false, \"Should not succeed as canRetry was not set\");\n\t});\n\n\tit(\"Should not retry if canRetry is not set\", async () => {\n\t\tlet retryTimes: number = 1;\n\t\tlet success = false;\n\t\tconst api = async () => {\n\t\t\tif (retryTimes > 0) {\n\t\t\t\tretryTimes -= 1;\n\t\t\t\tconst error = new Error(\"error\");\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\ttry {\n\t\t\tsuccess = await runWithFastSetTimeout(async () =>\n\t\t\t\trunWithRetry(api, \"test\", logger, {}),\n\t\t\t);\n\t\t\tassert.fail(\"Should not succeed\");\n\t\t} catch (error) {}\n\t\tassert.strictEqual(retryTimes, 0, \"Should not retry\");\n\t\tassert.strictEqual(success, false, \"Should not succeed as canRetry was not set\");\n\t});\n\n\tit(\"Should not retry if it is disabled\", async () => {\n\t\tlet retryTimes: number = 1;\n\t\tlet success = false;\n\t\tconst api = async () => {\n\t\t\tif (retryTimes > 0) {\n\t\t\t\tretryTimes -= 1;\n\t\t\t\tconst error = new Error(\"error\");\n\t\t\t\t(error as any).canRetry = true;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\t\ttry {\n\t\t\tsuccess = await runWithFastSetTimeout(async () =>\n\t\t\t\trunWithRetry(api, \"test\", logger, {\n\t\t\t\t\tonRetry: () => {\n\t\t\t\t\t\tthrow new Error(\"disposed\");\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t\tassert.fail(\"Should not succeed\");\n\t\t} catch (error) {}\n\t\tassert.strictEqual(retryTimes, 0, \"Should not retry\");\n\t\tassert.strictEqual(success, false, \"Should not succeed as retrying was disabled\");\n\t});\n\n\tit(\"Abort reason is included in thrown exception\", async () => {\n\t\tconst abortController = new AbortController();\n\n\t\tconst api = () => {\n\t\t\tabortController.abort(\"Sample abort reason\");\n\t\t\tconst error = new Error(\"aborted\");\n\t\t\t(error as any).canRetry = true;\n\t\t\tthrow error;\n\t\t};\n\t\ttry {\n\t\t\tawait runWithFastSetTimeout(async () =>\n\t\t\t\trunWithRetry(api, \"test\", logger, {\n\t\t\t\t\tcancel: abortController.signal,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tassert.fail(\"Should not succeed\");\n\t\t} catch (error) {\n\t\t\tassert.strictEqual((error as any).message, \"runWithRetry was Aborted\");\n\t\t\tassert.strictEqual((error as any).reason, \"Sample abort reason\");\n\t\t}\n\t});\n});\n"]}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
/* eslint-disable @typescript-eslint/dot-notation */
|
|
6
|
-
export const summaryTemplate = {
|
|
7
|
-
type: 1,
|
|
8
|
-
tree: {
|
|
9
|
-
".channels": {
|
|
10
|
-
type: 1,
|
|
11
|
-
tree: {
|
|
12
|
-
rootDOId: {
|
|
13
|
-
type: 1,
|
|
14
|
-
tree: {
|
|
15
|
-
".channels": {
|
|
16
|
-
type: 1,
|
|
17
|
-
tree: {
|
|
18
|
-
"7a99532d-94ec-43ac-8a53-d9f978ad4ae9": {
|
|
19
|
-
type: 1,
|
|
20
|
-
tree: {
|
|
21
|
-
"header": {
|
|
22
|
-
type: 2,
|
|
23
|
-
content: '{"value":"123"}',
|
|
24
|
-
},
|
|
25
|
-
".attributes": {
|
|
26
|
-
type: 2,
|
|
27
|
-
content: '{"type":"https://graph.microsoft.com/types/cell","snapshotFormatVersion":"0.1","packageVersion":"2.0.0-internal.4.2.0"}',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
"root": {
|
|
32
|
-
type: 1,
|
|
33
|
-
tree: {
|
|
34
|
-
"header": {
|
|
35
|
-
type: 2,
|
|
36
|
-
content: '{"blobs":[],"content":{"ci":{"csn":0,"ccIds":[]},"subdirectories":{"initial-objects-key":{"ci":{"csn":-1,"ccIds":["detached"]},"storage":{"tree":{"type":"Plain","value":{"type":"__fluid_handle__","url":"/rootDOId/de68ca53-be31-479e-8d34-a267958997e4"}}}}}}}',
|
|
37
|
-
},
|
|
38
|
-
".attributes": {
|
|
39
|
-
type: 2,
|
|
40
|
-
content: '{"type":"https://graph.microsoft.com/types/directory","snapshotFormatVersion":"0.1","packageVersion":"2.0.0-internal.4.2.0"}',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
".component": {
|
|
47
|
-
type: 2,
|
|
48
|
-
content: '{"pkg":"[\\"rootDO\\"]","summaryFormatVersion":2,"isRootDataStore":true}',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
".metadata": {
|
|
55
|
-
type: 2,
|
|
56
|
-
content: '{"createContainerRuntimeVersion":"2.0.0-internal.4.2.0","createContainerTimestamp":1683180222333,"summaryNumber":2,"summaryFormatVersion":1,"gcFeature":2,"sessionExpiryTimeoutMs":2592000000,"sweepEnabled":false,"sweepTimeoutMs":3110400000,"message":{"clientId":null,"clientSequenceNumber":-1,"minimumSequenceNumber":5,"referenceSequenceNumber":-1,"sequenceNumber":7,"timestamp":1683180249726,"type":"join"},"telemetryDocumentId":"72d29676-b076-43e8-80aa-b8fc7aba1506"}',
|
|
57
|
-
},
|
|
58
|
-
".protocol": {
|
|
59
|
-
type: 1,
|
|
60
|
-
tree: {
|
|
61
|
-
misotest: {
|
|
62
|
-
type: 2,
|
|
63
|
-
content: "ABC",
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
".electedSummarizer": {
|
|
68
|
-
type: 2,
|
|
69
|
-
content: '{"electedClientId":"f3bda689-ca40-4b68-b2ea-4c02dac76206","electedParentId":"af12d248-f040-413c-a6d1-8e5bd6619313","electionSequenceNumber":7}',
|
|
70
|
-
},
|
|
71
|
-
"gc": {
|
|
72
|
-
type: 1,
|
|
73
|
-
tree: {
|
|
74
|
-
__gc_root: {
|
|
75
|
-
type: 2,
|
|
76
|
-
content: '{"gcNodes":{"/":{"outboundRoutes":["/rootDOId"]},"/rootDOId":{"outboundRoutes":["/rootDOId/de68ca53-be31-479e-8d34-a267958997e4","/rootDOId/root"]},"/rootDOId/de68ca53-be31-479e-8d34-a267958997e4":{"outboundRoutes":["/rootDOId"]},"/rootDOId/root":{"outboundRoutes":["/rootDOId","/rootDOId/de68ca53-be31-479e-8d34-a267958997e4"]}}}',
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
export const snapshotTree = {
|
|
83
|
-
id: "c26019650fe7fc3c1e9f50b906071296008fd9e0",
|
|
84
|
-
blobs: {
|
|
85
|
-
".electedSummarizer": "1779e5eec3d53d36c476f7e365fe09d5eadb5cb7",
|
|
86
|
-
".metadata": "43a9378e44336b39fc8f86f0511a655511922f11",
|
|
87
|
-
".metadata.blobHeaders": "1",
|
|
88
|
-
},
|
|
89
|
-
trees: {
|
|
90
|
-
".channels": {
|
|
91
|
-
id: "1ac6a4929a0fb18b8093679b19d8eed478c908a0",
|
|
92
|
-
blobs: {},
|
|
93
|
-
commits: {},
|
|
94
|
-
trees: {
|
|
95
|
-
rootDOId: {
|
|
96
|
-
id: "5164ec1ecc2cfe24643347e30624aea2976f61e9",
|
|
97
|
-
blobs: {
|
|
98
|
-
".component": "c35bbe00f9cb9ee99c8af3d4757411abdda3d8f3",
|
|
99
|
-
},
|
|
100
|
-
commits: {},
|
|
101
|
-
trees: {
|
|
102
|
-
".channels": {
|
|
103
|
-
id: "9a415dc0f942849ac3d686ec8f8049a4d1484ee1",
|
|
104
|
-
blobs: {},
|
|
105
|
-
commits: {},
|
|
106
|
-
trees: {
|
|
107
|
-
"7a99532d-94ec-43ac-8a53-d9f978ad4ae9": {
|
|
108
|
-
id: "353aab1f600b0dd527073e286b4d6dd853c0d212",
|
|
109
|
-
blobs: {
|
|
110
|
-
".attributes": "d67e9b02c97d8b2d13b1ea88c4198ea6cdae3c06",
|
|
111
|
-
"compressed_2_header": "ee84b67e86708c9dd7fc79ff8f3380b78f000b79",
|
|
112
|
-
},
|
|
113
|
-
commits: {},
|
|
114
|
-
trees: {},
|
|
115
|
-
},
|
|
116
|
-
"root": {
|
|
117
|
-
id: "771be006709c44442dbcd69424b8f89e14a05de8",
|
|
118
|
-
blobs: {
|
|
119
|
-
".attributes": "3ec4a65a74f0e2fab11aaac9b31f284a8c931850",
|
|
120
|
-
"header": "c2de09aa55c92d79b9292d6efb469592915f0b1f",
|
|
121
|
-
},
|
|
122
|
-
commits: {},
|
|
123
|
-
trees: {},
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
".logTail": {
|
|
132
|
-
id: "9ae35f3164c7c34c4ed29107af49f2913dc2e948",
|
|
133
|
-
blobs: {
|
|
134
|
-
logTail: "8240863a82570a9eff14ecbc06cee9886d5dc560",
|
|
135
|
-
},
|
|
136
|
-
commits: {},
|
|
137
|
-
trees: {},
|
|
138
|
-
},
|
|
139
|
-
".protocol": {
|
|
140
|
-
id: "f4ab61e0c13030ccd4f56550fcf5e5c271de7152",
|
|
141
|
-
blobs: {
|
|
142
|
-
attributes: "78c80fb681c6b152c48f57526a76bd31ec3b1baf",
|
|
143
|
-
quorumMembers: "cf6929236bacbea80764beb3aba8645210f4af57",
|
|
144
|
-
quorumProposals: "0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc",
|
|
145
|
-
quorumValues: "c730f7a6ff8c606cc2b7d083e5a9705bff0d7029",
|
|
146
|
-
misotest: "misotest-id",
|
|
147
|
-
},
|
|
148
|
-
commits: {},
|
|
149
|
-
trees: {},
|
|
150
|
-
},
|
|
151
|
-
".serviceProtocol": {
|
|
152
|
-
id: "029fc548f99d4b9ef43cd98c401bc5a9f3a2f117",
|
|
153
|
-
blobs: {
|
|
154
|
-
deli: "041b2b724ca853a9d65f4917d5ddb97e91fd7408",
|
|
155
|
-
scribe: "97a0b1e36b67946044b7141ce62cbab6a5996723",
|
|
156
|
-
},
|
|
157
|
-
commits: {},
|
|
158
|
-
trees: {},
|
|
159
|
-
},
|
|
160
|
-
"gc": {
|
|
161
|
-
id: "e8ed0760ac37fd8042020559779ce80b1d88f266",
|
|
162
|
-
blobs: {
|
|
163
|
-
__gc_root: "018d97818f8b519f99c418cb3c33ce5cc4e38e3f",
|
|
164
|
-
},
|
|
165
|
-
commits: {},
|
|
166
|
-
trees: {},
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
//# sourceMappingURL=summaryCompressionData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summaryCompressionData.js","sourceRoot":"","sources":["../../src/test/summaryCompressionData.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oDAAoD;AAEpD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,IAAI,EAAE,CAAC;IACP,IAAI,EAAE;QACL,WAAW,EAAE;YACZ,IAAI,EAAE,CAAC;YACP,IAAI,EAAE;gBACL,QAAQ,EAAE;oBACT,IAAI,EAAE,CAAC;oBACP,IAAI,EAAE;wBACL,WAAW,EAAE;4BACZ,IAAI,EAAE,CAAC;4BACP,IAAI,EAAE;gCACL,sCAAsC,EAAE;oCACvC,IAAI,EAAE,CAAC;oCACP,IAAI,EAAE;wCACL,QAAQ,EAAE;4CACT,IAAI,EAAE,CAAC;4CACP,OAAO,EAAE,iBAAiB;yCAC1B;wCACD,aAAa,EAAE;4CACd,IAAI,EAAE,CAAC;4CACP,OAAO,EACN,yHAAyH;yCAC1H;qCACD;iCACD;gCACD,MAAM,EAAE;oCACP,IAAI,EAAE,CAAC;oCACP,IAAI,EAAE;wCACL,QAAQ,EAAE;4CACT,IAAI,EAAE,CAAC;4CACP,OAAO,EACN,mQAAmQ;yCACpQ;wCACD,aAAa,EAAE;4CACd,IAAI,EAAE,CAAC;4CACP,OAAO,EACN,8HAA8H;yCAC/H;qCACD;iCACD;6BACD;yBACD;wBACD,YAAY,EAAE;4BACb,IAAI,EAAE,CAAC;4BACP,OAAO,EACN,0EAA0E;yBAC3E;qBACD;iBACD;aACD;SACD;QACD,WAAW,E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EAAE;wCACN,aAAa,EAAE,0CAA0C;wCACzD,QAAQ,EAAE,0CAA0C;qCACpD;oCACD,OAAO,EAAE,EAAE;oCACX,KAAK,EAAE,EAAE;iCACT;6BACD;yBACD;qBACD;iBACD;aACD;SACD;QACD,UAAU,EAAE;YACX,EAAE,EAAE,0CAA0C;YAC9C,KAAK,EAAE;gBACN,OAAO,EAAE,0CAA0C;aACnD;YACD,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,EAAE;SACT;QACD,WAAW,EAAE;YACZ,EAAE,EAAE,0CAA0C;YAC9C,KAAK,EAAE;gBACN,UAAU,EAAE,0CAA0C;gBACtD,aAAa,EAAE,0CAA0C;gBACzD,eAAe,EAAE,0CAA0C;gBAC3D,YAAY,EAAE,0CAA0C;gBACxD,QAAQ,EAAE,aAAa;aACvB;YACD,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,EAAE;SACT;QACD,kBAAkB,EAAE;YACnB,EAAE,EAAE,0CAA0C;YAC9C,KAAK,EAAE;gBACN,IAAI,EAAE,0CAA0C;gBAChD,MAAM,EAAE,0CAA0C;aAClD;YACD,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,EAAE;SACT;QACD,IAAI,EAAE;YACL,EAAE,EAAE,0CAA0C;YAC9C,KAAK,EAAE;gBACN,SAAS,EAAE,0CAA0C;aACrD;YACD,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,EAAE;SACT;KACD;CACD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/dot-notation */\n\nexport const summaryTemplate = {\n\ttype: 1,\n\ttree: {\n\t\t\".channels\": {\n\t\t\ttype: 1,\n\t\t\ttree: {\n\t\t\t\trootDOId: {\n\t\t\t\t\ttype: 1,\n\t\t\t\t\ttree: {\n\t\t\t\t\t\t\".channels\": {\n\t\t\t\t\t\t\ttype: 1,\n\t\t\t\t\t\t\ttree: {\n\t\t\t\t\t\t\t\t\"7a99532d-94ec-43ac-8a53-d9f978ad4ae9\": {\n\t\t\t\t\t\t\t\t\ttype: 1,\n\t\t\t\t\t\t\t\t\ttree: {\n\t\t\t\t\t\t\t\t\t\t\"header\": {\n\t\t\t\t\t\t\t\t\t\t\ttype: 2,\n\t\t\t\t\t\t\t\t\t\t\tcontent: '{\"value\":\"123\"}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\".attributes\": {\n\t\t\t\t\t\t\t\t\t\t\ttype: 2,\n\t\t\t\t\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\t\t\t\t\t'{\"type\":\"https://graph.microsoft.com/types/cell\",\"snapshotFormatVersion\":\"0.1\",\"packageVersion\":\"2.0.0-internal.4.2.0\"}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"root\": {\n\t\t\t\t\t\t\t\t\ttype: 1,\n\t\t\t\t\t\t\t\t\ttree: {\n\t\t\t\t\t\t\t\t\t\t\"header\": {\n\t\t\t\t\t\t\t\t\t\t\ttype: 2,\n\t\t\t\t\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\t\t\t\t\t'{\"blobs\":[],\"content\":{\"ci\":{\"csn\":0,\"ccIds\":[]},\"subdirectories\":{\"initial-objects-key\":{\"ci\":{\"csn\":-1,\"ccIds\":[\"detached\"]},\"storage\":{\"tree\":{\"type\":\"Plain\",\"value\":{\"type\":\"__fluid_handle__\",\"url\":\"/rootDOId/de68ca53-be31-479e-8d34-a267958997e4\"}}}}}}}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\".attributes\": {\n\t\t\t\t\t\t\t\t\t\t\ttype: 2,\n\t\t\t\t\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\t\t\t\t\t'{\"type\":\"https://graph.microsoft.com/types/directory\",\"snapshotFormatVersion\":\"0.1\",\"packageVersion\":\"2.0.0-internal.4.2.0\"}',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\".component\": {\n\t\t\t\t\t\t\ttype: 2,\n\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\t'{\"pkg\":\"[\\\\\"rootDO\\\\\"]\",\"summaryFormatVersion\":2,\"isRootDataStore\":true}',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\".metadata\": {\n\t\t\ttype: 2,\n\t\t\tcontent:\n\t\t\t\t'{\"createContainerRuntimeVersion\":\"2.0.0-internal.4.2.0\",\"createContainerTimestamp\":1683180222333,\"summaryNumber\":2,\"summaryFormatVersion\":1,\"gcFeature\":2,\"sessionExpiryTimeoutMs\":2592000000,\"sweepEnabled\":false,\"sweepTimeoutMs\":3110400000,\"message\":{\"clientId\":null,\"clientSequenceNumber\":-1,\"minimumSequenceNumber\":5,\"referenceSequenceNumber\":-1,\"sequenceNumber\":7,\"timestamp\":1683180249726,\"type\":\"join\"},\"telemetryDocumentId\":\"72d29676-b076-43e8-80aa-b8fc7aba1506\"}',\n\t\t},\n\t\t\".protocol\": {\n\t\t\ttype: 1,\n\t\t\ttree: {\n\t\t\t\tmisotest: {\n\t\t\t\t\ttype: 2,\n\t\t\t\t\tcontent: \"ABC\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\".electedSummarizer\": {\n\t\t\ttype: 2,\n\t\t\tcontent:\n\t\t\t\t'{\"electedClientId\":\"f3bda689-ca40-4b68-b2ea-4c02dac76206\",\"electedParentId\":\"af12d248-f040-413c-a6d1-8e5bd6619313\",\"electionSequenceNumber\":7}',\n\t\t},\n\t\t\"gc\": {\n\t\t\ttype: 1,\n\t\t\ttree: {\n\t\t\t\t__gc_root: {\n\t\t\t\t\ttype: 2,\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t'{\"gcNodes\":{\"/\":{\"outboundRoutes\":[\"/rootDOId\"]},\"/rootDOId\":{\"outboundRoutes\":[\"/rootDOId/de68ca53-be31-479e-8d34-a267958997e4\",\"/rootDOId/root\"]},\"/rootDOId/de68ca53-be31-479e-8d34-a267958997e4\":{\"outboundRoutes\":[\"/rootDOId\"]},\"/rootDOId/root\":{\"outboundRoutes\":[\"/rootDOId\",\"/rootDOId/de68ca53-be31-479e-8d34-a267958997e4\"]}}}',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n\nexport const snapshotTree = {\n\tid: \"c26019650fe7fc3c1e9f50b906071296008fd9e0\",\n\tblobs: {\n\t\t\".electedSummarizer\": \"1779e5eec3d53d36c476f7e365fe09d5eadb5cb7\",\n\t\t\".metadata\": \"43a9378e44336b39fc8f86f0511a655511922f11\",\n\t\t\".metadata.blobHeaders\": \"1\",\n\t},\n\ttrees: {\n\t\t\".channels\": {\n\t\t\tid: \"1ac6a4929a0fb18b8093679b19d8eed478c908a0\",\n\t\t\tblobs: {},\n\t\t\tcommits: {},\n\t\t\ttrees: {\n\t\t\t\trootDOId: {\n\t\t\t\t\tid: \"5164ec1ecc2cfe24643347e30624aea2976f61e9\",\n\t\t\t\t\tblobs: {\n\t\t\t\t\t\t\".component\": \"c35bbe00f9cb9ee99c8af3d4757411abdda3d8f3\",\n\t\t\t\t\t},\n\t\t\t\t\tcommits: {},\n\t\t\t\t\ttrees: {\n\t\t\t\t\t\t\".channels\": {\n\t\t\t\t\t\t\tid: \"9a415dc0f942849ac3d686ec8f8049a4d1484ee1\",\n\t\t\t\t\t\t\tblobs: {},\n\t\t\t\t\t\t\tcommits: {},\n\t\t\t\t\t\t\ttrees: {\n\t\t\t\t\t\t\t\t\"7a99532d-94ec-43ac-8a53-d9f978ad4ae9\": {\n\t\t\t\t\t\t\t\t\tid: \"353aab1f600b0dd527073e286b4d6dd853c0d212\",\n\t\t\t\t\t\t\t\t\tblobs: {\n\t\t\t\t\t\t\t\t\t\t\".attributes\": \"d67e9b02c97d8b2d13b1ea88c4198ea6cdae3c06\",\n\t\t\t\t\t\t\t\t\t\t\"compressed_2_header\":\n\t\t\t\t\t\t\t\t\t\t\t\"ee84b67e86708c9dd7fc79ff8f3380b78f000b79\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcommits: {},\n\t\t\t\t\t\t\t\t\ttrees: {},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"root\": {\n\t\t\t\t\t\t\t\t\tid: \"771be006709c44442dbcd69424b8f89e14a05de8\",\n\t\t\t\t\t\t\t\t\tblobs: {\n\t\t\t\t\t\t\t\t\t\t\".attributes\": \"3ec4a65a74f0e2fab11aaac9b31f284a8c931850\",\n\t\t\t\t\t\t\t\t\t\t\"header\": \"c2de09aa55c92d79b9292d6efb469592915f0b1f\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tcommits: {},\n\t\t\t\t\t\t\t\t\ttrees: {},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t\".logTail\": {\n\t\t\tid: \"9ae35f3164c7c34c4ed29107af49f2913dc2e948\",\n\t\t\tblobs: {\n\t\t\t\tlogTail: \"8240863a82570a9eff14ecbc06cee9886d5dc560\",\n\t\t\t},\n\t\t\tcommits: {},\n\t\t\ttrees: {},\n\t\t},\n\t\t\".protocol\": {\n\t\t\tid: \"f4ab61e0c13030ccd4f56550fcf5e5c271de7152\",\n\t\t\tblobs: {\n\t\t\t\tattributes: \"78c80fb681c6b152c48f57526a76bd31ec3b1baf\",\n\t\t\t\tquorumMembers: \"cf6929236bacbea80764beb3aba8645210f4af57\",\n\t\t\t\tquorumProposals: \"0637a088a01e8ddab3bf3fa98dbe804cbde1a0dc\",\n\t\t\t\tquorumValues: \"c730f7a6ff8c606cc2b7d083e5a9705bff0d7029\",\n\t\t\t\tmisotest: \"misotest-id\",\n\t\t\t},\n\t\t\tcommits: {},\n\t\t\ttrees: {},\n\t\t},\n\t\t\".serviceProtocol\": {\n\t\t\tid: \"029fc548f99d4b9ef43cd98c401bc5a9f3a2f117\",\n\t\t\tblobs: {\n\t\t\t\tdeli: \"041b2b724ca853a9d65f4917d5ddb97e91fd7408\",\n\t\t\t\tscribe: \"97a0b1e36b67946044b7141ce62cbab6a5996723\",\n\t\t\t},\n\t\t\tcommits: {},\n\t\t\ttrees: {},\n\t\t},\n\t\t\"gc\": {\n\t\t\tid: \"e8ed0760ac37fd8042020559779ce80b1d88f266\",\n\t\t\tblobs: {\n\t\t\t\t__gc_root: \"018d97818f8b519f99c418cb3c33ce5cc4e38e3f\",\n\t\t\t},\n\t\t\tcommits: {},\n\t\t\ttrees: {},\n\t\t},\n\t},\n};\n"]}
|
|
@@ -1,429 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
7
|
-
/* eslint-disable @typescript-eslint/dot-notation */
|
|
8
|
-
import { strict as assert } from "assert";
|
|
9
|
-
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
10
|
-
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
11
|
-
import { applyStorageCompression, SummaryCompressionAlgorithm, blobHeadersBlobName, } from "../adapters/index.js";
|
|
12
|
-
import { snapshotTree, summaryTemplate } from "./summaryCompressionData.js";
|
|
13
|
-
/**
|
|
14
|
-
* This function clones the imported summary and returns a new summary with the same content.
|
|
15
|
-
*/
|
|
16
|
-
function cloneSummary() {
|
|
17
|
-
return JSON.parse(JSON.stringify(summaryTemplate));
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* This function generates the summary with the given content size. At first it clones the summary
|
|
21
|
-
* template, then it generates the content with the given size by loop, which will
|
|
22
|
-
* use repeated sequence from 0 to 10 to generate the content until the content size is achieved.
|
|
23
|
-
* The content is stored in the header of the summary.
|
|
24
|
-
* @param contentSize - The size of the content to be generated.
|
|
25
|
-
*/
|
|
26
|
-
function generateSummaryWithContent(contentSize) {
|
|
27
|
-
const summary = cloneSummary();
|
|
28
|
-
const header = summary.tree[".channels"].tree.rootDOId.tree[".channels"].tree["7a99532d-94ec-43ac-8a53-d9f978ad4ae9"].tree.header;
|
|
29
|
-
let contentString = "";
|
|
30
|
-
while (contentString.length < contentSize) {
|
|
31
|
-
if (contentString.length + 10 > contentSize) {
|
|
32
|
-
contentString += "0123456789".substring(0, contentSize - contentString.length);
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
contentString += "0123456789";
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
header["content"] = `{"value": ${contentString}}`;
|
|
40
|
-
return summary;
|
|
41
|
-
}
|
|
42
|
-
function generateSummaryWithBinaryContent(startsWith, contentSize) {
|
|
43
|
-
const summary = cloneSummary();
|
|
44
|
-
const header = summary.tree[".channels"].tree.rootDOId.tree[".channels"].tree["7a99532d-94ec-43ac-8a53-d9f978ad4ae9"].tree.header;
|
|
45
|
-
const content = new Uint8Array(contentSize);
|
|
46
|
-
content[0] = startsWith;
|
|
47
|
-
for (let i = 1; i < contentSize; i = i + 10) {
|
|
48
|
-
for (let j = 0; j < 10; j++) {
|
|
49
|
-
content[i + j] = j;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
header["content"] = content;
|
|
53
|
-
return summary;
|
|
54
|
-
}
|
|
55
|
-
const misotestid = "misotest-id";
|
|
56
|
-
const abcContent = "ABC";
|
|
57
|
-
class InternalTestStorage {
|
|
58
|
-
constructor() {
|
|
59
|
-
this.thisIsReallyOriginalStorage = "yes";
|
|
60
|
-
}
|
|
61
|
-
async getSnapshotTree(version, scenarioName) {
|
|
62
|
-
return JSON.parse(JSON.stringify(snapshotTree));
|
|
63
|
-
}
|
|
64
|
-
async getVersions(versionId, count, scenarioName, fetchSource) {
|
|
65
|
-
throw new Error("Method not implemented.");
|
|
66
|
-
}
|
|
67
|
-
async createBlob(file) {
|
|
68
|
-
throw new Error("Method not implemented.");
|
|
69
|
-
}
|
|
70
|
-
async readBlob(id) {
|
|
71
|
-
return id === misotestid
|
|
72
|
-
? new TextEncoder().encode(abcContent)
|
|
73
|
-
: getHeaderContent(this._uploadedSummary);
|
|
74
|
-
}
|
|
75
|
-
async uploadSummaryWithContext(summary, context) {
|
|
76
|
-
this._uploadedSummary = summary;
|
|
77
|
-
return "test";
|
|
78
|
-
}
|
|
79
|
-
async downloadSummary(handle) {
|
|
80
|
-
return this._uploadedSummary;
|
|
81
|
-
}
|
|
82
|
-
dispose(error) {
|
|
83
|
-
throw new Error("Method not implemented.");
|
|
84
|
-
}
|
|
85
|
-
get uploadedSummary() {
|
|
86
|
-
return this._uploadedSummary;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function isOriginalStorage(storage) {
|
|
90
|
-
return storage.thisIsReallyOriginalStorage === "yes";
|
|
91
|
-
}
|
|
92
|
-
class InternalTestDocumentService extends TypedEventEmitter {
|
|
93
|
-
constructor() {
|
|
94
|
-
super();
|
|
95
|
-
this.resolvedUrl = {};
|
|
96
|
-
this.storage = new InternalTestStorage();
|
|
97
|
-
}
|
|
98
|
-
async connectToStorage() {
|
|
99
|
-
return this.storage;
|
|
100
|
-
}
|
|
101
|
-
async connectToDeltaStorage() {
|
|
102
|
-
throw new Error("Method not implemented.");
|
|
103
|
-
}
|
|
104
|
-
async connectToDeltaStream(client) {
|
|
105
|
-
throw new Error("Method not implemented.");
|
|
106
|
-
}
|
|
107
|
-
dispose(error) {
|
|
108
|
-
throw new Error("Method not implemented.");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
class InternalTestDocumentServiceFactory {
|
|
112
|
-
constructor() {
|
|
113
|
-
this.documentService = new InternalTestDocumentService();
|
|
114
|
-
}
|
|
115
|
-
async createDocumentService(resolvedUrl, logger, clientIsSummarizer) {
|
|
116
|
-
return this.documentService;
|
|
117
|
-
}
|
|
118
|
-
async createContainer(createNewSummary, createNewResolvedUrl, logger, clientIsSummarizer) {
|
|
119
|
-
return this.documentService;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
async function buildCompressionStorage(config) {
|
|
123
|
-
{
|
|
124
|
-
const factory = applyStorageCompression(new InternalTestDocumentServiceFactory(), config);
|
|
125
|
-
const documentService = await factory.createContainer(undefined, {});
|
|
126
|
-
const storage = await documentService.connectToStorage();
|
|
127
|
-
return storage;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
const prefixForUncompressed = 0xb0;
|
|
131
|
-
const prefixForLZ4 = 0xb1;
|
|
132
|
-
describe("Summary Compression Test", () => {
|
|
133
|
-
it("Verify Proper Summary Generation", async () => {
|
|
134
|
-
const summary = generateSummaryWithContent(1000000);
|
|
135
|
-
const content = getHeaderContent(summary);
|
|
136
|
-
assert(content.length === 1000000 + 11, `The content size is ${content.length} and should be 1000011`);
|
|
137
|
-
});
|
|
138
|
-
it("Verify Config True", async () => {
|
|
139
|
-
const storage = await buildCompressionStorage(true);
|
|
140
|
-
checkCompressionConfig(storage, 500, SummaryCompressionAlgorithm.LZ4);
|
|
141
|
-
});
|
|
142
|
-
it("Verify Config False", async () => {
|
|
143
|
-
const storage = await buildCompressionStorage(false);
|
|
144
|
-
const config = storage._config;
|
|
145
|
-
assert(config === undefined, "The storage has compression");
|
|
146
|
-
assert(isOriginalStorage(storage), "The storage is not the original storage");
|
|
147
|
-
});
|
|
148
|
-
it("Verify Config Empty", async () => {
|
|
149
|
-
const storage = await buildCompressionStorage();
|
|
150
|
-
const config = storage._config;
|
|
151
|
-
assert(config === undefined, "The storage has compression");
|
|
152
|
-
assert(isOriginalStorage(storage), "The storage is not the original storage");
|
|
153
|
-
});
|
|
154
|
-
it("Verify Config Object (summary-blob markup)", async () => {
|
|
155
|
-
const config = {
|
|
156
|
-
algorithm: SummaryCompressionAlgorithm.None,
|
|
157
|
-
minSizeToCompress: 763,
|
|
158
|
-
};
|
|
159
|
-
const storage = await buildCompressionStorage(config);
|
|
160
|
-
checkCompressionConfig(storage, 763, SummaryCompressionAlgorithm.None);
|
|
161
|
-
});
|
|
162
|
-
it("Verify Compressed Markup at Summary (summary-blob markup)", async () => {
|
|
163
|
-
const config = {
|
|
164
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
165
|
-
minSizeToCompress: 500,
|
|
166
|
-
};
|
|
167
|
-
const storage = (await buildCompressionStorage(config));
|
|
168
|
-
const summary = generateSummaryWithContent(1000);
|
|
169
|
-
await storage.uploadSummaryWithContext(summary, {
|
|
170
|
-
referenceSequenceNumber: 0,
|
|
171
|
-
proposalHandle: "test",
|
|
172
|
-
ackHandle: "test",
|
|
173
|
-
});
|
|
174
|
-
const uploadedSummary = storage.service.uploadedSummary;
|
|
175
|
-
assert(uploadedSummary?.tree[blobHeadersBlobName] !== undefined, "The summary-blob markup is not added");
|
|
176
|
-
});
|
|
177
|
-
it("Verify Blob Enc/Dec Symmetry (summary-blob markup)", async () => {
|
|
178
|
-
const config = {
|
|
179
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
180
|
-
minSizeToCompress: 500,
|
|
181
|
-
};
|
|
182
|
-
await checkEncDec(config);
|
|
183
|
-
});
|
|
184
|
-
it("Verify Blob Enc/Dec no-compress Symmetry (summary-blob markup)", async () => {
|
|
185
|
-
const config = {
|
|
186
|
-
algorithm: SummaryCompressionAlgorithm.None,
|
|
187
|
-
minSizeToCompress: 500,
|
|
188
|
-
};
|
|
189
|
-
await checkEncDec(config);
|
|
190
|
-
});
|
|
191
|
-
it("Verify Upload / Download Summary (summary-blob markup)", async () => {
|
|
192
|
-
const config = {
|
|
193
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
194
|
-
minSizeToCompress: 500,
|
|
195
|
-
};
|
|
196
|
-
await checkUploadDownloadSummary(config);
|
|
197
|
-
});
|
|
198
|
-
it("Verify Upload / Download Summary no-compress (summary-blob markup)", async () => {
|
|
199
|
-
const config = {
|
|
200
|
-
algorithm: SummaryCompressionAlgorithm.None,
|
|
201
|
-
minSizeToCompress: 500,
|
|
202
|
-
};
|
|
203
|
-
await checkUploadDownloadSummary(config);
|
|
204
|
-
});
|
|
205
|
-
it("Verify no-compress small (summary-blob markup)", async () => {
|
|
206
|
-
const config = {
|
|
207
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
208
|
-
minSizeToCompress: 500,
|
|
209
|
-
};
|
|
210
|
-
const storage = (await buildCompressionStorage(config));
|
|
211
|
-
const summary = generateSummaryWithContent(300);
|
|
212
|
-
await storage.uploadSummaryWithContext(summary, {
|
|
213
|
-
referenceSequenceNumber: 0,
|
|
214
|
-
proposalHandle: "test",
|
|
215
|
-
ackHandle: "test",
|
|
216
|
-
});
|
|
217
|
-
const originalContent = getHeaderContent(summary);
|
|
218
|
-
const content = new TextDecoder().decode(await storage.readBlob("1234"));
|
|
219
|
-
assert(content === originalContent, `The content is not equal to original content \n${content} \n ${originalContent}`);
|
|
220
|
-
});
|
|
221
|
-
it("Verify no-compress prefix (summary-blob markup)", async () => {
|
|
222
|
-
const config = {
|
|
223
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
224
|
-
minSizeToCompress: 500,
|
|
225
|
-
};
|
|
226
|
-
const firstOriginalByte = 0xb3;
|
|
227
|
-
const contentSize = 30;
|
|
228
|
-
const uploadedContent = await uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config);
|
|
229
|
-
const firstByte = uploadedContent[0];
|
|
230
|
-
const secondByte = uploadedContent[1];
|
|
231
|
-
assert(firstByte === prefixForUncompressed, `The first byte should be ${prefixForUncompressed} but is ${firstByte}`);
|
|
232
|
-
assert(secondByte === firstOriginalByte, `The second byte should be ${firstOriginalByte} but is ${secondByte}`);
|
|
233
|
-
});
|
|
234
|
-
it("Verify compress prefix (summary-blob markup)", async () => {
|
|
235
|
-
const config = {
|
|
236
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
237
|
-
minSizeToCompress: 500,
|
|
238
|
-
};
|
|
239
|
-
const firstOriginalByte = 0xb3;
|
|
240
|
-
const contentSize = 800;
|
|
241
|
-
const uploadedContent = await uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config);
|
|
242
|
-
const firstByte = uploadedContent[0];
|
|
243
|
-
assert(firstByte === prefixForLZ4, `The first byte should be ${prefixForLZ4} but is ${firstByte}`);
|
|
244
|
-
});
|
|
245
|
-
it("Verify no-compress no-prefix (summary-blob markup)", async () => {
|
|
246
|
-
const config = {
|
|
247
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
248
|
-
minSizeToCompress: 500,
|
|
249
|
-
};
|
|
250
|
-
const contentSize = 30;
|
|
251
|
-
await testNoPrefix(contentSize, config);
|
|
252
|
-
});
|
|
253
|
-
it("Verify none-algorithm no-prefix (summary-blob markup)", async () => {
|
|
254
|
-
const config = {
|
|
255
|
-
algorithm: SummaryCompressionAlgorithm.None,
|
|
256
|
-
minSizeToCompress: 500,
|
|
257
|
-
};
|
|
258
|
-
const contentSize = 800;
|
|
259
|
-
await testNoPrefix(contentSize, config);
|
|
260
|
-
});
|
|
261
|
-
it("Verify prefix compressed (summary-blob markup)", async () => {
|
|
262
|
-
const config = {
|
|
263
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
264
|
-
minSizeToCompress: 500,
|
|
265
|
-
};
|
|
266
|
-
const contentSize = 800;
|
|
267
|
-
await testPrefix(contentSize, config);
|
|
268
|
-
});
|
|
269
|
-
it("Verify prefix uncompressed small size (summary-blob markup)", async () => {
|
|
270
|
-
const config = {
|
|
271
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
272
|
-
minSizeToCompress: 500,
|
|
273
|
-
};
|
|
274
|
-
const contentSize = 30;
|
|
275
|
-
await testPrefix(contentSize, config, 0xb0, 0xc0, prefixForUncompressed);
|
|
276
|
-
});
|
|
277
|
-
it("Verify prefix uncompressed algorithm none (summary-blob markup)", async () => {
|
|
278
|
-
const config = {
|
|
279
|
-
algorithm: SummaryCompressionAlgorithm.None,
|
|
280
|
-
minSizeToCompress: 500,
|
|
281
|
-
};
|
|
282
|
-
const contentSize = 800;
|
|
283
|
-
await testPrefix(contentSize, config, 0xb0, 0xc0, prefixForUncompressed);
|
|
284
|
-
});
|
|
285
|
-
it("Verify enc / dec compressed loop (summary-blob markup)", async () => {
|
|
286
|
-
const config = {
|
|
287
|
-
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
288
|
-
minSizeToCompress: 500,
|
|
289
|
-
};
|
|
290
|
-
const contentSize = 800;
|
|
291
|
-
await testEncDecBinaryLoop(contentSize, config);
|
|
292
|
-
});
|
|
293
|
-
it("Verify enc / dec uncompressed loop - algorithm none (summary-blob markup)", async () => {
|
|
294
|
-
const config = {
|
|
295
|
-
algorithm: SummaryCompressionAlgorithm.None,
|
|
296
|
-
minSizeToCompress: 500,
|
|
297
|
-
};
|
|
298
|
-
const contentSize = 800;
|
|
299
|
-
await testEncDecBinaryLoop(contentSize, config);
|
|
300
|
-
});
|
|
301
|
-
it("Verify enc / dec uncompressed loop - small (summary-blob markup)", async () => {
|
|
302
|
-
const config = {
|
|
303
|
-
algorithm: SummaryCompressionAlgorithm.None,
|
|
304
|
-
minSizeToCompress: 500,
|
|
305
|
-
};
|
|
306
|
-
const contentSize = 30;
|
|
307
|
-
await testEncDecBinaryLoop(contentSize, config);
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
async function testNoPrefix(contentSize, config) {
|
|
311
|
-
for (let i = 0; i < 256; i++) {
|
|
312
|
-
if (i >= 0xb0 && i <= 0xbf) {
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
const firstOriginalByte = i;
|
|
316
|
-
const uploadedContent = await uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config);
|
|
317
|
-
const firstByte = uploadedContent[0];
|
|
318
|
-
assert(firstByte === firstOriginalByte, `The first byte should be ${firstOriginalByte} but is ${firstByte}`);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
async function testPrefix(contentSize, config, from = 0, to = 256, prefix = prefixForLZ4) {
|
|
322
|
-
for (let i = from; i < to; i++) {
|
|
323
|
-
const firstOriginalByte = i;
|
|
324
|
-
const uploadedContent = await uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config);
|
|
325
|
-
const firstByte = uploadedContent[0];
|
|
326
|
-
assert(firstByte === prefix, `The first byte should be ${prefix} but is ${firstByte}`);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
async function uploadSummaryWithBinaryContent(firstOriginalByte, contentSize, config) {
|
|
330
|
-
const storage = (await buildCompressionStorage(config));
|
|
331
|
-
const summary = generateSummaryWithBinaryContent(firstOriginalByte, contentSize);
|
|
332
|
-
await storage.uploadSummaryWithContext(summary, {
|
|
333
|
-
referenceSequenceNumber: 0,
|
|
334
|
-
proposalHandle: "test",
|
|
335
|
-
ackHandle: "test",
|
|
336
|
-
});
|
|
337
|
-
const uploadedSummary = storage.service.uploadedSummary;
|
|
338
|
-
const uploadedContent = getHeaderContent(uploadedSummary);
|
|
339
|
-
return uploadedContent;
|
|
340
|
-
}
|
|
341
|
-
async function checkUploadDownloadSummary(config) {
|
|
342
|
-
const storage = (await buildCompressionStorage(config));
|
|
343
|
-
const summary = generateSummaryWithContent(1000);
|
|
344
|
-
const originBlobContent = getHeaderContent(summary);
|
|
345
|
-
await storage.uploadSummaryWithContext(summary, {
|
|
346
|
-
referenceSequenceNumber: 0,
|
|
347
|
-
proposalHandle: "test",
|
|
348
|
-
ackHandle: "test",
|
|
349
|
-
});
|
|
350
|
-
await storage.getSnapshotTree({ id: "test", treeId: "test" }, "test");
|
|
351
|
-
const summaryHandle = {
|
|
352
|
-
type: SummaryType.Handle,
|
|
353
|
-
handleType: SummaryType.Tree,
|
|
354
|
-
handle: "test",
|
|
355
|
-
};
|
|
356
|
-
const downloadedSummary = await storage.downloadSummary(summaryHandle);
|
|
357
|
-
const downloadedBlobContentBin = getHeaderContent(downloadedSummary);
|
|
358
|
-
// const blobStr = new TextDecoder().decode(blob);
|
|
359
|
-
const downloadedBlobContent = new TextDecoder().decode(downloadedBlobContentBin);
|
|
360
|
-
assert(originBlobContent === downloadedBlobContent, `The origin and the downloaded blob are not the same
|
|
361
|
-
\norigin : ${originBlobContent}
|
|
362
|
-
\ndownloaded : ${downloadedBlobContent}`);
|
|
363
|
-
return downloadedSummary;
|
|
364
|
-
}
|
|
365
|
-
async function checkEncDec(config) {
|
|
366
|
-
const summary = generateSummaryWithContent(1000);
|
|
367
|
-
await checkEncDecConfigurable(summary, config);
|
|
368
|
-
}
|
|
369
|
-
async function checkEncDecBinary(config, startsWith, contentSize) {
|
|
370
|
-
const summary = generateSummaryWithBinaryContent(startsWith, contentSize);
|
|
371
|
-
await checkEncDecConfigurable(summary, config, startsWith);
|
|
372
|
-
}
|
|
373
|
-
async function testEncDecBinaryLoop(contentSize, config, from = 0, to = 256) {
|
|
374
|
-
for (let i = from; i < to; i++) {
|
|
375
|
-
const firstOriginalByte = i;
|
|
376
|
-
await checkEncDecBinary(config, firstOriginalByte, contentSize);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
function compareTwoBlobs(blob1, blob2) {
|
|
380
|
-
const blob1View = new Uint8Array(blob1);
|
|
381
|
-
const blob2View = new Uint8Array(blob2);
|
|
382
|
-
if (blob1View.length !== blob2View.length) {
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
for (let i = 0; i < blob1View.length; i++) {
|
|
386
|
-
if (blob1View[i] !== blob2View[i]) {
|
|
387
|
-
return false;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return true;
|
|
391
|
-
}
|
|
392
|
-
async function checkEncDecConfigurable(summary, config, startsWith = -1) {
|
|
393
|
-
const storage = (await buildCompressionStorage(config));
|
|
394
|
-
const originHeaderHolder = getHeaderHolder(summary);
|
|
395
|
-
const originBlob = originHeaderHolder.tree.header.content;
|
|
396
|
-
await storage.uploadSummaryWithContext(summary, {
|
|
397
|
-
referenceSequenceNumber: 0,
|
|
398
|
-
proposalHandle: "test",
|
|
399
|
-
ackHandle: "test",
|
|
400
|
-
});
|
|
401
|
-
await storage.getSnapshotTree({ id: "test", treeId: "test" }, "test");
|
|
402
|
-
const blob = await storage.readBlob("abcd");
|
|
403
|
-
if (typeof originBlob === "string") {
|
|
404
|
-
const blobStr = new TextDecoder().decode(blob);
|
|
405
|
-
assert(blobStr === originBlob, `The origin and the downloaded blob starting with ${startsWith} are not the same \n\n\n${blobStr}\n\n${originBlob}`);
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
assert(compareTwoBlobs(blob, originBlob), `The origin and the downloaded blob are not the same \n\n\n${blob.byteLength}\n\n${originBlob.byteLength}.
|
|
409
|
-
The first bytes are ${blob[0]} and ${originBlob[0]}`);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
function checkCompressionConfig(storage, expectedMinSizeToCompress, expectedAlgorithm) {
|
|
413
|
-
const config = storage._config;
|
|
414
|
-
assert(config !== undefined, "The storage has no compression");
|
|
415
|
-
assert((config.minSizeToCompress === expectedMinSizeToCompress,
|
|
416
|
-
`Unexpected minSizeToCompress config ${config.minSizeToCompress}`));
|
|
417
|
-
assert((config.algorithmm === expectedAlgorithm,
|
|
418
|
-
`Unexpected minSizeToCompress config ${config.algorithmm}`));
|
|
419
|
-
}
|
|
420
|
-
function getHeaderContent(summary) {
|
|
421
|
-
return getHeader(summary)["content"];
|
|
422
|
-
}
|
|
423
|
-
function getHeader(summary) {
|
|
424
|
-
return getHeaderHolder(summary).tree.header;
|
|
425
|
-
}
|
|
426
|
-
function getHeaderHolder(summary) {
|
|
427
|
-
return summary.tree[".channels"].tree.rootDOId.tree[".channels"].tree["7a99532d-94ec-43ac-8a53-d9f978ad4ae9"];
|
|
428
|
-
}
|
|
429
|
-
//# sourceMappingURL=summaryCompresssionTester.spec.js.map
|