@fluidframework/odsp-driver 2.0.0-internal.2.2.1 → 2.0.0-internal.2.3.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 +1 -1
- package/dist/WriteBufferUtils.d.ts.map +1 -1
- package/dist/WriteBufferUtils.js +0 -1
- package/dist/WriteBufferUtils.js.map +1 -1
- package/dist/contractsPublic.d.ts.map +1 -1
- package/dist/contractsPublic.js.map +1 -1
- package/dist/createFile.d.ts +2 -6
- package/dist/createFile.d.ts.map +1 -1
- package/dist/createFile.js +13 -125
- package/dist/createFile.js.map +1 -1
- package/dist/createNewUtils.d.ts +16 -0
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/createNewUtils.js +131 -1
- package/dist/createNewUtils.js.map +1 -1
- package/dist/fetchSnapshot.js +1 -1
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js +1 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts +75 -0
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -0
- package/dist/odspDelayLoadedDeltaStream.js +259 -0
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -0
- package/dist/odspDocumentDeltaConnection.d.ts +1 -3
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +6 -6
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.d.ts +10 -25
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js +71 -204
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactory.js +1 -2
- package/dist/odspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +1 -3
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +3 -3
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +4 -0
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js +5 -20
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +0 -2
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js +0 -2
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspSummaryUploadManager.d.ts.map +1 -1
- package/dist/odspSummaryUploadManager.js +0 -2
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUtils.d.ts +10 -1
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js +5 -1
- package/dist/odspUtils.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/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/dist/zipItDataRepresentationUtils.js +0 -1
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/WriteBufferUtils.d.ts.map +1 -1
- package/lib/WriteBufferUtils.js +0 -1
- package/lib/WriteBufferUtils.js.map +1 -1
- package/lib/contractsPublic.d.ts.map +1 -1
- package/lib/contractsPublic.js.map +1 -1
- package/lib/createFile.d.ts +2 -6
- package/lib/createFile.d.ts.map +1 -1
- package/lib/createFile.js +15 -126
- package/lib/createFile.js.map +1 -1
- package/lib/createNewUtils.d.ts +16 -0
- package/lib/createNewUtils.d.ts.map +1 -1
- package/lib/createNewUtils.js +129 -1
- package/lib/createNewUtils.js.map +1 -1
- package/lib/fetchSnapshot.js +1 -1
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js +1 -1
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.ts +75 -0
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -0
- package/lib/odspDelayLoadedDeltaStream.js +255 -0
- package/lib/odspDelayLoadedDeltaStream.js.map +1 -0
- package/lib/odspDocumentDeltaConnection.d.ts +1 -3
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/odspDocumentDeltaConnection.js +6 -6
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspDocumentService.d.ts +10 -25
- package/lib/odspDocumentService.d.ts.map +1 -1
- package/lib/odspDocumentService.js +56 -207
- package/lib/odspDocumentService.js.map +1 -1
- package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactory.js +1 -2
- package/lib/odspDocumentServiceFactory.js.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts +1 -3
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.js +3 -3
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts +4 -0
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.js +5 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js +0 -2
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.js +0 -2
- package/lib/odspDocumentStorageServiceBase.js.map +1 -1
- package/lib/odspSummaryUploadManager.d.ts.map +1 -1
- package/lib/odspSummaryUploadManager.js +0 -2
- package/lib/odspSummaryUploadManager.js.map +1 -1
- package/lib/odspUtils.d.ts +10 -1
- package/lib/odspUtils.d.ts.map +1 -1
- package/lib/odspUtils.js +3 -0
- package/lib/odspUtils.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/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/lib/zipItDataRepresentationUtils.js +0 -1
- package/lib/zipItDataRepresentationUtils.js.map +1 -1
- package/package.json +13 -12
- package/src/WriteBufferUtils.ts +0 -1
- package/src/contractsPublic.ts +0 -1
- package/src/createFile.ts +23 -168
- package/src/createNewUtils.ts +188 -2
- package/src/fetchSnapshot.ts +1 -1
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +0 -1
- package/src/odspDelayLoadedDeltaStream.ts +359 -0
- package/src/odspDocumentDeltaConnection.ts +4 -7
- package/src/odspDocumentService.ts +63 -283
- package/src/odspDocumentServiceFactory.ts +0 -2
- package/src/odspDocumentServiceFactoryCore.ts +1 -3
- package/src/odspDocumentServiceFactoryWithCodeSplit.ts +4 -1
- package/src/odspDocumentStorageManager.ts +0 -4
- package/src/odspDocumentStorageServiceBase.ts +0 -3
- package/src/odspSummaryUploadManager.ts +0 -4
- package/src/odspUtils.ts +16 -1
- package/src/packageVersion.ts +1 -1
- package/src/zipItDataRepresentationUtils.ts +0 -1
- package/dist/getSocketIo.d.ts +0 -11
- package/dist/getSocketIo.d.ts.map +0 -1
- package/dist/getSocketIo.js +0 -20
- package/dist/getSocketIo.js.map +0 -1
- package/lib/getSocketIo.d.ts +0 -11
- package/lib/getSocketIo.d.ts.map +0 -1
- package/lib/getSocketIo.js +0 -13
- package/lib/getSocketIo.js.map +0 -1
- package/src/getSocketIo.ts +0 -14
|
@@ -6,7 +6,6 @@ import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
|
6
6
|
import { IDocumentDeltaConnection, IDocumentDeltaStorageService, IDocumentService, IResolvedUrl, IDocumentStorageService, IDocumentServicePolicies } from "@fluidframework/driver-definitions";
|
|
7
7
|
import { IClient, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
8
|
import { IOdspResolvedUrl, TokenFetchOptions, HostStoragePolicy, InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions";
|
|
9
|
-
import type { io as SocketIOClientStatic } from "socket.io-client";
|
|
10
9
|
import { IOdspCache } from "./odspCache";
|
|
11
10
|
import { EpochTracker } from "./epochTracker";
|
|
12
11
|
import { OpsCache } from "./opsCaching";
|
|
@@ -18,13 +17,14 @@ export declare class OdspDocumentService implements IDocumentService {
|
|
|
18
17
|
readonly odspResolvedUrl: IOdspResolvedUrl;
|
|
19
18
|
private readonly getStorageToken;
|
|
20
19
|
private readonly getWebsocketToken;
|
|
21
|
-
private readonly socketIoClientFactory;
|
|
22
20
|
private readonly cache;
|
|
23
21
|
private readonly epochTracker;
|
|
24
22
|
private readonly socketReferenceKeyPrefix?;
|
|
25
23
|
private readonly clientIsSummarizer?;
|
|
26
|
-
private _policies;
|
|
27
|
-
private
|
|
24
|
+
private readonly _policies;
|
|
25
|
+
private socketModuleP;
|
|
26
|
+
private odspDelayLoadedDeltaStream;
|
|
27
|
+
private odspSocketModuleLoaded;
|
|
28
28
|
/**
|
|
29
29
|
* @param resolvedUrl - resolved url identifying document that will be managed by returned service instance.
|
|
30
30
|
* @param getStorageToken - function that can provide the storage token. This is is also referred to as
|
|
@@ -33,20 +33,16 @@ export declare class OdspDocumentService implements IDocumentService {
|
|
|
33
33
|
* to as the "Push" token in SPO. If undefined then websocket token is expected to be returned with joinSession
|
|
34
34
|
* response payload.
|
|
35
35
|
* @param logger - a logger that can capture performance and diagnostic information
|
|
36
|
-
* @param socketIoClientFactory - A factory that returns a promise to the socket io library required by the driver
|
|
37
36
|
* @param cache - This caches response for joinSession.
|
|
38
37
|
* @param hostPolicy - This host constructed policy which customizes service behavior.
|
|
39
38
|
* @param epochTracker - This helper class which adds epoch to backend calls made by returned service instance.
|
|
40
39
|
* @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache
|
|
41
40
|
*/
|
|
42
|
-
static create(resolvedUrl: IResolvedUrl, getStorageToken: InstrumentedStorageTokenFetcher, getWebsocketToken: ((options: TokenFetchOptions) => Promise<string | null>) | undefined, logger: ITelemetryLogger,
|
|
41
|
+
static create(resolvedUrl: IResolvedUrl, getStorageToken: InstrumentedStorageTokenFetcher, getWebsocketToken: ((options: TokenFetchOptions) => Promise<string | null>) | undefined, logger: ITelemetryLogger, cache: IOdspCache, hostPolicy: HostStoragePolicy, epochTracker: EpochTracker, socketReferenceKeyPrefix?: string, clientIsSummarizer?: boolean): Promise<IDocumentService>;
|
|
43
42
|
private storageManager?;
|
|
44
43
|
private readonly mc;
|
|
45
|
-
private readonly joinSessionKey;
|
|
46
44
|
private readonly hostPolicy;
|
|
47
45
|
private _opsCache?;
|
|
48
|
-
private currentConnection?;
|
|
49
|
-
private relayServiceTenantAndSessionId;
|
|
50
46
|
/**
|
|
51
47
|
* @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.
|
|
52
48
|
* @param getStorageToken - function that can provide the storage token. This is is also referred to as
|
|
@@ -76,30 +72,19 @@ export declare class OdspDocumentService implements IDocumentService {
|
|
|
76
72
|
* @returns returns the document delta storage service for sharepoint driver.
|
|
77
73
|
*/
|
|
78
74
|
connectToDeltaStorage(): Promise<IDocumentDeltaStorageService>;
|
|
79
|
-
/** Annotate the given error indicating which connection step failed */
|
|
80
|
-
private annotateConnectionError;
|
|
81
75
|
/**
|
|
82
76
|
* Connects to a delta stream endpoint for emitting ops.
|
|
83
77
|
*
|
|
84
78
|
* @returns returns the document delta stream service for onedrive/sharepoint driver.
|
|
85
79
|
*/
|
|
86
80
|
connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection>;
|
|
87
|
-
private clearJoinSessionTimer;
|
|
88
|
-
private scheduleJoinSessionRefresh;
|
|
89
|
-
private joinSession;
|
|
90
|
-
private joinSessionCore;
|
|
91
|
-
private calculateJoinSessionRefreshDelta;
|
|
92
81
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* @
|
|
97
|
-
* @param token - authorization token for delta service
|
|
98
|
-
* @param io - websocket library
|
|
99
|
-
* @param client - information about the client
|
|
100
|
-
* @param webSocketUrl - websocket URL
|
|
82
|
+
* This dynamically imports the module for loading the delta connection. In many cases the delta stream, is not
|
|
83
|
+
* required during the critical load flow. So this way we don't have to bundle this in the initial bundle and can
|
|
84
|
+
* import this later on when required.
|
|
85
|
+
* @returns - delta stream object.
|
|
101
86
|
*/
|
|
102
|
-
private
|
|
87
|
+
private getDelayLoadedDeltaStream;
|
|
103
88
|
dispose(error?: any): void;
|
|
104
89
|
protected get opsCache(): OpsCache | undefined;
|
|
105
90
|
protected opsReceived(ops: ISequencedDocumentMessage[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentService.d.ts","sourceRoot":"","sources":["../src/odspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"odspDocumentService.d.ts","sourceRoot":"","sources":["../src/odspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOtE,OAAO,EACH,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,wBAAwB,EAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,OAAO,EACP,yBAAyB,EAC5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EAEjB,iBAAiB,E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CAAW;IAE7B;;;;;;;;;;;;;OAaG;IACH,OAAO;IA+BP,IAAW,WAAW,IAAI,YAAY,CAErC;IACD,IAAW,QAAQ,6BAElB;IAED;;;;OAIG;IACU,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IA4BjE;;;;OAIG;IACU,qBAAqB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAmC3E;;;;OAIG;IACU,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAiBrF;;;;;OAKG;YACW,yBAAyB;IA0BhC,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG;IAe1B,SAAS,KAAK,QAAQ,yBA8BrB;IAID,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,yBAAyB,EAAE;CAQzD"}
|
|
@@ -2,21 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { assert
|
|
6
|
-
import { ChildLogger, loggerToMonitoringContext,
|
|
7
|
-
import { DriverErrorType, } from "@fluidframework/driver-definitions";
|
|
8
|
-
import { canRetryOnError, DeltaStreamConnectionForbiddenError, NonRetryableError } from "@fluidframework/driver-utils";
|
|
9
|
-
import { OdspErrorType, } from "@fluidframework/odsp-driver-definitions";
|
|
10
|
-
import { hasFacetCodes } from "@fluidframework/odsp-doclib-utils";
|
|
5
|
+
import { assert } from "@fluidframework/common-utils";
|
|
6
|
+
import { ChildLogger, loggerToMonitoringContext, } from "@fluidframework/telemetry-utils";
|
|
11
7
|
import { OdspDeltaStorageService, OdspDeltaStorageWithCache } from "./odspDeltaStorageService";
|
|
12
|
-
import { OdspDocumentDeltaConnection } from "./odspDocumentDeltaConnection";
|
|
13
8
|
import { OdspDocumentStorageService } from "./odspDocumentStorageManager";
|
|
14
|
-
import {
|
|
15
|
-
import { fetchJoinSession } from "./vroom";
|
|
9
|
+
import { getOdspResolvedUrl } from "./odspUtils";
|
|
16
10
|
import { isOdcOrigin } from "./odspUrlHelper";
|
|
17
11
|
import { OpsCache } from "./opsCaching";
|
|
18
12
|
import { RetryErrorsStorageAdapter } from "./retryErrorsStorageAdapter";
|
|
19
|
-
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
20
13
|
/**
|
|
21
14
|
* The DocumentService manages the Socket.IO connection and manages routing requests to connected
|
|
22
15
|
* clients
|
|
@@ -36,20 +29,19 @@ export class OdspDocumentService {
|
|
|
36
29
|
* @param epochTracker - This helper class which adds epoch to backend calls made by this service instance.
|
|
37
30
|
* @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache
|
|
38
31
|
*/
|
|
39
|
-
constructor(odspResolvedUrl, getStorageToken, getWebsocketToken, logger,
|
|
32
|
+
constructor(odspResolvedUrl, getStorageToken, getWebsocketToken, logger, cache, hostPolicy, epochTracker, socketReferenceKeyPrefix, clientIsSummarizer) {
|
|
40
33
|
this.odspResolvedUrl = odspResolvedUrl;
|
|
41
34
|
this.getStorageToken = getStorageToken;
|
|
42
35
|
this.getWebsocketToken = getWebsocketToken;
|
|
43
|
-
this.socketIoClientFactory = socketIoClientFactory;
|
|
44
36
|
this.cache = cache;
|
|
45
37
|
this.epochTracker = epochTracker;
|
|
46
38
|
this.socketReferenceKeyPrefix = socketReferenceKeyPrefix;
|
|
47
39
|
this.clientIsSummarizer = clientIsSummarizer;
|
|
40
|
+
this.odspSocketModuleLoaded = false;
|
|
48
41
|
this._policies = {
|
|
49
42
|
// load in storage-only mode if a file version is specified
|
|
50
43
|
storageOnly: odspResolvedUrl.fileVersion !== undefined,
|
|
51
44
|
};
|
|
52
|
-
this.joinSessionKey = `${this.odspResolvedUrl.hashedDocumentId}/joinsession`;
|
|
53
45
|
this.mc = loggerToMonitoringContext(ChildLogger.create(logger, undefined, {
|
|
54
46
|
all: {
|
|
55
47
|
odc: isOdcOrigin(new URL(this.odspResolvedUrl.endpoints.snapshotStorageUrl).origin),
|
|
@@ -68,14 +60,13 @@ export class OdspDocumentService {
|
|
|
68
60
|
* to as the "Push" token in SPO. If undefined then websocket token is expected to be returned with joinSession
|
|
69
61
|
* response payload.
|
|
70
62
|
* @param logger - a logger that can capture performance and diagnostic information
|
|
71
|
-
* @param socketIoClientFactory - A factory that returns a promise to the socket io library required by the driver
|
|
72
63
|
* @param cache - This caches response for joinSession.
|
|
73
64
|
* @param hostPolicy - This host constructed policy which customizes service behavior.
|
|
74
65
|
* @param epochTracker - This helper class which adds epoch to backend calls made by returned service instance.
|
|
75
66
|
* @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache
|
|
76
67
|
*/
|
|
77
|
-
static async create(resolvedUrl, getStorageToken, getWebsocketToken, logger,
|
|
78
|
-
return new OdspDocumentService(getOdspResolvedUrl(resolvedUrl), getStorageToken, getWebsocketToken, logger,
|
|
68
|
+
static async create(resolvedUrl, getStorageToken, getWebsocketToken, logger, cache, hostPolicy, epochTracker, socketReferenceKeyPrefix, clientIsSummarizer) {
|
|
69
|
+
return new OdspDocumentService(getOdspResolvedUrl(resolvedUrl), getStorageToken, getWebsocketToken, logger, cache, hostPolicy, epochTracker, socketReferenceKeyPrefix, clientIsSummarizer);
|
|
79
70
|
}
|
|
80
71
|
get resolvedUrl() {
|
|
81
72
|
return this.odspResolvedUrl;
|
|
@@ -93,12 +84,15 @@ export class OdspDocumentService {
|
|
|
93
84
|
this.storageManager = new OdspDocumentStorageService(this.odspResolvedUrl, this.getStorageToken, this.mc.logger, true, this.cache, this.hostPolicy, this.epochTracker,
|
|
94
85
|
// flushCallback
|
|
95
86
|
async () => {
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
var _a;
|
|
88
|
+
const currentConnection = (_a = this.odspDelayLoadedDeltaStream) === null || _a === void 0 ? void 0 : _a.currentDeltaConnection;
|
|
89
|
+
if (currentConnection !== undefined && !currentConnection.disposed) {
|
|
90
|
+
return currentConnection.flush();
|
|
98
91
|
}
|
|
99
92
|
throw new Error("Disconnected while uploading summary (attempt to perform flush())");
|
|
100
93
|
}, () => {
|
|
101
|
-
|
|
94
|
+
var _a;
|
|
95
|
+
return (_a = this.odspDelayLoadedDeltaStream) === null || _a === void 0 ? void 0 : _a.relayServiceTenantAndSessionId;
|
|
102
96
|
}, this.mc.config.getNumber("Fluid.Driver.Odsp.snapshotFormatFetchType"));
|
|
103
97
|
}
|
|
104
98
|
return new RetryErrorsStorageAdapter(this.storageManager, this.mc.logger);
|
|
@@ -115,208 +109,64 @@ export class OdspDocumentService {
|
|
|
115
109
|
// batch size, please see issue #5211 for data around batch sizing
|
|
116
110
|
const batchSize = (_c = this.hostPolicy.opsBatchSize) !== null && _c !== void 0 ? _c : 5000;
|
|
117
111
|
const concurrency = (_d = this.hostPolicy.concurrentOpsBatches) !== null && _d !== void 0 ? _d : 1;
|
|
118
|
-
return new OdspDeltaStorageWithCache(snapshotOps, this.mc.logger, batchSize, concurrency,
|
|
112
|
+
return new OdspDeltaStorageWithCache(snapshotOps, this.mc.logger, batchSize, concurrency,
|
|
113
|
+
// Get Ops from storage callback.
|
|
114
|
+
async (from, to, telemetryProps, fetchReason) => service.get(from, to, telemetryProps, fetchReason),
|
|
115
|
+
// Get cachedOps Callback.
|
|
116
|
+
async (from, to) => {
|
|
119
117
|
var _a, _b;
|
|
120
118
|
const res = await ((_a = this.opsCache) === null || _a === void 0 ? void 0 : _a.get(from, to));
|
|
121
119
|
return (_b = res) !== null && _b !== void 0 ? _b : [];
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
},
|
|
121
|
+
// Ops requestFromSocket Callback.
|
|
122
|
+
(from, to) => {
|
|
123
|
+
var _a;
|
|
124
|
+
const currentConnection = (_a = this.odspDelayLoadedDeltaStream) === null || _a === void 0 ? void 0 : _a.currentDeltaConnection;
|
|
125
|
+
if (currentConnection !== undefined && !currentConnection.disposed) {
|
|
126
|
+
currentConnection.requestOps(from, to);
|
|
125
127
|
}
|
|
126
128
|
}, (ops) => this.opsReceived(ops));
|
|
127
129
|
}
|
|
128
|
-
/** Annotate the given error indicating which connection step failed */
|
|
129
|
-
annotateConnectionError(error, failedConnectionStep, separateTokenRequest) {
|
|
130
|
-
return normalizeError(error, { props: {
|
|
131
|
-
failedConnectionStep,
|
|
132
|
-
separateTokenRequest,
|
|
133
|
-
} });
|
|
134
|
-
}
|
|
135
130
|
/**
|
|
136
131
|
* Connects to a delta stream endpoint for emitting ops.
|
|
137
132
|
*
|
|
138
133
|
* @returns returns the document delta stream service for onedrive/sharepoint driver.
|
|
139
134
|
*/
|
|
140
135
|
async connectToDeltaStream(client) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return getWithRetryForTokenRefresh(async (options) => {
|
|
144
|
-
var _a;
|
|
145
|
-
// Presence of getWebsocketToken callback dictates whether callback is used for fetching
|
|
146
|
-
// websocket token or whether it is returned with joinSession response payload
|
|
147
|
-
const requestWebsocketTokenFromJoinSession = this.getWebsocketToken === undefined;
|
|
148
|
-
const websocketTokenPromise = requestWebsocketTokenFromJoinSession
|
|
149
|
-
? Promise.resolve(null)
|
|
150
|
-
: this.getWebsocketToken(options);
|
|
151
|
-
const annotateAndRethrowConnectionError = (step) => (error) => {
|
|
152
|
-
throw this.annotateConnectionError(error, step, !requestWebsocketTokenFromJoinSession);
|
|
153
|
-
};
|
|
154
|
-
const joinSessionPromise = this.joinSession(requestWebsocketTokenFromJoinSession, options);
|
|
155
|
-
const [websocketEndpoint, websocketToken, io] = await Promise.all([
|
|
156
|
-
joinSessionPromise.catch(annotateAndRethrowConnectionError("joinSession")),
|
|
157
|
-
websocketTokenPromise.catch(annotateAndRethrowConnectionError("getWebsocketToken")),
|
|
158
|
-
this.socketIoClientFactory().catch(annotateAndRethrowConnectionError("socketIoClientFactory")),
|
|
159
|
-
]);
|
|
160
|
-
const finalWebsocketToken = websocketToken !== null && websocketToken !== void 0 ? websocketToken : ((_a = websocketEndpoint.socketToken) !== null && _a !== void 0 ? _a : null);
|
|
161
|
-
if (finalWebsocketToken === null) {
|
|
162
|
-
throw this.annotateConnectionError(new NonRetryableError("Websocket token is null", OdspErrorType.fetchTokenError, { driverVersion }), "getWebsocketToken", !requestWebsocketTokenFromJoinSession);
|
|
163
|
-
}
|
|
164
|
-
try {
|
|
165
|
-
const connection = await this.createDeltaConnection(websocketEndpoint.tenantId, websocketEndpoint.id, finalWebsocketToken, io, client, websocketEndpoint.deltaStreamSocketUrl);
|
|
166
|
-
connection.on("op", (documentId, ops) => {
|
|
167
|
-
this.opsReceived(ops);
|
|
168
|
-
});
|
|
169
|
-
// On disconnect with 401/403 error code, we can just clear the joinSession cache as we will again
|
|
170
|
-
// get the auth error on reconnecting and face latency.
|
|
171
|
-
connection.once("disconnect", (error) => {
|
|
172
|
-
// Clear the join session refresh timer so that it can be restarted on reconnection.
|
|
173
|
-
this.clearJoinSessionTimer();
|
|
174
|
-
if (typeof error === "object" && error !== null
|
|
175
|
-
&& error.errorType === DriverErrorType.authorizationError) {
|
|
176
|
-
this.cache.sessionJoinCache.remove(this.joinSessionKey);
|
|
177
|
-
}
|
|
178
|
-
// If we hit this assert, it means that "disconnect" event is emitted before the connection went through
|
|
179
|
-
// dispose flow which is not correct and could lead to a bunch of erros.
|
|
180
|
-
assert(connection.disposed, 0x4ae /* Connection should be disposed by now */);
|
|
181
|
-
this.currentConnection = undefined;
|
|
182
|
-
});
|
|
183
|
-
this.currentConnection = connection;
|
|
184
|
-
return connection;
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
this.cache.sessionJoinCache.remove(this.joinSessionKey);
|
|
188
|
-
const normalizedError = this.annotateConnectionError(error, "createDeltaConnection", !requestWebsocketTokenFromJoinSession);
|
|
189
|
-
if (typeof error === "object" && error !== null) {
|
|
190
|
-
normalizedError.addTelemetryProperties({ socketDocumentId: websocketEndpoint.id });
|
|
191
|
-
}
|
|
192
|
-
throw normalizedError;
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
clearJoinSessionTimer() {
|
|
197
|
-
if (this.joinSessionRefreshTimer !== undefined) {
|
|
198
|
-
clearTimeout(this.joinSessionRefreshTimer);
|
|
199
|
-
this.joinSessionRefreshTimer = undefined;
|
|
136
|
+
if (this.socketModuleP === undefined) {
|
|
137
|
+
this.socketModuleP = this.getDelayLoadedDeltaStream();
|
|
200
138
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}, delta);
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
async joinSession(requestSocketToken, options) {
|
|
215
|
-
const response = await this.joinSessionCore(requestSocketToken, options).catch((e) => {
|
|
216
|
-
if (hasFacetCodes(e) && e.facetCodes !== undefined) {
|
|
217
|
-
for (const code of e.facetCodes) {
|
|
218
|
-
switch (code) {
|
|
219
|
-
case "sessionForbiddenOnPreservedFiles":
|
|
220
|
-
case "sessionForbiddenOnModerationEnabledLibrary":
|
|
221
|
-
case "sessionForbiddenOnRequireCheckout":
|
|
222
|
-
// This document can only be opened in storage-only mode.
|
|
223
|
-
// DeltaManager will recognize this error
|
|
224
|
-
// and load without a delta stream connection.
|
|
225
|
-
this._policies = Object.assign(Object.assign({}, this._policies), { storageOnly: true });
|
|
226
|
-
throw new DeltaStreamConnectionForbiddenError(code, { driverVersion });
|
|
227
|
-
default:
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
throw e;
|
|
139
|
+
return this.socketModuleP
|
|
140
|
+
.then(async (m) => {
|
|
141
|
+
this.odspSocketModuleLoaded = true;
|
|
142
|
+
return m.connectToDeltaStream(client);
|
|
143
|
+
})
|
|
144
|
+
.catch((error) => {
|
|
145
|
+
// Setting undefined in case someone tries to recover from module failure by calling again.
|
|
146
|
+
this.socketModuleP = undefined;
|
|
147
|
+
this.odspSocketModuleLoaded = false;
|
|
148
|
+
throw error;
|
|
233
149
|
});
|
|
234
|
-
this.relayServiceTenantAndSessionId = `${response.tenantId}/${response.id}`;
|
|
235
|
-
return response;
|
|
236
|
-
}
|
|
237
|
-
async joinSessionCore(requestSocketToken, options) {
|
|
238
|
-
const disableJoinSessionRefresh = this.mc.config.getBoolean("Fluid.Driver.Odsp.disableJoinSessionRefresh");
|
|
239
|
-
const executeFetch = async () => {
|
|
240
|
-
var _a;
|
|
241
|
-
const joinSessionResponse = await fetchJoinSession(this.odspResolvedUrl, "opStream/joinSession", "POST", this.mc.logger, this.getStorageToken, this.epochTracker, requestSocketToken, options, disableJoinSessionRefresh, (_a = this.hostPolicy.sessionOptions) === null || _a === void 0 ? void 0 : _a.unauthenticatedUserDisplayName);
|
|
242
|
-
return {
|
|
243
|
-
entryTime: Date.now(),
|
|
244
|
-
joinSessionResponse,
|
|
245
|
-
};
|
|
246
|
-
};
|
|
247
|
-
const getResponseAndRefreshAfterDeltaMs = async () => {
|
|
248
|
-
var _a;
|
|
249
|
-
const _response = await this.cache.sessionJoinCache.addOrGet(this.joinSessionKey, executeFetch);
|
|
250
|
-
// If the response does not contain refreshSessionDurationSeconds, then treat it as old flow and let the
|
|
251
|
-
// cache entry to be treated as expired after 1 hour.
|
|
252
|
-
_response.joinSessionResponse.refreshSessionDurationSeconds =
|
|
253
|
-
(_a = _response.joinSessionResponse.refreshSessionDurationSeconds) !== null && _a !== void 0 ? _a : 3600;
|
|
254
|
-
return Object.assign(Object.assign({}, _response), { refreshAfterDeltaMs: this.calculateJoinSessionRefreshDelta(_response.entryTime, _response.joinSessionResponse.refreshSessionDurationSeconds) });
|
|
255
|
-
};
|
|
256
|
-
let response = await getResponseAndRefreshAfterDeltaMs();
|
|
257
|
-
// This means that the cached entry has expired(This should not be possible if the response is fetched
|
|
258
|
-
// from the network call). In this case we remove the cached entry and fetch the new response.
|
|
259
|
-
if (response.refreshAfterDeltaMs <= 0) {
|
|
260
|
-
this.cache.sessionJoinCache.remove(this.joinSessionKey);
|
|
261
|
-
response = await getResponseAndRefreshAfterDeltaMs();
|
|
262
|
-
}
|
|
263
|
-
if (!disableJoinSessionRefresh) {
|
|
264
|
-
const props = {
|
|
265
|
-
entryTime: response.entryTime,
|
|
266
|
-
refreshSessionDurationSeconds: response.joinSessionResponse.refreshSessionDurationSeconds,
|
|
267
|
-
refreshAfterDeltaMs: response.refreshAfterDeltaMs,
|
|
268
|
-
};
|
|
269
|
-
if (response.refreshAfterDeltaMs > 0) {
|
|
270
|
-
this.scheduleJoinSessionRefresh(response.refreshAfterDeltaMs)
|
|
271
|
-
.catch((error) => {
|
|
272
|
-
const canRetry = canRetryOnError(error);
|
|
273
|
-
// Only record error event in case it is non retriable.
|
|
274
|
-
if (!canRetry) {
|
|
275
|
-
this.mc.logger.sendErrorEvent({
|
|
276
|
-
eventName: "JoinSessionRefreshError",
|
|
277
|
-
details: JSON.stringify(props),
|
|
278
|
-
}, error);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
// Logging just for informational purposes to help with debugging as this is a new feature.
|
|
284
|
-
this.mc.logger.sendTelemetryEvent({
|
|
285
|
-
eventName: "JoinSessionRefreshNotScheduled",
|
|
286
|
-
details: JSON.stringify(props),
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
return response.joinSessionResponse;
|
|
291
|
-
}
|
|
292
|
-
calculateJoinSessionRefreshDelta(responseFetchTime, refreshSessionDurationSeconds) {
|
|
293
|
-
// 30 seconds is buffer time to refresh the session.
|
|
294
|
-
return responseFetchTime + ((refreshSessionDurationSeconds * 1000) - 30000) - Date.now();
|
|
295
150
|
}
|
|
296
151
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* @
|
|
301
|
-
* @param token - authorization token for delta service
|
|
302
|
-
* @param io - websocket library
|
|
303
|
-
* @param client - information about the client
|
|
304
|
-
* @param webSocketUrl - websocket URL
|
|
152
|
+
* This dynamically imports the module for loading the delta connection. In many cases the delta stream, is not
|
|
153
|
+
* required during the critical load flow. So this way we don't have to bundle this in the initial bundle and can
|
|
154
|
+
* import this later on when required.
|
|
155
|
+
* @returns - delta stream object.
|
|
305
156
|
*/
|
|
306
|
-
async
|
|
307
|
-
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
this.mc.logger.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
return connection;
|
|
157
|
+
async getDelayLoadedDeltaStream() {
|
|
158
|
+
assert(this.odspSocketModuleLoaded === false, 0x507 /* Should be loaded only once */);
|
|
159
|
+
const module = await import(/* webpackChunkName: "socketModule" */ "./odspDelayLoadedDeltaStream")
|
|
160
|
+
.then((m) => {
|
|
161
|
+
this.mc.logger.sendTelemetryEvent({ eventName: "SocketModuleLoaded" });
|
|
162
|
+
return m;
|
|
163
|
+
})
|
|
164
|
+
.catch((error) => {
|
|
165
|
+
this.mc.logger.sendErrorEvent({ eventName: "SocketModuleLoadFailed" }, error);
|
|
166
|
+
throw error;
|
|
167
|
+
});
|
|
168
|
+
this.odspDelayLoadedDeltaStream = new module.OdspDelayLoadedDeltaStream(this.odspResolvedUrl, this._policies, this.getStorageToken, this.getWebsocketToken, this.mc, this.cache, this.hostPolicy, this.epochTracker, (ops) => this.opsReceived(ops), this.socketReferenceKeyPrefix);
|
|
169
|
+
return this.odspDelayLoadedDeltaStream;
|
|
320
170
|
}
|
|
321
171
|
dispose(error) {
|
|
322
172
|
var _a, _b, _c;
|
|
@@ -331,9 +181,8 @@ export class OdspDocumentService {
|
|
|
331
181
|
(_a = this._opsCache) === null || _a === void 0 ? void 0 : _a.flushOps();
|
|
332
182
|
}
|
|
333
183
|
(_b = this._opsCache) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
334
|
-
this.
|
|
335
|
-
(_c = this.
|
|
336
|
-
this.currentConnection = undefined;
|
|
184
|
+
// Only need to dipose this, if it is already loaded.
|
|
185
|
+
(_c = this.odspDelayLoadedDeltaStream) === null || _c === void 0 ? void 0 : _c.dispose();
|
|
337
186
|
}
|
|
338
187
|
get opsCache() {
|
|
339
188
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentService.js","sourceRoot":"","sources":["../src/odspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACH,WAAW,EAEX,yBAAyB,EAEzB,cAAc,GACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAOH,eAAe,GAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,mCAAmC,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAKvH,OAAO,EAMH,aAAa,GAChB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAIlE,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAuB,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IA0D5B;;;;;;;;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G,IAAI,QAAQ,CACzB,SAAS,EACT,IAAI,CAAC,EAAE,CAAC,MAAM;QACd,SAAS;QACT;YACI,KAAK,EAAE,KAAK,EAAE,GAAW,EAAE,OAAe,EAAE,EAAE;gBAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,iCAAM,MAAM,KAAE,GAAG,KAAI,OAAO,CAAC,CAAC;YACtE,CAAC;YACD,IAAI,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,iCAAM,MAAM,KAAE,GAAG,IAAG;YAC9E,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/E,EACD,SAAS,EACT,MAAA,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,gBAAgB,mCAAI,IAAI,EACpD,MAAA,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,eAAe,mCAAI,IAAI,CACtD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,mHAAmH;IACnH,8EAA8E;IACpE,WAAW,CAAC,GAAgC;;QAClD,2CAA2C;QAC3C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE;YACrD,OAAO;SACV;QAED,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, performance } from \"@fluidframework/common-utils\";\nimport {\n ChildLogger,\n IFluidErrorBase,\n loggerToMonitoringContext,\n MonitoringContext,\n normalizeError,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n IDocumentDeltaConnection,\n IDocumentDeltaStorageService,\n IDocumentService,\n IResolvedUrl,\n IDocumentStorageService,\n IDocumentServicePolicies,\n DriverErrorType,\n} from \"@fluidframework/driver-definitions\";\nimport { canRetryOnError, DeltaStreamConnectionForbiddenError, NonRetryableError } from \"@fluidframework/driver-utils\";\nimport {\n IClient,\n ISequencedDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IOdspResolvedUrl,\n TokenFetchOptions,\n IEntry,\n HostStoragePolicy,\n InstrumentedStorageTokenFetcher,\n OdspErrorType,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { hasFacetCodes } from \"@fluidframework/odsp-doclib-utils\";\nimport type { io as SocketIOClientStatic } from \"socket.io-client\";\nimport { HostStoragePolicyInternal, ISocketStorageDiscovery } from \"./contracts\";\nimport { IOdspCache } from \"./odspCache\";\nimport { OdspDeltaStorageService, OdspDeltaStorageWithCache } from \"./odspDeltaStorageService\";\nimport { OdspDocumentDeltaConnection } from \"./odspDocumentDeltaConnection\";\nimport { OdspDocumentStorageService } from \"./odspDocumentStorageManager\";\nimport { getWithRetryForTokenRefresh, getOdspResolvedUrl, TokenFetchOptionsEx } from \"./odspUtils\";\nimport { fetchJoinSession } from \"./vroom\";\nimport { isOdcOrigin } from \"./odspUrlHelper\";\nimport { EpochTracker } from \"./epochTracker\";\nimport { OpsCache } from \"./opsCaching\";\nimport { RetryErrorsStorageAdapter } from \"./retryErrorsStorageAdapter\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\n\n/**\n * The DocumentService manages the Socket.IO connection and manages routing requests to connected\n * clients\n */\nexport class OdspDocumentService implements IDocumentService {\n private _policies: IDocumentServicePolicies;\n // Timer which runs and executes the join session call after intervals.\n private joinSessionRefreshTimer: ReturnType<typeof setTimeout> | undefined;\n /**\n * @param resolvedUrl - resolved url identifying document that will be managed by returned service instance.\n * @param getStorageToken - function that can provide the storage token. This is is also referred to as\n * the \"Vroom\" token in SPO.\n * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred\n * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n * response payload.\n * @param logger - a logger that can capture performance and diagnostic information\n * @param socketIoClientFactory - A factory that returns a promise to the socket io library required by the driver\n * @param cache - This caches response for joinSession.\n * @param hostPolicy - This host constructed policy which customizes service behavior.\n * @param epochTracker - This helper class which adds epoch to backend calls made by returned service instance.\n * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n */\n public static async create(\n resolvedUrl: IResolvedUrl,\n getStorageToken: InstrumentedStorageTokenFetcher,\n getWebsocketToken: ((options: TokenFetchOptions) => Promise<string | null>) | undefined,\n logger: ITelemetryLogger,\n socketIoClientFactory: () => Promise<typeof SocketIOClientStatic>,\n cache: IOdspCache,\n hostPolicy: HostStoragePolicy,\n epochTracker: EpochTracker,\n socketReferenceKeyPrefix?: string,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n return new OdspDocumentService(\n getOdspResolvedUrl(resolvedUrl),\n getStorageToken,\n getWebsocketToken,\n logger,\n socketIoClientFactory,\n cache,\n hostPolicy,\n epochTracker,\n socketReferenceKeyPrefix,\n clientIsSummarizer,\n );\n }\n\n private storageManager?: OdspDocumentStorageService;\n\n private readonly mc: MonitoringContext;\n\n private readonly joinSessionKey: string;\n\n private readonly hostPolicy: HostStoragePolicyInternal;\n\n private _opsCache?: OpsCache;\n\n private currentConnection?: OdspDocumentDeltaConnection;\n\n private relayServiceTenantAndSessionId: string | undefined;\n\n /**\n * @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.\n * @param getStorageToken - function that can provide the storage token. This is is also referred to as\n * the \"Vroom\" token in SPO.\n * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred\n * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n * response payload.\n * @param logger - a logger that can capture performance and diagnostic information\n * @param socketIoClientFactory - A factory that returns a promise to the socket io library required by the driver\n * @param cache - This caches response for joinSession.\n * @param hostPolicy - host constructed policy which customizes service behavior.\n * @param epochTracker - This helper class which adds epoch to backend calls made by this service instance.\n * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n */\n private constructor(\n public readonly odspResolvedUrl: IOdspResolvedUrl,\n private readonly getStorageToken: InstrumentedStorageTokenFetcher,\n private readonly getWebsocketToken: ((options: TokenFetchOptions) => Promise<string | null>) | undefined,\n logger: ITelemetryLogger,\n private readonly socketIoClientFactory: () => Promise<typeof SocketIOClientStatic>,\n private readonly cache: IOdspCache,\n hostPolicy: HostStoragePolicy,\n private readonly epochTracker: EpochTracker,\n private readonly socketReferenceKeyPrefix?: string,\n private readonly clientIsSummarizer?: boolean,\n ) {\n this._policies = {\n // load in storage-only mode if a file version is specified\n storageOnly: odspResolvedUrl.fileVersion !== undefined,\n };\n\n this.joinSessionKey = `${this.odspResolvedUrl.hashedDocumentId}/joinsession`;\n this.mc = loggerToMonitoringContext(\n ChildLogger.create(logger,\n undefined,\n {\n all: {\n odc: isOdcOrigin(new URL(this.odspResolvedUrl.endpoints.snapshotStorageUrl).origin),\n },\n }));\n\n this.hostPolicy = hostPolicy;\n if (this.clientIsSummarizer) {\n this.hostPolicy = { ...this.hostPolicy, summarizerClient: true };\n }\n }\n\n public get resolvedUrl(): IResolvedUrl {\n return this.odspResolvedUrl;\n }\n public get policies() {\n return this._policies;\n }\n\n /**\n * Connects to a storage endpoint for snapshot service.\n *\n * @returns returns the document storage service for sharepoint driver.\n */\n public async connectToStorage(): Promise<IDocumentStorageService> {\n if (!this.storageManager) {\n this.storageManager = new OdspDocumentStorageService(\n this.odspResolvedUrl,\n this.getStorageToken,\n this.mc.logger,\n true,\n this.cache,\n this.hostPolicy,\n this.epochTracker,\n // flushCallback\n async () => {\n if (this.currentConnection !== undefined && !this.currentConnection.disposed) {\n return this.currentConnection.flush();\n }\n throw new Error(\"Disconnected while uploading summary (attempt to perform flush())\");\n },\n () => {\n return this.relayServiceTenantAndSessionId;\n },\n this.mc.config.getNumber(\"Fluid.Driver.Odsp.snapshotFormatFetchType\"),\n );\n }\n\n return new RetryErrorsStorageAdapter(this.storageManager, this.mc.logger);\n }\n\n /**\n * Connects to a delta storage endpoint for getting ops between a range.\n *\n * @returns returns the document delta storage service for sharepoint driver.\n */\n public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n const snapshotOps = this.storageManager?.ops ?? [];\n const service = new OdspDeltaStorageService(\n this.odspResolvedUrl.endpoints.deltaStorageUrl,\n this.getStorageToken,\n this.epochTracker,\n this.mc.logger,\n );\n\n // batch size, please see issue #5211 for data around batch sizing\n const batchSize = this.hostPolicy.opsBatchSize ?? 5000;\n const concurrency = this.hostPolicy.concurrentOpsBatches ?? 1;\n return new OdspDeltaStorageWithCache(\n snapshotOps,\n this.mc.logger,\n batchSize,\n concurrency,\n async (from, to, telemetryProps, fetchReason) => service.get(from, to, telemetryProps, fetchReason),\n async (from, to) => {\n const res = await this.opsCache?.get(from, to);\n return res as ISequencedDocumentMessage[] ?? [];\n },\n (from, to) => {\n if (this.currentConnection !== undefined && !this.currentConnection.disposed) {\n this.currentConnection.requestOps(from, to);\n }\n },\n (ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),\n );\n }\n\n /** Annotate the given error indicating which connection step failed */\n private annotateConnectionError(\n error: any,\n failedConnectionStep: string,\n separateTokenRequest: boolean,\n ): IFluidErrorBase {\n return normalizeError(error, { props: {\n failedConnectionStep,\n separateTokenRequest,\n } });\n }\n\n /**\n * Connects to a delta stream endpoint for emitting ops.\n *\n * @returns returns the document delta stream service for onedrive/sharepoint driver.\n */\n public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n assert(this.currentConnection === undefined, 0x4ad /* Should not be called when connection is already present! */);\n // Attempt to connect twice, in case we used expired token.\n return getWithRetryForTokenRefresh<IDocumentDeltaConnection>(async (options) => {\n // Presence of getWebsocketToken callback dictates whether callback is used for fetching\n // websocket token or whether it is returned with joinSession response payload\n const requestWebsocketTokenFromJoinSession = this.getWebsocketToken === undefined;\n const websocketTokenPromise = requestWebsocketTokenFromJoinSession\n ? Promise.resolve(null)\n : this.getWebsocketToken!(options);\n\n const annotateAndRethrowConnectionError = (step: string) => (error: any) => {\n throw this.annotateConnectionError(error, step, !requestWebsocketTokenFromJoinSession);\n };\n\n const joinSessionPromise = this.joinSession(requestWebsocketTokenFromJoinSession, options);\n const [websocketEndpoint, websocketToken, io] =\n await Promise.all([\n joinSessionPromise.catch(annotateAndRethrowConnectionError(\"joinSession\")),\n websocketTokenPromise.catch(annotateAndRethrowConnectionError(\"getWebsocketToken\")),\n this.socketIoClientFactory().catch(annotateAndRethrowConnectionError(\"socketIoClientFactory\")),\n ]);\n\n const finalWebsocketToken = websocketToken ?? (websocketEndpoint.socketToken ?? null);\n if (finalWebsocketToken === null) {\n throw this.annotateConnectionError(\n new NonRetryableError(\n \"Websocket token is null\",\n OdspErrorType.fetchTokenError,\n { driverVersion },\n ),\n \"getWebsocketToken\",\n !requestWebsocketTokenFromJoinSession);\n }\n try {\n const connection = await this.createDeltaConnection(\n websocketEndpoint.tenantId,\n websocketEndpoint.id,\n finalWebsocketToken,\n io,\n client,\n websocketEndpoint.deltaStreamSocketUrl);\n connection.on(\"op\", (documentId, ops: ISequencedDocumentMessage[]) => {\n this.opsReceived(ops);\n });\n // On disconnect with 401/403 error code, we can just clear the joinSession cache as we will again\n // get the auth error on reconnecting and face latency.\n connection.once(\"disconnect\", (error: any) => {\n // Clear the join session refresh timer so that it can be restarted on reconnection.\n this.clearJoinSessionTimer();\n if (typeof error === \"object\" && error !== null\n && error.errorType === DriverErrorType.authorizationError) {\n this.cache.sessionJoinCache.remove(this.joinSessionKey);\n }\n // If we hit this assert, it means that \"disconnect\" event is emitted before the connection went through\n // dispose flow which is not correct and could lead to a bunch of erros.\n assert(connection.disposed, 0x4ae /* Connection should be disposed by now */);\n this.currentConnection = undefined;\n });\n this.currentConnection = connection;\n return connection;\n } catch (error) {\n this.cache.sessionJoinCache.remove(this.joinSessionKey);\n\n const normalizedError = this.annotateConnectionError(\n error,\n \"createDeltaConnection\",\n !requestWebsocketTokenFromJoinSession);\n if (typeof error === \"object\" && error !== null) {\n normalizedError.addTelemetryProperties({ socketDocumentId: websocketEndpoint.id });\n }\n throw normalizedError;\n }\n });\n }\n\n private clearJoinSessionTimer() {\n if (this.joinSessionRefreshTimer !== undefined) {\n clearTimeout(this.joinSessionRefreshTimer);\n this.joinSessionRefreshTimer = undefined;\n }\n }\n\n private async scheduleJoinSessionRefresh(delta: number) {\n await new Promise<void>((resolve, reject) => {\n this.joinSessionRefreshTimer = setTimeout(() => {\n getWithRetryForTokenRefresh(async (options) => {\n await this.joinSession(false, options);\n resolve();\n }).catch((error) => {\n reject(error);\n });\n }, delta);\n });\n }\n\n private async joinSession(\n requestSocketToken: boolean,\n options: TokenFetchOptionsEx,\n ) {\n const response = await this.joinSessionCore(requestSocketToken, options).catch((e) => {\n if (hasFacetCodes(e) && e.facetCodes !== undefined) {\n for (const code of e.facetCodes) {\n switch (code) {\n case \"sessionForbiddenOnPreservedFiles\":\n case \"sessionForbiddenOnModerationEnabledLibrary\":\n case \"sessionForbiddenOnRequireCheckout\":\n // This document can only be opened in storage-only mode.\n // DeltaManager will recognize this error\n // and load without a delta stream connection.\n this._policies = { ...this._policies, storageOnly: true };\n throw new DeltaStreamConnectionForbiddenError(code, { driverVersion });\n default:\n continue;\n }\n }\n }\n throw e;\n });\n this.relayServiceTenantAndSessionId = `${response.tenantId}/${response.id}`;\n return response;\n }\n\n private async joinSessionCore(\n requestSocketToken: boolean,\n options: TokenFetchOptionsEx,\n ): Promise<ISocketStorageDiscovery> {\n const disableJoinSessionRefresh = this.mc.config.getBoolean(\"Fluid.Driver.Odsp.disableJoinSessionRefresh\");\n const executeFetch = async () => {\n const joinSessionResponse = await fetchJoinSession(\n this.odspResolvedUrl,\n \"opStream/joinSession\",\n \"POST\",\n this.mc.logger,\n this.getStorageToken,\n this.epochTracker,\n requestSocketToken,\n options,\n disableJoinSessionRefresh,\n this.hostPolicy.sessionOptions?.unauthenticatedUserDisplayName,\n );\n return {\n entryTime: Date.now(),\n joinSessionResponse,\n };\n };\n\n const getResponseAndRefreshAfterDeltaMs = async () => {\n const _response = await this.cache.sessionJoinCache.addOrGet(this.joinSessionKey, executeFetch);\n // If the response does not contain refreshSessionDurationSeconds, then treat it as old flow and let the\n // cache entry to be treated as expired after 1 hour.\n _response.joinSessionResponse.refreshSessionDurationSeconds =\n _response.joinSessionResponse.refreshSessionDurationSeconds ?? 3600;\n return {\n ..._response,\n refreshAfterDeltaMs: this.calculateJoinSessionRefreshDelta(\n _response.entryTime, _response.joinSessionResponse.refreshSessionDurationSeconds),\n };\n };\n let response = await getResponseAndRefreshAfterDeltaMs();\n // This means that the cached entry has expired(This should not be possible if the response is fetched\n // from the network call). In this case we remove the cached entry and fetch the new response.\n if (response.refreshAfterDeltaMs <= 0) {\n this.cache.sessionJoinCache.remove(this.joinSessionKey);\n response = await getResponseAndRefreshAfterDeltaMs();\n }\n if (!disableJoinSessionRefresh) {\n const props = {\n entryTime: response.entryTime,\n refreshSessionDurationSeconds:\n response.joinSessionResponse.refreshSessionDurationSeconds,\n refreshAfterDeltaMs: response.refreshAfterDeltaMs,\n };\n if (response.refreshAfterDeltaMs > 0) {\n this.scheduleJoinSessionRefresh(response.refreshAfterDeltaMs)\n .catch((error) => {\n const canRetry = canRetryOnError(error);\n // Only record error event in case it is non retriable.\n if (!canRetry) {\n this.mc.logger.sendErrorEvent({\n eventName: \"JoinSessionRefreshError\",\n details: JSON.stringify(props),\n },\n error,\n );\n }\n });\n } else {\n // Logging just for informational purposes to help with debugging as this is a new feature.\n this.mc.logger.sendTelemetryEvent({\n eventName: \"JoinSessionRefreshNotScheduled\",\n details: JSON.stringify(props),\n });\n }\n }\n return response.joinSessionResponse;\n }\n\n private calculateJoinSessionRefreshDelta(responseFetchTime: number, refreshSessionDurationSeconds: number) {\n // 30 seconds is buffer time to refresh the session.\n return responseFetchTime + ((refreshSessionDurationSeconds * 1000) - 30000) - Date.now();\n }\n\n /**\n * Creats a connection to the given delta stream endpoint\n *\n * @param tenantId - the ID of the tenant\n * @param documentId - document ID\n * @param token - authorization token for delta service\n * @param io - websocket library\n * @param client - information about the client\n * @param webSocketUrl - websocket URL\n */\n private async createDeltaConnection(\n tenantId: string,\n documentId: string,\n token: string | null,\n io: typeof SocketIOClientStatic,\n client: IClient,\n webSocketUrl: string,\n ): Promise<OdspDocumentDeltaConnection> {\n const startTime = performance.now();\n const connection = await OdspDocumentDeltaConnection.create(\n tenantId,\n documentId,\n token,\n io,\n client,\n webSocketUrl,\n this.mc.logger,\n 60000,\n this.epochTracker,\n this.socketReferenceKeyPrefix,\n );\n const duration = performance.now() - startTime;\n // This event happens rather often, so it adds up to cost of telemetry.\n // Given that most reconnects result in reusing socket and happen very quickly,\n // report event only if it took longer than threshold.\n if (duration >= 2000) {\n this.mc.logger.sendPerformanceEvent({\n eventName: \"ConnectionSuccess\",\n duration,\n });\n }\n return connection;\n }\n\n public dispose(error?: any) {\n // Error might indicate mismatch between client & server knowlege about file\n // (DriverErrorType.fileOverwrittenInStorage).\n // For example, file might have been overwritten in storage without generating new epoch\n // In such case client cached info is stale and has to be removed.\n if (error !== undefined) {\n this.epochTracker.removeEntries().catch(() => {});\n } else {\n this._opsCache?.flushOps();\n }\n this._opsCache?.dispose();\n this.clearJoinSessionTimer();\n this.currentConnection?.dispose();\n this.currentConnection = undefined;\n }\n\n protected get opsCache() {\n if (this._opsCache) {\n return this._opsCache;\n }\n\n const seqNumber = this.storageManager?.snapshotSequenceNumber;\n const batchSize = this.hostPolicy.opsCaching?.batchSize ?? 100;\n if (seqNumber === undefined || batchSize < 1) {\n return;\n }\n\n const opsKey: Omit<IEntry, \"key\"> = {\n type: \"ops\",\n };\n this._opsCache = new OpsCache(\n seqNumber,\n this.mc.logger,\n // ICache\n {\n write: async (key: string, opsData: string) => {\n return this.cache.persistedCache.put({ ...opsKey, key }, opsData);\n },\n read: async (key: string) => this.cache.persistedCache.get({ ...opsKey, key }),\n remove: () => { this.cache.persistedCache.removeEntries().catch(() => {}); },\n },\n batchSize,\n this.hostPolicy.opsCaching?.timerGranularity ?? 5000,\n this.hostPolicy.opsCaching?.totalOpsToCache ?? 5000,\n );\n return this._opsCache;\n }\n\n // Called whenever re receive ops through any channel for this document (snapshot, delta connection, delta storage)\n // We use it to notify caching layer of how stale is snapshot stored in cache.\n protected opsReceived(ops: ISequencedDocumentMessage[]) {\n // No need for two clients to save same ops\n if (ops.length === 0 || this.odspResolvedUrl.summarizer) {\n return;\n }\n\n this.opsCache?.addOps(ops);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDocumentService.js","sourceRoot":"","sources":["../src/odspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACH,WAAW,EACX,yBAAyB,GAE5B,MAAM,iCAAiC,CAAC;AAsBzC,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAGxE;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAuD5B;;;;;;;;;;;;;OAaG;IACH,YACoB,eAAiC,EAChC,eAAgD,EAChD,iBAAuF,EACxG,MAAwB,EACP,KAAiB,EAClC,UAA6B,EACZ,YAA0B,EAC1B,wBAAiC,EACjC,kBAA4B;QAR7B,oBAAe,GAAf,eAAe,CAAkB;QAChC,oBAAe,GAAf,eAAe,CAAiC;QAChD,sB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O,CAAC,CAAC;YACtE,CAAC;YACD,IAAI,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,iCAAM,MAAM,KAAE,GAAG,IAAG;YAC9E,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/E,EACD,SAAS,EACT,MAAA,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,gBAAgB,mCAAI,IAAI,EACpD,MAAA,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,eAAe,mCAAI,IAAI,CACtD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,mHAAmH;IACnH,8EAA8E;IACpE,WAAW,CAAC,GAAgC;;QAClD,2CAA2C;QAC3C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE;YACrD,OAAO;SACV;QAED,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n ChildLogger,\n loggerToMonitoringContext,\n MonitoringContext,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n IDocumentDeltaConnection,\n IDocumentDeltaStorageService,\n IDocumentService,\n IResolvedUrl,\n IDocumentStorageService,\n IDocumentServicePolicies,\n} from \"@fluidframework/driver-definitions\";\nimport {\n IClient,\n ISequencedDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IOdspResolvedUrl,\n TokenFetchOptions,\n IEntry,\n HostStoragePolicy,\n InstrumentedStorageTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { HostStoragePolicyInternal } from \"./contracts\";\nimport { IOdspCache } from \"./odspCache\";\nimport { OdspDeltaStorageService, OdspDeltaStorageWithCache } from \"./odspDeltaStorageService\";\nimport { OdspDocumentStorageService } from \"./odspDocumentStorageManager\";\nimport { getOdspResolvedUrl } from \"./odspUtils\";\nimport { isOdcOrigin } from \"./odspUrlHelper\";\nimport { EpochTracker } from \"./epochTracker\";\nimport { OpsCache } from \"./opsCaching\";\nimport { RetryErrorsStorageAdapter } from \"./retryErrorsStorageAdapter\";\nimport type { OdspDelayLoadedDeltaStream } from \"./odspDelayLoadedDeltaStream\";\n\n/**\n * The DocumentService manages the Socket.IO connection and manages routing requests to connected\n * clients\n */\nexport class OdspDocumentService implements IDocumentService {\n private readonly _policies: IDocumentServicePolicies;\n\n // Promise to load socket module only once.\n private socketModuleP: Promise<OdspDelayLoadedDeltaStream> | undefined;\n\n private odspDelayLoadedDeltaStream: OdspDelayLoadedDeltaStream | undefined;\n\n private odspSocketModuleLoaded: boolean = false;\n\n /**\n * @param resolvedUrl - resolved url identifying document that will be managed by returned service instance.\n * @param getStorageToken - function that can provide the storage token. This is is also referred to as\n * the \"Vroom\" token in SPO.\n * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred\n * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n * response payload.\n * @param logger - a logger that can capture performance and diagnostic information\n * @param cache - This caches response for joinSession.\n * @param hostPolicy - This host constructed policy which customizes service behavior.\n * @param epochTracker - This helper class which adds epoch to backend calls made by returned service instance.\n * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n */\n public static async create(\n resolvedUrl: IResolvedUrl,\n getStorageToken: InstrumentedStorageTokenFetcher,\n getWebsocketToken: ((options: TokenFetchOptions) => Promise<string | null>) | undefined,\n logger: ITelemetryLogger,\n cache: IOdspCache,\n hostPolicy: HostStoragePolicy,\n epochTracker: EpochTracker,\n socketReferenceKeyPrefix?: string,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n return new OdspDocumentService(\n getOdspResolvedUrl(resolvedUrl),\n getStorageToken,\n getWebsocketToken,\n logger,\n cache,\n hostPolicy,\n epochTracker,\n socketReferenceKeyPrefix,\n clientIsSummarizer,\n );\n }\n\n private storageManager?: OdspDocumentStorageService;\n\n private readonly mc: MonitoringContext;\n\n private readonly hostPolicy: HostStoragePolicyInternal;\n\n private _opsCache?: OpsCache;\n\n /**\n * @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.\n * @param getStorageToken - function that can provide the storage token. This is is also referred to as\n * the \"Vroom\" token in SPO.\n * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred\n * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n * response payload.\n * @param logger - a logger that can capture performance and diagnostic information\n * @param socketIoClientFactory - A factory that returns a promise to the socket io library required by the driver\n * @param cache - This caches response for joinSession.\n * @param hostPolicy - host constructed policy which customizes service behavior.\n * @param epochTracker - This helper class which adds epoch to backend calls made by this service instance.\n * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n */\n private constructor(\n public readonly odspResolvedUrl: IOdspResolvedUrl,\n private readonly getStorageToken: InstrumentedStorageTokenFetcher,\n private readonly getWebsocketToken: ((options: TokenFetchOptions) => Promise<string | null>) | undefined,\n logger: ITelemetryLogger,\n private readonly cache: IOdspCache,\n hostPolicy: HostStoragePolicy,\n private readonly epochTracker: EpochTracker,\n private readonly socketReferenceKeyPrefix?: string,\n private readonly clientIsSummarizer?: boolean,\n ) {\n this._policies = {\n // load in storage-only mode if a file version is specified\n storageOnly: odspResolvedUrl.fileVersion !== undefined,\n };\n\n this.mc = loggerToMonitoringContext(\n ChildLogger.create(logger,\n undefined,\n {\n all: {\n odc: isOdcOrigin(new URL(this.odspResolvedUrl.endpoints.snapshotStorageUrl).origin),\n },\n }));\n\n this.hostPolicy = hostPolicy;\n if (this.clientIsSummarizer) {\n this.hostPolicy = { ...this.hostPolicy, summarizerClient: true };\n }\n }\n\n public get resolvedUrl(): IResolvedUrl {\n return this.odspResolvedUrl;\n }\n public get policies() {\n return this._policies;\n }\n\n /**\n * Connects to a storage endpoint for snapshot service.\n *\n * @returns returns the document storage service for sharepoint driver.\n */\n public async connectToStorage(): Promise<IDocumentStorageService> {\n if (!this.storageManager) {\n this.storageManager = new OdspDocumentStorageService(\n this.odspResolvedUrl,\n this.getStorageToken,\n this.mc.logger,\n true,\n this.cache,\n this.hostPolicy,\n this.epochTracker,\n // flushCallback\n async () => {\n const currentConnection = this.odspDelayLoadedDeltaStream?.currentDeltaConnection;\n if (currentConnection !== undefined && !currentConnection.disposed) {\n return currentConnection.flush();\n }\n throw new Error(\"Disconnected while uploading summary (attempt to perform flush())\");\n },\n () => {\n return this.odspDelayLoadedDeltaStream?.relayServiceTenantAndSessionId;\n },\n this.mc.config.getNumber(\"Fluid.Driver.Odsp.snapshotFormatFetchType\"),\n );\n }\n\n return new RetryErrorsStorageAdapter(this.storageManager, this.mc.logger);\n }\n\n /**\n * Connects to a delta storage endpoint for getting ops between a range.\n *\n * @returns returns the document delta storage service for sharepoint driver.\n */\n public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n const snapshotOps = this.storageManager?.ops ?? [];\n const service = new OdspDeltaStorageService(\n this.odspResolvedUrl.endpoints.deltaStorageUrl,\n this.getStorageToken,\n this.epochTracker,\n this.mc.logger,\n );\n\n // batch size, please see issue #5211 for data around batch sizing\n const batchSize = this.hostPolicy.opsBatchSize ?? 5000;\n const concurrency = this.hostPolicy.concurrentOpsBatches ?? 1;\n return new OdspDeltaStorageWithCache(\n snapshotOps,\n this.mc.logger,\n batchSize,\n concurrency,\n // Get Ops from storage callback.\n async (from, to, telemetryProps, fetchReason) => service.get(from, to, telemetryProps, fetchReason),\n // Get cachedOps Callback.\n async (from, to) => {\n const res = await this.opsCache?.get(from, to);\n return res as ISequencedDocumentMessage[] ?? [];\n },\n // Ops requestFromSocket Callback.\n (from, to) => {\n const currentConnection = this.odspDelayLoadedDeltaStream?.currentDeltaConnection;\n if (currentConnection !== undefined && !currentConnection.disposed) {\n currentConnection.requestOps(from, to);\n }\n },\n (ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),\n );\n }\n\n /**\n * Connects to a delta stream endpoint for emitting ops.\n *\n * @returns returns the document delta stream service for onedrive/sharepoint driver.\n */\n public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n if (this.socketModuleP === undefined) {\n this.socketModuleP = this.getDelayLoadedDeltaStream();\n }\n return this.socketModuleP\n .then(async (m) => {\n this.odspSocketModuleLoaded = true;\n return m.connectToDeltaStream(client);\n })\n .catch((error) => {\n // Setting undefined in case someone tries to recover from module failure by calling again.\n this.socketModuleP = undefined;\n this.odspSocketModuleLoaded = false;\n throw error;\n });\n }\n\n /**\n * This dynamically imports the module for loading the delta connection. In many cases the delta stream, is not\n * required during the critical load flow. So this way we don't have to bundle this in the initial bundle and can\n * import this later on when required.\n * @returns - delta stream object.\n */\n private async getDelayLoadedDeltaStream() {\n assert(this.odspSocketModuleLoaded === false, 0x507 /* Should be loaded only once */);\n const module = await import(/* webpackChunkName: \"socketModule\" */ \"./odspDelayLoadedDeltaStream\")\n .then((m) => {\n this.mc.logger.sendTelemetryEvent({ eventName: \"SocketModuleLoaded\" });\n return m;\n })\n .catch((error) => {\n this.mc.logger.sendErrorEvent( { eventName: \"SocketModuleLoadFailed\" }, error);\n throw error;\n });\n this.odspDelayLoadedDeltaStream = new module.OdspDelayLoadedDeltaStream(\n this.odspResolvedUrl,\n this._policies,\n this.getStorageToken,\n this.getWebsocketToken,\n this.mc,\n this.cache,\n this.hostPolicy,\n this.epochTracker,\n (ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),\n this.socketReferenceKeyPrefix,\n );\n return this.odspDelayLoadedDeltaStream;\n }\n\n public dispose(error?: any) {\n // Error might indicate mismatch between client & server knowlege about file\n // (DriverErrorType.fileOverwrittenInStorage).\n // For example, file might have been overwritten in storage without generating new epoch\n // In such case client cached info is stale and has to be removed.\n if (error !== undefined) {\n this.epochTracker.removeEntries().catch(() => {});\n } else {\n this._opsCache?.flushOps();\n }\n this._opsCache?.dispose();\n // Only need to dipose this, if it is already loaded.\n this.odspDelayLoadedDeltaStream?.dispose();\n }\n\n protected get opsCache() {\n if (this._opsCache) {\n return this._opsCache;\n }\n\n const seqNumber = this.storageManager?.snapshotSequenceNumber;\n const batchSize = this.hostPolicy.opsCaching?.batchSize ?? 100;\n if (seqNumber === undefined || batchSize < 1) {\n return;\n }\n\n const opsKey: Omit<IEntry, \"key\"> = {\n type: \"ops\",\n };\n this._opsCache = new OpsCache(\n seqNumber,\n this.mc.logger,\n // ICache\n {\n write: async (key: string, opsData: string) => {\n return this.cache.persistedCache.put({ ...opsKey, key }, opsData);\n },\n read: async (key: string) => this.cache.persistedCache.get({ ...opsKey, key }),\n remove: () => { this.cache.persistedCache.removeEntries().catch(() => {}); },\n },\n batchSize,\n this.hostPolicy.opsCaching?.timerGranularity ?? 5000,\n this.hostPolicy.opsCaching?.totalOpsToCache ?? 5000,\n );\n return this._opsCache;\n }\n\n // Called whenever re receive ops through any channel for this document (snapshot, delta connection, delta storage)\n // We use it to notify caching layer of how stale is snapshot stored in cache.\n protected opsReceived(ops: ISequencedDocumentMessage[]) {\n // No need for two clients to save same ops\n if (ops.length === 0 || this.odspResolvedUrl.summarizer) {\n return;\n }\n\n this.opsCache?.addOps(ops);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACH,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EACf,iBAAiB,EACpB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACH,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EACf,iBAAiB,EACpB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAIlF;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,8BAA8B;gBAEtE,eAAe,EAAE,YAAY,CAAC,6BAA6B,CAAC,EAC5D,iBAAiB,EAAE,YAAY,CAAC,6BAA6B,CAAC,GAAG,SAAS,EAC1E,cAAc,CAAC,EAAE,eAAe,EAChC,UAAU,CAAC,EAAE,iBAAiB;CASrC;AAED,wBAAgB,qCAAqC,CAAC,aAAa,EAAE,UAAU,GAAG,MAAM,GAAG,uBAAuB,CAEjH"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore";
|
|
6
|
-
import { getSocketIo } from "./getSocketIo";
|
|
7
6
|
// eslint-disable-next-line import/no-internal-modules
|
|
8
7
|
import { LocalOdspDocumentServiceFactory } from "./localOdspDriver/localOdspDocumentServiceFactory";
|
|
9
8
|
/**
|
|
@@ -12,7 +11,7 @@ import { LocalOdspDocumentServiceFactory } from "./localOdspDriver/localOdspDocu
|
|
|
12
11
|
*/
|
|
13
12
|
export class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {
|
|
14
13
|
constructor(getStorageToken, getWebsocketToken, persistedCache, hostPolicy) {
|
|
15
|
-
super(getStorageToken, getWebsocketToken,
|
|
14
|
+
super(getStorageToken, getWebsocketToken, persistedCache, hostPolicy);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
export function createLocalOdspDocumentServiceFactory(localSnapshot) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentServiceFactory.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactory.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,sDAAsD;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AAEpG;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,8BAA8B;IAC1E,YACI,eAA4D,EAC5D,iBAA0E,EAC1E,cAAgC,EAChC,UAA8B;QAE9B,KAAK,CACD,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,UAAU,CACb,CAAC;IACN,CAAC;CACJ;AAED,MAAM,UAAU,qCAAqC,CAAC,aAAkC;IACpF,OAAO,IAAI,+BAA+B,CAAC,aAAa,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentServiceFactory } from \"@fluidframework/driver-definitions\";\nimport {\n OdspResourceTokenFetchOptions,\n TokenFetcher,\n IPersistedCache,\n HostStoragePolicy,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { OdspDocumentServiceFactoryCore } from \"./odspDocumentServiceFactoryCore\";\n// eslint-disable-next-line import/no-internal-modules\nimport { LocalOdspDocumentServiceFactory } from \"./localOdspDriver/localOdspDocumentServiceFactory\";\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n */\nexport class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {\n constructor(\n getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,\n persistedCache?: IPersistedCache,\n hostPolicy?: HostStoragePolicy,\n ) {\n super(\n getStorageToken,\n getWebsocketToken,\n persistedCache,\n hostPolicy,\n );\n }\n}\n\nexport function createLocalOdspDocumentServiceFactory(localSnapshot: Uint8Array | string): IDocumentServiceFactory {\n return new LocalOdspDocumentServiceFactory(localSnapshot);\n}\n"]}
|