@fluidframework/driver-utils 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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/.eslintrc.js +17 -19
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/blobAggregationStorage.d.ts +15 -2
- package/dist/blobAggregationStorage.d.ts.map +1 -1
- package/dist/blobAggregationStorage.js +22 -13
- package/dist/blobAggregationStorage.js.map +1 -1
- package/dist/blobCacheStorageService.d.ts.map +1 -1
- package/dist/blobCacheStorageService.js.map +1 -1
- package/dist/buildSnapshotTree.d.ts.map +1 -1
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/emptyDocumentDeltaStorageService.d.ts.map +1 -1
- package/dist/emptyDocumentDeltaStorageService.js.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/fluidResolvedUrl.d.ts.map +1 -1
- package/dist/fluidResolvedUrl.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/insecureUrlResolver.js +2 -1
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/mapWithExpiration.d.ts.map +1 -1
- package/dist/mapWithExpiration.js +5 -3
- package/dist/mapWithExpiration.js.map +1 -1
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js.map +1 -1
- package/dist/multiDocumentServiceFactory.d.ts.map +1 -1
- package/dist/multiDocumentServiceFactory.js.map +1 -1
- package/dist/multiUrlResolver.d.ts.map +1 -1
- package/dist/multiUrlResolver.js.map +1 -1
- package/dist/network.d.ts +1 -1
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +4 -3
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +2 -3
- 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.map +1 -1
- package/dist/parallelRequests.js +19 -9
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/rateLimiter.d.ts.map +1 -1
- package/dist/rateLimiter.js.map +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.map +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 +1 -4
- package/dist/treeConversions.js.map +1 -1
- package/dist/treeUtils.d.ts +10 -10
- package/dist/treeUtils.d.ts.map +1 -1
- package/dist/treeUtils.js +10 -10
- package/dist/treeUtils.js.map +1 -1
- package/lib/blobAggregationStorage.d.ts +15 -2
- package/lib/blobAggregationStorage.d.ts.map +1 -1
- package/lib/blobAggregationStorage.js +22 -13
- package/lib/blobAggregationStorage.js.map +1 -1
- package/lib/blobCacheStorageService.d.ts.map +1 -1
- package/lib/blobCacheStorageService.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts.map +1 -1
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts.map +1 -1
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/emptyDocumentDeltaStorageService.d.ts.map +1 -1
- package/lib/emptyDocumentDeltaStorageService.js.map +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js.map +1 -1
- package/lib/fluidResolvedUrl.d.ts.map +1 -1
- package/lib/fluidResolvedUrl.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/insecureUrlResolver.d.ts.map +1 -1
- package/lib/insecureUrlResolver.js +2 -1
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/mapWithExpiration.d.ts.map +1 -1
- package/lib/mapWithExpiration.js +5 -3
- package/lib/mapWithExpiration.js.map +1 -1
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +1 -1
- package/lib/messageRecognition.js.map +1 -1
- package/lib/multiDocumentServiceFactory.d.ts.map +1 -1
- package/lib/multiDocumentServiceFactory.js.map +1 -1
- package/lib/multiUrlResolver.d.ts.map +1 -1
- package/lib/multiUrlResolver.js.map +1 -1
- package/lib/network.d.ts +1 -1
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +4 -3
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +2 -3
- 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.map +1 -1
- package/lib/parallelRequests.js +19 -9
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/rateLimiter.d.ts.map +1 -1
- package/lib/rateLimiter.js.map +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.map +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 +4 -7
- package/lib/treeConversions.js.map +1 -1
- package/lib/treeUtils.d.ts +10 -10
- package/lib/treeUtils.d.ts.map +1 -1
- package/lib/treeUtils.js +11 -11
- package/lib/treeUtils.js.map +1 -1
- package/package.json +43 -64
- package/prettier.config.cjs +1 -1
- package/src/blobAggregationStorage.ts +380 -324
- package/src/blobCacheStorageService.ts +20 -17
- package/src/buildSnapshotTree.ts +54 -51
- package/src/documentStorageServiceProxy.ts +49 -43
- package/src/emptyDocumentDeltaStorageService.ts +11 -10
- package/src/error.ts +5 -7
- package/src/fluidResolvedUrl.ts +9 -6
- package/src/index.ts +5 -1
- package/src/insecureUrlResolver.ts +127 -116
- package/src/mapWithExpiration.ts +111 -104
- package/src/messageRecognition.ts +25 -19
- package/src/multiDocumentServiceFactory.ts +73 -62
- package/src/multiUrlResolver.ts +26 -29
- package/src/network.ts +114 -112
- package/src/networkUtils.ts +37 -34
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +571 -509
- package/src/prefetchDocumentStorageService.ts +76 -74
- package/src/rateLimiter.ts +29 -29
- package/src/readAndParse.ts +7 -4
- package/src/runWithRetry.ts +105 -94
- package/src/summaryForCreateNew.ts +27 -24
- package/src/treeConversions.ts +48 -70
- package/src/treeUtils.ts +70 -74
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +8 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAGN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAyB;IACzD,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,CAAC;AAC/C,CAAC;AAED,IAAK,cAQJ;AARD,WAAK,cAAc;IAClB,gDAA8B,CAAA;IAC9B,mCAAiB,CAAA;IACjB,yCAAuB,CAAA;IACvB,2CAAyB,CAAA;IACzB,mCAAiB,CAAA;IACjB,iCAAe,CAAA;IACf,kCAAgB,CAAA;AACjB,CAAC,EARI,cAAc,KAAd,cAAc,QAQlB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAkC;IAC1E,IAAK,MAAM,CAAC,MAAM,CAAC,cAAc,CAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACvE,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,iDAAiD;AACjD,kDAAkD;AAClD,MAAM,CAAN,IAAY,YAEX;AAFD,WAAY,YAAY;IACvB,iCAAiB,CAAA;AAClB,CAAC,EAFW,YAAY,KAAZ,YAAY,QAEvB;AAED,mEAAmE;AACnE,MAAM,UAAU,uBAAuB,CACtC,OAAqD;IAErD,6FAA6F;IAC7F,mEAAmE;IACnE,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,CAAC;AAClF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Tells if message was sent by container runtime\n * @privateRemarks ADO #1385: To be moved to container-definitions\n * @returns whether the message is a runtime message\n */\nexport function isRuntimeMessage(message: { type: string }): boolean {\n\treturn message.type === MessageType.Operation;\n}\n\nenum RuntimeMessage {\n\tFluidDataStoreOp = \"component\",\n\tAttach = \"attach\",\n\tChunkedOp = \"chunkedOp\",\n\tBlobAttach = \"blobAttach\",\n\tRejoin = \"rejoin\",\n\tAlias = \"alias\",\n\tOperation = \"op\",\n}\n\n/**\n * Determines whether or not the message type is one of the following: (legacy)\n *\n * - \"component\"\n *\n * - \"attach\"\n *\n * - \"chunkedOp\"\n *\n * - \"blobAttach\"\n *\n * - \"rejoin\"\n *\n * - \"alias\"\n *\n * - \"op\"\n *\n * @deprecated This API should not be used.\n */\nexport function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean {\n\tif ((Object.values(RuntimeMessage) as string[]).includes(message.type)) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// ADO #1385: staging code changes across layers.\n// Eventually to be replaced by MessageType.accept\nexport enum MessageType2 {\n\tAccept = \"accept\",\n}\n\n// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts\nexport function canBeCoalescedByService(\n\tmessage: ISequencedDocumentMessage | IDocumentMessage,\n): boolean {\n\t// This assumes that in the future relay service may implement coalescing of accept messages,\n\t// same way it was doing coalescing of immediate noops in the past.\n\treturn message.type === MessageType.NoOp || message.type === MessageType2.Accept;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"multiDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E,qBAAa,2BAA4B,YAAW,uBAAuB;WAC5D,MAAM,CACnB,sBAAsB,EAAE,uBAAuB,GAAG,uBAAuB,EAAE;IAoB5E,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAuC;gBAExE,wBAAwB,EAAE,uBAAuB,EAAE;IAM/D,SAAgB,YAAY,WAAW;IACjC,qBAAqB,CAC1B,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;IAgBf,eAAe,CAC3B,gBAAgB,EAAE,YAAY,EAC9B,oBAAoB,EAAE,YAAY,EAClC,MAAM,CAAC,EAAE,oBAAoB,EAC7B,kBAAkB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,gBAAgB,CAAC;CAmB5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiDocumentServiceFactory.js","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAQ5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,OAAO,2BAA2B;
|
|
1
|
+
{"version":3,"file":"multiDocumentServiceFactory.js","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAQ5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,OAAO,2BAA2B;IAwBvC,YAAY,wBAAmD;QAM/C,iBAAY,GAAG,OAAO,CAAC;QALtC,IAAI,CAAC,4BAA4B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC9C,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAgC,EAAE,EAAE;YACrE,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACJ,CAAC;IA5BM,MAAM,CAAC,MAAM,CACnB,sBAA2E;QAE3E,IAAI,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;YAC1C,MAAM,SAAS,GAA8B,EAAE,CAAC;YAChD,sBAAsB,CAAC,OAAO,CAAC,CAAC,OAAO,EAA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,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,EAAE;YAC9D,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SACxC;QACD,MAAM,OAAO,GAAwC,IAAI,CAAC,4BAA4B,CAAC,GAAG,CACzF,MAAM,CAAC,QAAQ,CACf,CAAC;QACF,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC1C;QACD,OAAO,OAAO,CAAC,eAAe,CAC7B,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,EACN,kBAAkB,CAClB,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport {\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n\tIDocumentService,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ensureFluidResolvedUrl } from \"./fluidResolvedUrl\";\n\nexport class MultiDocumentServiceFactory implements IDocumentServiceFactory {\n\tpublic static create(\n\t\tdocumentServiceFactory: IDocumentServiceFactory | IDocumentServiceFactory[],\n\t) {\n\t\tif (Array.isArray(documentServiceFactory)) {\n\t\t\tconst factories: IDocumentServiceFactory[] = [];\n\t\t\tdocumentServiceFactory.forEach((factory) => {\n\t\t\t\tconst maybeMulti = factory as MultiDocumentServiceFactory;\n\t\t\t\tif (maybeMulti.protocolToDocumentFactoryMap !== undefined) {\n\t\t\t\t\tfactories.push(...maybeMulti.protocolToDocumentFactoryMap.values());\n\t\t\t\t} else {\n\t\t\t\t\tfactories.push(factory);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (factories.length === 1) {\n\t\t\t\treturn factories[0];\n\t\t\t}\n\t\t\treturn new MultiDocumentServiceFactory(factories);\n\t\t}\n\t\treturn documentServiceFactory;\n\t}\n\n\tprivate readonly protocolToDocumentFactoryMap: Map<string, IDocumentServiceFactory>;\n\n\tconstructor(documentServiceFactories: IDocumentServiceFactory[]) {\n\t\tthis.protocolToDocumentFactoryMap = new Map();\n\t\tdocumentServiceFactories.forEach((factory: IDocumentServiceFactory) => {\n\t\t\tthis.protocolToDocumentFactoryMap.set(factory.protocolName, factory);\n\t\t});\n\t}\n\tpublic readonly protocolName = \"none:\";\n\tasync createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tensureFluidResolvedUrl(resolvedUrl);\n\t\tconst urlObj = parse(resolvedUrl.url);\n\t\tif (urlObj.protocol === undefined || urlObj.protocol === null) {\n\t\t\tthrow new Error(\"No protocol provided\");\n\t\t}\n\t\tconst factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(\n\t\t\turlObj.protocol,\n\t\t);\n\t\tif (factory === undefined) {\n\t\t\tthrow new Error(\"Unknown Fluid protocol\");\n\t\t}\n\n\t\treturn factory.createDocumentService(resolvedUrl, logger, clientIsSummarizer);\n\t}\n\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree,\n\t\tcreateNewResolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tensureFluidResolvedUrl(createNewResolvedUrl);\n\t\tconst urlObj = parse(createNewResolvedUrl.url);\n\t\tif (urlObj.protocol === undefined || urlObj.protocol === null) {\n\t\t\tthrow new Error(\"No protocol provided\");\n\t\t}\n\t\tconst factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(\n\t\t\turlObj.protocol,\n\t\t);\n\t\tif (factory === undefined) {\n\t\t\tthrow new Error(\"Unknown Fluid protocol\");\n\t\t}\n\t\treturn factory.createContainer(\n\t\t\tcreateNewSummary,\n\t\t\tcreateNewResolvedUrl,\n\t\t\tlogger,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiUrlResolver.d.ts","sourceRoot":"","sources":["../src/multiUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEhF;;;;GAIG;AACH,wBAAsB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"multiUrlResolver.d.ts","sourceRoot":"","sources":["../src/multiUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEhF;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC5C,aAAa,EAAE,YAAY,EAAE,EAC7B,OAAO,EAAE,QAAQ,GACf,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CASnC;AAED,qBAAa,gBAAiB,YAAW,YAAY;IAWhC,OAAO,CAAC,QAAQ,CAAC,YAAY;WAVnC,MAAM,CAAC,WAAW,EAAE,YAAY,GAAG,YAAY,EAAE;IAU/D,OAAO;IAED,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAItD,cAAc,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiUrlResolver.js","sourceRoot":"","sources":["../src/multiUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,
|
|
1
|
+
{"version":3,"file":"multiUrlResolver.js","sourceRoot":"","sources":["../src/multiUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,aAA6B,EAC7B,OAAiB;IAEjB,IAAI,QAAkC,CAAC;IACvC,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE;QACrC,QAAQ,GAAG,MAAM,QAAQ,CAAC,OAAO,mBAAM,OAAO,EAAG,CAAC;QAClD,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,OAAO,QAAQ,CAAC;SAChB;KACD;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,OAAO,gBAAgB;IAW5B,YAAqC,YAA4B;QAA5B,iBAAY,GAAZ,YAAY,CAAgB;IAAG,CAAC;IAV9D,MAAM,CAAC,MAAM,CAAC,WAA0C;QAC9D,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;YAC/B,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC7B,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;aACtB;YACD,OAAO,IAAI,gBAAgB,CAAC,WAAW,CAAC,CAAC;SACzC;QACD,OAAO,WAAW,CAAC;IACpB,CAAC;IAID,KAAK,CAAC,OAAO,CAAC,OAAiB;QAC9B,OAAO,uBAAuB,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,WAAyB,EAAE,WAAmB;QACzE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACnC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\n\n/**\n * Resolver that takes a list of url resolvers and then try each of them to resolve the url.\n * @param resolversList - List of url resolvers to be used to resolve the request.\n * @param request - Request to be resolved.\n */\nexport async function configurableUrlResolver(\n\tresolversList: IUrlResolver[],\n\trequest: IRequest,\n): Promise<IResolvedUrl | undefined> {\n\tlet resolved: IResolvedUrl | undefined;\n\tfor (const resolver of resolversList) {\n\t\tresolved = await resolver.resolve({ ...request });\n\t\tif (resolved !== undefined) {\n\t\t\treturn resolved;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport class MultiUrlResolver implements IUrlResolver {\n\tpublic static create(urlResolver: IUrlResolver | IUrlResolver[]) {\n\t\tif (Array.isArray(urlResolver)) {\n\t\t\tif (urlResolver.length === 1) {\n\t\t\t\treturn urlResolver[0];\n\t\t\t}\n\t\t\treturn new MultiUrlResolver(urlResolver);\n\t\t}\n\t\treturn urlResolver;\n\t}\n\n\tprivate constructor(private readonly urlResolvers: IUrlResolver[]) {}\n\n\tasync resolve(request: IRequest): Promise<IResolvedUrl | undefined> {\n\t\treturn configurableUrlResolver(this.urlResolvers, request);\n\t}\n\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tthrow new Error(\"Not implmented\");\n\t}\n}\n"]}
|
package/lib/network.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare function isOnline(): OnlineStatus;
|
|
|
22
22
|
*
|
|
23
23
|
* @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that
|
|
24
24
|
* it can used from the base to upper layers.
|
|
25
|
-
*/
|
|
25
|
+
*/
|
|
26
26
|
export interface IAnyDriverError extends Omit<IDriverErrorBase, "errorType"> {
|
|
27
27
|
readonly errorType: string;
|
|
28
28
|
}
|
package/lib/network.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"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AAa,cAAc,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,CAAC;gBAAtC,OAAO,EAAE,MAAM,EAAW,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,yBAAyB;CAGpF;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAa,YAAW,kBAAkB,EAAE,eAAe;IAM9F,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IALnC,QAAQ,CAAC,SAAS,mCAAmC;IACrD,QAAQ,CAAC,QAAQ,QAAQ;gBAGxB,OAAO,EAAE,MAAM,EACN,iBAAiB,EAAE,MAAM,EAClC,KAAK,EAAE,yBAAyB;CAIjC;AAED,eAAO,MAAM,gBAAgB,YAAa,MAAM,SAAS,yBAAyB,kDAChB,CAAC;AAEnE,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACvD,KAAK,EAAE,yBAAyB,GAC9B,eAAe,GAAG,mBAAmB,CAKvC;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,UAAW,GAAG,KAAG,OAAmC,CAAC;AAEjF,gDAAgD;AAChD,eAAO,MAAM,6BAA6B,UAAW,GAAG,KAAG,MAAM,GAAG,SACrB,CAAC;AAEhD,kEAAkE;AAClE,eAAO,MAAM,sBAAsB,UAAW,GAAG,KAAG,MAAM,GAAG,SACuB,CAAC"}
|
package/lib/network.js
CHANGED
|
@@ -14,7 +14,9 @@ export var OnlineStatus;
|
|
|
14
14
|
// No solution for node.js (other than resolve dns names / ping specific sites)
|
|
15
15
|
// Can also use window.addEventListener("online" / "offline")
|
|
16
16
|
export function isOnline() {
|
|
17
|
-
if (typeof navigator === "object" &&
|
|
17
|
+
if (typeof navigator === "object" &&
|
|
18
|
+
navigator !== null &&
|
|
19
|
+
typeof navigator.onLine === "boolean") {
|
|
18
20
|
return navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;
|
|
19
21
|
}
|
|
20
22
|
return OnlineStatus.Unknown;
|
|
@@ -112,6 +114,5 @@ export const canRetryOnError = (error) => (error === null || error === void 0 ?
|
|
|
112
114
|
/** Check retryAfterSeconds property on error */
|
|
113
115
|
export const getRetryDelaySecondsFromError = (error) => error === null || error === void 0 ? void 0 : error.retryAfterSeconds;
|
|
114
116
|
/** Check retryAfterSeconds property on error and convert to ms */
|
|
115
|
-
export const getRetryDelayFromError = (error) => (error === null || error === void 0 ? void 0 : error.retryAfterSeconds) !== undefined ?
|
|
116
|
-
error.retryAfterSeconds * 1000 : undefined;
|
|
117
|
+
export const getRetryDelayFromError = (error) => (error === null || error === void 0 ? void 0 : error.retryAfterSeconds) !== undefined ? error.retryAfterSeconds * 1000 : undefined;
|
|
117
118
|
//# sourceMappingURL=network.js.map
|
package/lib/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIH,eAAe,GAGlB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAmB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACX,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,mFAAmF;AACnF,+EAA+E;AAC/E,6DAA6D;AAC7D,MAAM,UAAU,QAAQ;IACpB,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE;QAC9F,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,C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AG,CAAC,OAAe,EAAE,KAAgC,EAAE,EAAE,CAClF,IAAI,iBAAiB,CAAC,OAAO,EAAE,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAEtE,MAAM,UAAU,yBAAyB,CACrC,OAAe,EACf,SAAwD,EACxD,KAAgC;IAEhC,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,EAAE;QAC5D,OAAO,IAAI,eAAe,CACtB,OAAO,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;KACtD;IACD,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAK,IAAI,CAAC;AAEjF,gDAAgD;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC5E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAuC,CAAC;AAEnD,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC;IAC9G,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IThrottlingWarning,\n IDriverErrorBase,\n IAuthorizationError,\n DriverErrorType,\n ILocationRedirectionError,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n Offline,\n Online,\n Unknown,\n}\n\n// It tells if we have local connection only - we might not have connection to web.\n// No solution for node.js (other than resolve dns names / ping specific sites)\n// Can also use window.addEventListener(\"online\" / \"offline\")\nexport function isOnline(): OnlineStatus {\n if (typeof navigator === \"object\" && navigator !== null && typeof navigator.onLine === \"boolean\") {\n return navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n }\n return OnlineStatus.Unknown;\n}\n\n/**\n * Interface describing errors and warnings raised by any driver code.\n * Not expected to be implemented by a class or an object literal, but rather used in place of\n * any or unknown in various function signatures that pass errors around.\n *\n * \"Any\" in the interface name is a nod to the fact that errorType has lost its type constraint.\n * It will be either DriverErrorType or the specific driver's specialized error type enum,\n * but we can't reference a specific driver's error type enum in this code.\n *\n * @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that\n * it can used from the base to upper layers.\n*/\nexport interface IAnyDriverError extends Omit<IDriverErrorBase, \"errorType\"> {\n readonly errorType: string;\n}\n\n/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & { driverVersion: string | undefined; };\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.genericNetworkError;\n\n constructor(\n message: string,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\n/**\n * FluidInvalidSchema error class.\n */\n export class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.fluidInvalidSchema;\n readonly canRetry = false;\n\n constructor(\n message: string,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;\n readonly errorType = DeltaStreamConnectionForbiddenError.errorType;\n readonly canRetry = false;\n\n constructor(message: string, props: DriverErrorTelemetryProps) {\n super(message, { ...props, statusCode: 400 });\n }\n}\n\nexport class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {\n readonly errorType = DriverErrorType.authorizationError;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly claims: string | undefined,\n readonly tenantId: string | undefined,\n props: DriverErrorTelemetryProps,\n ) {\n // don't log claims or tenantId\n super(message, props, new Set([\"claims\", \"tenantId\"]));\n }\n}\n\nexport class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {\n readonly errorType = DriverErrorType.locationRedirection;\n readonly canRetry = false;\n\n constructor(\n message: string,\n readonly redirectUrl: IResolvedUrl,\n props: DriverErrorTelemetryProps,\n ) {\n // do not log redirectURL\n super(message, props, new Set([\"redirectUrl\"]));\n }\n}\n\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n constructor(\n message: string,\n readonly errorType: T,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, false, props);\n }\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n message: string,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, errorType, true, props);\n }\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n readonly errorType = DriverErrorType.throttlingError;\n readonly canRetry = true;\n\n constructor(\n message: string,\n readonly retryAfterSeconds: number,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n new NonRetryableError(message, DriverErrorType.writeError, props);\n\nexport function createGenericNetworkError(\n message: string,\n retryInfo: { canRetry: boolean; retryAfterMs?: number; },\n props: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n if (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n return new ThrottlingError(\n message, retryInfo.retryAfterMs / 1000, props);\n }\n return new GenericNetworkError(message, retryInfo.canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/** Check retryAfterSeconds property on error */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n error?.retryAfterSeconds as number | undefined;\n\n/** Check retryAfterSeconds property on error and convert to ms */\nexport const getRetryDelayFromError = (error: any): number | undefined => error?.retryAfterSeconds !== undefined ?\n error.retryAfterSeconds * 1000 : undefined;\n"]}
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,eAAe,GAGf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAmB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACvB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACR,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,mFAAmF;AACnF,+EAA+E;AAC/E,6DAA6D;AAC7D,MAAM,UAAU,QAAQ;IACvB,IACC,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,EACpC;QACD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;KACrE;IACD,OAAO,YAAY,CAAC,OAAO,CAAC;AAC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CAAC,OAAO,EAAE,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAEnE,MAAM,UAAU,yBAAyB,CACxC,OAAe,EACf,SAAuD,EACvD,KAAgC;IAEhC,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,EAAE;QAC/D,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;KAC1E;IACD,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAK,IAAI,CAAC;AAEjF,gDAAgD;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC/E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAuC,CAAC;AAEhD,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CACxE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIThrottlingWarning,\n\tIDriverErrorBase,\n\tIAuthorizationError,\n\tDriverErrorType,\n\tILocationRedirectionError,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n\tOffline,\n\tOnline,\n\tUnknown,\n}\n\n// It tells if we have local connection only - we might not have connection to web.\n// No solution for node.js (other than resolve dns names / ping specific sites)\n// Can also use window.addEventListener(\"online\" / \"offline\")\nexport function isOnline(): OnlineStatus {\n\tif (\n\t\ttypeof navigator === \"object\" &&\n\t\tnavigator !== null &&\n\t\ttypeof navigator.onLine === \"boolean\"\n\t) {\n\t\treturn navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n\t}\n\treturn OnlineStatus.Unknown;\n}\n\n/**\n * Interface describing errors and warnings raised by any driver code.\n * Not expected to be implemented by a class or an object literal, but rather used in place of\n * any or unknown in various function signatures that pass errors around.\n *\n * \"Any\" in the interface name is a nod to the fact that errorType has lost its type constraint.\n * It will be either DriverErrorType or the specific driver's specialized error type enum,\n * but we can't reference a specific driver's error type enum in this code.\n *\n * @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that\n * it can used from the base to upper layers.\n */\nexport interface IAnyDriverError extends Omit<IDriverErrorBase, \"errorType\"> {\n\treadonly errorType: string;\n}\n\n/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & {\n\tdriverVersion: string | undefined;\n};\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n\treadonly errorType = DriverErrorType.genericNetworkError;\n\n\tconstructor(message: string, readonly canRetry: boolean, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * FluidInvalidSchema error class.\n */\nexport class FluidInvalidSchemaError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorType.fluidInvalidSchema;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\nexport class DeltaStreamConnectionForbiddenError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\tstatic readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;\n\treadonly errorType = DeltaStreamConnectionForbiddenError.errorType;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, { ...props, statusCode: 400 });\n\t}\n}\n\nexport class AuthorizationError\n\textends LoggingError\n\timplements IAuthorizationError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorType.authorizationError;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly claims: string | undefined,\n\t\treadonly tenantId: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// don't log claims or tenantId\n\t\tsuper(message, props, new Set([\"claims\", \"tenantId\"]));\n\t}\n}\n\nexport class LocationRedirectionError\n\textends LoggingError\n\timplements ILocationRedirectionError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorType.locationRedirection;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly redirectUrl: IResolvedUrl,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// do not log redirectURL\n\t\tsuper(message, props, new Set([\"redirectUrl\"]));\n\t}\n}\n\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\treadonly canRetry: boolean,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(message: string, readonly errorType: T, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, errorType, false, props);\n\t}\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(message: string, readonly errorType: T, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, errorType, true, props);\n\t}\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\treadonly errorType = DriverErrorType.throttlingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n\tnew NonRetryableError(message, DriverErrorType.writeError, props);\n\nexport function createGenericNetworkError(\n\tmessage: string,\n\tretryInfo: { canRetry: boolean; retryAfterMs?: number },\n\tprops: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n\tif (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n\t\treturn new ThrottlingError(message, retryInfo.retryAfterMs / 1000, props);\n\t}\n\treturn new GenericNetworkError(message, retryInfo.canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/** Check retryAfterSeconds property on error */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds as number | undefined;\n\n/** Check retryAfterSeconds property on error and convert to ms */\nexport const getRetryDelayFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG5F,wBAAgB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG5F,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,oBAAoB,EAC3B,KAAK,CAAC,EAAE,GAAG,QAmBX;AAED;;;;;;;;GAQG;AAEH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBrE"}
|
package/lib/networkUtils.js
CHANGED
|
@@ -7,9 +7,8 @@ export function logNetworkFailure(logger, event, error) {
|
|
|
7
7
|
var _a, _b;
|
|
8
8
|
const newEvent = Object.assign({}, event);
|
|
9
9
|
const errorOnlineProp = error.online;
|
|
10
|
-
newEvent.online =
|
|
11
|
-
? errorOnlineProp
|
|
12
|
-
: OnlineStatus[isOnline()];
|
|
10
|
+
newEvent.online =
|
|
11
|
+
typeof errorOnlineProp === "string" ? errorOnlineProp : OnlineStatus[isOnline()];
|
|
13
12
|
if (typeof navigator === "object" && navigator !== null) {
|
|
14
13
|
const nav = navigator;
|
|
15
14
|
const connection = (_b = (_a = nav.connection) !== null && _a !== void 0 ? _a : nav.mozConnection) !== null && _b !== void 0 ? _b : nav.webkitConnection;
|
package/lib/networkUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEpE,MAAM,UAAU,iBAAiB,
|
|
1
|
+
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEpE,MAAM,UAAU,iBAAiB,CAChC,MAAwB,EACxB,KAA2B,EAC3B,KAAW;;IAEX,MAAM,QAAQ,qBAAQ,KAAK,CAAE,CAAC;IAE9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AC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBAChD,CAAC,CAAC;gBACF,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;gBACnD,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;aACjD;SACD;QACD,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryErrorEvent, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { isOnline, OnlineStatus, canRetryOnError } from \"./network\";\n\nexport function logNetworkFailure(\n\tlogger: ITelemetryLogger,\n\tevent: ITelemetryErrorEvent,\n\terror?: any,\n) {\n\tconst newEvent = { ...event };\n\n\tconst errorOnlineProp = error.online;\n\tnewEvent.online =\n\t\ttypeof errorOnlineProp === \"string\" ? errorOnlineProp : OnlineStatus[isOnline()];\n\n\tif (typeof navigator === \"object\" && navigator !== null) {\n\t\tconst nav = navigator as any;\n\t\tconst connection = nav.connection ?? nav.mozConnection ?? nav.webkitConnection;\n\t\tif (connection !== null && typeof connection === \"object\") {\n\t\t\tnewEvent.connectionType = connection.type;\n\t\t}\n\t}\n\n\t// non-retryable errors are fatal and should be logged as errors\n\tnewEvent.category = canRetryOnError(error) ? \"generic\" : \"error\";\n\tlogger.sendTelemetryEvent(newEvent, error);\n}\n\n/**\n * Wait for browser to get to connected state.\n * If connected, waits minimum of minDelay anyway (between network retries)\n * If disconnected, polls every 30 seconds anyway, to make sure we are not getting stuck because of wrong signal\n * Note that browsers will have false positives (like having Hyper-V adapter on machine,\n * or machine connected to router that is not connected to internet)\n * But there should be no false negatives.\n * The only exception - Opera returns false when user enters \"Work Offline\" mode, regardless of actual connectivity.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async\nexport function waitForConnectedState(minDelay: number): Promise<void> {\n\t// Use this frequency to poll even when we are offline and able to setup online/offline listener\n\t// This is mostly safety net\n\tconst offlinePollFrequency = 30000;\n\n\treturn new Promise((resolve) => {\n\t\tlet listener: () => void = resolve;\n\t\tlet delay = minDelay;\n\t\tif (isOnline() === OnlineStatus.Offline) {\n\t\t\tif (window?.addEventListener !== undefined) {\n\t\t\t\tlistener = () => {\n\t\t\t\t\tresolve();\n\t\t\t\t\twindow.removeEventListener(\"online\", listener);\n\t\t\t\t};\n\t\t\t\twindow.addEventListener(\"online\", listener, false);\n\t\t\t\tdelay = Math.max(minDelay, offlinePollFrequency);\n\t\t\t}\n\t\t}\n\t\tsetTimeout(listener, delay);\n\t});\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 = "2.0.0-internal.3.0
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.3.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export const pkgName = "@fluidframework/driver-utils";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.3.0
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.3.2.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -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,sBAAsB,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 = \"2.0.0-internal.3.0
|
|
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,sBAAsB,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 = \"2.0.0-internal.3.2.0\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallelRequests.d.ts","sourceRoot":"","sources":["../src/parallelRequests.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAWhG;;;;;;;;;;;GAWG;AACH,qBAAa,gBAAgB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"parallelRequests.d.ts","sourceRoot":"","sources":["../src/parallelRequests.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE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C,CAAC,CAAC,CAQZ"}
|
package/lib/parallelRequests.js
CHANGED
|
@@ -36,10 +36,14 @@ export class ParallelRequests {
|
|
|
36
36
|
this.requests = 0;
|
|
37
37
|
this.latestRequested = from;
|
|
38
38
|
this.nextToDeliver = from;
|
|
39
|
-
this.knewTo =
|
|
39
|
+
this.knewTo = to !== undefined;
|
|
40
|
+
}
|
|
41
|
+
get working() {
|
|
42
|
+
return this.workingState === "working";
|
|
43
|
+
}
|
|
44
|
+
get canceled() {
|
|
45
|
+
return this.workingState === "canceled";
|
|
40
46
|
}
|
|
41
|
-
get working() { return this.workingState === "working"; }
|
|
42
|
-
get canceled() { return this.workingState === "canceled"; }
|
|
43
47
|
cancel() {
|
|
44
48
|
if (this.working) {
|
|
45
49
|
this.workingState = "canceled";
|
|
@@ -173,7 +177,7 @@ export class ParallelRequests {
|
|
|
173
177
|
if (this.working) {
|
|
174
178
|
const fromOrig = from;
|
|
175
179
|
const length = payload.length;
|
|
176
|
-
let fullChunk =
|
|
180
|
+
let fullChunk = requestedLength <= length; // we can possible get more than we asked.
|
|
177
181
|
if (length !== 0) {
|
|
178
182
|
// We can get more than we asked for!
|
|
179
183
|
// This can screw up logic in dispatch!
|
|
@@ -402,16 +406,20 @@ export function requestOps(get, concurrency, fromTotal, toTotal, payloadSize, lo
|
|
|
402
406
|
// waits (up to 10 seconds) and fetches (can take infinite amount of time).
|
|
403
407
|
// While every such case should be improved and take into account signal (and thus cancel immediately),
|
|
404
408
|
// it is beneficial to have catch-all
|
|
405
|
-
const listener = (event) => {
|
|
409
|
+
const listener = (event) => {
|
|
410
|
+
manager.cancel();
|
|
411
|
+
};
|
|
406
412
|
if (signal !== undefined) {
|
|
407
413
|
signal.addEventListener("abort", listener);
|
|
408
414
|
}
|
|
409
|
-
manager
|
|
415
|
+
manager
|
|
416
|
+
.run(concurrency)
|
|
410
417
|
.finally(() => {
|
|
411
418
|
if (signal !== undefined) {
|
|
412
419
|
signal.removeEventListener("abort", listener);
|
|
413
420
|
}
|
|
414
|
-
})
|
|
421
|
+
})
|
|
422
|
+
.then(() => {
|
|
415
423
|
const props = {
|
|
416
424
|
lastFetch,
|
|
417
425
|
length,
|
|
@@ -421,7 +429,7 @@ export function requestOps(get, concurrency, fromTotal, toTotal, payloadSize, lo
|
|
|
421
429
|
telemetryEvent.cancel(Object.assign(Object.assign({}, props), { error: "ops request cancelled by client" }));
|
|
422
430
|
}
|
|
423
431
|
else {
|
|
424
|
-
assert(toTotal === undefined || lastFetch !== undefined && lastFetch >= toTotal - 1, 0x270 /* "All requested ops fetched" */);
|
|
432
|
+
assert(toTotal === undefined || (lastFetch !== undefined && lastFetch >= toTotal - 1), 0x270 /* "All requested ops fetched" */);
|
|
425
433
|
telemetryEvent.end(props);
|
|
426
434
|
}
|
|
427
435
|
queue.pushDone();
|
|
@@ -437,7 +445,9 @@ export function requestOps(get, concurrency, fromTotal, toTotal, payloadSize, lo
|
|
|
437
445
|
return queue;
|
|
438
446
|
}
|
|
439
447
|
export const emptyMessageStream = {
|
|
440
|
-
read: async () => {
|
|
448
|
+
read: async () => {
|
|
449
|
+
return { done: true };
|
|
450
|
+
},
|
|
441
451
|
};
|
|
442
452
|
export function streamFromMessages(messagesArg) {
|
|
443
453
|
let messages = messagesArg;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parallelRequests.js","sourceRoot":"","sources":["../src/parallelRequests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,sFAAsF;AACtF,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MA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E,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QACxE,CAAC;KACJ,CAAC;AACN,CAAC;AAED,MAAM,UAAU,cAAc,CAAI,MAAkB,EAAE,OAA0C;IAC5F,OAAO;QACH,IAAI,EAAE,KAAK,IAAI,EAAE;YACb,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAClC,OAAO,CAAC,KAAK,CAAC,CAAC;YACf,OAAO,KAAK,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert, Deferred, performance } from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger, ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IDeltasFetchResult, IStream, IStreamResult } from \"@fluidframework/driver-definitions\";\nimport { getRetryDelayFromError, canRetryOnError, createGenericNetworkError } from \"./network\";\nimport { waitForConnectedState, logNetworkFailure } from \"./networkUtils\";\n// For now, this package is versioned and released in unison with the specific drivers\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\n\nconst MaxFetchDelayInMs = 10000;\nconst MissingFetchDelayInMs = 100;\n\ntype WorkingState = \"working\" | \"done\" | \"canceled\";\n\n/**\n * Helper class to organize parallel fetching of data\n * It can be used to concurrently do many requests, while consuming\n * data in the right order. Take a look at UT for examples.\n * @param concurrency - level of concurrency\n * @param from - starting point of fetching data (inclusive)\n * @param to - ending point of fetching data. exclusive, or undefined if unknown\n * @param payloadSize - batch size\n * @param logger - logger to use\n * @param requestCallback - callback to request batches\n * @returns - Queue that can be used to retrieve data\n */\nexport class ParallelRequests<T> {\n private latestRequested: number;\n private nextToDeliver: number;\n private readonly results: Map<number, T[]> = new Map();\n private workingState: WorkingState = \"working\";\n private requestsInFlight = 0;\n private readonly endEvent = new Deferred<void>();\n private requests = 0;\n private readonly knewTo: boolean;\n\n private get working() { return this.workingState === \"working\"; }\n public get canceled() { return this.workingState === \"canceled\"; }\n\n constructor(\n from: number,\n private to: number | undefined,\n private readonly payloadSize: number,\n private readonly logger: ITelemetryLogger,\n private readonly requestCallback: (\n request: number,\n from: number,\n to: number,\n strongTo: boolean,\n props: ITelemetryProperties) => Promise<{ partial: boolean; cancel: boolean; payload: T[]; }>,\n private readonly responseCallback: (payload: T[]) => void) {\n this.latestRequested = from;\n this.nextToDeliver = from;\n this.knewTo = (to !== undefined);\n }\n\n public cancel() {\n if (this.working) {\n this.workingState = \"canceled\";\n this.endEvent.resolve();\n }\n }\n\n public async run(concurrency: number) {\n assert(concurrency > 0, 0x102 /* \"invalid level of concurrency\" */);\n assert(this.working, 0x103 /* \"trying to parallel run while not working\" */);\n\n let c = concurrency;\n while (c > 0) {\n c--;\n this.addRequest();\n }\n this.dispatch();// will recalculate and trigger this.endEvent if needed\n return this.endEvent.promise;\n }\n\n private done() {\n // We should satisfy request fully.\n assert(this.to !== undefined, 0x104 /* \"undefined end point for parallel fetch\" */);\n assert(this.nextToDeliver >= this.to, 0x105 /* \"unexpected end point for parallel fetch\" */);\n if (this.working) {\n this.workingState = \"done\";\n this.endEvent.resolve();\n }\n }\n\n private fail(error) {\n if (this.working) {\n this.workingState = \"done\";\n this.endEvent.reject(error);\n }\n }\n\n private dispatch() {\n while (this.working) {\n const value = this.results.get(this.nextToDeliver);\n if (value === undefined) {\n break;\n }\n this.results.delete(this.nextToDeliver);\n assert(value.length <= this.payloadSize, 0x1d9 /* \"addRequestCore() should break into smaller chunks\" */);\n this.nextToDeliver += value.length;\n this.responseCallback(value);\n }\n\n // Account for cancellation - state might be not in consistent state on cancelling operation\n if (this.working) {\n if (this.requestsInFlight === 0) {\n // we should have dispatched everything, no matter whether we knew about the end or not.\n // see comment in addRequestCore() around throwing away chunk if it's above this.to\n assert(this.results.size === 0,\n 0x107 /* \"ending dispatch with remaining results to be sent\" */);\n this.done();\n } else if (this.to !== undefined && this.nextToDeliver >= this.to) {\n // Learned about the end and dispatched all the ops up to it.\n // Ignore all the in-flight requests above boundary - unblock caller sooner.\n assert(!this.knewTo, 0x108 /* \"ending results dispatch but knew in advance about more requests\" */);\n this.done();\n }\n }\n }\n\n private getNextChunk() {\n if (!this.working) {\n return undefined;\n }\n\n const from = this.latestRequested;\n if (this.to !== undefined) {\n if (this.to <= from) {\n return undefined;\n }\n }\n\n // this.latestRequested\n // inclusive on the right side! Exclusive on the left.\n this.latestRequested += this.payloadSize;\n\n if (this.to !== undefined) {\n this.latestRequested = Math.min(this.to, this.latestRequested);\n }\n\n assert(from < this.latestRequested, 0x109 /* \"unexpected next chunk position\" */);\n\n return { from, to: this.latestRequested };\n }\n\n private addRequest() {\n const chunk = this.getNextChunk();\n if (chunk === undefined) {\n return;\n }\n this.addRequestCore(chunk.from, chunk.to).catch(this.fail.bind(this));\n }\n\n private async addRequestCore(fromArg: number, toArg: number) {\n assert(this.working, 0x10a /* \"cannot add parallel request while not working\" */);\n\n let from = fromArg;\n let to = toArg;\n\n // to & from are exclusive\n this.requestsInFlight++;\n while (this.working) {\n const requestedLength = to - from;\n assert(requestedLength > 0, 0x10b /* \"invalid parallel request range\" */);\n\n // We should not be wasting time asking for something useless.\n if (this.to !== undefined) {\n assert(from < this.to, 0x10c /* \"invalid parallel request start point\" */);\n assert(to <= this.to, 0x10d /* \"invalid parallel request end point\" */);\n }\n\n this.requests++;\n\n const promise = this.requestCallback(this.requests, from, to, this.to !== undefined, {});\n\n // dispatch any prior received data\n this.dispatch();\n\n const { payload, cancel, partial } = await promise;\n\n if (cancel) {\n this.cancel();\n }\n\n if (this.to !== undefined && from >= this.to) {\n // while we were waiting for response, we learned on what is the boundary\n // We can get here (with actual result!) if situation changed while this request was in\n // flight, i.e. the end was extended over what we learn in some other request\n // While it's useful not to throw this result, this is very corner cases and makes logic\n // (including consistency checks) much harder to write correctly.\n // So for now, we are throwing this result out the window.\n assert(!this.knewTo, 0x10e /* \"should not throw result if we knew about boundary in advance\" */);\n // Learn how often it happens and if it's too wasteful to throw these chunks.\n // If it pops into our view a lot, we would need to reconsider how we approach it.\n // Note that this is not visible to user other than potentially not hitting 100% of\n // what we can in perf domain.\n if (payload.length !== 0) {\n this.logger.sendErrorEvent({\n eventName: \"ParallelRequests_GotExtra\",\n from,\n to,\n end: this.to,\n length: payload.length,\n });\n }\n\n break;\n }\n\n if (this.working) {\n const fromOrig = from;\n const length = payload.length;\n let fullChunk = (requestedLength <= length); // we can possible get more than we asked.\n\n if (length !== 0) {\n // We can get more than we asked for!\n // This can screw up logic in dispatch!\n // So push only batch size, and keep the rest for later - if conditions are favorable, we\n // will be able to use it. If not (parallel request overlapping these ops), it's easier to\n // discard them and wait for another (overlapping) request to come in later.\n if (requestedLength < length) {\n // This is error in a sense that it's not expected and likely points bug in other layer.\n // This layer copes with this situation just fine.\n this.logger.sendTelemetryEvent({\n eventName: \"ParallelRequests_Over\",\n from,\n to,\n length,\n });\n }\n const data = payload.splice(0, requestedLength);\n this.results.set(from, data);\n from += data.length;\n } else {\n // 1. empty (partial) chunks should not be returned by various caching / adapter layers -\n // they should fall back to next layer. This might be important invariant to hold to ensure\n // that we are less likely have bugs where such layer would keep returning empty partial\n // result on each call.\n // 2. Current invariant is that callback does retries until it gets something,\n // with the goal of failing if zero data is retrieved in given amount of time.\n // This is very specific property of storage / ops, so this logic is not here, but given only\n // one user of this class, we assert that to catch issues earlier.\n // These invariant can be relaxed if needed.\n assert(!partial, 0x10f /* \"empty/partial chunks should not be returned by caching\" */);\n assert(!this.knewTo,\n 0x110 /* \"callback should retry until valid fetch before it learns new boundary\" */);\n }\n\n if (!partial && !fullChunk) {\n if (!this.knewTo) {\n if (this.to === undefined || this.to > from) {\n // The END\n this.to = from;\n }\n break;\n }\n // We know that there are more items to be retrieved\n // Can we get partial chunk? Ideally storage indicates that's not a full chunk\n // Note that it's possible that not all ops hit storage yet.\n // We will come back to request more, and if we can't get any more ops soon, it's\n // catastrophic failure (see comment above on responsibility of callback to return something)\n // This layer will just keep trying until it gets full set.\n this.logger.sendPerformanceEvent({\n eventName: \"ParallelRequests_Partial\",\n from: fromOrig,\n to,\n length,\n });\n }\n\n if (to === this.latestRequested) {\n // we can go after full chunk at the end if we received partial chunk, or more than asked\n // Also if we got more than we asked to, we can actually use those ops!\n if (payload.length !== 0) {\n this.results.set(from, payload);\n from += payload.length;\n }\n\n this.latestRequested = from;\n fullChunk = true;\n }\n\n if (fullChunk) {\n const chunk = this.getNextChunk();\n if (chunk === undefined) { break; }\n from = chunk.from;\n to = chunk.to;\n }\n }\n }\n this.requestsInFlight--;\n this.dispatch();\n }\n}\n\n/**\n * Helper queue class to allow async push / pull\n * It's essentially a pipe allowing multiple writers, and single reader\n */\nexport class Queue<T> implements IStream<T> {\n private readonly queue: Promise<IStreamResult<T>>[] = [];\n private deferred: Deferred<IStreamResult<T>> | undefined;\n private done = false;\n\n public pushValue(value: T) {\n this.pushCore(Promise.resolve({ done: false, value }));\n }\n\n public pushError(error: any) {\n this.pushCore(Promise.reject(error));\n this.done = true;\n }\n\n public pushDone() {\n this.pushCore(Promise.resolve({ done: true }));\n this.done = true;\n }\n\n protected pushCore(value: Promise<IStreamResult<T>>) {\n assert(!this.done, 0x112 /* \"cannot push onto queue if done\" */);\n if (this.deferred) {\n assert(this.queue.length === 0, 0x113 /* \"deferred queue should be empty\" */);\n this.deferred.resolve(value);\n this.deferred = undefined;\n } else {\n this.queue.push(value);\n }\n }\n\n public async read(): Promise<IStreamResult<T>> {\n assert(this.deferred === undefined, 0x114 /* \"cannot pop if deferred\" */);\n const value = this.queue.shift();\n if (value !== undefined) {\n return value;\n }\n assert(!this.done, 0x115 /* \"queue should not be done during pop\" */);\n this.deferred = new Deferred<IStreamResult<T>>();\n return this.deferred.promise;\n }\n}\n\n/**\n * Retrieve single batch of ops\n * @param request - request index\n * @param from - inclusive boundary\n * @param to - exclusive boundary\n * @param telemetryEvent - telemetry event used to track consecutive batch of requests\n * @param strongTo - tells if ops in range from...to have to be there and have to be retrieved.\n * If false, returning less ops would mean we reached end of file.\n * @param logger - logger object to use to log progress & errors\n * @param signal - cancelation signal\n * @param scenarioName - reason for fetching ops\n * @returns - an object with resulting ops and cancellation / partial result flags\n */\nasync function getSingleOpBatch(\n get: (telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>,\n props: ITelemetryProperties,\n strongTo: boolean,\n logger: ITelemetryLogger,\n signal?: AbortSignal,\n scenarioName?: string):\n Promise<{ partial: boolean; cancel: boolean; payload: ISequencedDocumentMessage[]; }> {\n let lastSuccessTime: number | undefined;\n\n let retry: number = 0;\n const deltas: ISequencedDocumentMessage[] = [];\n const nothing = { partial: false, cancel: true, payload: [] };\n\n while (signal?.aborted !== true) {\n retry++;\n let delay = Math.min(MaxFetchDelayInMs, MissingFetchDelayInMs * Math.pow(2, retry));\n const startTime = performance.now();\n\n try {\n // Issue async request for deltas - limit the number fetched to MaxBatchDeltas\n const deltasP = get({ ...props, retry } /* telemetry props */);\n\n const { messages, partialResult } = await deltasP;\n deltas.push(...messages);\n\n const deltasRetrievedLast = messages.length;\n\n if (deltasRetrievedLast !== 0 || !strongTo) {\n return { payload: deltas, cancel: false, partial: partialResult };\n }\n\n // Storage does not have ops we need.\n // Attempt to fetch more deltas. If we didn't receive any in the previous call we up our retry\n // count since something prevented us from seeing those deltas\n\n if (lastSuccessTime === undefined) {\n lastSuccessTime = performance.now();\n } else if (performance.now() - lastSuccessTime > 30000) {\n // If we are connected and receiving proper responses from server, but can't get any ops back,\n // then give up after some time. This likely indicates the issue with ordering service not flushing\n // ops to storage quick enough, and possibly waiting for summaries, while summarizer can't get\n // current as it can't get ops.\n throw createGenericNetworkError(\n // pre-0.58 error message: failedToRetrieveOpsFromStorage:TooManyRetries\n \"Failed to retrieve ops from storage (Too Many Retries)\",\n { canRetry: false },\n {\n retry,\n driverVersion,\n ...props,\n },\n );\n }\n } catch (error) {\n const canRetry = canRetryOnError(error);\n\n lastSuccessTime = undefined;\n\n const retryAfter = getRetryDelayFromError(error);\n\n // This will log to error table only if the error is non-retryable\n logNetworkFailure(\n logger,\n {\n eventName: \"GetDeltas_Error\",\n ...props,\n retry,\n duration: performance.now() - startTime,\n retryAfter,\n reason: scenarioName,\n },\n error);\n\n if (!canRetry) {\n // It's game over scenario.\n throw error;\n }\n\n if (retryAfter !== undefined && retryAfter >= 0) {\n delay = retryAfter;\n }\n }\n\n await waitForConnectedState(delay);\n }\n\n return nothing;\n}\n\n/**\n * Request ops from storage\n * @param get - Getter callback to get individual batches\n * @param concurrency - Number of concurrent requests to make\n * @param fromTotal - starting sequence number to fetch (inclusive)\n * @param toTotal - max (exclusive) sequence number to fetch\n * @param payloadSize - Payload size\n * @param logger - Logger to log progress and errors\n * @param signal - Cancelation signal\n * @param scenarioName - Reason for fetching ops\n * @returns - Messages fetched\n */\nexport function requestOps(\n get: (from: number, to: number, telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>,\n concurrency: number,\n fromTotal: number,\n toTotal: number | undefined,\n payloadSize: number,\n logger: ITelemetryLogger,\n signal?: AbortSignal,\n scenarioName?: string,\n): IStream<ISequencedDocumentMessage[]> {\n let requests = 0;\n let lastFetch: number | undefined;\n let length = 0;\n const queue = new Queue<ISequencedDocumentMessage[]>();\n\n const propsTotal: ITelemetryProperties = {\n fromTotal,\n toTotal,\n };\n\n const telemetryEvent = PerformanceEvent.start(logger, {\n eventName: \"GetDeltas\",\n ...propsTotal,\n reason: scenarioName,\n });\n\n const manager = new ParallelRequests<ISequencedDocumentMessage>(\n fromTotal,\n toTotal,\n payloadSize,\n logger,\n async (request: number, from: number, to: number, strongTo: boolean, propsPerRequest: ITelemetryProperties) => {\n requests++;\n return getSingleOpBatch(\n async (propsAll) => get(from, to, propsAll),\n { request, from, to, ...propsTotal, ...propsPerRequest },\n strongTo,\n logger,\n signal,\n scenarioName,\n );\n },\n (deltas: ISequencedDocumentMessage[]) => {\n // Assert continuing and right start.\n if (lastFetch === undefined) {\n assert(deltas[0].sequenceNumber === fromTotal, 0x26d /* \"wrong start\" */);\n } else {\n assert(deltas[0].sequenceNumber === lastFetch + 1, 0x26e /* \"wrong start\" */);\n }\n lastFetch = deltas[deltas.length - 1].sequenceNumber;\n assert(lastFetch - deltas[0].sequenceNumber + 1 === deltas.length,\n 0x26f /* \"continuous and no duplicates\" */);\n length += deltas.length;\n queue.pushValue(deltas);\n });\n\n // Implement faster cancellation. getSingleOpBatch() checks signal, but only in between\n // waits (up to 10 seconds) and fetches (can take infinite amount of time).\n // While every such case should be improved and take into account signal (and thus cancel immediately),\n // it is beneficial to have catch-all\n const listener = (event: Event) => { manager.cancel(); };\n if (signal !== undefined) {\n signal.addEventListener(\"abort\", listener);\n }\n\n manager.run(concurrency)\n .finally(() => {\n if (signal !== undefined) {\n signal.removeEventListener(\"abort\", listener);\n }\n }).then(() => {\n const props = {\n lastFetch,\n length,\n requests,\n };\n if (manager.canceled) {\n telemetryEvent.cancel({ ...props, error: \"ops request cancelled by client\" });\n } else {\n assert(toTotal === undefined || lastFetch !== undefined && lastFetch >= toTotal - 1,\n 0x270 /* \"All requested ops fetched\" */);\n telemetryEvent.end(props);\n }\n queue.pushDone();\n })\n .catch((error) => {\n telemetryEvent.cancel({\n lastFetch,\n length,\n requests,\n }, error);\n queue.pushError(error);\n });\n\n return queue;\n}\n\nexport const emptyMessageStream: IStream<ISequencedDocumentMessage[]> = {\n read: async () => { return { done: true }; },\n};\n\nexport function streamFromMessages(messagesArg: Promise<ISequencedDocumentMessage[]>):\n IStream<ISequencedDocumentMessage[]> {\n let messages: Promise<ISequencedDocumentMessage[]> | undefined = messagesArg;\n return {\n read: async () => {\n if (messages === undefined) {\n return { done: true };\n }\n const value = await messages;\n messages = undefined;\n return value.length === 0 ? { done: true } : { done: false, value };\n },\n };\n}\n\nexport function streamObserver<T>(stream: IStream<T>, handler: (value: IStreamResult<T>) => void): IStream<T> {\n return {\n read: async () => {\n const value = await stream.read();\n handler(value);\n return value;\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"parallelRequests.js","sourceRoot":"","sources":["../src/parallelRequests.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,sFAAsF;AACtF,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAChC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAIlC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,gBAAgB;IAiB5B,YACC,IAAY,EACJ,EAAsB,EACb,WAAmB,EACnB,MAAwB,EACxB,eAMgD,EAChD,gBAAwC;QAVjD,OAAE,GAAF,EAAE,CAAoB;QACb,gBAAW,GAAX,WAAW,CAAQ;QACnB,WAAM,GAAN,MAAM,CAAkB;QACxB,oBAAe,GAAf,eAAe,CAMiC;QAChD,qBAAgB,GAAhB,gBAAgB,CAAwB;QA1BzC,YAAO,GAAqB,IAAI,GAAG,EAAE,CAAC;QAC/C,iBAAY,GAAiB,SAAS,CAAC;QACvC,qBAAgB,GAAG,CAAC,CAAC;QACZ,aAAQ,GAAG,IAAI,QAAQ,EAAQ,CAAC;QACzC,aAAQ,GAAG,CAAC,CAAC;QAwBpB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,EAAE,KAAK,SAAS,CAAC;IAChC,CAAC;IAxBD,IAAY,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AAE,IAAI,EAAE,CAAC;IACvB,CAAC;CACD,CAAC;AAEF,MAAM,UAAU,kBAAkB,CACjC,WAAiD;IAEjD,IAAI,QAAQ,GAAqD,WAAW,CAAC;IAC7E,OAAO;QACN,IAAI,EAAE,KAAK,IAAI,EAAE;YAChB,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC3B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;aACtB;YACD,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC;YAC7B,QAAQ,GAAG,SAAS,CAAC;YACrB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QACrE,CAAC;KACD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAC7B,MAAkB,EAClB,OAA0C;IAE1C,OAAO;QACN,IAAI,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAClC,OAAO,CAAC,KAAK,CAAC,CAAC;YACf,OAAO,KAAK,CAAC;QACd,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { assert, Deferred, performance } from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger, ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IDeltasFetchResult, IStream, IStreamResult } from \"@fluidframework/driver-definitions\";\nimport { getRetryDelayFromError, canRetryOnError, createGenericNetworkError } from \"./network\";\nimport { waitForConnectedState, logNetworkFailure } from \"./networkUtils\";\n// For now, this package is versioned and released in unison with the specific drivers\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\n\nconst MaxFetchDelayInMs = 10000;\nconst MissingFetchDelayInMs = 100;\n\ntype WorkingState = \"working\" | \"done\" | \"canceled\";\n\n/**\n * Helper class to organize parallel fetching of data\n * It can be used to concurrently do many requests, while consuming\n * data in the right order. Take a look at UT for examples.\n * @param concurrency - level of concurrency\n * @param from - starting point of fetching data (inclusive)\n * @param to - ending point of fetching data. exclusive, or undefined if unknown\n * @param payloadSize - batch size\n * @param logger - logger to use\n * @param requestCallback - callback to request batches\n * @returns - Queue that can be used to retrieve data\n */\nexport class ParallelRequests<T> {\n\tprivate latestRequested: number;\n\tprivate nextToDeliver: number;\n\tprivate readonly results: Map<number, T[]> = new Map();\n\tprivate workingState: WorkingState = \"working\";\n\tprivate requestsInFlight = 0;\n\tprivate readonly endEvent = new Deferred<void>();\n\tprivate requests = 0;\n\tprivate readonly knewTo: boolean;\n\n\tprivate get working() {\n\t\treturn this.workingState === \"working\";\n\t}\n\tpublic get canceled() {\n\t\treturn this.workingState === \"canceled\";\n\t}\n\n\tconstructor(\n\t\tfrom: number,\n\t\tprivate to: number | undefined,\n\t\tprivate readonly payloadSize: number,\n\t\tprivate readonly logger: ITelemetryLogger,\n\t\tprivate readonly requestCallback: (\n\t\t\trequest: number,\n\t\t\tfrom: number,\n\t\t\tto: number,\n\t\t\tstrongTo: boolean,\n\t\t\tprops: ITelemetryProperties,\n\t\t) => Promise<{ partial: boolean; cancel: boolean; payload: T[] }>,\n\t\tprivate readonly responseCallback: (payload: T[]) => void,\n\t) {\n\t\tthis.latestRequested = from;\n\t\tthis.nextToDeliver = from;\n\t\tthis.knewTo = to !== undefined;\n\t}\n\n\tpublic cancel() {\n\t\tif (this.working) {\n\t\t\tthis.workingState = \"canceled\";\n\t\t\tthis.endEvent.resolve();\n\t\t}\n\t}\n\n\tpublic async run(concurrency: number) {\n\t\tassert(concurrency > 0, 0x102 /* \"invalid level of concurrency\" */);\n\t\tassert(this.working, 0x103 /* \"trying to parallel run while not working\" */);\n\n\t\tlet c = concurrency;\n\t\twhile (c > 0) {\n\t\t\tc--;\n\t\t\tthis.addRequest();\n\t\t}\n\t\tthis.dispatch(); // will recalculate and trigger this.endEvent if needed\n\t\treturn this.endEvent.promise;\n\t}\n\n\tprivate done() {\n\t\t// We should satisfy request fully.\n\t\tassert(this.to !== undefined, 0x104 /* \"undefined end point for parallel fetch\" */);\n\t\tassert(\n\t\t\tthis.nextToDeliver >= this.to,\n\t\t\t0x105 /* \"unexpected end point for parallel fetch\" */,\n\t\t);\n\t\tif (this.working) {\n\t\t\tthis.workingState = \"done\";\n\t\t\tthis.endEvent.resolve();\n\t\t}\n\t}\n\n\tprivate fail(error) {\n\t\tif (this.working) {\n\t\t\tthis.workingState = \"done\";\n\t\t\tthis.endEvent.reject(error);\n\t\t}\n\t}\n\n\tprivate dispatch() {\n\t\twhile (this.working) {\n\t\t\tconst value = this.results.get(this.nextToDeliver);\n\t\t\tif (value === undefined) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis.results.delete(this.nextToDeliver);\n\t\t\tassert(\n\t\t\t\tvalue.length <= this.payloadSize,\n\t\t\t\t0x1d9 /* \"addRequestCore() should break into smaller chunks\" */,\n\t\t\t);\n\t\t\tthis.nextToDeliver += value.length;\n\t\t\tthis.responseCallback(value);\n\t\t}\n\n\t\t// Account for cancellation - state might be not in consistent state on cancelling operation\n\t\tif (this.working) {\n\t\t\tif (this.requestsInFlight === 0) {\n\t\t\t\t// we should have dispatched everything, no matter whether we knew about the end or not.\n\t\t\t\t// see comment in addRequestCore() around throwing away chunk if it's above this.to\n\t\t\t\tassert(\n\t\t\t\t\tthis.results.size === 0,\n\t\t\t\t\t0x107 /* \"ending dispatch with remaining results to be sent\" */,\n\t\t\t\t);\n\t\t\t\tthis.done();\n\t\t\t} else if (this.to !== undefined && this.nextToDeliver >= this.to) {\n\t\t\t\t// Learned about the end and dispatched all the ops up to it.\n\t\t\t\t// Ignore all the in-flight requests above boundary - unblock caller sooner.\n\t\t\t\tassert(\n\t\t\t\t\t!this.knewTo,\n\t\t\t\t\t0x108 /* \"ending results dispatch but knew in advance about more requests\" */,\n\t\t\t\t);\n\t\t\t\tthis.done();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getNextChunk() {\n\t\tif (!this.working) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst from = this.latestRequested;\n\t\tif (this.to !== undefined) {\n\t\t\tif (this.to <= from) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\t// this.latestRequested\n\t\t// inclusive on the right side! Exclusive on the left.\n\t\tthis.latestRequested += this.payloadSize;\n\n\t\tif (this.to !== undefined) {\n\t\t\tthis.latestRequested = Math.min(this.to, this.latestRequested);\n\t\t}\n\n\t\tassert(from < this.latestRequested, 0x109 /* \"unexpected next chunk position\" */);\n\n\t\treturn { from, to: this.latestRequested };\n\t}\n\n\tprivate addRequest() {\n\t\tconst chunk = this.getNextChunk();\n\t\tif (chunk === undefined) {\n\t\t\treturn;\n\t\t}\n\t\tthis.addRequestCore(chunk.from, chunk.to).catch(this.fail.bind(this));\n\t}\n\n\tprivate async addRequestCore(fromArg: number, toArg: number) {\n\t\tassert(this.working, 0x10a /* \"cannot add parallel request while not working\" */);\n\n\t\tlet from = fromArg;\n\t\tlet to = toArg;\n\n\t\t// to & from are exclusive\n\t\tthis.requestsInFlight++;\n\t\twhile (this.working) {\n\t\t\tconst requestedLength = to - from;\n\t\t\tassert(requestedLength > 0, 0x10b /* \"invalid parallel request range\" */);\n\n\t\t\t// We should not be wasting time asking for something useless.\n\t\t\tif (this.to !== undefined) {\n\t\t\t\tassert(from < this.to, 0x10c /* \"invalid parallel request start point\" */);\n\t\t\t\tassert(to <= this.to, 0x10d /* \"invalid parallel request end point\" */);\n\t\t\t}\n\n\t\t\tthis.requests++;\n\n\t\t\tconst promise = this.requestCallback(\n\t\t\t\tthis.requests,\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tthis.to !== undefined,\n\t\t\t\t{},\n\t\t\t);\n\n\t\t\t// dispatch any prior received data\n\t\t\tthis.dispatch();\n\n\t\t\tconst { payload, cancel, partial } = await promise;\n\n\t\t\tif (cancel) {\n\t\t\t\tthis.cancel();\n\t\t\t}\n\n\t\t\tif (this.to !== undefined && from >= this.to) {\n\t\t\t\t// while we were waiting for response, we learned on what is the boundary\n\t\t\t\t// We can get here (with actual result!) if situation changed while this request was in\n\t\t\t\t// flight, i.e. the end was extended over what we learn in some other request\n\t\t\t\t// While it's useful not to throw this result, this is very corner cases and makes logic\n\t\t\t\t// (including consistency checks) much harder to write correctly.\n\t\t\t\t// So for now, we are throwing this result out the window.\n\t\t\t\tassert(\n\t\t\t\t\t!this.knewTo,\n\t\t\t\t\t0x10e /* \"should not throw result if we knew about boundary in advance\" */,\n\t\t\t\t);\n\t\t\t\t// Learn how often it happens and if it's too wasteful to throw these chunks.\n\t\t\t\t// If it pops into our view a lot, we would need to reconsider how we approach it.\n\t\t\t\t// Note that this is not visible to user other than potentially not hitting 100% of\n\t\t\t\t// what we can in perf domain.\n\t\t\t\tif (payload.length !== 0) {\n\t\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\t\teventName: \"ParallelRequests_GotExtra\",\n\t\t\t\t\t\tfrom,\n\t\t\t\t\t\tto,\n\t\t\t\t\t\tend: this.to,\n\t\t\t\t\t\tlength: payload.length,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (this.working) {\n\t\t\t\tconst fromOrig = from;\n\t\t\t\tconst length = payload.length;\n\t\t\t\tlet fullChunk = requestedLength <= length; // we can possible get more than we asked.\n\n\t\t\t\tif (length !== 0) {\n\t\t\t\t\t// We can get more than we asked for!\n\t\t\t\t\t// This can screw up logic in dispatch!\n\t\t\t\t\t// So push only batch size, and keep the rest for later - if conditions are favorable, we\n\t\t\t\t\t// will be able to use it. If not (parallel request overlapping these ops), it's easier to\n\t\t\t\t\t// discard them and wait for another (overlapping) request to come in later.\n\t\t\t\t\tif (requestedLength < length) {\n\t\t\t\t\t\t// This is error in a sense that it's not expected and likely points bug in other layer.\n\t\t\t\t\t\t// This layer copes with this situation just fine.\n\t\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"ParallelRequests_Over\",\n\t\t\t\t\t\t\tfrom,\n\t\t\t\t\t\t\tto,\n\t\t\t\t\t\t\tlength,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tconst data = payload.splice(0, requestedLength);\n\t\t\t\t\tthis.results.set(from, data);\n\t\t\t\t\tfrom += data.length;\n\t\t\t\t} else {\n\t\t\t\t\t// 1. empty (partial) chunks should not be returned by various caching / adapter layers -\n\t\t\t\t\t// they should fall back to next layer. This might be important invariant to hold to ensure\n\t\t\t\t\t// that we are less likely have bugs where such layer would keep returning empty partial\n\t\t\t\t\t// result on each call.\n\t\t\t\t\t// 2. Current invariant is that callback does retries until it gets something,\n\t\t\t\t\t// with the goal of failing if zero data is retrieved in given amount of time.\n\t\t\t\t\t// This is very specific property of storage / ops, so this logic is not here, but given only\n\t\t\t\t\t// one user of this class, we assert that to catch issues earlier.\n\t\t\t\t\t// These invariant can be relaxed if needed.\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!partial,\n\t\t\t\t\t\t0x10f /* \"empty/partial chunks should not be returned by caching\" */,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!this.knewTo,\n\t\t\t\t\t\t0x110 /* \"callback should retry until valid fetch before it learns new boundary\" */,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (!partial && !fullChunk) {\n\t\t\t\t\tif (!this.knewTo) {\n\t\t\t\t\t\tif (this.to === undefined || this.to > from) {\n\t\t\t\t\t\t\t// The END\n\t\t\t\t\t\t\tthis.to = from;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// We know that there are more items to be retrieved\n\t\t\t\t\t// Can we get partial chunk? Ideally storage indicates that's not a full chunk\n\t\t\t\t\t// Note that it's possible that not all ops hit storage yet.\n\t\t\t\t\t// We will come back to request more, and if we can't get any more ops soon, it's\n\t\t\t\t\t// catastrophic failure (see comment above on responsibility of callback to return something)\n\t\t\t\t\t// This layer will just keep trying until it gets full set.\n\t\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\t\teventName: \"ParallelRequests_Partial\",\n\t\t\t\t\t\tfrom: fromOrig,\n\t\t\t\t\t\tto,\n\t\t\t\t\t\tlength,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (to === this.latestRequested) {\n\t\t\t\t\t// we can go after full chunk at the end if we received partial chunk, or more than asked\n\t\t\t\t\t// Also if we got more than we asked to, we can actually use those ops!\n\t\t\t\t\tif (payload.length !== 0) {\n\t\t\t\t\t\tthis.results.set(from, payload);\n\t\t\t\t\t\tfrom += payload.length;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.latestRequested = from;\n\t\t\t\t\tfullChunk = true;\n\t\t\t\t}\n\n\t\t\t\tif (fullChunk) {\n\t\t\t\t\tconst chunk = this.getNextChunk();\n\t\t\t\t\tif (chunk === undefined) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tfrom = chunk.from;\n\t\t\t\t\tto = chunk.to;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.requestsInFlight--;\n\t\tthis.dispatch();\n\t}\n}\n\n/**\n * Helper queue class to allow async push / pull\n * It's essentially a pipe allowing multiple writers, and single reader\n */\nexport class Queue<T> implements IStream<T> {\n\tprivate readonly queue: Promise<IStreamResult<T>>[] = [];\n\tprivate deferred: Deferred<IStreamResult<T>> | undefined;\n\tprivate done = false;\n\n\tpublic pushValue(value: T) {\n\t\tthis.pushCore(Promise.resolve({ done: false, value }));\n\t}\n\n\tpublic pushError(error: any) {\n\t\tthis.pushCore(Promise.reject(error));\n\t\tthis.done = true;\n\t}\n\n\tpublic pushDone() {\n\t\tthis.pushCore(Promise.resolve({ done: true }));\n\t\tthis.done = true;\n\t}\n\n\tprotected pushCore(value: Promise<IStreamResult<T>>) {\n\t\tassert(!this.done, 0x112 /* \"cannot push onto queue if done\" */);\n\t\tif (this.deferred) {\n\t\t\tassert(this.queue.length === 0, 0x113 /* \"deferred queue should be empty\" */);\n\t\t\tthis.deferred.resolve(value);\n\t\t\tthis.deferred = undefined;\n\t\t} else {\n\t\t\tthis.queue.push(value);\n\t\t}\n\t}\n\n\tpublic async read(): Promise<IStreamResult<T>> {\n\t\tassert(this.deferred === undefined, 0x114 /* \"cannot pop if deferred\" */);\n\t\tconst value = this.queue.shift();\n\t\tif (value !== undefined) {\n\t\t\treturn value;\n\t\t}\n\t\tassert(!this.done, 0x115 /* \"queue should not be done during pop\" */);\n\t\tthis.deferred = new Deferred<IStreamResult<T>>();\n\t\treturn this.deferred.promise;\n\t}\n}\n\n/**\n * Retrieve single batch of ops\n * @param request - request index\n * @param from - inclusive boundary\n * @param to - exclusive boundary\n * @param telemetryEvent - telemetry event used to track consecutive batch of requests\n * @param strongTo - tells if ops in range from...to have to be there and have to be retrieved.\n * If false, returning less ops would mean we reached end of file.\n * @param logger - logger object to use to log progress & errors\n * @param signal - cancelation signal\n * @param scenarioName - reason for fetching ops\n * @returns - an object with resulting ops and cancellation / partial result flags\n */\nasync function getSingleOpBatch(\n\tget: (telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>,\n\tprops: ITelemetryProperties,\n\tstrongTo: boolean,\n\tlogger: ITelemetryLogger,\n\tsignal?: AbortSignal,\n\tscenarioName?: string,\n): Promise<{ partial: boolean; cancel: boolean; payload: ISequencedDocumentMessage[] }> {\n\tlet lastSuccessTime: number | undefined;\n\n\tlet retry: number = 0;\n\tconst deltas: ISequencedDocumentMessage[] = [];\n\tconst nothing = { partial: false, cancel: true, payload: [] };\n\n\twhile (signal?.aborted !== true) {\n\t\tretry++;\n\t\tlet delay = Math.min(MaxFetchDelayInMs, MissingFetchDelayInMs * Math.pow(2, retry));\n\t\tconst startTime = performance.now();\n\n\t\ttry {\n\t\t\t// Issue async request for deltas - limit the number fetched to MaxBatchDeltas\n\t\t\tconst deltasP = get({ ...props, retry } /* telemetry props */);\n\n\t\t\tconst { messages, partialResult } = await deltasP;\n\t\t\tdeltas.push(...messages);\n\n\t\t\tconst deltasRetrievedLast = messages.length;\n\n\t\t\tif (deltasRetrievedLast !== 0 || !strongTo) {\n\t\t\t\treturn { payload: deltas, cancel: false, partial: partialResult };\n\t\t\t}\n\n\t\t\t// Storage does not have ops we need.\n\t\t\t// Attempt to fetch more deltas. If we didn't receive any in the previous call we up our retry\n\t\t\t// count since something prevented us from seeing those deltas\n\n\t\t\tif (lastSuccessTime === undefined) {\n\t\t\t\tlastSuccessTime = performance.now();\n\t\t\t} else if (performance.now() - lastSuccessTime > 30000) {\n\t\t\t\t// If we are connected and receiving proper responses from server, but can't get any ops back,\n\t\t\t\t// then give up after some time. This likely indicates the issue with ordering service not flushing\n\t\t\t\t// ops to storage quick enough, and possibly waiting for summaries, while summarizer can't get\n\t\t\t\t// current as it can't get ops.\n\t\t\t\tthrow createGenericNetworkError(\n\t\t\t\t\t// pre-0.58 error message: failedToRetrieveOpsFromStorage:TooManyRetries\n\t\t\t\t\t\"Failed to retrieve ops from storage (Too Many Retries)\",\n\t\t\t\t\t{ canRetry: false },\n\t\t\t\t\t{\n\t\t\t\t\t\tretry,\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t\t...props,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst canRetry = canRetryOnError(error);\n\n\t\t\tlastSuccessTime = undefined;\n\n\t\t\tconst retryAfter = getRetryDelayFromError(error);\n\n\t\t\t// This will log to error table only if the error is non-retryable\n\t\t\tlogNetworkFailure(\n\t\t\t\tlogger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"GetDeltas_Error\",\n\t\t\t\t\t...props,\n\t\t\t\t\tretry,\n\t\t\t\t\tduration: performance.now() - startTime,\n\t\t\t\t\tretryAfter,\n\t\t\t\t\treason: scenarioName,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\n\t\t\tif (!canRetry) {\n\t\t\t\t// It's game over scenario.\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (retryAfter !== undefined && retryAfter >= 0) {\n\t\t\t\tdelay = retryAfter;\n\t\t\t}\n\t\t}\n\n\t\tawait waitForConnectedState(delay);\n\t}\n\n\treturn nothing;\n}\n\n/**\n * Request ops from storage\n * @param get - Getter callback to get individual batches\n * @param concurrency - Number of concurrent requests to make\n * @param fromTotal - starting sequence number to fetch (inclusive)\n * @param toTotal - max (exclusive) sequence number to fetch\n * @param payloadSize - Payload size\n * @param logger - Logger to log progress and errors\n * @param signal - Cancelation signal\n * @param scenarioName - Reason for fetching ops\n * @returns - Messages fetched\n */\nexport function requestOps(\n\tget: (\n\t\tfrom: number,\n\t\tto: number,\n\t\ttelemetryProps: ITelemetryProperties,\n\t) => Promise<IDeltasFetchResult>,\n\tconcurrency: number,\n\tfromTotal: number,\n\ttoTotal: number | undefined,\n\tpayloadSize: number,\n\tlogger: ITelemetryLogger,\n\tsignal?: AbortSignal,\n\tscenarioName?: string,\n): IStream<ISequencedDocumentMessage[]> {\n\tlet requests = 0;\n\tlet lastFetch: number | undefined;\n\tlet length = 0;\n\tconst queue = new Queue<ISequencedDocumentMessage[]>();\n\n\tconst propsTotal: ITelemetryProperties = {\n\t\tfromTotal,\n\t\ttoTotal,\n\t};\n\n\tconst telemetryEvent = PerformanceEvent.start(logger, {\n\t\teventName: \"GetDeltas\",\n\t\t...propsTotal,\n\t\treason: scenarioName,\n\t});\n\n\tconst manager = new ParallelRequests<ISequencedDocumentMessage>(\n\t\tfromTotal,\n\t\ttoTotal,\n\t\tpayloadSize,\n\t\tlogger,\n\t\tasync (\n\t\t\trequest: number,\n\t\t\tfrom: number,\n\t\t\tto: number,\n\t\t\tstrongTo: boolean,\n\t\t\tpropsPerRequest: ITelemetryProperties,\n\t\t) => {\n\t\t\trequests++;\n\t\t\treturn getSingleOpBatch(\n\t\t\t\tasync (propsAll) => get(from, to, propsAll),\n\t\t\t\t{ request, from, to, ...propsTotal, ...propsPerRequest },\n\t\t\t\tstrongTo,\n\t\t\t\tlogger,\n\t\t\t\tsignal,\n\t\t\t\tscenarioName,\n\t\t\t);\n\t\t},\n\t\t(deltas: ISequencedDocumentMessage[]) => {\n\t\t\t// Assert continuing and right start.\n\t\t\tif (lastFetch === undefined) {\n\t\t\t\tassert(deltas[0].sequenceNumber === fromTotal, 0x26d /* \"wrong start\" */);\n\t\t\t} else {\n\t\t\t\tassert(deltas[0].sequenceNumber === lastFetch + 1, 0x26e /* \"wrong start\" */);\n\t\t\t}\n\t\t\tlastFetch = deltas[deltas.length - 1].sequenceNumber;\n\t\t\tassert(\n\t\t\t\tlastFetch - deltas[0].sequenceNumber + 1 === deltas.length,\n\t\t\t\t0x26f /* \"continuous and no duplicates\" */,\n\t\t\t);\n\t\t\tlength += deltas.length;\n\t\t\tqueue.pushValue(deltas);\n\t\t},\n\t);\n\n\t// Implement faster cancellation. getSingleOpBatch() checks signal, but only in between\n\t// waits (up to 10 seconds) and fetches (can take infinite amount of time).\n\t// While every such case should be improved and take into account signal (and thus cancel immediately),\n\t// it is beneficial to have catch-all\n\tconst listener = (event: Event) => {\n\t\tmanager.cancel();\n\t};\n\tif (signal !== undefined) {\n\t\tsignal.addEventListener(\"abort\", listener);\n\t}\n\n\tmanager\n\t\t.run(concurrency)\n\t\t.finally(() => {\n\t\t\tif (signal !== undefined) {\n\t\t\t\tsignal.removeEventListener(\"abort\", listener);\n\t\t\t}\n\t\t})\n\t\t.then(() => {\n\t\t\tconst props = {\n\t\t\t\tlastFetch,\n\t\t\t\tlength,\n\t\t\t\trequests,\n\t\t\t};\n\t\t\tif (manager.canceled) {\n\t\t\t\ttelemetryEvent.cancel({ ...props, error: \"ops request cancelled by client\" });\n\t\t\t} else {\n\t\t\t\tassert(\n\t\t\t\t\ttoTotal === undefined || (lastFetch !== undefined && lastFetch >= toTotal - 1),\n\t\t\t\t\t0x270 /* \"All requested ops fetched\" */,\n\t\t\t\t);\n\t\t\t\ttelemetryEvent.end(props);\n\t\t\t}\n\t\t\tqueue.pushDone();\n\t\t})\n\t\t.catch((error) => {\n\t\t\ttelemetryEvent.cancel(\n\t\t\t\t{\n\t\t\t\t\tlastFetch,\n\t\t\t\t\tlength,\n\t\t\t\t\trequests,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\tqueue.pushError(error);\n\t\t});\n\n\treturn queue;\n}\n\nexport const emptyMessageStream: IStream<ISequencedDocumentMessage[]> = {\n\tread: async () => {\n\t\treturn { done: true };\n\t},\n};\n\nexport function streamFromMessages(\n\tmessagesArg: Promise<ISequencedDocumentMessage[]>,\n): IStream<ISequencedDocumentMessage[]> {\n\tlet messages: Promise<ISequencedDocumentMessage[]> | undefined = messagesArg;\n\treturn {\n\t\tread: async () => {\n\t\t\tif (messages === undefined) {\n\t\t\t\treturn { done: true };\n\t\t\t}\n\t\t\tconst value = await messages;\n\t\t\tmessages = undefined;\n\t\t\treturn value.length === 0 ? { done: true } : { done: false, value };\n\t\t},\n\t};\n}\n\nexport function streamObserver<T>(\n\tstream: IStream<T>,\n\thandler: (value: IStreamResult<T>) => void,\n): IStream<T> {\n\treturn {\n\t\tread: async () => {\n\t\t\tconst value = await stream.read();\n\t\t\thandler(value);\n\t\t\treturn value;\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetchDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"prefetchDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG5E,qBAAa,8BAA+B,SAAQ,2BAA2B;IAE9E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+C;IAC7E,OAAO,CAAC,eAAe,CAAQ;IAE/B,IAAW,QAAQ;;;;kBAKlB;IAEY,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAclE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAGxD,YAAY;YAKL,UAAU;IAqBxB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,gBAAgB;CAmBxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetchDocumentStorageService.js","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"prefetchDocumentStorageService.js","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,OAAO,8BAA+B,SAAQ,2BAA2B;IAA/E;;QACC,qCAAqC;QACpB,kBAAa,GAAG,IAAI,GAAG,EAAoC,CAAC;QACrE,oBAAe,GAAG,IAAI,CAAC;IAiFhC,CAAC;IA/EA,IAAW,QAAQ;QAClB,MAAM,QAAQ,GAAG,IAAI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C,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC;SACtD;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { LoaderCachingPolicy } from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree, IVersion } from \"@fluidframework/protocol-definitions\";\nimport { DocumentStorageServiceProxy } from \"./documentStorageServiceProxy\";\nimport { canRetryOnError } from \"./network\";\n\nexport class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {\n\t// BlobId -> blob prefetchCache cache\n\tprivate readonly prefetchCache = new Map<string, Promise<ArrayBufferLike>>();\n\tprivate prefetchEnabled = true;\n\n\tpublic get policies() {\n\t\tconst policies = this.internalStorageService.policies;\n\t\tif (policies) {\n\t\t\treturn { ...policies, caching: LoaderCachingPolicy.NoCaching };\n\t\t}\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tconst p = this.internalStorageService.getSnapshotTree(version);\n\t\tif (this.prefetchEnabled) {\n\t\t\t// We don't care if the prefetch succeeds\n\t\t\tvoid p.then((tree: ISnapshotTree | null | undefined) => {\n\t\t\t\tif (tree === null || tree === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.prefetchTree(tree);\n\t\t\t});\n\t\t}\n\t\treturn p;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.cachedRead(blobId);\n\t}\n\tpublic stopPrefetch() {\n\t\tthis.prefetchEnabled = false;\n\t\tthis.prefetchCache.clear();\n\t}\n\n\tprivate async cachedRead(blobId: string): Promise<ArrayBufferLike> {\n\t\tif (this.prefetchEnabled) {\n\t\t\tconst prefetchedBlobP = this.prefetchCache.get(blobId);\n\t\t\tif (prefetchedBlobP !== undefined) {\n\t\t\t\treturn prefetchedBlobP;\n\t\t\t}\n\t\t\tconst prefetchedBlobPFromStorage = this.internalStorageService.readBlob(blobId);\n\t\t\tthis.prefetchCache.set(\n\t\t\t\tblobId,\n\t\t\t\tprefetchedBlobPFromStorage.catch((error) => {\n\t\t\t\t\tif (canRetryOnError(error)) {\n\t\t\t\t\t\tthis.prefetchCache.delete(blobId);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn prefetchedBlobPFromStorage;\n\t\t}\n\t\treturn this.internalStorageService.readBlob(blobId);\n\t}\n\n\tprivate prefetchTree(tree: ISnapshotTree) {\n\t\tconst secondary: string[] = [];\n\t\tthis.prefetchTreeCore(tree, secondary);\n\n\t\tfor (const blob of secondary) {\n\t\t\t// We don't care if the prefetch succeeds\n\t\t\tvoid this.cachedRead(blob);\n\t\t}\n\t}\n\n\tprivate prefetchTreeCore(tree: ISnapshotTree, secondary: string[]) {\n\t\tfor (const blobKey of Object.keys(tree.blobs)) {\n\t\t\tconst blob = tree.blobs[blobKey];\n\t\t\tif (blobKey.startsWith(\".\") || blobKey === \"header\" || blobKey.startsWith(\"quorum\")) {\n\t\t\t\tif (blob !== null) {\n\t\t\t\t\t// We don't care if the prefetch succeeds\n\t\t\t\t\tvoid this.cachedRead(blob);\n\t\t\t\t}\n\t\t\t} else if (!blobKey.startsWith(\"deltas\")) {\n\t\t\t\tif (blob !== null) {\n\t\t\t\t\tsecondary.push(blob);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const subTree of Object.keys(tree.trees)) {\n\t\t\tthis.prefetchTreeCore(tree.trees[subTree], secondary);\n\t\t}\n\t}\n}\n"]}
|
package/lib/rateLimiter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rateLimiter.d.ts","sourceRoot":"","sources":["../src/rateLimiter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,qBAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"rateLimiter.d.ts","sourceRoot":"","sources":["../src/rateLimiter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,qBAAa,WAAW;IAEX,OAAO,CAAC,WAAW;IAD/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;gBACxB,WAAW,EAAE,MAAM;IAIvC,IAAW,eAAe,IAAI,MAAM,CAEnC;IAID,SAAS,CAAC,QAAQ,CAAC,OAAO,aAMxB;cAEc,OAAO;IAWV,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;CAI/C"}
|