@fluidframework/driver-utils 1.2.3-83900 → 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
package/src/network.ts
CHANGED
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
IDriverErrorBase,
|
|
9
9
|
IAuthorizationError,
|
|
10
10
|
DriverErrorType,
|
|
11
|
+
ILocationRedirectionError,
|
|
12
|
+
IResolvedUrl,
|
|
11
13
|
} from "@fluidframework/driver-definitions";
|
|
12
14
|
import { ITelemetryProperties } from "@fluidframework/common-definitions";
|
|
13
15
|
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
@@ -91,6 +93,19 @@ export class AuthorizationError extends LoggingError implements IAuthorizationEr
|
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
export class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {
|
|
97
|
+
readonly errorType = DriverErrorType.locationRedirection;
|
|
98
|
+
readonly canRetry = false;
|
|
99
|
+
|
|
100
|
+
constructor(
|
|
101
|
+
message: string,
|
|
102
|
+
readonly redirectUrl: IResolvedUrl,
|
|
103
|
+
props: DriverErrorTelemetryProps,
|
|
104
|
+
) {
|
|
105
|
+
super(message, props);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
94
109
|
export class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
|
|
95
110
|
constructor(
|
|
96
111
|
message: string,
|
package/src/packageVersion.ts
CHANGED
package/src/parallelRequests.ts
CHANGED
|
@@ -23,7 +23,7 @@ type WorkingState = "working" | "done" | "canceled";
|
|
|
23
23
|
* data in the right order. Take a look at UT for examples.
|
|
24
24
|
* @param concurrency - level of concurrency
|
|
25
25
|
* @param from - starting point of fetching data (inclusive)
|
|
26
|
-
* @param to
|
|
26
|
+
* @param to - ending point of fetching data. exclusive, or undefined if unknown
|
|
27
27
|
* @param payloadSize - batch size
|
|
28
28
|
* @param logger - logger to use
|
|
29
29
|
* @param requestCallback - callback to request batches
|
|
@@ -354,6 +354,9 @@ export class Queue<T> implements IStream<T> {
|
|
|
354
354
|
* @param telemetryEvent - telemetry event used to track consecutive batch of requests
|
|
355
355
|
* @param strongTo - tells if ops in range from...to have to be there and have to be retrieved.
|
|
356
356
|
* If false, returning less ops would mean we reached end of file.
|
|
357
|
+
* @param logger - logger object to use to log progress & errors
|
|
358
|
+
* @param signal - cancelation signal
|
|
359
|
+
* @param scenarioName - reason for fetching ops
|
|
357
360
|
* @returns - an object with resulting ops and cancellation / partial result flags
|
|
358
361
|
*/
|
|
359
362
|
async function getSingleOpBatch(
|
|
@@ -362,7 +365,7 @@ async function getSingleOpBatch(
|
|
|
362
365
|
strongTo: boolean,
|
|
363
366
|
logger: ITelemetryLogger,
|
|
364
367
|
signal?: AbortSignal,
|
|
365
|
-
|
|
368
|
+
scenarioName?: string):
|
|
366
369
|
Promise<{ partial: boolean; cancel: boolean; payload: ISequencedDocumentMessage[]; }> {
|
|
367
370
|
let lastSuccessTime: number | undefined;
|
|
368
371
|
|
|
@@ -426,7 +429,7 @@ async function getSingleOpBatch(
|
|
|
426
429
|
retry,
|
|
427
430
|
duration: performance.now() - startTime,
|
|
428
431
|
retryAfter,
|
|
429
|
-
|
|
432
|
+
reason: scenarioName,
|
|
430
433
|
},
|
|
431
434
|
error);
|
|
432
435
|
|
|
@@ -446,6 +449,18 @@ async function getSingleOpBatch(
|
|
|
446
449
|
return nothing;
|
|
447
450
|
}
|
|
448
451
|
|
|
452
|
+
/**
|
|
453
|
+
* Request ops from storage
|
|
454
|
+
* @param get - Getter callback to get individual batches
|
|
455
|
+
* @param concurrency - Number of concurrent requests to make
|
|
456
|
+
* @param fromTotal - starting sequence number to fetch (inclusive)
|
|
457
|
+
* @param toTotal - max (exclusive) sequence number to fetch
|
|
458
|
+
* @param payloadSize - Payload size
|
|
459
|
+
* @param logger - Logger to log progress and errors
|
|
460
|
+
* @param signal - Cancelation signal
|
|
461
|
+
* @param scenarioName - Reason for fetching ops
|
|
462
|
+
* @returns - Messages fetched
|
|
463
|
+
*/
|
|
449
464
|
export function requestOps(
|
|
450
465
|
get: (from: number, to: number, telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>,
|
|
451
466
|
concurrency: number,
|
|
@@ -454,7 +469,7 @@ export function requestOps(
|
|
|
454
469
|
payloadSize: number,
|
|
455
470
|
logger: ITelemetryLogger,
|
|
456
471
|
signal?: AbortSignal,
|
|
457
|
-
|
|
472
|
+
scenarioName?: string,
|
|
458
473
|
): IStream<ISequencedDocumentMessage[]> {
|
|
459
474
|
let requests = 0;
|
|
460
475
|
let lastFetch: number | undefined;
|
|
@@ -469,7 +484,7 @@ export function requestOps(
|
|
|
469
484
|
const telemetryEvent = PerformanceEvent.start(logger, {
|
|
470
485
|
eventName: "GetDeltas",
|
|
471
486
|
...propsTotal,
|
|
472
|
-
|
|
487
|
+
reason: scenarioName,
|
|
473
488
|
});
|
|
474
489
|
|
|
475
490
|
const manager = new ParallelRequests<ISequencedDocumentMessage>(
|
|
@@ -485,7 +500,7 @@ export function requestOps(
|
|
|
485
500
|
strongTo,
|
|
486
501
|
logger,
|
|
487
502
|
signal,
|
|
488
|
-
|
|
503
|
+
scenarioName,
|
|
489
504
|
);
|
|
490
505
|
},
|
|
491
506
|
(deltas: ISequencedDocumentMessage[]) => {
|
package/src/readAndParse.ts
CHANGED
|
@@ -7,11 +7,16 @@ import { bufferToString } from "@fluidframework/common-utils";
|
|
|
7
7
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Read a blob from IDocumentStorageService and
|
|
10
|
+
* Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and
|
|
11
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}
|
|
12
|
+
* it into object of type `T`.
|
|
11
13
|
*
|
|
12
|
-
* @param storage -
|
|
13
|
-
* @param id -
|
|
14
|
-
*
|
|
14
|
+
* @param storage - The `DocumentStorageService` to read from.
|
|
15
|
+
* @param id - The ID of the blob to read and parse.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam T - Output type matching JSON format of inpyt blob data.
|
|
18
|
+
*
|
|
19
|
+
* @returns The object that we decoded and parsed via `JSON.parse`.
|
|
15
20
|
*/
|
|
16
21
|
export async function readAndParse<T>(storage: Pick<IDocumentStorageService, "readBlob">, id: string): Promise<T> {
|
|
17
22
|
const blob = await storage.readBlob(id);
|