@fluidframework/container-loader 2.0.0-rc.4.0.6 → 2.0.0-rc.5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/api-extractor/api-extractor-lint-bundle.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-legacy.esm.json +5 -0
- package/api-extractor/api-extractor-lint-public.cjs.json +5 -0
- package/api-extractor/api-extractor-lint-public.esm.json +5 -0
- package/api-extractor.json +1 -1
- package/api-report/{container-loader.api.md → container-loader.alpha.api.md} +60 -17
- package/api-report/container-loader.beta.api.md +44 -0
- package/api-report/container-loader.public.api.md +44 -0
- package/biome.jsonc +4 -0
- package/dist/attachment.d.ts +1 -1
- package/dist/attachment.d.ts.map +1 -1
- package/dist/attachment.js.map +1 -1
- package/dist/audience.d.ts +3 -2
- package/dist/audience.d.ts.map +1 -1
- package/dist/audience.js.map +1 -1
- package/dist/catchUpMonitor.d.ts.map +1 -1
- package/dist/catchUpMonitor.js.map +1 -1
- package/dist/connectionManager.d.ts +4 -3
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +7 -8
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts +1 -1
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +8 -4
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts +3 -2
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +78 -80
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +2 -2
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +5 -4
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +24 -8
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +2 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.d.ts.map +1 -1
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts +6 -5
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +15 -16
- package/dist/deltaManager.js.map +1 -1
- package/dist/deltaQueue.d.ts.map +1 -1
- package/dist/deltaQueue.js.map +1 -1
- package/dist/disposal.js.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +5 -0
- package/dist/loadPaused.js.map +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js.map +1 -1
- package/dist/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/dist/memoryBlobStorage.d.ts.map +1 -1
- package/dist/memoryBlobStorage.js +4 -3
- package/dist/memoryBlobStorage.js.map +1 -1
- package/dist/noopHeuristic.d.ts +1 -1
- package/dist/noopHeuristic.d.ts.map +1 -1
- package/dist/noopHeuristic.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocol/index.d.ts +7 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +12 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/protocol.d.ts +52 -0
- package/dist/protocol/protocol.d.ts.map +1 -0
- package/dist/protocol/protocol.js +112 -0
- package/dist/protocol/protocol.js.map +1 -0
- package/dist/protocol/quorum.d.ts +185 -0
- package/dist/protocol/quorum.d.ts.map +1 -0
- package/dist/protocol/quorum.js +419 -0
- package/dist/protocol/quorum.js.map +1 -0
- package/dist/protocol.d.ts +4 -4
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +6 -6
- package/dist/protocol.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +16 -9
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js +18 -9
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/quorum.d.ts +1 -1
- package/dist/quorum.d.ts.map +1 -1
- package/dist/quorum.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +2 -2
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +3 -1
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/serializedStateManager.d.ts +5 -5
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +16 -12
- package/dist/serializedStateManager.js.map +1 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +7 -7
- package/dist/utils.js.map +1 -1
- package/lib/attachment.d.ts +1 -1
- package/lib/attachment.d.ts.map +1 -1
- package/lib/attachment.js.map +1 -1
- package/lib/audience.d.ts +3 -2
- package/lib/audience.d.ts.map +1 -1
- package/lib/audience.js.map +1 -1
- package/lib/catchUpMonitor.d.ts.map +1 -1
- package/lib/catchUpMonitor.js.map +1 -1
- package/lib/connectionManager.d.ts +4 -3
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +6 -7
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts +1 -1
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +8 -4
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts +3 -2
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +20 -22
- package/lib/container.js.map +1 -1
- package/lib/containerContext.d.ts +2 -2
- package/lib/containerContext.d.ts.map +1 -1
- package/lib/containerContext.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +5 -4
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +24 -8
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/contracts.d.ts +2 -2
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/debugLogger.d.ts.map +1 -1
- package/lib/debugLogger.js.map +1 -1
- package/lib/deltaManager.d.ts +6 -5
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +8 -9
- package/lib/deltaManager.js.map +1 -1
- package/lib/deltaQueue.d.ts.map +1 -1
- package/lib/deltaQueue.js.map +1 -1
- package/lib/disposal.js.map +1 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +5 -0
- package/lib/loadPaused.js.map +1 -1
- package/lib/loader.d.ts +1 -1
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js.map +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -1
- package/lib/memoryBlobStorage.d.ts.map +1 -1
- package/lib/memoryBlobStorage.js +4 -3
- package/lib/memoryBlobStorage.js.map +1 -1
- package/lib/noopHeuristic.d.ts +1 -1
- package/lib/noopHeuristic.d.ts.map +1 -1
- package/lib/noopHeuristic.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/protocol/index.d.ts +7 -0
- package/lib/protocol/index.d.ts.map +1 -0
- package/lib/protocol/index.js +7 -0
- package/lib/protocol/index.js.map +1 -0
- package/lib/protocol/protocol.d.ts +52 -0
- package/lib/protocol/protocol.d.ts.map +1 -0
- package/lib/protocol/protocol.js +108 -0
- package/lib/protocol/protocol.js.map +1 -0
- package/lib/protocol/quorum.d.ts +185 -0
- package/lib/protocol/quorum.d.ts.map +1 -0
- package/lib/protocol/quorum.js +410 -0
- package/lib/protocol/quorum.js.map +1 -0
- package/lib/protocol.d.ts +4 -4
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +2 -2
- package/lib/protocol.js.map +1 -1
- package/lib/protocolTreeDocumentStorageService.d.ts +16 -9
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/lib/protocolTreeDocumentStorageService.js +18 -9
- package/lib/protocolTreeDocumentStorageService.js.map +1 -1
- package/lib/quorum.d.ts +1 -1
- package/lib/quorum.d.ts.map +1 -1
- package/lib/quorum.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts +2 -2
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js +3 -1
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/serializedStateManager.d.ts +5 -5
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +17 -13
- package/lib/serializedStateManager.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/utils.d.ts +2 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +3 -3
- package/lib/utils.js.map +1 -1
- package/package.json +32 -31
- package/src/attachment.ts +8 -5
- package/src/audience.ts +4 -7
- package/src/catchUpMonitor.ts +4 -2
- package/src/connectionManager.ts +27 -24
- package/src/connectionStateHandler.ts +11 -10
- package/src/container.ts +64 -72
- package/src/containerContext.ts +5 -5
- package/src/containerStorageAdapter.ts +37 -22
- package/src/contracts.ts +4 -5
- package/src/debugLogger.ts +2 -3
- package/src/deltaManager.ts +13 -18
- package/src/deltaQueue.ts +4 -1
- package/src/error.ts +4 -1
- package/src/index.ts +7 -0
- package/src/loadPaused.ts +1 -1
- package/src/loader.ts +1 -1
- package/src/memoryBlobStorage.ts +6 -4
- package/src/noopHeuristic.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/protocol/README.md +10 -0
- package/src/protocol/index.ts +16 -0
- package/src/protocol/protocol.ts +185 -0
- package/src/protocol/quorum.ts +577 -0
- package/src/protocol.ts +6 -9
- package/src/protocolTreeDocumentStorageService.ts +30 -13
- package/src/quorum.ts +1 -1
- package/src/retriableDocumentStorageService.ts +6 -7
- package/src/serializedStateManager.ts +33 -34
- package/src/utils.ts +16 -10
- package/tsconfig.json +2 -0
- package/tsdoc.json +4 -0
package/lib/protocol.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IAudienceOwner } from "@fluidframework/container-definitions/internal";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { IDocumentAttributes, IProcessMessageResult, ISequencedDocumentMessage, ISignalMessage } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import { IBaseProtocolHandler, IQuorumSnapshot, ProtocolOpHandler } from "./protocol/index.js";
|
|
8
8
|
export declare enum SignalType {
|
|
9
|
-
ClientJoin = "join",
|
|
10
|
-
ClientLeave = "leave",
|
|
9
|
+
ClientJoin = "join",// same value as MessageType.ClientJoin,
|
|
10
|
+
ClientLeave = "leave",// same value as MessageType.ClientLeave,
|
|
11
11
|
Clear = "clear"
|
|
12
12
|
}
|
|
13
13
|
/**
|
package/lib/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EACN,mBAAmB,EACnB,qBAAqB,EAGrB,yBAAyB,EACzB,cAAc,EACd,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG/F,oBAAY,UAAU;IACrB,UAAU,SAAS,CAAE,wCAAwC;IAC7D,WAAW,UAAU,CAAE,yCAAyC;IAChE,KAAK,UAAU;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,CACpC,UAAU,EAAE,mBAAmB,EAC/B,QAAQ,EAAE,eAAe,EACzB,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,MAAM,KAC7C,gBAAgB,CAAC;AAEtB;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC7D,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,aAAa,CAAC,OAAO,EAAE,cAAc,OAAE;CACvC;AAED,qBAAa,eAAgB,SAAQ,iBAAkB,YAAW,gBAAgB;aAKhE,QAAQ,EAAE,cAAc;IACxC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAJrC,UAAU,EAAE,mBAAmB,EAC/B,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,MAAM,EACjC,QAAQ,EAAE,cAAc,EACvB,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO;IAyB9D,cAAc,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,GACZ,qBAAqB;IAuBjB,aAAa,CAAC,OAAO,EAAE,cAAc;CAgC5C;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,cAAc,WAWzE"}
|
package/lib/protocol.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { MessageType, } from "@fluidframework/driver-definitions/internal";
|
|
5
6
|
import { canBeCoalescedByService } from "@fluidframework/driver-utils/internal";
|
|
6
|
-
import { ProtocolOpHandler
|
|
7
|
-
import { MessageType, } from "@fluidframework/protocol-definitions";
|
|
7
|
+
import { ProtocolOpHandler } from "./protocol/index.js";
|
|
8
8
|
// ADO: #1986: Start using enum from protocol-base.
|
|
9
9
|
export var SignalType;
|
|
10
10
|
(function (SignalType) {
|
package/lib/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAIN,WAAW,GAGX,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,OAAO,EAAyC,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE/F,mDAAmD;AACnD,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACrB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;AAChB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAoBD,MAAM,OAAO,eAAgB,SAAQ,iBAAiB;IACrD,YACC,UAA+B,EAC/B,cAA+B,EAC/B,YAAiD,EACjC,QAAwB,EACvB,oBAAmD;QAEpE,KAAK,CACJ,UAAU,CAAC,qBAAqB,EAChC,UAAU,CAAC,cAAc,EACzB,cAAc,CAAC,OAAO,EACtB,cAAc,CAAC,SAAS,EACxB,cAAc,CAAC,MAAM,EACrB,YAAY,CACZ,CAAC;QAVc,aAAQ,GAAR,QAAQ,CAAgB;QACvB,yBAAoB,GAApB,oBAAoB,CAA+B;QAWpE,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;YAC3D,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,C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B;IACzE,gCAAgC;IAChC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC/B,MAAM,YAAY,GAAG,OAAO,CAAC,OAA6C,CAAC;QAC3E,OAAO,CACN,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,KAAK;YACtC,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,UAAU;YAC3C,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,CAC5C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IAudienceOwner } from \"@fluidframework/container-definitions/internal\";\nimport {\n\tIDocumentAttributes,\n\tIProcessMessageResult,\n\tISignalClient,\n\tMessageType,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils/internal\";\n\nimport { IBaseProtocolHandler, IQuorumSnapshot, ProtocolOpHandler } from \"./protocol/index.js\";\n\n// ADO: #1986: Start using enum from protocol-base.\nexport enum SignalType {\n\tClientJoin = \"join\", // same value as MessageType.ClientJoin,\n\tClientLeave = \"leave\", // same value as MessageType.ClientLeave,\n\tClear = \"clear\", // used only by client for synthetic signals\n}\n\n/**\n * Function to be used for creating a protocol handler.\n * @alpha\n */\nexport type ProtocolHandlerBuilder = (\n\tattributes: IDocumentAttributes,\n\tsnapshot: IQuorumSnapshot,\n\tsendProposal: (key: string, value: any) => number,\n) => IProtocolHandler;\n\n/**\n * @alpha\n */\nexport interface IProtocolHandler extends IBaseProtocolHandler {\n\treadonly audience: IAudienceOwner;\n\tprocessSignal(message: ISignalMessage);\n}\n\nexport class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandler {\n\tconstructor(\n\t\tattributes: IDocumentAttributes,\n\t\tquorumSnapshot: IQuorumSnapshot,\n\t\tsendProposal: (key: string, value: any) => number,\n\t\tpublic readonly audience: IAudienceOwner,\n\t\tprivate readonly shouldClientHaveLeft: (clientId: string) => boolean,\n\t) {\n\t\tsuper(\n\t\t\tattributes.minimumSequenceNumber,\n\t\t\tattributes.sequenceNumber,\n\t\t\tquorumSnapshot.members,\n\t\t\tquorumSnapshot.proposals,\n\t\t\tquorumSnapshot.values,\n\t\t\tsendProposal,\n\t\t);\n\n\t\tfor (const [clientId, member] of this.quorum.getMembers()) {\n\t\t\taudience.addMember(clientId, member.client);\n\t\t}\n\n\t\t// Join / leave signals are ignored for \"write\" clients in favor of join / leave ops\n\t\tthis.quorum.on(\"addMember\", (clientId, details) =>\n\t\t\taudience.addMember(clientId, details.client),\n\t\t);\n\t\tthis.quorum.on(\"removeMember\", (clientId) => audience.removeMember(clientId));\n\t\tfor (const [clientId, details] of this.quorum.getMembers()) {\n\t\t\tthis.audience.addMember(clientId, details.client);\n\t\t}\n\t}\n\n\tpublic processMessage(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t): IProcessMessageResult {\n\t\t// Check and report if we're getting messages from a clientId that we previously\n\t\t// flagged as shouldHaveLeft, or from a client that's not in the quorum but should be\n\t\tif (message.clientId != null) {\n\t\t\tconst client = this.quorum.getMember(message.clientId);\n\n\t\t\tif (client === undefined && message.type !== MessageType.ClientJoin) {\n\t\t\t\t// pre-0.58 error message: messageClientIdMissingFromQuorum\n\t\t\t\tthrow new Error(\"Remote message's clientId is missing from the quorum\");\n\t\t\t}\n\n\t\t\t// Here checking canBeCoalescedByService is used as an approximation of \"is benign to process despite being unexpected\".\n\t\t\t// It's still not good to see these messages from unexpected clientIds, but since they don't harm the integrity of the\n\t\t\t// document we don't need to blow up aggressively.\n\t\t\tif (this.shouldClientHaveLeft(message.clientId) && !canBeCoalescedByService(message)) {\n\t\t\t\t// pre-0.58 error message: messageClientIdShouldHaveLeft\n\t\t\t\tthrow new Error(\"Remote message's clientId already should have left\");\n\t\t\t}\n\t\t}\n\n\t\treturn super.processMessage(message, local);\n\t}\n\n\tpublic processSignal(message: ISignalMessage) {\n\t\tconst innerContent = message.content as { content: any; type: string };\n\t\tswitch (innerContent.type) {\n\t\t\tcase SignalType.Clear: {\n\t\t\t\tconst members = this.audience.getMembers();\n\t\t\t\tfor (const [clientId, client] of members) {\n\t\t\t\t\tif (client.mode === \"read\") {\n\t\t\t\t\t\tthis.audience.removeMember(clientId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientJoin: {\n\t\t\t\tconst newClient = innerContent.content as ISignalClient;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (newClient.client.mode === \"read\") {\n\t\t\t\t\tthis.audience.addMember(newClient.clientId, newClient.client);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientLeave: {\n\t\t\t\tconst leftClientId = innerContent.content as string;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (this.audience.getMember(leftClientId)?.mode === \"read\") {\n\t\t\t\t\tthis.audience.removeMember(leftClientId);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\n/**\n * Function to check whether the protocol handler should process the Signal.\n * The protocol handler should strictly handle only ClientJoin, ClientLeave\n * and Clear signal types.\n */\nexport function protocolHandlerShouldProcessSignal(message: ISignalMessage) {\n\t// Signal originates from server\n\tif (message.clientId === null) {\n\t\tconst innerContent = message.content as { content: unknown; type: string };\n\t\treturn (\n\t\t\tinnerContent.type === SignalType.Clear ||\n\t\t\tinnerContent.type === SignalType.ClientJoin ||\n\t\t\tinnerContent.type === SignalType.ClientLeave\n\t\t);\n\t}\n\treturn false;\n}\n"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
7
|
import { IDocumentStorageService, ISummaryContext } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
8
8
|
/**
|
|
9
9
|
* A storage service wrapper whose sole job is to intercept calls to uploadSummaryWithContext and ensure they include
|
|
10
10
|
* the protocol summary, using the provided callback to add it if necessary.
|
|
@@ -12,16 +12,23 @@ import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
|
12
12
|
export declare class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {
|
|
13
13
|
private readonly internalStorageService;
|
|
14
14
|
private readonly addProtocolSummaryIfMissing;
|
|
15
|
-
|
|
15
|
+
private readonly shouldSummarizeProtocolTree;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param internalStorageService - Document storage service responsible to make api calls to the storage.
|
|
19
|
+
* @param addProtocolSummaryIfMissing - Function to add protocol summary tree to the summary. Used in scenarios where single-commit summaries are used.
|
|
20
|
+
* @param shouldSummarizeProtocolTree - Callback function to learn about the service preference on whether single-commit summaries are enabled.
|
|
21
|
+
*/
|
|
22
|
+
constructor(internalStorageService: IDocumentStorageService & IDisposable, addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree, shouldSummarizeProtocolTree: () => boolean);
|
|
16
23
|
get policies(): import("@fluidframework/driver-definitions/internal").IDocumentStorageServicePolicies | undefined;
|
|
17
24
|
get disposed(): boolean;
|
|
18
|
-
getSnapshotTree:
|
|
19
|
-
getSnapshot:
|
|
20
|
-
getVersions:
|
|
21
|
-
createBlob:
|
|
22
|
-
readBlob:
|
|
23
|
-
downloadSummary:
|
|
24
|
-
dispose:
|
|
25
|
+
getSnapshotTree: IDocumentStorageService["getSnapshotTree"];
|
|
26
|
+
getSnapshot: IDocumentStorageService["getSnapshot"];
|
|
27
|
+
getVersions: IDocumentStorageService["getVersions"];
|
|
28
|
+
createBlob: IDocumentStorageService["createBlob"];
|
|
29
|
+
readBlob: IDocumentStorageService["readBlob"];
|
|
30
|
+
downloadSummary: IDocumentStorageService["downloadSummary"];
|
|
31
|
+
dispose: IDisposable["dispose"];
|
|
25
32
|
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
26
33
|
}
|
|
27
34
|
//# sourceMappingURL=protocolTreeDocumentStorageService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocolTreeDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"protocolTreeDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EACN,uBAAuB,EACvB,eAAe,EACf,MAAM,6CAA6C,CAAC;AAErD;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,uBAAuB,EAAE,WAAW;IAQrF,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAC5C,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAT7C;;;;;OAKG;gBAEe,sBAAsB,EAAE,uBAAuB,GAAG,WAAW,EAC7D,2BAA2B,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,YAAY,EACxE,2BAA2B,EAAE,MAAM,OAAO;IAU5D,IAAW,QAAQ,sGAElB;IACD,IAAW,QAAQ,YAElB;IAED,eAAe,EAAE,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;IAC5D,WAAW,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACpD,WAAW,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACpD,UAAU,EAAE,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAClD,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAC9C,eAAe,EAAE,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;IAC5D,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAE1B,wBAAwB,CAC7B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;CAQlB"}
|
|
@@ -7,16 +7,23 @@
|
|
|
7
7
|
* the protocol summary, using the provided callback to add it if necessary.
|
|
8
8
|
*/
|
|
9
9
|
export class ProtocolTreeStorageService {
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param internalStorageService - Document storage service responsible to make api calls to the storage.
|
|
13
|
+
* @param addProtocolSummaryIfMissing - Function to add protocol summary tree to the summary. Used in scenarios where single-commit summaries are used.
|
|
14
|
+
* @param shouldSummarizeProtocolTree - Callback function to learn about the service preference on whether single-commit summaries are enabled.
|
|
15
|
+
*/
|
|
16
|
+
constructor(internalStorageService, addProtocolSummaryIfMissing, shouldSummarizeProtocolTree) {
|
|
11
17
|
this.internalStorageService = internalStorageService;
|
|
12
18
|
this.addProtocolSummaryIfMissing = addProtocolSummaryIfMissing;
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
19
|
+
this.shouldSummarizeProtocolTree = shouldSummarizeProtocolTree;
|
|
20
|
+
this.getSnapshotTree = internalStorageService.getSnapshotTree.bind(internalStorageService);
|
|
21
|
+
this.getSnapshot = internalStorageService.getSnapshot?.bind(internalStorageService);
|
|
22
|
+
this.getVersions = internalStorageService.getVersions.bind(internalStorageService);
|
|
23
|
+
this.createBlob = internalStorageService.createBlob.bind(internalStorageService);
|
|
24
|
+
this.readBlob = internalStorageService.readBlob.bind(internalStorageService);
|
|
25
|
+
this.downloadSummary = internalStorageService.downloadSummary.bind(internalStorageService);
|
|
26
|
+
this.dispose = internalStorageService.dispose.bind(internalStorageService);
|
|
20
27
|
}
|
|
21
28
|
get policies() {
|
|
22
29
|
return this.internalStorageService.policies;
|
|
@@ -25,7 +32,9 @@ export class ProtocolTreeStorageService {
|
|
|
25
32
|
return this.internalStorageService.disposed;
|
|
26
33
|
}
|
|
27
34
|
async uploadSummaryWithContext(summary, context) {
|
|
28
|
-
return this.
|
|
35
|
+
return this.shouldSummarizeProtocolTree()
|
|
36
|
+
? this.internalStorageService.uploadSummaryWithContext(this.addProtocolSummaryIfMissing(summary), context)
|
|
37
|
+
: this.internalStorageService.uploadSummaryWithContext(summary, context);
|
|
29
38
|
}
|
|
30
39
|
}
|
|
31
40
|
//# sourceMappingURL=protocolTreeDocumentStorageService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocolTreeDocumentStorageService.js","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;GAGG;AACH,MAAM,OAAO,0BAA0B;IACtC,YACkB,sBAA6D,EAC7D,2BAAwE;
|
|
1
|
+
{"version":3,"file":"protocolTreeDocumentStorageService.js","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;GAGG;AACH,MAAM,OAAO,0BAA0B;IACtC;;;;;OAKG;IACH,YACkB,sBAA6D,EAC7D,2BAAwE,EACxE,2BAA0C;QAF1C,2BAAsB,GAAtB,sBAAsB,CAAuC;QAC7D,gCAA2B,GAA3B,2BAA2B,CAA6C;QACxE,gCAA2B,GAA3B,2BAA2B,CAAe;QAE3D,IAAI,CAAC,eAAe,GAAG,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC3F,IAAI,CAAC,WAAW,GAAG,sBAAsB,CAAC,WAAW,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACpF,IAAI,CAAC,WAAW,GAAG,sBAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACnF,IAAI,CAAC,UAAU,GAAG,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACjF,IAAI,CAAC,QAAQ,GAAG,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC7E,IAAI,CAAC,eAAe,GAAG,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC3F,IAAI,CAAC,OAAO,GAAG,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAC5E,CAAC;IACD,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IACD,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IAUD,KAAK,CAAC,wBAAwB,CAC7B,OAAqB,EACrB,OAAwB;QAExB,OAAO,IAAI,CAAC,2BAA2B,EAAE;YACxC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CACpD,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,EACzC,OAAO,CACP;YACF,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentStorageService,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * A storage service wrapper whose sole job is to intercept calls to uploadSummaryWithContext and ensure they include\n * the protocol summary, using the provided callback to add it if necessary.\n */\nexport class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {\n\t/**\n\t *\n\t * @param internalStorageService - Document storage service responsible to make api calls to the storage.\n\t * @param addProtocolSummaryIfMissing - Function to add protocol summary tree to the summary. Used in scenarios where single-commit summaries are used.\n\t * @param shouldSummarizeProtocolTree - Callback function to learn about the service preference on whether single-commit summaries are enabled.\n\t */\n\tconstructor(\n\t\tprivate readonly internalStorageService: IDocumentStorageService & IDisposable,\n\t\tprivate readonly addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree,\n\t\tprivate readonly shouldSummarizeProtocolTree: () => boolean,\n\t) {\n\t\tthis.getSnapshotTree = internalStorageService.getSnapshotTree.bind(internalStorageService);\n\t\tthis.getSnapshot = internalStorageService.getSnapshot?.bind(internalStorageService);\n\t\tthis.getVersions = internalStorageService.getVersions.bind(internalStorageService);\n\t\tthis.createBlob = internalStorageService.createBlob.bind(internalStorageService);\n\t\tthis.readBlob = internalStorageService.readBlob.bind(internalStorageService);\n\t\tthis.downloadSummary = internalStorageService.downloadSummary.bind(internalStorageService);\n\t\tthis.dispose = internalStorageService.dispose.bind(internalStorageService);\n\t}\n\tpublic get policies() {\n\t\treturn this.internalStorageService.policies;\n\t}\n\tpublic get disposed() {\n\t\treturn this.internalStorageService.disposed;\n\t}\n\n\tgetSnapshotTree: IDocumentStorageService[\"getSnapshotTree\"];\n\tgetSnapshot: IDocumentStorageService[\"getSnapshot\"];\n\tgetVersions: IDocumentStorageService[\"getVersions\"];\n\tcreateBlob: IDocumentStorageService[\"createBlob\"];\n\treadBlob: IDocumentStorageService[\"readBlob\"];\n\tdownloadSummary: IDocumentStorageService[\"downloadSummary\"];\n\tdispose: IDisposable[\"dispose\"];\n\n\tasync uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\treturn this.shouldSummarizeProtocolTree()\n\t\t\t? this.internalStorageService.uploadSummaryWithContext(\n\t\t\t\t\tthis.addProtocolSummaryIfMissing(summary),\n\t\t\t\t\tcontext,\n\t\t\t\t)\n\t\t\t: this.internalStorageService.uploadSummaryWithContext(summary, context);\n\t}\n}\n"]}
|
package/lib/quorum.d.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IFluidCodeDetails } from "@fluidframework/container-definitions/internal";
|
|
6
|
-
import { ICommittedProposal } from "@fluidframework/
|
|
6
|
+
import { ICommittedProposal } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
export declare function initQuorumValuesFromCodeDetails(source: IFluidCodeDetails): [string, ICommittedProposal][];
|
|
8
8
|
//# sourceMappingURL=quorum.d.ts.map
|
package/lib/quorum.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quorum.d.ts","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"quorum.d.ts","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEjF,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,iBAAiB,GACvB,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAUhC"}
|
package/lib/quorum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quorum.js","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,UAAU,+BAA+B,CAC9C,MAAyB;IAEzB,kEAAkE;IAClE,MAAM,qBAAqB,GAAuB;QACjD,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,MAAM;QACb,sBAAsB,EAAE,CAAC;QACzB,oBAAoB,EAAE,CAAC;QACvB,cAAc,EAAE,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidCodeDetails } from \"@fluidframework/container-definitions/internal\";\nimport { ICommittedProposal } from \"@fluidframework/
|
|
1
|
+
{"version":3,"file":"quorum.js","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,UAAU,+BAA+B,CAC9C,MAAyB;IAEzB,kEAAkE;IAClE,MAAM,qBAAqB,GAAuB;QACjD,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,MAAM;QACb,sBAAsB,EAAE,CAAC;QACzB,oBAAoB,EAAE,CAAC;QACvB,cAAc,EAAE,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidCodeDetails } from \"@fluidframework/container-definitions/internal\";\nimport { ICommittedProposal } from \"@fluidframework/driver-definitions/internal\";\n\nexport function initQuorumValuesFromCodeDetails(\n\tsource: IFluidCodeDetails,\n): [string, ICommittedProposal][] {\n\t// Seed the base quorum to be an empty list with a code quorum set\n\tconst committedCodeProposal: ICommittedProposal = {\n\t\tkey: \"code\",\n\t\tvalue: source,\n\t\tapprovalSequenceNumber: 0,\n\t\tcommitSequenceNumber: 0,\n\t\tsequenceNumber: 0,\n\t};\n\treturn [[\"code\", committedCodeProposal]];\n}\n"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IDisposable } from "@fluidframework/core-interfaces";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
|
|
7
|
+
import { FetchSource, IDocumentStorageService, IDocumentStorageServicePolicies, ISnapshot, ISnapshotFetchOptions, ISummaryContext, ICreateBlobResponse, ISnapshotTree, IVersion } from "@fluidframework/driver-definitions/internal";
|
|
8
8
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
9
9
|
export declare class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {
|
|
10
10
|
private readonly internalStorageServiceP;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retriableDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EACN,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"retriableDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EACN,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,MAAM,6CAA6C,CAAC;AAErD,OAAO,EACN,mBAAmB,EAGnB,MAAM,0CAA0C,CAAC;AAElD,qBAAa,+BAAgC,YAAW,uBAAuB,EAAE,WAAW;IAI1F,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJxB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,sBAAsB,CAAsC;gBAElD,uBAAuB,EAAE,OAAO,CAAC,uBAAuB,CAAC,EACzD,MAAM,EAAE,mBAAmB;IAO7C,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAKjE;IACD,IAAW,QAAQ,YAElB;IACM,OAAO;IAID,eAAe,CAC3B,OAAO,CAAC,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAUnB,WAAW,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IAe7E,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAO9C,WAAW,CACvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUT,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IA8BL,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAO9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO5E,OAAO,CAAC,oBAAoB;YAiBd,YAAY;CAM1B"}
|
|
@@ -10,7 +10,9 @@ export class RetriableDocumentStorageService {
|
|
|
10
10
|
this.internalStorageServiceP = internalStorageServiceP;
|
|
11
11
|
this.logger = logger;
|
|
12
12
|
this._disposed = false;
|
|
13
|
-
this.internalStorageServiceP
|
|
13
|
+
this.internalStorageServiceP
|
|
14
|
+
.then((s) => (this.internalStorageService = s))
|
|
15
|
+
.catch(() => { });
|
|
14
16
|
}
|
|
15
17
|
get policies() {
|
|
16
18
|
if (this.internalStorageService) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retriableDocumentStorageService.js","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"retriableDocumentStorageService.js","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAa7D,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAEN,YAAY,EACZ,UAAU,GACV,MAAM,0CAA0C,CAAC;AAElD,MAAM,OAAO,+BAA+B;IAG3C,YACkB,uBAAyD,EACzD,MAA2B;QAD3B,4BAAuB,GAAvB,uBAAuB,CAAkC;QACzD,WAAM,GAAN,MAAM,CAAqB;QAJrC,cAAS,GAAG,KAAK,CAAC;QAMzB,IAAI,CAAC,uBAAuB;aAC1B,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,sBAAsB,GAAG,CAAC,CAAC,CAAC;aAC9C,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACnB,CAAC;IAED,IAAW,QAAQ;QAClB,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;QAC7C,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACzD,CAAC;IACD,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IACM,OAAO;QACb,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;IAEM,KAAK,CA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AC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAC9E,oBAAoB,CACpB,CAAC;IACH,CAAC;IAEO,oBAAoB,CAAC,QAAgB,EAAE,KAAc;QAC5D,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAC7B;gBACC,SAAS,EAAE,GAAG,QAAQ,yBAAyB;gBAC/C,aAAa,EAAE,QAAQ,EAAE,gDAAgD;aACzE,EACD,KAAK,CACL,CAAC;YACF,4DAA4D;YAC5D,MAAM,IAAI,YAAY,CAAC,2CAA2C,EAAE;gBACnE,QAAQ,EAAE,KAAK;aACf,CAAC,CAAC;QACJ,CAAC;QACD,OAAO;IACR,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACpE,OAAO,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE;YAC/C,OAAO,EAAE,CAAC,UAAkB,EAAE,KAAc,EAAE,EAAE,CAC/C,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC;SAC3C,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryHandle, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { runWithRetry } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tGenericError,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nexport class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {\n\tprivate _disposed = false;\n\tprivate internalStorageService: IDocumentStorageService | undefined;\n\tconstructor(\n\t\tprivate readonly internalStorageServiceP: Promise<IDocumentStorageService>,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.internalStorageServiceP\n\t\t\t.then((s) => (this.internalStorageService = s))\n\t\t\t.catch(() => {});\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\tif (this.internalStorageService) {\n\t\t\treturn this.internalStorageService.policies;\n\t\t}\n\t\tthrow new Error(\"storage service not yet instantiated\");\n\t}\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose() {\n\t\tthis._disposed = true;\n\t}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: IVersion,\n\t\tscenarioName?: string,\n\t): Promise<ISnapshotTree | null> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) =>\n\t\t\t\t\ts.getSnapshotTree(version, scenarioName),\n\t\t\t\t),\n\t\t\t\"storage_getSnapshotTree\",\n\t\t);\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) => {\n\t\t\t\t\tif (s.getSnapshot !== undefined) {\n\t\t\t\t\t\treturn s.getSnapshot(snapshotFetchOptions);\n\t\t\t\t\t}\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\"getSnapshot api should exist on internal storage in RetriableDocStorageService class\",\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t\"storage_getSnapshot\",\n\t\t);\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageServiceP.then(async (s) => s.readBlob(id)),\n\t\t\t\"storage_readBlob\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) =>\n\t\t\t\t\ts.getVersions(versionId, count, scenarioName, fetchSource),\n\t\t\t\t),\n\t\t\t\"storage_getVersions\",\n\t\t);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\t// Not using retry loop here. Couple reasons:\n\t\t// 1. If client lost connectivity, then retry loop will result in uploading stale summary\n\t\t// by stale summarizer after connectivity comes back. It will cause failures for this client and for\n\t\t// real (new) summarizer. This problem in particular should be solved in future by supplying abort handle\n\t\t// on all APIs and caller (ContainerRuntime.submitSummary) aborting call on loss of connectivity\n\t\t// 2. Similar, if we get 429 with retryAfter = 10 minutes, it's likely not the right call to retry summary\n\t\t// upload in 10 minutes - it's better to keep processing ops and retry later. Though caller needs to take\n\t\t// retryAfter into account!\n\t\t// But retry loop is required for creation flow (Container.attach)\n\t\tassert(\n\t\t\t(context.referenceSequenceNumber === 0) === (context.ackHandle === undefined),\n\t\t\t0x251 /* \"creation summary has to have seq=0 && handle === undefined\" */,\n\t\t);\n\t\tif (context.referenceSequenceNumber !== 0) {\n\t\t\treturn this.internalStorageServiceP.then(async (s) =>\n\t\t\t\ts.uploadSummaryWithContext(summary, context),\n\t\t\t);\n\t\t}\n\n\t\t// Creation flow with attachment blobs - need to do retries!\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) =>\n\t\t\t\t\ts.uploadSummaryWithContext(summary, context),\n\t\t\t\t),\n\t\t\t\"storage_uploadSummaryWithContext\",\n\t\t);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageServiceP.then(async (s) => s.downloadSummary(handle)),\n\t\t\t\"storage_downloadSummary\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageServiceP.then(async (s) => s.createBlob(file)),\n\t\t\t\"storage_createBlob\",\n\t\t);\n\t}\n\n\tprivate checkStorageDisposed(callName: string, error: unknown) {\n\t\tif (this._disposed) {\n\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: `${callName}_abortedStorageDisposed`,\n\t\t\t\t\tfetchCallName: callName, // fetchCallName matches logs in runWithRetry.ts\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\t// pre-0.58 error message: storageServiceDisposedCannotRetry\n\t\t\tthrow new GenericError(\"Storage Service is disposed. Cannot retry\", {\n\t\t\t\tcanRetry: false,\n\t\t\t});\n\t\t}\n\t\treturn;\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(api, callName, this.logger, {\n\t\t\tonRetry: (_delayInMs: number, error: unknown) =>\n\t\t\t\tthis.checkStorageDisposed(callName, error),\n\t\t});\n\t}\n}\n"]}
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IGetPendingLocalStateProps, IRuntime } from "@fluidframework/container-definitions/internal";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import type { IEventProvider, IEvent, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
|
+
import { IDocumentStorageService, IResolvedUrl, ISnapshot, ISnapshotTree, IVersion, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
8
8
|
import { MonitoringContext } from "@fluidframework/telemetry-utils/internal";
|
|
9
|
-
import type { ITelemetryBaseLogger, IEventProvider, IEvent } from "@fluidframework/core-interfaces";
|
|
10
9
|
import { ISerializableBlobContents } from "./containerStorageAdapter.js";
|
|
11
10
|
/**
|
|
12
11
|
* This is very similar to {@link @fluidframework/protocol-definitions/internal#ISnapshot}, but the difference is
|
|
@@ -97,6 +96,7 @@ export declare class SerializedStateManager {
|
|
|
97
96
|
private readonly storageAdapter;
|
|
98
97
|
private readonly _offlineLoadEnabled;
|
|
99
98
|
private readonly containerDirty;
|
|
99
|
+
private readonly supportGetSnapshotApi;
|
|
100
100
|
private readonly processedOps;
|
|
101
101
|
private readonly mc;
|
|
102
102
|
private snapshot;
|
|
@@ -111,7 +111,7 @@ export declare class SerializedStateManager {
|
|
|
111
111
|
* @param containerEvent - Source of the "saved" event when the container has all its pending state uploaded
|
|
112
112
|
* @param containerDirty - Is the container "dirty"? That's the opposite of "saved" - there is pending state that may not have been received yet by the service.
|
|
113
113
|
*/
|
|
114
|
-
constructor(pendingLocalState: IPendingContainerState | undefined, subLogger: ITelemetryBaseLogger, storageAdapter: ISerializedStateManagerDocumentStorageService, _offlineLoadEnabled: boolean, containerEvent: IEventProvider<ISerializerEvent>, containerDirty: () => boolean);
|
|
114
|
+
constructor(pendingLocalState: IPendingContainerState | undefined, subLogger: ITelemetryBaseLogger, storageAdapter: ISerializedStateManagerDocumentStorageService, _offlineLoadEnabled: boolean, containerEvent: IEventProvider<ISerializerEvent>, containerDirty: () => boolean, supportGetSnapshotApi: () => boolean);
|
|
115
115
|
get offlineLoadEnabled(): boolean;
|
|
116
116
|
/**
|
|
117
117
|
* Promise that will resolve (or reject) once we've tried to download the latest snapshot(s) from storage
|
|
@@ -131,7 +131,7 @@ export declare class SerializedStateManager {
|
|
|
131
131
|
* @param supportGetSnapshotApi - a boolean indicating whether to use the fetchISnapshot or fetchISnapshotTree.
|
|
132
132
|
* @returns The snapshot to boot the container from
|
|
133
133
|
*/
|
|
134
|
-
fetchSnapshot(specifiedVersion: string | undefined
|
|
134
|
+
fetchSnapshot(specifiedVersion: string | undefined): Promise<{
|
|
135
135
|
baseSnapshot: ISnapshotTree | ISnapshot;
|
|
136
136
|
version: IVersion | undefined;
|
|
137
137
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializedStateManager.d.ts","sourceRoot":"","sources":["../src/serializedStateManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"serializedStateManager.d.ts","sourceRoot":"","sources":["../src/serializedStateManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,0BAA0B,EAC1B,QAAQ,EACR,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACX,cAAc,EACd,MAAM,EACN,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAEN,uBAAuB,EACvB,YAAY,EACZ,SAAS,EAET,aAAa,EACb,QAAQ,EACR,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EACN,iBAAiB,EAIjB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACN,yBAAyB,EAEzB,MAAM,8BAA8B,CAAC;AAGtC;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,YAAY,EAAE,aAAa,CAAC;IAC5B;;;OAGG;IACH,aAAa,EAAE,yBAAyB,CAAC;CACzC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAChE,yGAAyG;IACzG,QAAQ,EAAE,IAAI,CAAC;IACf;;;OAGG;IACH,mBAAmB,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACvD;;;;OAIG;IACH,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IACtC,0FAA0F;IAC1F,GAAG,EAAE,MAAM,CAAC;IACZ,sIAAsI;IACtI,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,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,CAAC,CAsBvD;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACvC,EAAE,EAAE,iBAAiB,EACrB,cAAc,EAAE,IAAI,CAAC,uBAAuB,EAAE,iBAAiB,GAAG,aAAa,CAAC,EAChF,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAClC,OAAO,CAAC;IAAE,QAAQ,CAAC,EAAE,aAAa,CAAC;IAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,CAAC,CAsBvE"}
|
|
@@ -7,7 +7,7 @@ import { assert } from "@fluidframework/core-utils/internal";
|
|
|
7
7
|
import { FetchSource, } from "@fluidframework/driver-definitions/internal";
|
|
8
8
|
import { getSnapshotTree } from "@fluidframework/driver-utils/internal";
|
|
9
9
|
import { PerformanceEvent, UsageError, createChildMonitoringContext, } from "@fluidframework/telemetry-utils/internal";
|
|
10
|
-
import { getBlobContentsFromTree } from "./containerStorageAdapter.js";
|
|
10
|
+
import { getBlobContentsFromTree, } from "./containerStorageAdapter.js";
|
|
11
11
|
import { convertSnapshotToSnapshotInfo, getDocumentAttributes } from "./utils.js";
|
|
12
12
|
/**
|
|
13
13
|
* Helper class to manage the state of the container needed for proper serialization.
|
|
@@ -25,17 +25,21 @@ export class SerializedStateManager {
|
|
|
25
25
|
* @param containerEvent - Source of the "saved" event when the container has all its pending state uploaded
|
|
26
26
|
* @param containerDirty - Is the container "dirty"? That's the opposite of "saved" - there is pending state that may not have been received yet by the service.
|
|
27
27
|
*/
|
|
28
|
-
constructor(pendingLocalState, subLogger, storageAdapter, _offlineLoadEnabled, containerEvent, containerDirty) {
|
|
28
|
+
constructor(pendingLocalState, subLogger, storageAdapter, _offlineLoadEnabled, containerEvent, containerDirty, supportGetSnapshotApi) {
|
|
29
29
|
this.pendingLocalState = pendingLocalState;
|
|
30
30
|
this.storageAdapter = storageAdapter;
|
|
31
31
|
this._offlineLoadEnabled = _offlineLoadEnabled;
|
|
32
32
|
this.containerDirty = containerDirty;
|
|
33
|
+
this.supportGetSnapshotApi = supportGetSnapshotApi;
|
|
33
34
|
this.processedOps = [];
|
|
34
35
|
this.lastSavedOpSequenceNumber = 0;
|
|
35
36
|
this.mc = createChildMonitoringContext({
|
|
36
37
|
logger: subLogger,
|
|
37
38
|
namespace: "serializedStateManager",
|
|
38
39
|
});
|
|
40
|
+
// special case handle. Obtaining the last saved op seq num to avoid
|
|
41
|
+
// refreshing the snapshot before we have processed it. It could cause
|
|
42
|
+
// a subsequent stashing to have a newer snapshot than allowed.
|
|
39
43
|
if (pendingLocalState && pendingLocalState.savedOps.length > 0) {
|
|
40
44
|
const savedOpsSize = pendingLocalState.savedOps.length;
|
|
41
45
|
this.lastSavedOpSequenceNumber =
|
|
@@ -71,9 +75,9 @@ export class SerializedStateManager {
|
|
|
71
75
|
* @param supportGetSnapshotApi - a boolean indicating whether to use the fetchISnapshot or fetchISnapshotTree.
|
|
72
76
|
* @returns The snapshot to boot the container from
|
|
73
77
|
*/
|
|
74
|
-
async fetchSnapshot(specifiedVersion
|
|
78
|
+
async fetchSnapshot(specifiedVersion) {
|
|
75
79
|
if (this.pendingLocalState === undefined) {
|
|
76
|
-
const { baseSnapshot, version } = await getSnapshot(this.mc, this.storageAdapter, supportGetSnapshotApi, specifiedVersion);
|
|
80
|
+
const { baseSnapshot, version } = await getSnapshot(this.mc, this.storageAdapter, this.supportGetSnapshotApi(), specifiedVersion);
|
|
77
81
|
const baseSnapshotTree = getSnapshotTree(baseSnapshot);
|
|
78
82
|
// non-interactive clients will not have any pending state we want to save
|
|
79
83
|
if (this.offlineLoadEnabled) {
|
|
@@ -98,7 +102,7 @@ export class SerializedStateManager {
|
|
|
98
102
|
if (this.refreshSnapshotP === undefined &&
|
|
99
103
|
this.mc.config.getBoolean("Fluid.Container.enableOfflineSnapshotRefresh") === true) {
|
|
100
104
|
// Don't block on the refresh snapshot call - it is for the next time we serialize, not booting this incarnation
|
|
101
|
-
this.refreshSnapshotP = this.refreshLatestSnapshot(supportGetSnapshotApi);
|
|
105
|
+
this.refreshSnapshotP = this.refreshLatestSnapshot(this.supportGetSnapshotApi());
|
|
102
106
|
this.refreshSnapshotP.catch((e) => {
|
|
103
107
|
this.mc.logger.sendErrorEvent({
|
|
104
108
|
eventName: "RefreshLatestSnapshotFailed",
|
|
@@ -184,9 +188,7 @@ export class SerializedStateManager {
|
|
|
184
188
|
eventName: "SnapshotRefreshed",
|
|
185
189
|
snapshotSequenceNumber,
|
|
186
190
|
firstProcessedOpSequenceNumber,
|
|
187
|
-
newFirstProcessedOpSequenceNumber: this.processedOps.length === 0
|
|
188
|
-
? undefined
|
|
189
|
-
: this.processedOps[0].sequenceNumber,
|
|
191
|
+
newFirstProcessedOpSequenceNumber: this.processedOps.length === 0 ? undefined : this.processedOps[0].sequenceNumber,
|
|
190
192
|
});
|
|
191
193
|
}
|
|
192
194
|
}
|
|
@@ -216,8 +218,12 @@ export class SerializedStateManager {
|
|
|
216
218
|
async getPendingLocalState(props, clientId, runtime, resolvedUrl) {
|
|
217
219
|
return PerformanceEvent.timedExecAsync(this.mc.logger, {
|
|
218
220
|
eventName: "getPendingLocalState",
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
details: {
|
|
222
|
+
notifyImminentClosure: props.notifyImminentClosure,
|
|
223
|
+
sessionExpiryTimerStarted: props.sessionExpiryTimerStarted,
|
|
224
|
+
snapshotSequenceNumber: props.snapshotSequenceNumber,
|
|
225
|
+
processedOpsSize: this.processedOps.length,
|
|
226
|
+
},
|
|
221
227
|
clientId,
|
|
222
228
|
}, async () => {
|
|
223
229
|
if (!this.offlineLoadEnabled) {
|
|
@@ -244,9 +250,7 @@ export class SerializedStateManager {
|
|
|
244
250
|
pendingRuntimeState,
|
|
245
251
|
baseSnapshot: this.snapshot.baseSnapshot,
|
|
246
252
|
snapshotBlobs: this.snapshot.snapshotBlobs,
|
|
247
|
-
loadedGroupIdSnapshots: hasGroupIdSnapshots
|
|
248
|
-
? loadedGroupIdSnapshots
|
|
249
|
-
: undefined,
|
|
253
|
+
loadedGroupIdSnapshots: hasGroupIdSnapshots ? loadedGroupIdSnapshots : undefined,
|
|
250
254
|
savedOps: this.processedOps,
|
|
251
255
|
url: resolvedUrl.url,
|
|
252
256
|
clientId,
|