@fluidframework/routerlicious-driver 2.10.0-305357 → 2.10.0-307060
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +1 -0
- package/dist/deltaStorageService.d.ts +2 -1
- package/dist/deltaStorageService.d.ts.map +1 -1
- package/dist/deltaStorageService.js +4 -2
- package/dist/deltaStorageService.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/deltaStorageService.d.ts +2 -1
- package/lib/deltaStorageService.d.ts.map +1 -1
- package/lib/deltaStorageService.js +4 -2
- package/lib/deltaStorageService.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 +9 -9
- package/src/deltaStorageService.ts +9 -1
- package/src/packageVersion.ts +1 -1
package/.eslintrc.cjs
CHANGED
|
@@ -31,6 +31,7 @@ export declare class DeltaStorageService implements IDeltaStorageService {
|
|
|
31
31
|
private readonly getDeltaStorageUrl;
|
|
32
32
|
constructor(url: string, restWrapper: RestWrapper, logger: ITelemetryLoggerExt, getRestWrapper?: () => Promise<RestWrapper>, getDeltaStorageUrl?: () => string);
|
|
33
33
|
get(tenantId: string, id: string, from: number, // inclusive
|
|
34
|
-
to: number
|
|
34
|
+
to: number, // exclusive
|
|
35
|
+
fetchReason?: string): Promise<IDeltasFetchResult>;
|
|
35
36
|
}
|
|
36
37
|
//# sourceMappingURL=deltaStorageService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deltaStorageService.d.ts","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC5B,OAAO,EACP,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAOrD,OAAO,EACN,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
|
}
|
|
50
50
|
this.snapshotOps = undefined;
|
|
51
51
|
}
|
|
52
|
-
const ops = await this.deltaStorageService.get(this.tenantId, this.id, from, to);
|
|
52
|
+
const ops = await this.deltaStorageService.get(this.tenantId, this.id, from, to, fetchReason);
|
|
53
53
|
(0, internal_1.validateMessages)("storage", ops.messages, from, this.logger, false /* strict */);
|
|
54
54
|
opsFromStorage += ops.messages.length;
|
|
55
55
|
return ops;
|
|
@@ -90,7 +90,8 @@ class DeltaStorageService {
|
|
|
90
90
|
this.getDeltaStorageUrl = getDeltaStorageUrl;
|
|
91
91
|
}
|
|
92
92
|
async get(tenantId, id, from, // inclusive
|
|
93
|
-
to
|
|
93
|
+
to, // exclusive
|
|
94
|
+
fetchReason) {
|
|
94
95
|
const ops = await internal_3.PerformanceEvent.timedExecAsync(this.logger, {
|
|
95
96
|
eventName: "OpsFetch",
|
|
96
97
|
from,
|
|
@@ -101,6 +102,7 @@ class DeltaStorageService {
|
|
|
101
102
|
const response = await restWrapper.get(url, {
|
|
102
103
|
from: from - 1,
|
|
103
104
|
to,
|
|
105
|
+
fetchReason: fetchReason ?? "",
|
|
104
106
|
});
|
|
105
107
|
event.end({
|
|
106
108
|
length: response.content.length,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deltaStorageService.js","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,mEAAoF;AAQpF,oEAK+C;AAC/C,uEAGkD;AAKlD;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B;;GAEG;AACH,MAAa,2BAA2B;IACvC,YACkB,QAAgB,EAChB,EAAU,EACV,mBAAyC,EACzC,sBAA8C,EAC9C,MAA2B;QAJ3B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAQ;QACV,wBAAmB,GAAnB,mBAAmB,CAAsB;QACzC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,WAA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Ac;oBACrD,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,cAAc;iBAC9E,CAAC;gBACF,GAAG,QAAQ,CAAC,UAAU;gBACtB,GAAG,IAAA,qBAAU,EAAC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;aACpD,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,OAAO,CAAC;QACzB,CAAC,CACD,CAAC;QAEF,oGAAoG;QACpG,4GAA4G;QAC5G,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAChD,CAAC;CACD;AA9CD,kDA8CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { getW3CData, validateMessages } from \"@fluidframework/driver-base/internal\";\nimport {\n\tIDeltaStorageService,\n\tIDeltasFetchResult,\n\tIDocumentDeltaStorageService,\n\tIStream,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\temptyMessageStream,\n\treadAndParse,\n\trequestOps,\n\tstreamObserver,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { DocumentStorageService } from \"./documentStorageService.js\";\nimport { RestWrapper } from \"./restWrapperBase.js\";\n\n/**\n * Maximum number of ops we can fetch at a time. This should be kept at 2k, as\n * server determines whether to try to fallback to long-term storage if the ops range requested is larger than\n * what they have locally available in short-term storage. So if we request 2k ops, they know it is not a\n * specific request and they don't fall to long term storage which takes time.\n * Please coordinate to AFR team if this value need to be changed.\n */\nconst MaxBatchDeltas = 2000;\n\n/**\n * Storage service limited to only being able to fetch documents for a specific document\n */\nexport class DocumentDeltaStorageService implements IDocumentDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly id: string,\n\t\tprivate readonly deltaStorageService: IDeltaStorageService,\n\t\tprivate readonly documentStorageService: DocumentStorageService,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.logtailSha = documentStorageService.logTailSha;\n\t}\n\n\tprivate logtailSha: string | undefined;\n\tprivate snapshotOps: ISequencedDocumentMessage[] | undefined;\n\n\tfetchMessages(\n\t\tfromTotal: number,\n\t\ttoTotal: number | undefined,\n\t\tabortSignal?: AbortSignal,\n\t\tcachedOnly?: boolean,\n\t\tfetchReason?: string,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\tif (cachedOnly) {\n\t\t\treturn emptyMessageStream;\n\t\t}\n\n\t\tlet opsFromSnapshot = 0;\n\t\tlet opsFromStorage = 0;\n\t\tconst requestCallback = async (\n\t\t\tfrom: number,\n\t\t\tto: number,\n\t\t\ttelemetryProps: ITelemetryBaseProperties,\n\t\t) => {\n\t\t\tthis.snapshotOps = this.logtailSha\n\t\t\t\t? await readAndParse<ISequencedDocumentMessage[]>(\n\t\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\t\tthis.logtailSha,\n\t\t\t\t\t)\n\t\t\t\t: [];\n\t\t\tthis.logtailSha = undefined;\n\n\t\t\tif (this.snapshotOps !== undefined && this.snapshotOps.length !== 0) {\n\t\t\t\tconst messages = this.snapshotOps.filter(\n\t\t\t\t\t(op) => op.sequenceNumber >= from && op.sequenceNumber < to,\n\t\t\t\t);\n\t\t\t\tvalidateMessages(\"snapshotOps\", messages, from, this.logger, false /* strict */);\n\t\t\t\tif (messages.length > 0 && messages[0].sequenceNumber === from) {\n\t\t\t\t\tthis.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);\n\t\t\t\t\topsFromSnapshot += messages.length;\n\t\t\t\t\treturn { messages, partialResult: true };\n\t\t\t\t}\n\t\t\t\tthis.snapshotOps = undefined;\n\t\t\t}\n\n\t\t\tconst ops = await this.deltaStorageService.get(this.tenantId, this.id, from, to);\n\t\t\tvalidateMessages(\"storage\", ops.messages, from, this.logger, false /* strict */);\n\t\t\topsFromStorage += ops.messages.length;\n\t\t\treturn ops;\n\t\t};\n\n\t\tconst stream = requestOps(\n\t\t\tasync (from: number, to: number, telemetryProps: ITelemetryBaseProperties) => {\n\t\t\t\tconst result = await requestCallback(from, to, telemetryProps);\n\t\t\t\t// Catch all case, just in case\n\t\t\t\tvalidateMessages(\"catch all\", result.messages, from, this.logger);\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\t// Staging: starting with no concurrency, listening for feedback first.\n\t\t\t// In future releases we will switch to actual concurrency\n\t\t\t1, // concurrency\n\t\t\tfromTotal, // inclusive\n\t\t\ttoTotal, // exclusive\n\t\t\tMaxBatchDeltas,\n\t\t\tthis.logger,\n\t\t\tabortSignal,\n\t\t\tfetchReason,\n\t\t);\n\n\t\treturn streamObserver(stream, (result) => {\n\t\t\tif (result.done && opsFromSnapshot + opsFromStorage !== 0) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"CacheOpsRetrieved\",\n\t\t\t\t\topsFromSnapshot,\n\t\t\t\t\topsFromStorage,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Provides access to the underlying delta storage on the server for routerlicious driver.\n */\nexport class DeltaStorageService implements IDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly url: string,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly getRestWrapper: () => Promise<RestWrapper> = async () => this.restWrapper,\n\t\tprivate readonly getDeltaStorageUrl: () => string = () => this.url,\n\t) {}\n\n\tpublic async get(\n\t\ttenantId: string,\n\t\tid: string,\n\t\tfrom: number, // inclusive\n\t\tto: number, // exclusive\n\t): Promise<IDeltasFetchResult> {\n\t\tconst ops = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"OpsFetch\",\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst restWrapper = await this.getRestWrapper();\n\t\t\t\tconst url = this.getDeltaStorageUrl();\n\t\t\t\tconst response = await restWrapper.get<ISequencedDocumentMessage[]>(url, {\n\t\t\t\t\tfrom: from - 1,\n\t\t\t\t\tto,\n\t\t\t\t});\n\t\t\t\tevent.end({\n\t\t\t\t\tlength: response.content.length,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tfirstOpSeqNumber: response.content[0]?.sequenceNumber,\n\t\t\t\t\t\tlastOpSeqNumber: response.content[response.content.length - 1]?.sequenceNumber,\n\t\t\t\t\t}),\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\t...getW3CData(response.requestUrl, \"xmlhttprequest\"),\n\t\t\t\t});\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\n\t\t// It is assumed that server always returns all the ops that it has in the range that was requested.\n\t\t// This may change in the future, if so, we need to adjust and receive \"end\" value from server in such case.\n\t\treturn { messages: ops, partialResult: false };\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deltaStorageService.js","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,mEAAoF;AAQpF,oEAK+C;AAC/C,uEAGkD;AAKlD;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B;;GAEG;AACH,MAAa,2BAA2B;IACvC,YACkB,QAAgB,EAChB,EAAU,EACV,mBAAyC,EACzC,sBAA8C,EAC9C,MAA2B;QAJ3B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,OAAE,GAAF,EAAE,CAAQ;QACV,wBAAmB,GAAnB,mBAAmB,CAAsB;QACzC,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,WAAM,GAAN,MAAM,CAAqB;QAE5C,IAAI,CAAC,UAAU,GAAG,sBAAsB,CAAC,UAA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AAc;oBACrD,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,cAAc;iBAC9E,CAAC;gBACF,GAAG,QAAQ,CAAC,UAAU;gBACtB,GAAG,IAAA,qBAAU,EAAC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;aACpD,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,OAAO,CAAC;QACzB,CAAC,CACD,CAAC;QAEF,oGAAoG;QACpG,4GAA4G;QAC5G,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAChD,CAAC;CACD;AAhDD,kDAgDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { getW3CData, validateMessages } from \"@fluidframework/driver-base/internal\";\nimport {\n\tIDeltaStorageService,\n\tIDeltasFetchResult,\n\tIDocumentDeltaStorageService,\n\tIStream,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\temptyMessageStream,\n\treadAndParse,\n\trequestOps,\n\tstreamObserver,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { DocumentStorageService } from \"./documentStorageService.js\";\nimport { RestWrapper } from \"./restWrapperBase.js\";\n\n/**\n * Maximum number of ops we can fetch at a time. This should be kept at 2k, as\n * server determines whether to try to fallback to long-term storage if the ops range requested is larger than\n * what they have locally available in short-term storage. So if we request 2k ops, they know it is not a\n * specific request and they don't fall to long term storage which takes time.\n * Please coordinate to AFR team if this value need to be changed.\n */\nconst MaxBatchDeltas = 2000;\n\n/**\n * Storage service limited to only being able to fetch documents for a specific document\n */\nexport class DocumentDeltaStorageService implements IDocumentDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly id: string,\n\t\tprivate readonly deltaStorageService: IDeltaStorageService,\n\t\tprivate readonly documentStorageService: DocumentStorageService,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.logtailSha = documentStorageService.logTailSha;\n\t}\n\n\tprivate logtailSha: string | undefined;\n\tprivate snapshotOps: ISequencedDocumentMessage[] | undefined;\n\n\tfetchMessages(\n\t\tfromTotal: number,\n\t\ttoTotal: number | undefined,\n\t\tabortSignal?: AbortSignal,\n\t\tcachedOnly?: boolean,\n\t\tfetchReason?: string,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\tif (cachedOnly) {\n\t\t\treturn emptyMessageStream;\n\t\t}\n\n\t\tlet opsFromSnapshot = 0;\n\t\tlet opsFromStorage = 0;\n\t\tconst requestCallback = async (\n\t\t\tfrom: number,\n\t\t\tto: number,\n\t\t\ttelemetryProps: ITelemetryBaseProperties,\n\t\t) => {\n\t\t\tthis.snapshotOps = this.logtailSha\n\t\t\t\t? await readAndParse<ISequencedDocumentMessage[]>(\n\t\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\t\tthis.logtailSha,\n\t\t\t\t\t)\n\t\t\t\t: [];\n\t\t\tthis.logtailSha = undefined;\n\n\t\t\tif (this.snapshotOps !== undefined && this.snapshotOps.length !== 0) {\n\t\t\t\tconst messages = this.snapshotOps.filter(\n\t\t\t\t\t(op) => op.sequenceNumber >= from && op.sequenceNumber < to,\n\t\t\t\t);\n\t\t\t\tvalidateMessages(\"snapshotOps\", messages, from, this.logger, false /* strict */);\n\t\t\t\tif (messages.length > 0 && messages[0].sequenceNumber === from) {\n\t\t\t\t\tthis.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);\n\t\t\t\t\topsFromSnapshot += messages.length;\n\t\t\t\t\treturn { messages, partialResult: true };\n\t\t\t\t}\n\t\t\t\tthis.snapshotOps = undefined;\n\t\t\t}\n\n\t\t\tconst ops = await this.deltaStorageService.get(\n\t\t\t\tthis.tenantId,\n\t\t\t\tthis.id,\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tfetchReason,\n\t\t\t);\n\t\t\tvalidateMessages(\"storage\", ops.messages, from, this.logger, false /* strict */);\n\t\t\topsFromStorage += ops.messages.length;\n\t\t\treturn ops;\n\t\t};\n\n\t\tconst stream = requestOps(\n\t\t\tasync (from: number, to: number, telemetryProps: ITelemetryBaseProperties) => {\n\t\t\t\tconst result = await requestCallback(from, to, telemetryProps);\n\t\t\t\t// Catch all case, just in case\n\t\t\t\tvalidateMessages(\"catch all\", result.messages, from, this.logger);\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\t// Staging: starting with no concurrency, listening for feedback first.\n\t\t\t// In future releases we will switch to actual concurrency\n\t\t\t1, // concurrency\n\t\t\tfromTotal, // inclusive\n\t\t\ttoTotal, // exclusive\n\t\t\tMaxBatchDeltas,\n\t\t\tthis.logger,\n\t\t\tabortSignal,\n\t\t\tfetchReason,\n\t\t);\n\n\t\treturn streamObserver(stream, (result) => {\n\t\t\tif (result.done && opsFromSnapshot + opsFromStorage !== 0) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"CacheOpsRetrieved\",\n\t\t\t\t\topsFromSnapshot,\n\t\t\t\t\topsFromStorage,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Provides access to the underlying delta storage on the server for routerlicious driver.\n */\nexport class DeltaStorageService implements IDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly url: string,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly getRestWrapper: () => Promise<RestWrapper> = async () => this.restWrapper,\n\t\tprivate readonly getDeltaStorageUrl: () => string = () => this.url,\n\t) {}\n\n\tpublic async get(\n\t\ttenantId: string,\n\t\tid: string,\n\t\tfrom: number, // inclusive\n\t\tto: number, // exclusive\n\t\tfetchReason?: string,\n\t): Promise<IDeltasFetchResult> {\n\t\tconst ops = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"OpsFetch\",\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst restWrapper = await this.getRestWrapper();\n\t\t\t\tconst url = this.getDeltaStorageUrl();\n\t\t\t\tconst response = await restWrapper.get<ISequencedDocumentMessage[]>(url, {\n\t\t\t\t\tfrom: from - 1,\n\t\t\t\t\tto,\n\t\t\t\t\tfetchReason: fetchReason ?? \"\",\n\t\t\t\t});\n\t\t\t\tevent.end({\n\t\t\t\t\tlength: response.content.length,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tfirstOpSeqNumber: response.content[0]?.sequenceNumber,\n\t\t\t\t\t\tlastOpSeqNumber: response.content[response.content.length - 1]?.sequenceNumber,\n\t\t\t\t\t}),\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\t...getW3CData(response.requestUrl, \"xmlhttprequest\"),\n\t\t\t\t});\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\n\t\t// It is assumed that server always returns all the ops that it has in the range that was requested.\n\t\t// This may change in the future, if so, we need to adjust and receive \"end\" value from server in such case.\n\t\treturn { messages: ops, partialResult: false };\n\t}\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/routerlicious-driver";
|
|
8
|
-
export declare const pkgVersion = "2.10.0-
|
|
8
|
+
export declare const pkgVersion = "2.10.0-307060";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/routerlicious-driver";
|
|
11
|
-
exports.pkgVersion = "2.10.0-
|
|
11
|
+
exports.pkgVersion = "2.10.0-307060";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sCAAsC,CAAC;AACjD,QAAA,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/routerlicious-driver\";\nexport const pkgVersion = \"2.10.0-
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sCAAsC,CAAC;AACjD,QAAA,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/routerlicious-driver\";\nexport const pkgVersion = \"2.10.0-307060\";\n"]}
|
|
@@ -31,6 +31,7 @@ export declare class DeltaStorageService implements IDeltaStorageService {
|
|
|
31
31
|
private readonly getDeltaStorageUrl;
|
|
32
32
|
constructor(url: string, restWrapper: RestWrapper, logger: ITelemetryLoggerExt, getRestWrapper?: () => Promise<RestWrapper>, getDeltaStorageUrl?: () => string);
|
|
33
33
|
get(tenantId: string, id: string, from: number, // inclusive
|
|
34
|
-
to: number
|
|
34
|
+
to: number, // exclusive
|
|
35
|
+
fetchReason?: string): Promise<IDeltasFetchResult>;
|
|
35
36
|
}
|
|
36
37
|
//# sourceMappingURL=deltaStorageService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deltaStorageService.d.ts","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,4BAA4B,EAC5B,OAAO,EACP,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAOrD,OAAO,EACN,mBAAmB,EAEnB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAWnD;;GAEG;AACH,qBAAa,2BAA4B,YAAW,4BAA4B;IAE9E,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAJN,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,mBAAmB,EAAE,oBAAoB,EACzC,sBAAsB,EAAE,sBAAsB,EAC9C,MAAM,EAAE,mBAAmB;IAK7C,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,WAAW,CAA0C;IAE7D,aAAa,CACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,UAAU,CAAC,EAAE,OAAO,EACpB,WAAW,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,yBAAyB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"deltaStorageService.d.ts","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO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Ac,GAAE,MAAM,OAAO,CAAC,WAAW,CAAgC,EACzE,kBAAkB,GAAE,MAAM,MAAuB;IAGtD,GAAG,CACf,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EAAE,YAAY;IAC1B,EAAE,EAAE,MAAM,EAAE,YAAY;IACxB,WAAW,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,kBAAkB,CAAC;CAiC9B"}
|
|
@@ -46,7 +46,7 @@ export class DocumentDeltaStorageService {
|
|
|
46
46
|
}
|
|
47
47
|
this.snapshotOps = undefined;
|
|
48
48
|
}
|
|
49
|
-
const ops = await this.deltaStorageService.get(this.tenantId, this.id, from, to);
|
|
49
|
+
const ops = await this.deltaStorageService.get(this.tenantId, this.id, from, to, fetchReason);
|
|
50
50
|
validateMessages("storage", ops.messages, from, this.logger, false /* strict */);
|
|
51
51
|
opsFromStorage += ops.messages.length;
|
|
52
52
|
return ops;
|
|
@@ -86,7 +86,8 @@ export class DeltaStorageService {
|
|
|
86
86
|
this.getDeltaStorageUrl = getDeltaStorageUrl;
|
|
87
87
|
}
|
|
88
88
|
async get(tenantId, id, from, // inclusive
|
|
89
|
-
to
|
|
89
|
+
to, // exclusive
|
|
90
|
+
fetchReason) {
|
|
90
91
|
const ops = await PerformanceEvent.timedExecAsync(this.logger, {
|
|
91
92
|
eventName: "OpsFetch",
|
|
92
93
|
from,
|
|
@@ -97,6 +98,7 @@ export class DeltaStorageService {
|
|
|
97
98
|
const response = await restWrapper.get(url, {
|
|
98
99
|
from: from - 1,
|
|
99
100
|
to,
|
|
101
|
+
fetchReason: fetchReason ?? "",
|
|
100
102
|
});
|
|
101
103
|
event.end({
|
|
102
104
|
length: response.content.length,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deltaStorageService.js","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,gBAAgB,E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MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAChD,MAAM,GAAG,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACtC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,CAA8B,GAAG,EAAE;gBACxE,IAAI,EAAE,IAAI,GAAG,CAAC;gBACd,EAAE;aACF,CAAC,CAAC;YACH,KAAK,CAAC,GAAG,CAAC;gBACT,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM;gBAC/B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACvB,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc;oBACrD,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,cAAc;iBAC9E,CAAC;gBACF,GAAG,QAAQ,CAAC,UAAU;gBACtB,GAAG,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;aACpD,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,OAAO,CAAC;QACzB,CAAC,CACD,CAAC;QAEF,oGAAoG;QACpG,4GAA4G;QAC5G,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAChD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { getW3CData, validateMessages } from \"@fluidframework/driver-base/internal\";\nimport {\n\tIDeltaStorageService,\n\tIDeltasFetchResult,\n\tIDocumentDeltaStorageService,\n\tIStream,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\temptyMessageStream,\n\treadAndParse,\n\trequestOps,\n\tstreamObserver,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { DocumentStorageService } from \"./documentStorageService.js\";\nimport { RestWrapper } from \"./restWrapperBase.js\";\n\n/**\n * Maximum number of ops we can fetch at a time. This should be kept at 2k, as\n * server determines whether to try to fallback to long-term storage if the ops range requested is larger than\n * what they have locally available in short-term storage. So if we request 2k ops, they know it is not a\n * specific request and they don't fall to long term storage which takes time.\n * Please coordinate to AFR team if this value need to be changed.\n */\nconst MaxBatchDeltas = 2000;\n\n/**\n * Storage service limited to only being able to fetch documents for a specific document\n */\nexport class DocumentDeltaStorageService implements IDocumentDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly id: string,\n\t\tprivate readonly deltaStorageService: IDeltaStorageService,\n\t\tprivate readonly documentStorageService: DocumentStorageService,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.logtailSha = documentStorageService.logTailSha;\n\t}\n\n\tprivate logtailSha: string | undefined;\n\tprivate snapshotOps: ISequencedDocumentMessage[] | undefined;\n\n\tfetchMessages(\n\t\tfromTotal: number,\n\t\ttoTotal: number | undefined,\n\t\tabortSignal?: AbortSignal,\n\t\tcachedOnly?: boolean,\n\t\tfetchReason?: string,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\tif (cachedOnly) {\n\t\t\treturn emptyMessageStream;\n\t\t}\n\n\t\tlet opsFromSnapshot = 0;\n\t\tlet opsFromStorage = 0;\n\t\tconst requestCallback = async (\n\t\t\tfrom: number,\n\t\t\tto: number,\n\t\t\ttelemetryProps: ITelemetryBaseProperties,\n\t\t) => {\n\t\t\tthis.snapshotOps = this.logtailSha\n\t\t\t\t? await readAndParse<ISequencedDocumentMessage[]>(\n\t\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\t\tthis.logtailSha,\n\t\t\t\t\t)\n\t\t\t\t: [];\n\t\t\tthis.logtailSha = undefined;\n\n\t\t\tif (this.snapshotOps !== undefined && this.snapshotOps.length !== 0) {\n\t\t\t\tconst messages = this.snapshotOps.filter(\n\t\t\t\t\t(op) => op.sequenceNumber >= from && op.sequenceNumber < to,\n\t\t\t\t);\n\t\t\t\tvalidateMessages(\"snapshotOps\", messages, from, this.logger, false /* strict */);\n\t\t\t\tif (messages.length > 0 && messages[0].sequenceNumber === from) {\n\t\t\t\t\tthis.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);\n\t\t\t\t\topsFromSnapshot += messages.length;\n\t\t\t\t\treturn { messages, partialResult: true };\n\t\t\t\t}\n\t\t\t\tthis.snapshotOps = undefined;\n\t\t\t}\n\n\t\t\tconst ops = await this.deltaStorageService.get(this.tenantId, this.id, from, to);\n\t\t\tvalidateMessages(\"storage\", ops.messages, from, this.logger, false /* strict */);\n\t\t\topsFromStorage += ops.messages.length;\n\t\t\treturn ops;\n\t\t};\n\n\t\tconst stream = requestOps(\n\t\t\tasync (from: number, to: number, telemetryProps: ITelemetryBaseProperties) => {\n\t\t\t\tconst result = await requestCallback(from, to, telemetryProps);\n\t\t\t\t// Catch all case, just in case\n\t\t\t\tvalidateMessages(\"catch all\", result.messages, from, this.logger);\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\t// Staging: starting with no concurrency, listening for feedback first.\n\t\t\t// In future releases we will switch to actual concurrency\n\t\t\t1, // concurrency\n\t\t\tfromTotal, // inclusive\n\t\t\ttoTotal, // exclusive\n\t\t\tMaxBatchDeltas,\n\t\t\tthis.logger,\n\t\t\tabortSignal,\n\t\t\tfetchReason,\n\t\t);\n\n\t\treturn streamObserver(stream, (result) => {\n\t\t\tif (result.done && opsFromSnapshot + opsFromStorage !== 0) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"CacheOpsRetrieved\",\n\t\t\t\t\topsFromSnapshot,\n\t\t\t\t\topsFromStorage,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Provides access to the underlying delta storage on the server for routerlicious driver.\n */\nexport class DeltaStorageService implements IDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly url: string,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly getRestWrapper: () => Promise<RestWrapper> = async () => this.restWrapper,\n\t\tprivate readonly getDeltaStorageUrl: () => string = () => this.url,\n\t) {}\n\n\tpublic async get(\n\t\ttenantId: string,\n\t\tid: string,\n\t\tfrom: number, // inclusive\n\t\tto: number, // exclusive\n\t): Promise<IDeltasFetchResult> {\n\t\tconst ops = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"OpsFetch\",\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst restWrapper = await this.getRestWrapper();\n\t\t\t\tconst url = this.getDeltaStorageUrl();\n\t\t\t\tconst response = await restWrapper.get<ISequencedDocumentMessage[]>(url, {\n\t\t\t\t\tfrom: from - 1,\n\t\t\t\t\tto,\n\t\t\t\t});\n\t\t\t\tevent.end({\n\t\t\t\t\tlength: response.content.length,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tfirstOpSeqNumber: response.content[0]?.sequenceNumber,\n\t\t\t\t\t\tlastOpSeqNumber: response.content[response.content.length - 1]?.sequenceNumber,\n\t\t\t\t\t}),\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\t...getW3CData(response.requestUrl, \"xmlhttprequest\"),\n\t\t\t\t});\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\n\t\t// It is assumed that server always returns all the ops that it has in the range that was requested.\n\t\t// This may change in the future, if so, we need to adjust and receive \"end\" value from server in such case.\n\t\treturn { messages: ops, partialResult: false };\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deltaStorageService.js","sourceRoot":"","sources":["../src/deltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,U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J,EAAE;SACF,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;YACf,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAChD,MAAM,GAAG,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACtC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,CAA8B,GAAG,EAAE;gBACxE,IAAI,EAAE,IAAI,GAAG,CAAC;gBACd,EAAE;gBACF,WAAW,EAAE,WAAW,IAAI,EAAE;aAC9B,CAAC,CAAC;YACH,KAAK,CAAC,GAAG,CAAC;gBACT,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM;gBAC/B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACvB,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,cAAc;oBACrD,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,cAAc;iBAC9E,CAAC;gBACF,GAAG,QAAQ,CAAC,UAAU;gBACtB,GAAG,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;aACpD,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,OAAO,CAAC;QACzB,CAAC,CACD,CAAC;QAEF,oGAAoG;QACpG,4GAA4G;QAC5G,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAChD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { getW3CData, validateMessages } from \"@fluidframework/driver-base/internal\";\nimport {\n\tIDeltaStorageService,\n\tIDeltasFetchResult,\n\tIDocumentDeltaStorageService,\n\tIStream,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\temptyMessageStream,\n\treadAndParse,\n\trequestOps,\n\tstreamObserver,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { DocumentStorageService } from \"./documentStorageService.js\";\nimport { RestWrapper } from \"./restWrapperBase.js\";\n\n/**\n * Maximum number of ops we can fetch at a time. This should be kept at 2k, as\n * server determines whether to try to fallback to long-term storage if the ops range requested is larger than\n * what they have locally available in short-term storage. So if we request 2k ops, they know it is not a\n * specific request and they don't fall to long term storage which takes time.\n * Please coordinate to AFR team if this value need to be changed.\n */\nconst MaxBatchDeltas = 2000;\n\n/**\n * Storage service limited to only being able to fetch documents for a specific document\n */\nexport class DocumentDeltaStorageService implements IDocumentDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly id: string,\n\t\tprivate readonly deltaStorageService: IDeltaStorageService,\n\t\tprivate readonly documentStorageService: DocumentStorageService,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.logtailSha = documentStorageService.logTailSha;\n\t}\n\n\tprivate logtailSha: string | undefined;\n\tprivate snapshotOps: ISequencedDocumentMessage[] | undefined;\n\n\tfetchMessages(\n\t\tfromTotal: number,\n\t\ttoTotal: number | undefined,\n\t\tabortSignal?: AbortSignal,\n\t\tcachedOnly?: boolean,\n\t\tfetchReason?: string,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\tif (cachedOnly) {\n\t\t\treturn emptyMessageStream;\n\t\t}\n\n\t\tlet opsFromSnapshot = 0;\n\t\tlet opsFromStorage = 0;\n\t\tconst requestCallback = async (\n\t\t\tfrom: number,\n\t\t\tto: number,\n\t\t\ttelemetryProps: ITelemetryBaseProperties,\n\t\t) => {\n\t\t\tthis.snapshotOps = this.logtailSha\n\t\t\t\t? await readAndParse<ISequencedDocumentMessage[]>(\n\t\t\t\t\t\tthis.documentStorageService,\n\t\t\t\t\t\tthis.logtailSha,\n\t\t\t\t\t)\n\t\t\t\t: [];\n\t\t\tthis.logtailSha = undefined;\n\n\t\t\tif (this.snapshotOps !== undefined && this.snapshotOps.length !== 0) {\n\t\t\t\tconst messages = this.snapshotOps.filter(\n\t\t\t\t\t(op) => op.sequenceNumber >= from && op.sequenceNumber < to,\n\t\t\t\t);\n\t\t\t\tvalidateMessages(\"snapshotOps\", messages, from, this.logger, false /* strict */);\n\t\t\t\tif (messages.length > 0 && messages[0].sequenceNumber === from) {\n\t\t\t\t\tthis.snapshotOps = this.snapshotOps.filter((op) => op.sequenceNumber >= to);\n\t\t\t\t\topsFromSnapshot += messages.length;\n\t\t\t\t\treturn { messages, partialResult: true };\n\t\t\t\t}\n\t\t\t\tthis.snapshotOps = undefined;\n\t\t\t}\n\n\t\t\tconst ops = await this.deltaStorageService.get(\n\t\t\t\tthis.tenantId,\n\t\t\t\tthis.id,\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tfetchReason,\n\t\t\t);\n\t\t\tvalidateMessages(\"storage\", ops.messages, from, this.logger, false /* strict */);\n\t\t\topsFromStorage += ops.messages.length;\n\t\t\treturn ops;\n\t\t};\n\n\t\tconst stream = requestOps(\n\t\t\tasync (from: number, to: number, telemetryProps: ITelemetryBaseProperties) => {\n\t\t\t\tconst result = await requestCallback(from, to, telemetryProps);\n\t\t\t\t// Catch all case, just in case\n\t\t\t\tvalidateMessages(\"catch all\", result.messages, from, this.logger);\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\t// Staging: starting with no concurrency, listening for feedback first.\n\t\t\t// In future releases we will switch to actual concurrency\n\t\t\t1, // concurrency\n\t\t\tfromTotal, // inclusive\n\t\t\ttoTotal, // exclusive\n\t\t\tMaxBatchDeltas,\n\t\t\tthis.logger,\n\t\t\tabortSignal,\n\t\t\tfetchReason,\n\t\t);\n\n\t\treturn streamObserver(stream, (result) => {\n\t\t\tif (result.done && opsFromSnapshot + opsFromStorage !== 0) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"CacheOpsRetrieved\",\n\t\t\t\t\topsFromSnapshot,\n\t\t\t\t\topsFromStorage,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * Provides access to the underlying delta storage on the server for routerlicious driver.\n */\nexport class DeltaStorageService implements IDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly url: string,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly getRestWrapper: () => Promise<RestWrapper> = async () => this.restWrapper,\n\t\tprivate readonly getDeltaStorageUrl: () => string = () => this.url,\n\t) {}\n\n\tpublic async get(\n\t\ttenantId: string,\n\t\tid: string,\n\t\tfrom: number, // inclusive\n\t\tto: number, // exclusive\n\t\tfetchReason?: string,\n\t): Promise<IDeltasFetchResult> {\n\t\tconst ops = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"OpsFetch\",\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst restWrapper = await this.getRestWrapper();\n\t\t\t\tconst url = this.getDeltaStorageUrl();\n\t\t\t\tconst response = await restWrapper.get<ISequencedDocumentMessage[]>(url, {\n\t\t\t\t\tfrom: from - 1,\n\t\t\t\t\tto,\n\t\t\t\t\tfetchReason: fetchReason ?? \"\",\n\t\t\t\t});\n\t\t\t\tevent.end({\n\t\t\t\t\tlength: response.content.length,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tfirstOpSeqNumber: response.content[0]?.sequenceNumber,\n\t\t\t\t\t\tlastOpSeqNumber: response.content[response.content.length - 1]?.sequenceNumber,\n\t\t\t\t\t}),\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\t...getW3CData(response.requestUrl, \"xmlhttprequest\"),\n\t\t\t\t});\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\n\t\t// It is assumed that server always returns all the ops that it has in the range that was requested.\n\t\t// This may change in the future, if so, we need to adjust and receive \"end\" value from server in such case.\n\t\treturn { messages: ops, partialResult: false };\n\t}\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/routerlicious-driver";
|
|
8
|
-
export declare const pkgVersion = "2.10.0-
|
|
8
|
+
export declare const pkgVersion = "2.10.0-307060";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sCAAsC,CAAC;AAC9D,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/routerlicious-driver\";\nexport const pkgVersion = \"2.10.0-
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sCAAsC,CAAC;AAC9D,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/routerlicious-driver\";\nexport const pkgVersion = \"2.10.0-307060\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/routerlicious-driver",
|
|
3
|
-
"version": "2.10.0-
|
|
3
|
+
"version": "2.10.0-307060",
|
|
4
4
|
"description": "Socket.IO + Git implementation of Fluid service API",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "2.10.0-
|
|
73
|
-
"@fluidframework/core-interfaces": "2.10.0-
|
|
74
|
-
"@fluidframework/core-utils": "2.10.0-
|
|
75
|
-
"@fluidframework/driver-base": "2.10.0-
|
|
76
|
-
"@fluidframework/driver-definitions": "2.10.0-
|
|
77
|
-
"@fluidframework/driver-utils": "2.10.0-
|
|
72
|
+
"@fluid-internal/client-utils": "2.10.0-307060",
|
|
73
|
+
"@fluidframework/core-interfaces": "2.10.0-307060",
|
|
74
|
+
"@fluidframework/core-utils": "2.10.0-307060",
|
|
75
|
+
"@fluidframework/driver-base": "2.10.0-307060",
|
|
76
|
+
"@fluidframework/driver-definitions": "2.10.0-307060",
|
|
77
|
+
"@fluidframework/driver-utils": "2.10.0-307060",
|
|
78
78
|
"@fluidframework/server-services-client": "^5.0.0",
|
|
79
|
-
"@fluidframework/telemetry-utils": "2.10.0-
|
|
79
|
+
"@fluidframework/telemetry-utils": "2.10.0-307060",
|
|
80
80
|
"cross-fetch": "^3.1.5",
|
|
81
81
|
"json-stringify-safe": "5.0.1",
|
|
82
82
|
"socket.io-client": "~4.7.5",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@arethetypeswrong/cli": "^0.16.4",
|
|
87
87
|
"@biomejs/biome": "~1.9.3",
|
|
88
|
-
"@fluid-internal/mocha-test-setup": "2.10.0-
|
|
88
|
+
"@fluid-internal/mocha-test-setup": "2.10.0-307060",
|
|
89
89
|
"@fluid-tools/build-cli": "^0.50.0",
|
|
90
90
|
"@fluidframework/build-common": "^2.0.3",
|
|
91
91
|
"@fluidframework/build-tools": "^0.50.0",
|
|
@@ -91,7 +91,13 @@ export class DocumentDeltaStorageService implements IDocumentDeltaStorageService
|
|
|
91
91
|
this.snapshotOps = undefined;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
const ops = await this.deltaStorageService.get(
|
|
94
|
+
const ops = await this.deltaStorageService.get(
|
|
95
|
+
this.tenantId,
|
|
96
|
+
this.id,
|
|
97
|
+
from,
|
|
98
|
+
to,
|
|
99
|
+
fetchReason,
|
|
100
|
+
);
|
|
95
101
|
validateMessages("storage", ops.messages, from, this.logger, false /* strict */);
|
|
96
102
|
opsFromStorage += ops.messages.length;
|
|
97
103
|
return ops;
|
|
@@ -144,6 +150,7 @@ export class DeltaStorageService implements IDeltaStorageService {
|
|
|
144
150
|
id: string,
|
|
145
151
|
from: number, // inclusive
|
|
146
152
|
to: number, // exclusive
|
|
153
|
+
fetchReason?: string,
|
|
147
154
|
): Promise<IDeltasFetchResult> {
|
|
148
155
|
const ops = await PerformanceEvent.timedExecAsync(
|
|
149
156
|
this.logger,
|
|
@@ -158,6 +165,7 @@ export class DeltaStorageService implements IDeltaStorageService {
|
|
|
158
165
|
const response = await restWrapper.get<ISequencedDocumentMessage[]>(url, {
|
|
159
166
|
from: from - 1,
|
|
160
167
|
to,
|
|
168
|
+
fetchReason: fetchReason ?? "",
|
|
161
169
|
});
|
|
162
170
|
event.end({
|
|
163
171
|
length: response.content.length,
|
package/src/packageVersion.ts
CHANGED