@fluidframework/driver-utils 1.2.1 → 2.0.0-internal.1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/documentStorageServiceProxy.d.ts +2 -2
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js +2 -2
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/network.d.ts +7 -1
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +10 -1
- package/dist/network.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/parallelRequests.d.ts +14 -2
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +21 -7
- package/dist/parallelRequests.js.map +1 -1
- package/dist/readAndParse.d.ts +9 -4
- package/dist/readAndParse.d.ts.map +1 -1
- package/dist/readAndParse.js +9 -4
- package/dist/readAndParse.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +2 -2
- package/lib/documentStorageServiceProxy.d.ts.map +1 -1
- package/lib/documentStorageServiceProxy.js +2 -2
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/network.d.ts +7 -1
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +8 -0
- package/lib/network.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/parallelRequests.d.ts +14 -2
- package/lib/parallelRequests.d.ts.map +1 -1
- package/lib/parallelRequests.js +21 -7
- package/lib/parallelRequests.js.map +1 -1
- package/lib/readAndParse.d.ts +9 -4
- package/lib/readAndParse.d.ts.map +1 -1
- package/lib/readAndParse.js +9 -4
- package/lib/readAndParse.js.map +1 -1
- package/package.json +28 -14
- package/src/documentStorageServiceProxy.ts +8 -2
- package/src/network.ts +15 -0
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +21 -6
- package/src/readAndParse.ts +9 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceProxy.js","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"documentStorageServiceProxy.js","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,MAAM,OAAO,2BAA2B;IAepC,YAA+B,sBAA+C;QAA/C,2BAAsB,GAAtB,sBAAsB,CAAyB;IAAI,CAAC;IAZnF,IAAW,QAAQ,CAAC,QAAqD;QACrE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED,IAAW,QAAQ;;QACf,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAClE,CAAC;IAED,IAAW,aAAa;QACpB,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;IACrD,CAAC;IAIM,KAAK,CAAC,eAAe,CAAC,OAAkB,EAAE,YAAqB;QAClE,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9E,CAAC;IAEM,KAAK,CAAC,WAAW,CACpB,SAAwB,EACxB,KAAa,EACb,YAAqB,EACrB,WAAyB;QAEzB,OAAO,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IAChG,CAAC;IAEM,KAAK,CAAC,wBAAwB,CAAC,OAAqB,EAAE,OAAwB;QACjF,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAC/C,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QACzC,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAc;QAChC,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n FetchSource,\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n} from \"@fluidframework/protocol-definitions\";\n\nexport class DocumentStorageServiceProxy implements IDocumentStorageService {\n private _policies: IDocumentStorageServicePolicies | undefined;\n\n public set policies(policies: IDocumentStorageServicePolicies | undefined) {\n this._policies = policies;\n }\n\n public get policies() {\n return this._policies ?? this.internalStorageService.policies;\n }\n\n public get repositoryUrl(): string {\n return this.internalStorageService.repositoryUrl;\n }\n\n constructor(protected readonly internalStorageService: IDocumentStorageService) { }\n\n public async getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null> {\n return this.internalStorageService.getSnapshotTree(version, scenarioName);\n }\n\n public async getVersions(\n versionId: string | null,\n count: number,\n scenarioName?: string,\n fetchSource?: FetchSource,\n ): Promise<IVersion[]> {\n return this.internalStorageService.getVersions(versionId, count, scenarioName, fetchSource);\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n return this.internalStorageService.uploadSummaryWithContext(summary, context);\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n return this.internalStorageService.downloadSummary(handle);\n }\n\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.internalStorageService.createBlob(file);\n }\n\n public async readBlob(blobId: string): Promise<ArrayBufferLike> {\n return this.internalStorageService.readBlob(blobId);\n }\n}\n"]}
|
package/lib/network.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IThrottlingWarning, IDriverErrorBase, IAuthorizationError, DriverErrorType } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { IThrottlingWarning, IDriverErrorBase, IAuthorizationError, DriverErrorType, ILocationRedirectionError, IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
6
6
|
import { ITelemetryProperties } from "@fluidframework/common-definitions";
|
|
7
7
|
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
8
8
|
export declare enum OnlineStatus {
|
|
@@ -48,6 +48,12 @@ export declare class AuthorizationError extends LoggingError implements IAuthori
|
|
|
48
48
|
readonly canRetry = false;
|
|
49
49
|
constructor(message: string, claims: string | undefined, tenantId: string | undefined, props: DriverErrorTelemetryProps);
|
|
50
50
|
}
|
|
51
|
+
export declare class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {
|
|
52
|
+
readonly redirectUrl: IResolvedUrl;
|
|
53
|
+
readonly errorType = DriverErrorType.locationRedirection;
|
|
54
|
+
readonly canRetry = false;
|
|
55
|
+
constructor(message: string, redirectUrl: IResolvedUrl, props: DriverErrorTelemetryProps);
|
|
56
|
+
}
|
|
51
57
|
export declare class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
|
|
52
58
|
readonly errorType: T;
|
|
53
59
|
readonly canRetry: boolean;
|
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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AE,MAAM,EACN,SAAS,EAAE,CAAC,EACrB,KAAK,EAAE,yBAAyB;CAIvC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAa,YAAW,kBAAkB,EAAE,eAAe;IAMxF,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IALtC,QAAQ,CAAC,SAAS,mCAAmC;IACrD,QAAQ,CAAC,QAAQ,QAAQ;gBAGrB,OAAO,EAAE,MAAM,EACN,iBAAiB,EAAE,MAAM,EAClC,KAAK,EAAE,yBAAyB;CAIvC;AAED,eAAO,MAAM,gBAAgB,YAAa,MAAM,SAAS,yBAAyB,kDACb,CAAC;AAEtE,wBAAgB,yBAAyB,CACrC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAAE,EACxD,KAAK,EAAE,yBAAyB,GACjC,eAAe,GAAG,mBAAmB,CAMvC;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,UAAW,GAAG,KAAG,OAAmC,CAAC;AAEjF,gDAAgD;AAChD,eAAO,MAAM,6BAA6B,UAAW,GAAG,KAAG,MAAM,GAAG,SAClB,CAAC;AAEnD,kEAAkE;AAClE,eAAO,MAAM,sBAAsB,UAAW,GAAG,KAAG,MAAM,GAAG,SACf,CAAC"}
|
package/lib/network.js
CHANGED
|
@@ -54,6 +54,14 @@ export class AuthorizationError extends LoggingError {
|
|
|
54
54
|
this.canRetry = false;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
+
export class LocationRedirectionError extends LoggingError {
|
|
58
|
+
constructor(message, redirectUrl, props) {
|
|
59
|
+
super(message, props);
|
|
60
|
+
this.redirectUrl = redirectUrl;
|
|
61
|
+
this.errorType = DriverErrorType.locationRedirection;
|
|
62
|
+
this.canRetry = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
57
65
|
export class NetworkErrorBasic extends LoggingError {
|
|
58
66
|
constructor(message, errorType, canRetry, props) {
|
|
59
67
|
super(message, props);
|
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,GAClB,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,CAAC;KACxE;IACD,OAAO,YAAY,CAAC,OAAO,CAAC;AAChC,CAAC;AAkBD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAGjD,YACI,OAAe,EACN,QAAiB,EAC1B,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,aAAQ,GAAR,QAAQ,CAAS;QAJrB,cAAS,GAAG,eAAe,CAAC,mBAAmB,CAAC;IAQzD,CAAC;CACJ;AAED,oFAAoF;AACpF,yEAAyE;AACzE,qEAAqE;AACrE,uEAAuE;AACvE,SAAS;AACT,MAAM,iCAAiC,GAAG,gCAAgC,CAAC;AAC3E,MAAM,OAAO,mCAAoC,SAAQ,YAAY;IAMjE,YAAY,OAAe,EAAE,KAAgC;QACzD,KAAK,CAAC,OAAO,kCAAO,KAAK,KAAE,UAAU,EAAE,GAAG,I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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} 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 export 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// Todo GH #6214: Remove after next drive def bump. This is necessary as there is no\n// compatible way to augment an enum, as it can't be optional. So for now\n// we need to duplicate the value here. We likely need to rethink our\n// DriverErrorType strategy so that it supports extension with optional\n// value.\nconst deltaStreamConnectionForbiddenStr = \"deltaStreamConnectionForbidden\";\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {\n static readonly errorType: string =\n DriverErrorType[deltaStreamConnectionForbiddenStr] ?? deltaStreamConnectionForbiddenStr;\n readonly errorType: string = 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 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,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,CAAC;KACxE;IACD,OAAO,YAAY,CAAC,OAAO,CAAC;AAChC,CAAC;AAkBD;;GAEG;AACH,MAA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AI,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 export 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// Todo GH #6214: Remove after next drive def bump. This is necessary as there is no\n// compatible way to augment an enum, as it can't be optional. So for now\n// we need to duplicate the value here. We likely need to rethink our\n// DriverErrorType strategy so that it supports extension with optional\n// value.\nconst deltaStreamConnectionForbiddenStr = \"deltaStreamConnectionForbidden\";\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {\n static readonly errorType: string =\n DriverErrorType[deltaStreamConnectionForbiddenStr] ?? deltaStreamConnectionForbiddenStr;\n readonly errorType: string = 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 super(message, props);\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"]}
|
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 = "1.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.1.0.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,yBAAyB,CAAC"}
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,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.1.0.0\";\n"]}
|
|
@@ -7,7 +7,7 @@ import { IDeltasFetchResult, IStream, IStreamResult } from "@fluidframework/driv
|
|
|
7
7
|
* data in the right order. Take a look at UT for examples.
|
|
8
8
|
* @param concurrency - level of concurrency
|
|
9
9
|
* @param from - starting point of fetching data (inclusive)
|
|
10
|
-
* @param to
|
|
10
|
+
* @param to - ending point of fetching data. exclusive, or undefined if unknown
|
|
11
11
|
* @param payloadSize - batch size
|
|
12
12
|
* @param logger - logger to use
|
|
13
13
|
* @param requestCallback - callback to request batches
|
|
@@ -57,7 +57,19 @@ export declare class Queue<T> implements IStream<T> {
|
|
|
57
57
|
protected pushCore(value: Promise<IStreamResult<T>>): void;
|
|
58
58
|
read(): Promise<IStreamResult<T>>;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Request ops from storage
|
|
62
|
+
* @param get - Getter callback to get individual batches
|
|
63
|
+
* @param concurrency - Number of concurrent requests to make
|
|
64
|
+
* @param fromTotal - starting sequence number to fetch (inclusive)
|
|
65
|
+
* @param toTotal - max (exclusive) sequence number to fetch
|
|
66
|
+
* @param payloadSize - Payload size
|
|
67
|
+
* @param logger - Logger to log progress and errors
|
|
68
|
+
* @param signal - Cancelation signal
|
|
69
|
+
* @param scenarioName - Reason for fetching ops
|
|
70
|
+
* @returns - Messages fetched
|
|
71
|
+
*/
|
|
72
|
+
export declare function requestOps(get: (from: number, to: number, telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>, concurrency: number, fromTotal: number, toTotal: number | undefined, payloadSize: number, logger: ITelemetryLogger, signal?: AbortSignal, scenarioName?: string): IStream<ISequencedDocumentMessage[]>;
|
|
61
73
|
export declare const emptyMessageStream: IStream<ISequencedDocumentMessage[]>;
|
|
62
74
|
export declare function streamFromMessages(messagesArg: Promise<ISequencedDocumentMessage[]>): IStream<ISequencedDocumentMessage[]>;
|
|
63
75
|
export declare function streamObserver<T>(stream: IStream<T>, handler: (value: IStreamResult<T>) => void): IStream<T>;
|
|
@@ -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;IAevB,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAMhC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAvBrC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IACvD,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IAEjC,OAAO,KAAK,OAAO,GAA8C;IACjE,IAAW,QAAQ,YAA+C;gBAG9D,IAAI,EAAE,MAAM,EACJ,EAAE,EAAE,MAAM,GAAG,SA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AAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAQ5G"}
|
package/lib/parallelRequests.js
CHANGED
|
@@ -16,7 +16,7 @@ const MissingFetchDelayInMs = 100;
|
|
|
16
16
|
* data in the right order. Take a look at UT for examples.
|
|
17
17
|
* @param concurrency - level of concurrency
|
|
18
18
|
* @param from - starting point of fetching data (inclusive)
|
|
19
|
-
* @param to
|
|
19
|
+
* @param to - ending point of fetching data. exclusive, or undefined if unknown
|
|
20
20
|
* @param payloadSize - batch size
|
|
21
21
|
* @param logger - logger to use
|
|
22
22
|
* @param requestCallback - callback to request batches
|
|
@@ -302,9 +302,12 @@ export class Queue {
|
|
|
302
302
|
* @param telemetryEvent - telemetry event used to track consecutive batch of requests
|
|
303
303
|
* @param strongTo - tells if ops in range from...to have to be there and have to be retrieved.
|
|
304
304
|
* If false, returning less ops would mean we reached end of file.
|
|
305
|
+
* @param logger - logger object to use to log progress & errors
|
|
306
|
+
* @param signal - cancelation signal
|
|
307
|
+
* @param scenarioName - reason for fetching ops
|
|
305
308
|
* @returns - an object with resulting ops and cancellation / partial result flags
|
|
306
309
|
*/
|
|
307
|
-
async function getSingleOpBatch(get, props, strongTo, logger, signal,
|
|
310
|
+
async function getSingleOpBatch(get, props, strongTo, logger, signal, scenarioName) {
|
|
308
311
|
let lastSuccessTime;
|
|
309
312
|
let retry = 0;
|
|
310
313
|
const deltas = [];
|
|
@@ -344,8 +347,7 @@ async function getSingleOpBatch(get, props, strongTo, logger, signal, fetchReaso
|
|
|
344
347
|
lastSuccessTime = undefined;
|
|
345
348
|
const retryAfter = getRetryDelayFromError(error);
|
|
346
349
|
// This will log to error table only if the error is non-retryable
|
|
347
|
-
logNetworkFailure(logger, Object.assign(Object.assign({ eventName: "GetDeltas_Error" }, props), { retry, duration: performance.now() - startTime, retryAfter,
|
|
348
|
-
fetchReason }), error);
|
|
350
|
+
logNetworkFailure(logger, Object.assign(Object.assign({ eventName: "GetDeltas_Error" }, props), { retry, duration: performance.now() - startTime, retryAfter, reason: scenarioName }), error);
|
|
349
351
|
if (!canRetry) {
|
|
350
352
|
// It's game over scenario.
|
|
351
353
|
throw error;
|
|
@@ -358,7 +360,19 @@ async function getSingleOpBatch(get, props, strongTo, logger, signal, fetchReaso
|
|
|
358
360
|
}
|
|
359
361
|
return nothing;
|
|
360
362
|
}
|
|
361
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Request ops from storage
|
|
365
|
+
* @param get - Getter callback to get individual batches
|
|
366
|
+
* @param concurrency - Number of concurrent requests to make
|
|
367
|
+
* @param fromTotal - starting sequence number to fetch (inclusive)
|
|
368
|
+
* @param toTotal - max (exclusive) sequence number to fetch
|
|
369
|
+
* @param payloadSize - Payload size
|
|
370
|
+
* @param logger - Logger to log progress and errors
|
|
371
|
+
* @param signal - Cancelation signal
|
|
372
|
+
* @param scenarioName - Reason for fetching ops
|
|
373
|
+
* @returns - Messages fetched
|
|
374
|
+
*/
|
|
375
|
+
export function requestOps(get, concurrency, fromTotal, toTotal, payloadSize, logger, signal, scenarioName) {
|
|
362
376
|
let requests = 0;
|
|
363
377
|
let lastFetch;
|
|
364
378
|
let length = 0;
|
|
@@ -367,10 +381,10 @@ export function requestOps(get, concurrency, fromTotal, toTotal, payloadSize, lo
|
|
|
367
381
|
fromTotal,
|
|
368
382
|
toTotal,
|
|
369
383
|
};
|
|
370
|
-
const telemetryEvent = PerformanceEvent.start(logger, Object.assign(Object.assign({ eventName: "GetDeltas" }, propsTotal), {
|
|
384
|
+
const telemetryEvent = PerformanceEvent.start(logger, Object.assign(Object.assign({ eventName: "GetDeltas" }, propsTotal), { reason: scenarioName }));
|
|
371
385
|
const manager = new ParallelRequests(fromTotal, toTotal, payloadSize, logger, async (request, from, to, strongTo, propsPerRequest) => {
|
|
372
386
|
requests++;
|
|
373
|
-
return getSingleOpBatch(async (propsAll) => get(from, to, propsAll), Object.assign(Object.assign({ request, from, to }, propsTotal), propsPerRequest), strongTo, logger, signal,
|
|
387
|
+
return getSingleOpBatch(async (propsAll) => get(from, to, propsAll), Object.assign(Object.assign({ request, from, to }, propsTotal), propsPerRequest), strongTo, logger, signal, scenarioName);
|
|
374
388
|
}, (deltas) => {
|
|
375
389
|
// Assert continuing and right start.
|
|
376
390
|
if (lastFetch === undefined) {
|
|
@@ -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,MAAM,kBAAkB,CAAC;AAE/D,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAChC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAIlC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,gBAAgB;IAazB,YACI,IAAY,EACJ,EAAsB,EACb,WAAmB,EACnB,MAAwB,EACxB,eAKgF,EAChF,gBAAwC;QATjD,OAAE,GAAF,EAAE,CAAoB;QACb,gBAAW,GAAX,WAAW,CAAQ;QACnB,WAAM,GAAN,MAAM,CAAkB;QACxB,oBAAe,GAAf,eAAe,CAKiE;QAChF,qBAAgB,GAAhB,gBAAgB,CAAwB;QArB5C,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;QAkBjB,IAAI,CAAC,eAAe,GAAG,IAAI,C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P,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAyC;IACpE,IAAI,EAAE,KAAK,IAAI,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,WAAiD;IAEhF,IAAI,QAAQ,GAAqD,WAAW,CAAC;IAC7E,OAAO;QACH,IAAI,EAAE,KAAK,IAAI,EAAE;YACb,IAAI,QAAQ,KAAK,SAAS,EAAE;gBACxB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;aACzB;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;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 * @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 fetchReason?: 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 fetchReason,\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\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 fetchReason?: 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 fetchReason,\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 fetchReason,\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;IAazB,YACI,IAAY,EACJ,EAAsB,EACb,WAAmB,EACnB,MAAwB,EACxB,eAKgF,EAChF,gBAAwC;QATjD,OAAE,GAAF,EAAE,CAAoB;QACb,gBAAW,GAAX,WAAW,CAAQ;QACnB,WAAM,GAAN,MAAM,CAAkB;QACxB,oBAAe,GAAf,eAAe,CAKiE;QAChF,qBAAgB,GAAhB,gBAAgB,CAAwB;QArB5C,YAAO,GAAqB,IAAI,GAAG,EAAE,CAAC;QAC/C,iBAAY,GAAiB,SAAS,CAAC;QACvC,qBAAgB,GAAG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AAE,EAAE;QACb,cAAc,CAAC,MAAM,CAAC;YAClB,SAAS;YACT,MAAM;YACN,QAAQ;SACX,EAAE,KAAK,CAAC,CAAC;QACV,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEP,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAyC;IACpE,IAAI,EAAE,KAAK,IAAI,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,WAAiD;IAEhF,IAAI,QAAQ,GAAqD,WAAW,CAAC;IAC7E,OAAO;QACH,IAAI,EAAE,KAAK,IAAI,EAAE;YACb,IAAI,QAAQ,KAAK,SAAS,EAAE;gBACxB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;aACzB;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;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"]}
|
package/lib/readAndParse.d.ts
CHANGED
|
@@ -4,11 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
6
6
|
/**
|
|
7
|
-
* Read a blob from IDocumentStorageService and
|
|
7
|
+
* Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and
|
|
8
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}
|
|
9
|
+
* it into object of type `T`.
|
|
8
10
|
*
|
|
9
|
-
* @param storage -
|
|
10
|
-
* @param id -
|
|
11
|
-
*
|
|
11
|
+
* @param storage - The `DocumentStorageService` to read from.
|
|
12
|
+
* @param id - The ID of the blob to read and parse.
|
|
13
|
+
*
|
|
14
|
+
* @typeParam T - Output type matching JSON format of inpyt blob data.
|
|
15
|
+
*
|
|
16
|
+
* @returns The object that we decoded and parsed via `JSON.parse`.
|
|
12
17
|
*/
|
|
13
18
|
export declare function readAndParse<T>(storage: Pick<IDocumentStorageService, "readBlob">, id: string): Promise<T>;
|
|
14
19
|
//# sourceMappingURL=readAndParse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readAndParse.d.ts","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E
|
|
1
|
+
{"version":3,"file":"readAndParse.d.ts","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAIhH"}
|
package/lib/readAndParse.js
CHANGED
|
@@ -4,11 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { bufferToString } from "@fluidframework/common-utils";
|
|
6
6
|
/**
|
|
7
|
-
* Read a blob from IDocumentStorageService and
|
|
7
|
+
* Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and
|
|
8
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}
|
|
9
|
+
* it into object of type `T`.
|
|
8
10
|
*
|
|
9
|
-
* @param storage -
|
|
10
|
-
* @param id -
|
|
11
|
-
*
|
|
11
|
+
* @param storage - The `DocumentStorageService` to read from.
|
|
12
|
+
* @param id - The ID of the blob to read and parse.
|
|
13
|
+
*
|
|
14
|
+
* @typeParam T - Output type matching JSON format of inpyt blob data.
|
|
15
|
+
*
|
|
16
|
+
* @returns The object that we decoded and parsed via `JSON.parse`.
|
|
12
17
|
*/
|
|
13
18
|
export async function readAndParse(storage, id) {
|
|
14
19
|
const blob = await storage.readBlob(id);
|
package/lib/readAndParse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readAndParse.js","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D
|
|
1
|
+
{"version":3,"file":"readAndParse.js","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAI,OAAkD,EAAE,EAAU;IAChG,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;AACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluidframework/common-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\n\n/**\n * Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}\n * it into object of type `T`.\n *\n * @param storage - The `DocumentStorageService` to read from.\n * @param id - The ID of the blob to read and parse.\n *\n * @typeParam T - Output type matching JSON format of inpyt blob data.\n *\n * @returns The object that we decoded and parsed via `JSON.parse`.\n */\nexport async function readAndParse<T>(storage: Pick<IDocumentStorageService, \"readBlob\">, id: string): Promise<T> {\n const blob = await storage.readBlob(id);\n const decoded = bufferToString(blob, \"utf8\");\n return JSON.parse(decoded) as T;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.0-internal.1.0.0",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -61,23 +61,24 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
64
|
-
"@fluidframework/common-utils": "^0.
|
|
65
|
-
"@fluidframework/core-interfaces": "^1.
|
|
66
|
-
"@fluidframework/driver-definitions": "^1.
|
|
67
|
-
"@fluidframework/gitresources": "^0.
|
|
68
|
-
"@fluidframework/protocol-base": "^0.
|
|
69
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
70
|
-
"@fluidframework/telemetry-utils": "^1.
|
|
64
|
+
"@fluidframework/common-utils": "^1.0.0",
|
|
65
|
+
"@fluidframework/core-interfaces": "^2.0.0-internal.1.0.0",
|
|
66
|
+
"@fluidframework/driver-definitions": "^2.0.0-internal.1.0.0",
|
|
67
|
+
"@fluidframework/gitresources": "^0.1037.1000",
|
|
68
|
+
"@fluidframework/protocol-base": "^0.1037.1000",
|
|
69
|
+
"@fluidframework/protocol-definitions": "^1.0.0",
|
|
70
|
+
"@fluidframework/telemetry-utils": "^2.0.0-internal.1.0.0",
|
|
71
71
|
"axios": "^0.26.0",
|
|
72
|
+
"url": "^0.11.0",
|
|
72
73
|
"uuid": "^8.3.1"
|
|
73
74
|
},
|
|
74
75
|
"devDependencies": {
|
|
75
76
|
"@fluidframework/build-common": "^0.24.0",
|
|
76
|
-
"@fluidframework/build-tools": "^0.
|
|
77
|
-
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils
|
|
77
|
+
"@fluidframework/build-tools": "^0.3.1000",
|
|
78
|
+
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@^1.0.0",
|
|
78
79
|
"@fluidframework/eslint-config-fluid": "^0.28.2000",
|
|
79
|
-
"@fluidframework/mocha-test-setup": "^1.
|
|
80
|
-
"@fluidframework/runtime-utils": "^1.
|
|
80
|
+
"@fluidframework/mocha-test-setup": "^2.0.0-internal.1.0.0",
|
|
81
|
+
"@fluidframework/runtime-utils": "^2.0.0-internal.1.0.0",
|
|
81
82
|
"@microsoft/api-extractor": "^7.22.2",
|
|
82
83
|
"@rushstack/eslint-config": "^2.5.1",
|
|
83
84
|
"@types/mocha": "^9.1.1",
|
|
@@ -93,7 +94,20 @@
|
|
|
93
94
|
"typescript-formatter": "7.1.0"
|
|
94
95
|
},
|
|
95
96
|
"typeValidation": {
|
|
96
|
-
"version": "
|
|
97
|
-
"broken": {
|
|
97
|
+
"version": "2.0.0",
|
|
98
|
+
"broken": {
|
|
99
|
+
"RemovedFunctionDeclaration_convertSnapshotAndBlobsToSummaryTree": {
|
|
100
|
+
"forwardCompat": false,
|
|
101
|
+
"backCompat": false
|
|
102
|
+
},
|
|
103
|
+
"RemovedInterfaceDeclaration_ISummaryTreeAssemblerProps": {
|
|
104
|
+
"forwardCompat": false,
|
|
105
|
+
"backCompat": false
|
|
106
|
+
},
|
|
107
|
+
"RemovedClassDeclaration_SummaryTreeAssembler": {
|
|
108
|
+
"forwardCompat": false,
|
|
109
|
+
"backCompat": false
|
|
110
|
+
}
|
|
111
|
+
}
|
|
98
112
|
}
|
|
99
113
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
+
FetchSource,
|
|
7
8
|
IDocumentStorageService,
|
|
8
9
|
IDocumentStorageServicePolicies,
|
|
9
10
|
ISummaryContext,
|
|
@@ -37,8 +38,13 @@ export class DocumentStorageServiceProxy implements IDocumentStorageService {
|
|
|
37
38
|
return this.internalStorageService.getSnapshotTree(version, scenarioName);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
public async getVersions(
|
|
41
|
-
|
|
41
|
+
public async getVersions(
|
|
42
|
+
versionId: string | null,
|
|
43
|
+
count: number,
|
|
44
|
+
scenarioName?: string,
|
|
45
|
+
fetchSource?: FetchSource,
|
|
46
|
+
): Promise<IVersion[]> {
|
|
47
|
+
return this.internalStorageService.getVersions(versionId, count, scenarioName, fetchSource);
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {
|