@fluidframework/odsp-driver 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkUrl.d.ts +1 -1
- package/dist/checkUrl.js +1 -1
- package/dist/checkUrl.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/contractsPublic.d.ts +1 -0
- package/dist/contractsPublic.d.ts.map +1 -1
- package/dist/contractsPublic.js.map +1 -1
- package/dist/getFileLink.js +0 -4
- package/dist/getFileLink.js.map +1 -1
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +26 -0
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentService.js +39 -0
- package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +24 -0
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js +45 -0
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +27 -0
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js +66 -0
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
- package/dist/odspDeltaStorageService.js.map +1 -1
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactory.d.ts +2 -1
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactory.js +7 -1
- package/dist/odspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +3 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts +5 -23
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +52 -245
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts +58 -0
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -0
- package/dist/odspDocumentStorageServiceBase.js +216 -0
- package/dist/odspDocumentStorageServiceBase.js.map +1 -0
- package/dist/odspDriverUrlResolver.js +1 -1
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.d.ts +8 -2
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js +11 -3
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspFluidFileLink.d.ts.map +1 -1
- package/dist/odspFluidFileLink.js +27 -21
- package/dist/odspFluidFileLink.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/lib/checkUrl.d.ts +1 -1
- package/lib/checkUrl.js +1 -1
- package/lib/checkUrl.js.map +1 -1
- package/lib/constants.d.ts +1 -1
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/contractsPublic.d.ts +1 -0
- package/lib/contractsPublic.d.ts.map +1 -1
- package/lib/contractsPublic.js.map +1 -1
- package/lib/getFileLink.js +0 -4
- package/lib/getFileLink.js.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.ts +26 -0
- package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -0
- package/lib/localOdspDriver/localOdspDocumentService.js +35 -0
- package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -0
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts +24 -0
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -0
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js +41 -0
- package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -0
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts +27 -0
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -0
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js +62 -0
- package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
- package/lib/odspDeltaStorageService.js.map +1 -1
- package/lib/odspDocumentService.d.ts.map +1 -1
- package/lib/odspDocumentService.js +1 -1
- package/lib/odspDocumentService.js.map +1 -1
- package/lib/odspDocumentServiceFactory.d.ts +2 -1
- package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactory.js +5 -0
- package/lib/odspDocumentServiceFactory.js.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts +3 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts +5 -23
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js +53 -246
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.ts +58 -0
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -0
- package/lib/odspDocumentStorageServiceBase.js +212 -0
- package/lib/odspDocumentStorageServiceBase.js.map +1 -0
- package/lib/odspDriverUrlResolver.js +1 -1
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.d.ts +8 -2
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.js +11 -3
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/lib/odspFluidFileLink.d.ts.map +1 -1
- package/lib/odspFluidFileLink.js +27 -21
- package/lib/odspFluidFileLink.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/package.json +17 -12
- package/src/checkUrl.ts +1 -1
- package/src/constants.ts +1 -1
- package/src/contractsPublic.ts +1 -0
- package/src/getFileLink.ts +0 -5
- package/src/localOdspDriver/localOdspDocumentService.ts +54 -0
- package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +67 -0
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +83 -0
- package/src/odspDeltaStorageService.ts +1 -1
- package/src/odspDocumentService.ts +5 -1
- package/src/odspDocumentServiceFactory.ts +7 -3
- package/src/odspDocumentServiceFactoryCore.ts +1 -1
- package/src/odspDocumentStorageManager.ts +81 -312
- package/src/odspDocumentStorageServiceBase.ts +268 -0
- package/src/odspDriverUrlResolver.ts +1 -1
- package/src/odspDriverUrlResolverForShareLink.ts +13 -1
- package/src/odspFluidFileLink.ts +26 -22
- package/src/packageVersion.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localOdspDocumentStorageManager.js","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentStorageManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAGnF,OAAO,EAAE,yCAAyC,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;GAGG;AACH,MAAM,OAAO,+BAAgC,SAAQ,8BAA8B;IAG/E,YACqB,MAAwB,EACxB,aAAkC;QAEnD,KAAK,EAAE,CAAC;QAHS,WAAM,GAAN,MAAM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C7D,IAAI,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC;IACjD,CAAC;IAEM,wBAAwB,CAAC,QAA0B,EAAE,QAAyB;QACjF,IAAI,CAAC,eAAe,CAAC,0BAA0B,CAAC,CAAC;IACrD,CAAC;IAEM,UAAU,CAAC,KAAsB;QACpC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;IAEO,eAAe,CAAC,UAAkB;QACtC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,UAAU,uDAAuD,CAAC,CAAC;QACtG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC,CAAC;QACvE,MAAM,OAAO,CAAC;IAClB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport { UsageError } from \"@fluidframework/driver-utils\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { OdspDocumentStorageServiceBase } from \"../odspDocumentStorageServiceBase\";\nimport { ISnapshotContents } from \"../odspPublicUtils\";\nimport { IOdspSnapshot } from \"../contracts\";\nimport { convertOdspSnapshotToSnapshotTreeAndBlobs } from \"../odspSnapshotParser\";\nimport { parseCompactSnapshotResponse } from \"../compactSnapshotParser\";\nimport { ReadBuffer } from \"../ReadBufferUtils\";\n\n/**\n * ODSP document storage service that works on a provided snapshot for all its processing.\n * Attempting to use unsupported actions/methods will result in errors being thrown.\n */\nexport class LocalOdspDocumentStorageService extends OdspDocumentStorageServiceBase {\n private snapshotTreeId: string | undefined;\n\n constructor(\n private readonly logger: ITelemetryLogger,\n private readonly localSnapshot: Uint8Array | string,\n ) {\n super();\n }\n\n private calledGetVersions = false;\n\n public async getVersions(blobid: string | null, count: number, _scenarioName?: string): Promise<api.IVersion[]> {\n assert(blobid === null, 0x342 /* Invalid usage. \"blobid\" should always be null */);\n assert(count === 1, 0x343 /* Invalid usage. \"count\" should always be 1 */);\n\n // No reason to re-parse the data since it will never change\n if (this.calledGetVersions) {\n return this.getSnapshotVersion();\n }\n this.calledGetVersions = true;\n\n let snapshotContents: ISnapshotContents;\n\n if (typeof this.localSnapshot === \"string\") {\n const content: IOdspSnapshot = JSON.parse(this.localSnapshot);\n snapshotContents = convertOdspSnapshotToSnapshotTreeAndBlobs(content);\n } else {\n snapshotContents = parseCompactSnapshotResponse(\n new ReadBuffer(this.localSnapshot));\n }\n\n this.snapshotTreeId = this.initializeFromSnapshot(snapshotContents);\n return this.getSnapshotVersion();\n }\n\n private getSnapshotVersion(): api.IVersion[] {\n return this.snapshotTreeId ? [{ id: this.snapshotTreeId, treeId: undefined! }] : [];\n }\n\n protected fetchTreeFromSnapshot(_id: string, _scenarioName?: string): never {\n this.throwUsageError(\"fetchTreeFromSnapshot\");\n }\n\n protected fetchBlobFromStorage(_blobId: string, _evicted: boolean): never {\n this.throwUsageError(\"fetchBlobFromStorage\");\n }\n\n public uploadSummaryWithContext(_summary: api.ISummaryTree, _context: ISummaryContext): never {\n this.throwUsageError(\"uploadSummaryWithContext\");\n }\n\n public createBlob(_file: ArrayBufferLike): never {\n this.throwUsageError(\"createBlob\");\n }\n\n private throwUsageError(methodName: string): never {\n const toThrow = new UsageError(`\"${methodName}\" is not supported by LocalOdspDocumentStorageService`);\n this.logger.sendErrorEvent({ eventName: \"UnsupportedUsage\" }, toThrow);\n throw toThrow;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDeltaStorageService.js","sourceRoot":"","sources":["../src/odspDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,EAAE,IAAI,IA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C;YACrD,cAAc,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;YACtC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC/B,OAAO,GAAG,CAAC;QACf,CAAC,CAAC;QAEF,MAAM,MAAM,GAAG,UAAU,CACrB,KAAK,EAAE,IAAY,EAAE,EAAU,EAAE,cAAoC,EAAE,EAAE;YACrE,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;YAC/D,+BAA+B;YAC/B,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC1D,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,uEAAuE;QACvE,0DAA0D;QAC1D,IAAI,CAAC,WAAW,EAChB,SAAS,EAAE,YAAY;QACvB,OAAO,EAAE,YAAY;QACrB,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,MAAM,EACX,WAAW,EACX,WAAW,CACd,CAAC;QAEF,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;YACrC,IAAI,MAAM,CAAC,IAAI,IAAI,eAAe,GAAG,YAAY,GAAG,cAAc,KAAK,CAAC,EAAE;gBACtE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;oBAC7B,SAAS,EAAE,mBAAmB;oBAC9B,eAAe;oBACf,YAAY;oBACZ,cAAc;iBACjB,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;IACX,CAAC;CACA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { default as AbortController } from \"abort-controller\";\nimport { v4 as uuid } from \"uuid\";\nimport { ITelemetryLogger, ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { InstrumentedStorageTokenFetcher } from \"@fluidframework/odsp-driver-definitions\";\nimport { IDeltasFetchResult, IDocumentDeltaStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n requestOps,\n streamObserver,\n} from \"@fluidframework/driver-utils\";\nimport { IDeltaStorageGetResponse, ISequencedDeltaOpMessage } from \"./contracts\";\nimport { EpochTracker } from \"./epochTracker\";\nimport { getWithRetryForTokenRefresh } from \"./odspUtils\";\n\n/**\n * Provides access to the underlying delta storage on the server for sharepoint driver.\n */\nexport class OdspDeltaStorageService {\n constructor(\n private readonly deltaFeedUrl: string,\n private readonly getStorageToken: InstrumentedStorageTokenFetcher,\n private readonly epochTracker: EpochTracker,\n private readonly logger: ITelemetryLogger,\n ) {\n }\n\n /**\n * Retrieves ops from cache\n * @param from - inclusive\n * @param to - exclusive\n * @param telemetryProps - properties to add when issuing telemetry events\n * @returns ops retrieved & info if result was partial (i.e. more is available)\n */\n public async get(\n from: number,\n to: number,\n telemetryProps: ITelemetryProperties,\n fetchReason?: string,\n ): Promise<IDeltasFetchResult> {\n return getWithRetryForTokenRefresh(async (options) => {\n // Note - this call ends up in getSocketStorageDiscovery() and can refresh token\n // Thus it needs to be done before we call getStorageToken() to reduce extra calls\n const baseUrl = this.buildUrl(from, to);\n const storageToken = await this.getStorageToken(options, \"DeltaStorage\");\n\n const formBoundary = uuid();\n let postBody = `--${formBoundary}\\r\\n`;\n postBody += `Authorization: Bearer ${storageToken}\\r\\n`;\n postBody += `X-HTTP-Method-Override: GET\\r\\n`;\n\n postBody += `_post: 1\\r\\n`;\n postBody += `\\r\\n--${formBoundary}--`;\n const headers: { [index: string]: any; } = {\n \"Content-Type\": `multipart/form-data;boundary=${formBoundary}`,\n };\n\n // Some request take a long time (1-2 minutes) to complete, where telemetry shows very small amount\n // of time spent on server, and usually small payload sizes. I.e. all the time is spent somewhere in\n // networking. Even bigger problem - a lot of requests timeout (based on cursory look - after 1-2 minutes)\n // So adding some timeout to ensure we retry again in hope of faster success.\n // Please see https://github.com/microsoft/FluidFramework/issues/6997 for details.\n const abort = new AbortController();\n const timer = setTimeout(() => abort.abort(), 30000);\n\n const response = await this.epochTracker.fetchAndParseAsJSON<IDeltaStorageGetResponse>(\n baseUrl,\n {\n headers,\n body: postBody,\n method: \"POST\",\n signal: abort.signal,\n },\n \"ops\",\n true,\n fetchReason,\n );\n clearTimeout(timer);\n const deltaStorageResponse = response.content;\n let messages: ISequencedDocumentMessage[];\n if (deltaStorageResponse.value.length > 0 && \"op\" in deltaStorageResponse.value[0]) {\n messages = (deltaStorageResponse.value as ISequencedDeltaOpMessage[]).map((operation) => operation.op);\n } else {\n messages = deltaStorageResponse.value as ISequencedDocumentMessage[];\n }\n\n this.logger.sendPerformanceEvent({\n eventName: \"OpsFetch\",\n headers: Object.keys(headers).length !== 0 ? true : undefined,\n length: messages.length,\n duration: response.duration, // this duration for single attempt!\n ...response.propsToLog,\n attempts: options.refresh ? 2 : 1,\n from,\n to,\n ...telemetryProps,\n });\n\n // It is assumed that server always returns all the ops that it has in the range that was requested.\n // This may change in the future, if so, we need to adjust and receive \"end\" value from server in such case.\n return { messages, partialResult: false };\n });\n }\n\n public buildUrl(from: number, to: number) {\n const filter = encodeURIComponent(`sequenceNumber ge ${from} and sequenceNumber le ${to - 1}`);\n const queryString = `?ump=1&filter=${filter}`;\n return `${this.deltaFeedUrl}${queryString}`;\n }\n}\n\nexport class OdspDeltaStorageWithCache implements IDocumentDeltaStorageService {\n private firstCacheMiss = Number.MAX_SAFE_INTEGER;\n\n public constructor(\n private snapshotOps: ISequencedDocumentMessage[] | undefined,\n private readonly logger: ITelemetryLogger,\n private readonly batchSize: number,\n private readonly concurrency: number,\n private readonly getFromStorage: (\n from: number,\n to: number,\n telemetryProps: ITelemetryProperties,\n fetchReason?: string) => Promise<IDeltasFetchResult>,\n private readonly getCached: (from: number, to: number) => Promise<ISequencedDocumentMessage[]>,\n private readonly requestFromSocket: (from: number, to: number) => void,\n private readonly opsReceived: (ops: ISequencedDocumentMessage[]) => void,\n ) {\n }\n\n protected validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number) {\n if (messages.length !== 0) {\n const start = messages[0].sequenceNumber;\n const length = messages.length;\n const last = messages[length - 1].sequenceNumber;\n if (start !== from) {\n this.logger.sendErrorEvent({ eventName: \"OpsFetchViolation\", reason, from, start, last, length });\n messages.length = 0;\n }\n if (last + 1 !== from + length) {\n this.logger.sendErrorEvent({ eventName: \"OpsFetchViolation\", reason, from, start, last, length });\n // we can do better here by finding consecutive sub-block and return it\n messages.length = 0;\n }\n }\n }\n\n public fetchMessages(\n fromTotal: number,\n toTotal: number | undefined,\n abortSignal?: AbortSignal,\n cachedOnly?: boolean,\n fetchReason?: string) {\n // We do not control what's in the cache. Current API assumes that fetchMessages() keeps banging on\n // storage / cache until it gets ops it needs. This would result in deadlock if fixed range is asked from\n // cache and it's not there.\n // Better implementation would be to return only what we have in cache, but that also breaks API\n assert(!cachedOnly || toTotal === undefined, 0x1e3);\n\n let opsFromSnapshot = 0;\n let opsFromCache = 0;\n let opsFromStorage = 0;\n\n const requestCallback = async (from: number, to: number, telemetryProps: ITelemetryProperties) => {\n if (this.snapshotOps !== undefined && this.snapshotOps.length !== 0) {\n const messages = this.snapshotOps.filter((op) =>\n op.sequenceNumber >= from && op.sequenceNumber < to);\n this.validateMessages(\"cached\", messages, from);\n if (messages.length > 0 && messages[0].sequenceNumber === from) {\n this.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);\n opsFromSnapshot = messages.length;\n return { messages, partialResult: true };\n }\n this.snapshotOps = undefined;\n }\n\n // Kick out request to PUSH for ops if it has them\n this.requestFromSocket(from, to);\n\n // Cache in normal flow is continuous. Once there is a miss, stop consulting cache.\n // This saves a bit of processing time\n if (from < this.firstCacheMiss) {\n const messagesFromCache = await this.getCached(from, to);\n this.validateMessages(\"cached\", messagesFromCache, from);\n if (messagesFromCache.length !== 0) {\n opsFromCache += messagesFromCache.length;\n return {\n messages: messagesFromCache,\n partialResult: true,\n };\n }\n this.firstCacheMiss = Math.min(this.firstCacheMiss, from);\n }\n\n if (cachedOnly) {\n return { messages: [], partialResult: false };\n }\n\n const ops = await this.getFromStorage(from, to, telemetryProps, fetchReason);\n this.validateMessages(\"storage\", ops.messages, from);\n opsFromStorage += ops.messages.length;\n this.opsReceived(ops.messages);\n return ops;\n };\n\n const stream = requestOps(\n async (from: number, to: number, telemetryProps: ITelemetryProperties) => {\n const result = await requestCallback(from, to, telemetryProps);\n // Catch all case, just in case\n this.validateMessages(\"catch all\", result.messages, from);\n return result;\n },\n // Staging: starting with no concurrency, listening for feedback first.\n // In future releases we will switch to actual concurrency\n this.concurrency,\n fromTotal, // inclusive\n toTotal, // exclusive\n this.batchSize,\n this.logger,\n abortSignal,\n fetchReason,\n );\n\n return streamObserver(stream, (result) => {\n if (result.done && opsFromSnapshot + opsFromCache + opsFromStorage !== 0) {\n this.logger.sendPerformanceEvent({\n eventName: \"CacheOpsRetrieved\",\n opsFromSnapshot,\n opsFromCache,\n opsFromStorage,\n });\n }\n });\n}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDeltaStorageService.js","sourceRoot":"","sources":["../src/odspDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAItD,OAAO,EACH,UAAU,EACV,cAAc,GACjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAChC,YACqB,YAAoB,EACpB,eAAgD,EAChD,YAA0B,EAC1B,MAAwB;QAHxB,iBAAY,GAAZ,YAAY,CAAQ;QACpB,oBAAe,GAAf,eAAe,CAAiC;QAChD,iBAAY,G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gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC1D,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,uEAAuE;QACvE,0DAA0D;QAC1D,IAAI,CAAC,WAAW,EAChB,SAAS,EAAE,YAAY;QACvB,OAAO,EAAE,YAAY;QACrB,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,MAAM,EACX,WAAW,EACX,WAAW,CACd,CAAC;QAEF,OAAO,cAAc,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;YACrC,IAAI,MAAM,CAAC,IAAI,IAAI,eAAe,GAAG,YAAY,GAAG,cAAc,KAAK,CAAC,EAAE;gBACtE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;oBAC7B,SAAS,EAAE,mBAAmB;oBAC9B,eAAe;oBACf,YAAY;oBACZ,cAAc;iBACjB,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { default as AbortController } from \"abort-controller\";\nimport { v4 as uuid } from \"uuid\";\nimport { ITelemetryLogger, ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { InstrumentedStorageTokenFetcher } from \"@fluidframework/odsp-driver-definitions\";\nimport { IDeltasFetchResult, IDocumentDeltaStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n requestOps,\n streamObserver,\n} from \"@fluidframework/driver-utils\";\nimport { IDeltaStorageGetResponse, ISequencedDeltaOpMessage } from \"./contracts\";\nimport { EpochTracker } from \"./epochTracker\";\nimport { getWithRetryForTokenRefresh } from \"./odspUtils\";\n\n/**\n * Provides access to the underlying delta storage on the server for sharepoint driver.\n */\nexport class OdspDeltaStorageService {\n constructor(\n private readonly deltaFeedUrl: string,\n private readonly getStorageToken: InstrumentedStorageTokenFetcher,\n private readonly epochTracker: EpochTracker,\n private readonly logger: ITelemetryLogger,\n ) {\n }\n\n /**\n * Retrieves ops from cache\n * @param from - inclusive\n * @param to - exclusive\n * @param telemetryProps - properties to add when issuing telemetry events\n * @returns ops retrieved & info if result was partial (i.e. more is available)\n */\n public async get(\n from: number,\n to: number,\n telemetryProps: ITelemetryProperties,\n fetchReason?: string,\n ): Promise<IDeltasFetchResult> {\n return getWithRetryForTokenRefresh(async (options) => {\n // Note - this call ends up in getSocketStorageDiscovery() and can refresh token\n // Thus it needs to be done before we call getStorageToken() to reduce extra calls\n const baseUrl = this.buildUrl(from, to);\n const storageToken = await this.getStorageToken(options, \"DeltaStorage\");\n\n const formBoundary = uuid();\n let postBody = `--${formBoundary}\\r\\n`;\n postBody += `Authorization: Bearer ${storageToken}\\r\\n`;\n postBody += `X-HTTP-Method-Override: GET\\r\\n`;\n\n postBody += `_post: 1\\r\\n`;\n postBody += `\\r\\n--${formBoundary}--`;\n const headers: { [index: string]: any; } = {\n \"Content-Type\": `multipart/form-data;boundary=${formBoundary}`,\n };\n\n // Some request take a long time (1-2 minutes) to complete, where telemetry shows very small amount\n // of time spent on server, and usually small payload sizes. I.e. all the time is spent somewhere in\n // networking. Even bigger problem - a lot of requests timeout (based on cursory look - after 1-2 minutes)\n // So adding some timeout to ensure we retry again in hope of faster success.\n // Please see https://github.com/microsoft/FluidFramework/issues/6997 for details.\n const abort = new AbortController();\n const timer = setTimeout(() => abort.abort(), 30000);\n\n const response = await this.epochTracker.fetchAndParseAsJSON<IDeltaStorageGetResponse>(\n baseUrl,\n {\n headers,\n body: postBody,\n method: \"POST\",\n signal: abort.signal,\n },\n \"ops\",\n true,\n fetchReason,\n );\n clearTimeout(timer);\n const deltaStorageResponse = response.content;\n let messages: ISequencedDocumentMessage[];\n if (deltaStorageResponse.value.length > 0 && \"op\" in deltaStorageResponse.value[0]) {\n messages = (deltaStorageResponse.value as ISequencedDeltaOpMessage[]).map((operation) => operation.op);\n } else {\n messages = deltaStorageResponse.value as ISequencedDocumentMessage[];\n }\n\n this.logger.sendPerformanceEvent({\n eventName: \"OpsFetch\",\n headers: Object.keys(headers).length !== 0 ? true : undefined,\n length: messages.length,\n duration: response.duration, // this duration for single attempt!\n ...response.propsToLog,\n attempts: options.refresh ? 2 : 1,\n from,\n to,\n ...telemetryProps,\n });\n\n // It is assumed that server always returns all the ops that it has in the range that was requested.\n // This may change in the future, if so, we need to adjust and receive \"end\" value from server in such case.\n return { messages, partialResult: false };\n });\n }\n\n public buildUrl(from: number, to: number) {\n const filter = encodeURIComponent(`sequenceNumber ge ${from} and sequenceNumber le ${to - 1}`);\n const queryString = `?ump=1&filter=${filter}`;\n return `${this.deltaFeedUrl}${queryString}`;\n }\n}\n\nexport class OdspDeltaStorageWithCache implements IDocumentDeltaStorageService {\n private firstCacheMiss = Number.MAX_SAFE_INTEGER;\n\n public constructor(\n private snapshotOps: ISequencedDocumentMessage[] | undefined,\n private readonly logger: ITelemetryLogger,\n private readonly batchSize: number,\n private readonly concurrency: number,\n private readonly getFromStorage: (\n from: number,\n to: number,\n telemetryProps: ITelemetryProperties,\n fetchReason?: string) => Promise<IDeltasFetchResult>,\n private readonly getCached: (from: number, to: number) => Promise<ISequencedDocumentMessage[]>,\n private readonly requestFromSocket: (from: number, to: number) => void,\n private readonly opsReceived: (ops: ISequencedDocumentMessage[]) => void,\n ) {\n }\n\n protected validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number) {\n if (messages.length !== 0) {\n const start = messages[0].sequenceNumber;\n const length = messages.length;\n const last = messages[length - 1].sequenceNumber;\n if (start !== from) {\n this.logger.sendErrorEvent({ eventName: \"OpsFetchViolation\", reason, from, start, last, length });\n messages.length = 0;\n }\n if (last + 1 !== from + length) {\n this.logger.sendErrorEvent({ eventName: \"OpsFetchViolation\", reason, from, start, last, length });\n // we can do better here by finding consecutive sub-block and return it\n messages.length = 0;\n }\n }\n }\n\n public fetchMessages(\n fromTotal: number,\n toTotal: number | undefined,\n abortSignal?: AbortSignal,\n cachedOnly?: boolean,\n fetchReason?: string) {\n // We do not control what's in the cache. Current API assumes that fetchMessages() keeps banging on\n // storage / cache until it gets ops it needs. This would result in deadlock if fixed range is asked from\n // cache and it's not there.\n // Better implementation would be to return only what we have in cache, but that also breaks API\n assert(!cachedOnly || toTotal === undefined, 0x1e3);\n\n let opsFromSnapshot = 0;\n let opsFromCache = 0;\n let opsFromStorage = 0;\n\n const requestCallback = async (from: number, to: number, telemetryProps: ITelemetryProperties) => {\n if (this.snapshotOps !== undefined && this.snapshotOps.length !== 0) {\n const messages = this.snapshotOps.filter((op) =>\n op.sequenceNumber >= from && op.sequenceNumber < to);\n this.validateMessages(\"cached\", messages, from);\n if (messages.length > 0 && messages[0].sequenceNumber === from) {\n this.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);\n opsFromSnapshot = messages.length;\n return { messages, partialResult: true };\n }\n this.snapshotOps = undefined;\n }\n\n // Kick out request to PUSH for ops if it has them\n this.requestFromSocket(from, to);\n\n // Cache in normal flow is continuous. Once there is a miss, stop consulting cache.\n // This saves a bit of processing time\n if (from < this.firstCacheMiss) {\n const messagesFromCache = await this.getCached(from, to);\n this.validateMessages(\"cached\", messagesFromCache, from);\n if (messagesFromCache.length !== 0) {\n opsFromCache += messagesFromCache.length;\n return {\n messages: messagesFromCache,\n partialResult: true,\n };\n }\n this.firstCacheMiss = Math.min(this.firstCacheMiss, from);\n }\n\n if (cachedOnly) {\n return { messages: [], partialResult: false };\n }\n\n const ops = await this.getFromStorage(from, to, telemetryProps, fetchReason);\n this.validateMessages(\"storage\", ops.messages, from);\n opsFromStorage += ops.messages.length;\n this.opsReceived(ops.messages);\n return ops;\n };\n\n const stream = requestOps(\n async (from: number, to: number, telemetryProps: ITelemetryProperties) => {\n const result = await requestCallback(from, to, telemetryProps);\n // Catch all case, just in case\n this.validateMessages(\"catch all\", result.messages, from);\n return result;\n },\n // Staging: starting with no concurrency, listening for feedback first.\n // In future releases we will switch to actual concurrency\n this.concurrency,\n fromTotal, // inclusive\n toTotal, // exclusive\n this.batchSize,\n this.logger,\n abortSignal,\n fetchReason,\n );\n\n return streamObserver(stream, (result) => {\n if (result.done && opsFromSnapshot + opsFromCache + opsFromStorage !== 0) {\n this.logger.sendPerformanceEvent({\n eventName: \"CacheOpsRetrieved\",\n opsFromSnapshot,\n opsFromCache,\n opsFromStorage,\n });\n }\n });\n }\n}\n"]}
|
|
@@ -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;AAStE,OAAO,EACH,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,wBAAwB,EAE3B,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;AAStE,OAAO,EACH,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EACvB,wBAAwB,EAE3B,MAAM,oCAAoC,CAAC;AAO5C,OAAO,EACH,OAAO,EACP,yBAAyB,EAC5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EAEjB,iBAAiB,EACjB,+BAA+B,EAElC,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,EAAE,IAAI,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAA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,YAAY,CAErC;IACD,IAAW,QAAQ,6BAElB;IAED;;;;OAIG;IACU,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAwBjE;;;;OAIG;IACU,qBAAqB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IA+B3E,uEAAuE;IACvE,OAAO,CAAC,uBAAuB;IAW/B;;;;OAIG;IACU,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAuErF,OAAO,CAAC,qBAAqB;YAOf,0BAA0B;YAa1B,WAAW;YA0BX,eAAe;IA2E7B,OAAO,CAAC,gCAAgC;IAKxC;;;;;;;;;OASG;YACW,qBAAqB;IAkC5B,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG;IAa1B,SAAS,KAAK,QAAQ,yBA8BrB;IAID,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,yBAAyB,EAAE;CAQzD"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { performance } from "@fluidframework/common-utils";
|
|
6
6
|
import { ChildLogger, loggerToMonitoringContext, normalizeError, } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { DriverErrorType, } from "@fluidframework/driver-definitions";
|
|
8
|
-
import { canRetryOnError, DeltaStreamConnectionForbiddenError, NonRetryableError } from "@fluidframework/driver-utils";
|
|
8
|
+
import { canRetryOnError, DeltaStreamConnectionForbiddenError, NonRetryableError, } from "@fluidframework/driver-utils";
|
|
9
9
|
import { OdspErrorType, } from "@fluidframework/odsp-driver-definitions";
|
|
10
10
|
import { OdspDeltaStorageService, OdspDeltaStorageWithCache } from "./odspDeltaStorageService";
|
|
11
11
|
import { OdspDocumentDeltaConnection } from "./odspDocumentDeltaConnection";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentService.js","sourceRoot":"","sources":["../src/odspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CA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E,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 { 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 { IFacetCodes } from \"@fluidframework/odsp-doclib-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 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 /**\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 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 // 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.on(\"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 });\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 return this.joinSessionCore(requestSocketToken, options).catch((e) => {\n const likelyFacetCodes = e as IFacetCodes;\n if (Array.isArray(likelyFacetCodes.facetCodes)) {\n for (const code of likelyFacetCodes.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 }\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 }\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,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EACH,WAAW,EAEX,yBAAyB,EAEzB,cAAc,GACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAOH,eAAe,GAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,eAAe,EACf,mCAAmC,EACnC,iBAAiB,GACpB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EAMH,aAAa,GAChB,MAAM,yCAAyC,CAAC;AAIjD,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,OA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a,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 { 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 {\n canRetryOnError,\n DeltaStreamConnectionForbiddenError,\n NonRetryableError,\n} from \"@fluidframework/driver-utils\";\nimport { IFacetCodes } from \"@fluidframework/odsp-doclib-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 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 /**\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 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 // 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.on(\"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 });\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 return this.joinSessionCore(requestSocketToken, options).catch((e) => {\n const likelyFacetCodes = e as IFacetCodes;\n if (Array.isArray(likelyFacetCodes.facetCodes)) {\n for (const code of likelyFacetCodes.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 }\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 }\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"]}
|
|
@@ -9,7 +9,8 @@ import { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore
|
|
|
9
9
|
* Factory for creating the sharepoint document service. Use this if you want to
|
|
10
10
|
* use the sharepoint implementation.
|
|
11
11
|
*/
|
|
12
|
-
export declare class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore
|
|
12
|
+
export declare class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {
|
|
13
13
|
constructor(getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined, persistedCache?: IPersistedCache, hostPolicy?: HostStoragePolicy);
|
|
14
14
|
}
|
|
15
|
+
export declare function createLocalOdspDocumentServiceFactory(localSnapshot: Uint8Array | string): IDocumentServiceFactory;
|
|
15
16
|
//# sourceMappingURL=odspDocumentServiceFactory.d.ts.map
|
|
@@ -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;AAKlF;;;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;CAUrC;AAED,wBAAgB,qCAAqC,CAAC,aAAa,EAAE,UAAU,GAAG,MAAM,GAAG,uBAAuB,CAEjH"}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore";
|
|
6
6
|
import { getSocketIo } from "./getSocketIo";
|
|
7
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
8
|
+
import { LocalOdspDocumentServiceFactory } from "./localOdspDriver/localOdspDocumentServiceFactory";
|
|
7
9
|
/**
|
|
8
10
|
* Factory for creating the sharepoint document service. Use this if you want to
|
|
9
11
|
* use the sharepoint implementation.
|
|
@@ -13,4 +15,7 @@ export class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {
|
|
|
13
15
|
super(getStorageToken, getWebsocketToken, async () => getSocketIo(), persistedCache, hostPolicy);
|
|
14
16
|
}
|
|
15
17
|
}
|
|
18
|
+
export function createLocalOdspDocumentServiceFactory(localSnapshot) {
|
|
19
|
+
return new LocalOdspDocumentServiceFactory(localSnapshot);
|
|
20
|
+
}
|
|
16
21
|
//# sourceMappingURL=odspDocumentServiceFactory.js.map
|
|
@@ -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,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactory.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,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,KAAK,IAAI,EAAE,CAAC,WAAW,EAAE,EACzB,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\";\nimport { getSocketIo } from \"./getSocketIo\";\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 async () => getSocketIo(),\n persistedCache,\n hostPolicy,\n );\n }\n}\n\nexport function createLocalOdspDocumentServiceFactory(localSnapshot: Uint8Array | string): IDocumentServiceFactory {\n return new LocalOdspDocumentServiceFactory(localSnapshot);\n}\n"]}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
6
6
|
import { IDocumentService, IDocumentServiceFactory, IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
7
7
|
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
8
|
+
import { TelemetryLogger } from "@fluidframework/telemetry-utils";
|
|
8
9
|
import { OdspResourceTokenFetchOptions, TokenFetcher, IPersistedCache, HostStoragePolicy } from "@fluidframework/odsp-driver-definitions";
|
|
9
10
|
import type { io as SocketIOClientStatic } from "socket.io-client";
|
|
11
|
+
import { ICacheAndTracker } from "./epochTracker";
|
|
10
12
|
/**
|
|
11
13
|
* Factory for creating the sharepoint document service. Use this if you want to
|
|
12
14
|
* use the sharepoint implementation.
|
|
@@ -36,6 +38,6 @@ export declare class OdspDocumentServiceFactoryCore implements IDocumentServiceF
|
|
|
36
38
|
*/
|
|
37
39
|
constructor(getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined, getSocketIOClient: () => Promise<typeof SocketIOClientStatic>, persistedCache?: IPersistedCache, hostPolicy?: HostStoragePolicy);
|
|
38
40
|
createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
|
|
39
|
-
|
|
41
|
+
protected createDocumentServiceCore(resolvedUrl: IResolvedUrl, odspLogger: TelemetryLogger, cacheAndTrackerArg?: ICacheAndTracker, clientIsSummarizer?: boolean): Promise<IDocumentService>;
|
|
40
42
|
}
|
|
41
43
|
//# sourceMappingURL=odspDocumentServiceFactoryCore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentServiceFactoryCore.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EACH,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactoryCore.d.ts","sourceRoot":"","sources":["../src/odspDocumentServi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V,kBAAkB,CAAC,CAAC;QAExB,MAAM,mBAAmB,GAAG,8BAA8B,CACtD,UAAU,EACV,eAAe,EACf,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,sBAAsB,CAC9B,CAAC;QAEF,MAAM,qBAAqB,GAAG,IAAI,CAAC,iBAAiB,KAAK,SAAS;YAC9D,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,KAAK,EAAE,OAA0B,EAAE,EAAE,CAAC,8BAA8B,CAClE,UAAU,EACV,eAAe,EACf,IAAI,CAAC,iBAAkB,EACvB,KAAK,CAAC,sBAAsB,CAC/B,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QAEpC,OAAO,mBAAmB,CAAC,MAAM,CAC7B,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,UAAU,EACV,IAAI,CAAC,iBAAiB,EACtB,eAAe,CAAC,KAAK,EACrB,IAAI,CAAC,UAAU,EACf,eAAe,CAAC,YAAY,EAC5B,IAAI,CAAC,wBAAwB,EAC7B,kBAAkB,CACrB,CAAC;IACN,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport {\n IDocumentService,\n IDocumentServiceFactory,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport {\n TelemetryLogger,\n PerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n getDocAttributesFromProtocolSummary,\n ensureFluidResolvedUrl,\n} from \"@fluidframework/driver-utils\";\nimport {\n TokenFetchOptions,\n OdspResourceTokenFetchOptions,\n TokenFetcher,\n IPersistedCache,\n HostStoragePolicy,\n IFileEntry,\n IOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport type { io as SocketIOClientStatic } from \"socket.io-client\";\nimport { v4 as uuid } from \"uuid\";\nimport {\n LocalPersistentCache,\n NonPersistentCache,\n} from \"./odspCache\";\nimport {\n createOdspCacheAndTracker,\n ICacheAndTracker,\n} from \"./epochTracker\";\nimport { OdspDocumentService } from \"./odspDocumentService\";\nimport { INewFileInfo, getOdspResolvedUrl, createOdspLogger, toInstrumentedOdspTokenFetcher } from \"./odspUtils\";\nimport { createNewFluidFile } from \"./createFile\";\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n *\n * This constructor should be used by environments that support dynamic imports and that wish\n * to leverage code splitting as a means to keep bundles as small as possible.\n */\nexport class OdspDocumentServiceFactoryCore implements IDocumentServiceFactory {\n public readonly protocolName = \"fluid-odsp:\";\n\n private readonly nonPersistentCache = new NonPersistentCache();\n private readonly socketReferenceKeyPrefix?: string;\n\n public async createContainer(\n createNewSummary: ISummaryTree | undefined,\n createNewResolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n ensureFluidResolvedUrl(createNewResolvedUrl);\n\n let odspResolvedUrl = getOdspResolvedUrl(createNewResolvedUrl);\n const resolvedUrlData: IOdspUrlParts = {\n siteUrl: odspResolvedUrl.siteUrl,\n driveId: odspResolvedUrl.driveId,\n itemId: odspResolvedUrl.itemId,\n };\n const [, queryString] = odspResolvedUrl.url.split(\"?\");\n\n const searchParams = new URLSearchParams(queryString);\n const filePath = searchParams.get(\"path\");\n if (filePath === undefined || filePath === null) {\n throw new Error(\"File path should be provided!!\");\n }\n\n const protocolSummary = createNewSummary?.tree[\".protocol\"];\n if (protocolSummary) {\n const documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary as ISummaryTree);\n if (documentAttributes?.sequenceNumber !== 0) {\n throw new Error(\"Seq number in detached ODSP container should be 0\");\n }\n }\n\n const newFileInfo: INewFileInfo = {\n driveId: odspResolvedUrl.driveId,\n siteUrl: odspResolvedUrl.siteUrl,\n filePath,\n filename: odspResolvedUrl.fileName,\n // set createLinkType to undefined if enableShareLinkWithCreate is set to false,\n // so that share link creation with create file can be enabled\n createLinkType: this.hostPolicy.enableShareLinkWithCreate ?\n odspResolvedUrl.shareLinkInfo?.createLink?.type : undefined,\n };\n\n const odspLogger = createOdspLogger(logger);\n\n const fileEntry: IFileEntry = { resolvedUrl: odspResolvedUrl, docId: odspResolvedUrl.hashedDocumentId };\n const cacheAndTracker = createOdspCacheAndTracker(\n this.persistedCache,\n this.nonPersistentCache,\n fileEntry,\n odspLogger,\n clientIsSummarizer);\n\n return PerformanceEvent.timedExecAsync(\n odspLogger,\n {\n eventName: \"CreateNew\",\n isWithSummaryUpload: true,\n },\n async (event) => {\n odspResolvedUrl = await createNewFluidFile(\n toInstrumentedOdspTokenFetcher(\n odspLogger,\n resolvedUrlData,\n this.getStorageToken,\n true /* throwOnNullToken */,\n ),\n newFileInfo,\n odspLogger,\n createNewSummary,\n cacheAndTracker.epochTracker,\n fileEntry,\n this.hostPolicy.cacheCreateNewSummary ?? true,\n !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n odspResolvedUrl.isClpCompliantApp,\n );\n const docService = this.createDocumentServiceCore(odspResolvedUrl, odspLogger,\n cacheAndTracker, clientIsSummarizer);\n event.end({\n docId: odspResolvedUrl.hashedDocumentId,\n });\n return docService;\n });\n }\n\n /**\n * @param getStorageToken - function that can provide the storage token for a given site. This is\n * is also referred to as the \"Vroom\" token in SPO.\n * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also\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 storageFetchWrapper - if not provided FetchWrapper will be used\n * @param deltasFetchWrapper - if not provided FetchWrapper will be used\n * @param persistedCache - PersistedCache provided by host for use in this session.\n */\n constructor(\n private readonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n private readonly getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,\n private readonly getSocketIOClient: () => Promise<typeof SocketIOClientStatic>,\n protected persistedCache: IPersistedCache = new LocalPersistentCache(),\n private readonly hostPolicy: HostStoragePolicy = {},\n ) {\n if (this.hostPolicy.isolateSocketCache === true) {\n // create the key to separate the socket reuse cache\n this.socketReferenceKeyPrefix = uuid();\n }\n // Set enableRedeemFallback by default as true.\n this.hostPolicy.enableRedeemFallback = this.hostPolicy.enableRedeemFallback ?? true;\n this.hostPolicy.sessionOptions = {\n forceAccessTokenViaAuthorizationHeader: true,\n ...this.hostPolicy.sessionOptions,\n };\n }\n\n public async createDocumentService(\n resolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n return this.createDocumentServiceCore(resolvedUrl, createOdspLogger(logger), undefined, clientIsSummarizer);\n }\n\n private async createDocumentServiceCore(\n resolvedUrl: IResolvedUrl,\n odspLogger: TelemetryLogger,\n cacheAndTrackerArg?: ICacheAndTracker,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n const resolvedUrlData: IOdspUrlParts = {\n siteUrl: odspResolvedUrl.siteUrl,\n driveId: odspResolvedUrl.driveId,\n itemId: odspResolvedUrl.itemId,\n };\n const cacheAndTracker = cacheAndTrackerArg ?? createOdspCacheAndTracker(\n this.persistedCache,\n this.nonPersistentCache,\n { resolvedUrl: odspResolvedUrl, docId: odspResolvedUrl.hashedDocumentId },\n odspLogger,\n clientIsSummarizer);\n\n const storageTokenFetcher = toInstrumentedOdspTokenFetcher(\n odspLogger,\n resolvedUrlData,\n this.getStorageToken,\n true /* throwOnNullToken */,\n );\n\n const webSocketTokenFetcher = this.getWebsocketToken === undefined\n ? undefined\n : async (options: TokenFetchOptions) => toInstrumentedOdspTokenFetcher(\n odspLogger,\n resolvedUrlData,\n this.getWebsocketToken!,\n false /* throwOnNullToken */,\n )(options, \"GetWebsocketToken\");\n\n return OdspDocumentService.create(\n resolvedUrl,\n storageTokenFetcher,\n webSocketTokenFetcher,\n odspLogger,\n this.getSocketIOClient,\n cacheAndTracker.cache,\n this.hostPolicy,\n cacheAndTracker.epochTracker,\n this.socketReferenceKeyPrefix,\n clientIsSummarizer,\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactoryCore.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAEH,gBAAgB,GACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,mCAAmC,EACnC,sBAAsB,GACzB,MAAM,8BAA8B,CAAC;AAWtC,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EACH,oBAAoB,EACpB,kBAAkB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,yBAAyB,GAE5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAgB,kBAAkB,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,OAAO,8BAA8B;IAyFvC;;;;;;;;;OASG;IACH,YACqB,eAA4D,EAC5D,iBAA0E,EAC1E,iBAA6D,EACpE,iBAAkC,IAAI,oBAAoB,EAAE,EACrD,aAAgC,EAAE;;QAJlC,oBAAe,GAAf,eAAe,CAA6C;QAC5D,sBAAiB,GAAjB,iBAAiB,CAAyD;QAC1E,sBAAiB,GAAjB,iBAAiB,CAA4C;QACpE,mBAAc,GAAd,cAAc,CAA8C;QACrD,eAAU,GAAV,UAAU,CAAwB;QAvGvC,iBAAY,GAAG,aAAa,CAAC;QAE5B,uBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAuG3D,IAAI,IAAI,CAAC,UAAU,CAAC,kBAAkB,KAAK,IAAI,EAAE;YAC7C,oDAAoD;YAC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AAC,8BAA8B,CAClE,UAAU,EACV,eAAe,EACf,IAAI,CAAC,iBAAkB,EACvB,KAAK,CAAC,sBAAsB,CAC/B,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QAEpC,OAAO,mBAAmB,CAAC,MAAM,CAC7B,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,UAAU,EACV,IAAI,CAAC,iBAAiB,EACtB,eAAe,CAAC,KAAK,EACrB,IAAI,CAAC,UAAU,EACf,eAAe,CAAC,YAAY,EAC5B,IAAI,CAAC,wBAAwB,EAC7B,kBAAkB,CACrB,CAAC;IACN,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport {\n IDocumentService,\n IDocumentServiceFactory,\n IResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport {\n TelemetryLogger,\n PerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n getDocAttributesFromProtocolSummary,\n ensureFluidResolvedUrl,\n} from \"@fluidframework/driver-utils\";\nimport {\n TokenFetchOptions,\n OdspResourceTokenFetchOptions,\n TokenFetcher,\n IPersistedCache,\n HostStoragePolicy,\n IFileEntry,\n IOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport type { io as SocketIOClientStatic } from \"socket.io-client\";\nimport { v4 as uuid } from \"uuid\";\nimport {\n LocalPersistentCache,\n NonPersistentCache,\n} from \"./odspCache\";\nimport {\n createOdspCacheAndTracker,\n ICacheAndTracker,\n} from \"./epochTracker\";\nimport { OdspDocumentService } from \"./odspDocumentService\";\nimport { INewFileInfo, getOdspResolvedUrl, createOdspLogger, toInstrumentedOdspTokenFetcher } from \"./odspUtils\";\nimport { createNewFluidFile } from \"./createFile\";\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n *\n * This constructor should be used by environments that support dynamic imports and that wish\n * to leverage code splitting as a means to keep bundles as small as possible.\n */\nexport class OdspDocumentServiceFactoryCore implements IDocumentServiceFactory {\n public readonly protocolName = \"fluid-odsp:\";\n\n private readonly nonPersistentCache = new NonPersistentCache();\n private readonly socketReferenceKeyPrefix?: string;\n\n public async createContainer(\n createNewSummary: ISummaryTree | undefined,\n createNewResolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n ensureFluidResolvedUrl(createNewResolvedUrl);\n\n let odspResolvedUrl = getOdspResolvedUrl(createNewResolvedUrl);\n const resolvedUrlData: IOdspUrlParts = {\n siteUrl: odspResolvedUrl.siteUrl,\n driveId: odspResolvedUrl.driveId,\n itemId: odspResolvedUrl.itemId,\n };\n const [, queryString] = odspResolvedUrl.url.split(\"?\");\n\n const searchParams = new URLSearchParams(queryString);\n const filePath = searchParams.get(\"path\");\n if (filePath === undefined || filePath === null) {\n throw new Error(\"File path should be provided!!\");\n }\n\n const protocolSummary = createNewSummary?.tree[\".protocol\"];\n if (protocolSummary) {\n const documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary as ISummaryTree);\n if (documentAttributes?.sequenceNumber !== 0) {\n throw new Error(\"Seq number in detached ODSP container should be 0\");\n }\n }\n\n const newFileInfo: INewFileInfo = {\n driveId: odspResolvedUrl.driveId,\n siteUrl: odspResolvedUrl.siteUrl,\n filePath,\n filename: odspResolvedUrl.fileName,\n // set createLinkType to undefined if enableShareLinkWithCreate is set to false,\n // so that share link creation with create file can be enabled\n createLinkType: this.hostPolicy.enableShareLinkWithCreate ?\n odspResolvedUrl.shareLinkInfo?.createLink?.type : undefined,\n };\n\n const odspLogger = createOdspLogger(logger);\n\n const fileEntry: IFileEntry = { resolvedUrl: odspResolvedUrl, docId: odspResolvedUrl.hashedDocumentId };\n const cacheAndTracker = createOdspCacheAndTracker(\n this.persistedCache,\n this.nonPersistentCache,\n fileEntry,\n odspLogger,\n clientIsSummarizer);\n\n return PerformanceEvent.timedExecAsync(\n odspLogger,\n {\n eventName: \"CreateNew\",\n isWithSummaryUpload: true,\n },\n async (event) => {\n odspResolvedUrl = await createNewFluidFile(\n toInstrumentedOdspTokenFetcher(\n odspLogger,\n resolvedUrlData,\n this.getStorageToken,\n true /* throwOnNullToken */,\n ),\n newFileInfo,\n odspLogger,\n createNewSummary,\n cacheAndTracker.epochTracker,\n fileEntry,\n this.hostPolicy.cacheCreateNewSummary ?? true,\n !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n odspResolvedUrl.isClpCompliantApp,\n );\n const docService = this.createDocumentServiceCore(odspResolvedUrl, odspLogger,\n cacheAndTracker, clientIsSummarizer);\n event.end({\n docId: odspResolvedUrl.hashedDocumentId,\n });\n return docService;\n });\n }\n\n /**\n * @param getStorageToken - function that can provide the storage token for a given site. This is\n * is also referred to as the \"Vroom\" token in SPO.\n * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also\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 storageFetchWrapper - if not provided FetchWrapper will be used\n * @param deltasFetchWrapper - if not provided FetchWrapper will be used\n * @param persistedCache - PersistedCache provided by host for use in this session.\n */\n constructor(\n private readonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n private readonly getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,\n private readonly getSocketIOClient: () => Promise<typeof SocketIOClientStatic>,\n protected persistedCache: IPersistedCache = new LocalPersistentCache(),\n private readonly hostPolicy: HostStoragePolicy = {},\n ) {\n if (this.hostPolicy.isolateSocketCache === true) {\n // create the key to separate the socket reuse cache\n this.socketReferenceKeyPrefix = uuid();\n }\n // Set enableRedeemFallback by default as true.\n this.hostPolicy.enableRedeemFallback = this.hostPolicy.enableRedeemFallback ?? true;\n this.hostPolicy.sessionOptions = {\n forceAccessTokenViaAuthorizationHeader: true,\n ...this.hostPolicy.sessionOptions,\n };\n }\n\n public async createDocumentService(\n resolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n return this.createDocumentServiceCore(resolvedUrl, createOdspLogger(logger), undefined, clientIsSummarizer);\n }\n\n protected async createDocumentServiceCore(\n resolvedUrl: IResolvedUrl,\n odspLogger: TelemetryLogger,\n cacheAndTrackerArg?: ICacheAndTracker,\n clientIsSummarizer?: boolean,\n ): Promise<IDocumentService> {\n const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n const resolvedUrlData: IOdspUrlParts = {\n siteUrl: odspResolvedUrl.siteUrl,\n driveId: odspResolvedUrl.driveId,\n itemId: odspResolvedUrl.itemId,\n };\n const cacheAndTracker = cacheAndTrackerArg ?? createOdspCacheAndTracker(\n this.persistedCache,\n this.nonPersistentCache,\n { resolvedUrl: odspResolvedUrl, docId: odspResolvedUrl.hashedDocumentId },\n odspLogger,\n clientIsSummarizer);\n\n const storageTokenFetcher = toInstrumentedOdspTokenFetcher(\n odspLogger,\n resolvedUrlData,\n this.getStorageToken,\n true /* throwOnNullToken */,\n );\n\n const webSocketTokenFetcher = this.getWebsocketToken === undefined\n ? undefined\n : async (options: TokenFetchOptions) => toInstrumentedOdspTokenFetcher(\n odspLogger,\n resolvedUrlData,\n this.getWebsocketToken!,\n false /* throwOnNullToken */,\n )(options, \"GetWebsocketToken\");\n\n return OdspDocumentService.create(\n resolvedUrl,\n storageTokenFetcher,\n webSocketTokenFetcher,\n odspLogger,\n this.getSocketIOClient,\n cacheAndTracker.cache,\n this.hostPolicy,\n cacheAndTracker.epochTracker,\n this.socketReferenceKeyPrefix,\n clientIsSummarizer,\n );\n }\n}\n"]}
|
|
@@ -4,15 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
6
|
import * as api from "@fluidframework/protocol-definitions";
|
|
7
|
-
import { ISummaryContext
|
|
7
|
+
import { ISummaryContext } from "@fluidframework/driver-definitions";
|
|
8
8
|
import { IOdspResolvedUrl, InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions";
|
|
9
9
|
import { HostStoragePolicyInternal } from "./contracts";
|
|
10
10
|
import { SnapshotFormatSupportType } from "./fetchSnapshot";
|
|
11
11
|
import { IOdspCache } from "./odspCache";
|
|
12
12
|
import { EpochTracker } from "./epochTracker";
|
|
13
13
|
import { FlushResult } from "./odspDocumentDeltaConnection";
|
|
14
|
+
import { OdspDocumentStorageServiceBase } from "./odspDocumentStorageServiceBase";
|
|
14
15
|
export declare const defaultSummarizerCacheExpiryTimeout: number;
|
|
15
|
-
export declare class OdspDocumentStorageService
|
|
16
|
+
export declare class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
16
17
|
private readonly odspResolvedUrl;
|
|
17
18
|
private readonly getStorageToken;
|
|
18
19
|
private readonly logger;
|
|
@@ -22,17 +23,8 @@ export declare class OdspDocumentStorageService implements IDocumentStorageServi
|
|
|
22
23
|
private readonly epochTracker;
|
|
23
24
|
private readonly flushCallback;
|
|
24
25
|
private readonly snapshotFormatFetchType?;
|
|
25
|
-
readonly policies: {
|
|
26
|
-
caching: LoaderCachingPolicy;
|
|
27
|
-
minBlobSize: number;
|
|
28
|
-
maximumCacheDurationMs: number;
|
|
29
|
-
};
|
|
30
|
-
private readonly commitCache;
|
|
31
|
-
private readonly attributesBlobHandles;
|
|
32
26
|
private readonly odspSummaryUploadManager;
|
|
33
|
-
private _ops;
|
|
34
27
|
private firstVersionCall;
|
|
35
|
-
private _snapshotSequenceNumber;
|
|
36
28
|
private readonly documentId;
|
|
37
29
|
private readonly snapshotUrl;
|
|
38
30
|
private readonly attachmentPOSTUrl;
|
|
@@ -45,27 +37,17 @@ export declare class OdspDocumentStorageService implements IDocumentStorageServi
|
|
|
45
37
|
private readonly maxSnapshotSizeLimit;
|
|
46
38
|
private readonly maxSnapshotFetchTimeout;
|
|
47
39
|
private readonly createBlobRateLimiter;
|
|
48
|
-
private readonly blobCache;
|
|
49
|
-
set ops(ops: api.ISequencedDocumentMessage[] | undefined);
|
|
50
|
-
get ops(): api.ISequencedDocumentMessage[] | undefined;
|
|
51
|
-
get snapshotSequenceNumber(): number | undefined;
|
|
52
40
|
constructor(odspResolvedUrl: IOdspResolvedUrl, getStorageToken: InstrumentedStorageTokenFetcher, logger: ITelemetryLogger, fetchFullSnapshot: boolean, cache: IOdspCache, hostPolicy: HostStoragePolicyInternal, epochTracker: EpochTracker, flushCallback: () => Promise<FlushResult>, snapshotFormatFetchType?: SnapshotFormatSupportType | undefined);
|
|
53
|
-
get repositoryUrl(): string;
|
|
54
41
|
createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
|
|
55
|
-
|
|
56
|
-
readBlob(blobId: string): Promise<ArrayBufferLike>;
|
|
42
|
+
protected fetchBlobFromStorage(blobId: string, evicted: boolean): Promise<ArrayBuffer>;
|
|
57
43
|
getSnapshotTree(version?: api.IVersion, scenarioName?: string): Promise<api.ISnapshotTree | null>;
|
|
58
44
|
getVersions(blobid: string | null, count: number, scenarioName?: string): Promise<api.IVersion[]>;
|
|
59
45
|
private fetchSnapshot;
|
|
60
46
|
private fetchSnapshotCore;
|
|
61
47
|
uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
62
|
-
downloadSummary(commit: api.ISummaryHandle): Promise<api.ISummaryTree>;
|
|
63
|
-
private setRootTree;
|
|
64
|
-
private initBlobsCache;
|
|
65
48
|
private checkSnapshotUrl;
|
|
66
49
|
private checkAttachmentPOSTUrl;
|
|
67
50
|
private checkAttachmentGETUrl;
|
|
68
|
-
|
|
69
|
-
private combineProtocolAndAppSnapshotTree;
|
|
51
|
+
protected fetchTreeFromSnapshot(id: string, scenarioName?: string): Promise<api.ISnapshotTree | undefined>;
|
|
70
52
|
}
|
|
71
53
|
//# sourceMappingURL=odspDocumentStorageManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentStorageManager.d.ts","sourceRoot":"","sources":["../src/odspDocumentStorageManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAQtE,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EACH,eAAe,
|
|
1
|
+
{"version":3,"file":"odspDocumentStorageManager.d.ts","sourceRoot":"","sources":["../src/odspDocumentStorageManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAQtE,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EACH,eAAe,EAElB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACH,gBAAgB,EAGhB,+BAA+B,EAClC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAEH,yBAAyB,EAG5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAA4D,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAEtH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,eAAO,MAAM,mCAAmC,EAAE,MAAkB,CAAC;AAkBrE,qBAAa,0BAA2B,SAAQ,8BAA8B;IAsBtE,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;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