@fluidframework/container-loader 2.63.0-359286 → 2.63.0-359734
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attachment.d.ts +2 -7
- package/dist/attachment.d.ts.map +1 -1
- package/dist/attachment.js +2 -4
- package/dist/attachment.js.map +1 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +10 -9
- package/dist/container.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/serializedStateManager.d.ts +11 -8
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +51 -34
- package/dist/serializedStateManager.js.map +1 -1
- package/dist/utils.d.ts +7 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +41 -23
- package/dist/utils.js.map +1 -1
- package/lib/attachment.d.ts +2 -7
- package/lib/attachment.d.ts.map +1 -1
- package/lib/attachment.js +3 -5
- package/lib/attachment.js.map +1 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +11 -10
- package/lib/container.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/serializedStateManager.d.ts +11 -8
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +52 -35
- package/lib/serializedStateManager.js.map +1 -1
- package/lib/utils.d.ts +7 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +39 -22
- package/lib/utils.js.map +1 -1
- package/package.json +11 -11
- package/src/attachment.ts +7 -13
- package/src/container.ts +11 -11
- package/src/packageVersion.ts +1 -1
- package/src/serializedStateManager.ts +68 -39
- package/src/utils.ts +49 -26
package/dist/attachment.d.ts
CHANGED
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { AttachState } from "@fluidframework/container-definitions";
|
|
6
6
|
import type { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
7
|
-
import type { IDocumentStorageService } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import type { IDocumentStorageService, ISnapshot } from "@fluidframework/driver-definitions/internal";
|
|
8
8
|
import type { CombinedAppAndProtocolSummary } from "@fluidframework/driver-utils/internal";
|
|
9
9
|
import type { MemoryDetachedBlobStorage } from "./memoryBlobStorage.js";
|
|
10
|
-
import type { SnapshotWithBlobs } from "./serializedStateManager.js";
|
|
11
10
|
/**
|
|
12
11
|
* The default state a newly created detached container will have.
|
|
13
12
|
* All but the state are optional and undefined, they just exist
|
|
@@ -97,10 +96,6 @@ export interface AttachProcessProps {
|
|
|
97
96
|
* @returns The attachment summary for the container.
|
|
98
97
|
*/
|
|
99
98
|
readonly createAttachmentSummary: (redirectTable?: Map<string, string>) => CombinedAppAndProtocolSummary;
|
|
100
|
-
/**
|
|
101
|
-
* Whether offline load is enabled or not.
|
|
102
|
-
*/
|
|
103
|
-
readonly offlineLoadEnabled: boolean;
|
|
104
99
|
}
|
|
105
100
|
/**
|
|
106
101
|
* Executes the attach process state machine based on the provided data and services.
|
|
@@ -110,5 +105,5 @@ export interface AttachProcessProps {
|
|
|
110
105
|
* @param AttachProcessProps - The data and services necessary to run the attachment process
|
|
111
106
|
* @returns - The attach summary (only if offline load is enabled), or undefined
|
|
112
107
|
*/
|
|
113
|
-
export declare const runRetriableAttachProcess: ({ detachedBlobStorage, createOrGetStorageService, setAttachmentData, createAttachmentSummary,
|
|
108
|
+
export declare const runRetriableAttachProcess: ({ detachedBlobStorage, createOrGetStorageService, setAttachmentData, createAttachmentSummary, initialAttachmentData, }: AttachProcessProps) => Promise<ISnapshot>;
|
|
114
109
|
//# sourceMappingURL=attachment.d.ts.map
|
package/dist/attachment.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO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- The data and services necessary to run the attachment process
|
|
17
17
|
* @returns - The attach summary (only if offline load is enabled), or undefined
|
|
18
18
|
*/
|
|
19
|
-
const runRetriableAttachProcess = async ({ detachedBlobStorage, createOrGetStorageService, setAttachmentData, createAttachmentSummary,
|
|
19
|
+
const runRetriableAttachProcess = async ({ detachedBlobStorage, createOrGetStorageService, setAttachmentData, createAttachmentSummary, initialAttachmentData, }) => {
|
|
20
20
|
let currentData = initialAttachmentData;
|
|
21
21
|
if (currentData.blobs === undefined) {
|
|
22
22
|
// If attachment blobs were uploaded in detached state we will go through a different attach flow
|
|
@@ -71,9 +71,7 @@ const runRetriableAttachProcess = async ({ detachedBlobStorage, createOrGetStora
|
|
|
71
71
|
proposalHandle: undefined,
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
const snapshot =
|
|
75
|
-
? (0, utils_js_1.getSnapshotTreeAndBlobsFromSerializedContainer)(currentData.summary)
|
|
76
|
-
: undefined;
|
|
74
|
+
const snapshot = (0, utils_js_1.getISnapshotFromSerializedContainer)(currentData.summary);
|
|
77
75
|
setAttachmentData((currentData = {
|
|
78
76
|
state: container_definitions_1.AttachState.Attached,
|
|
79
77
|
}));
|
package/dist/attachment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.js","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AACpE,kEAA6D;AAO7D,yCAA4E;AAwH5E;;;;;;;GAOG;AACI,MAAM,yBAAyB,GAAG,KAAK,EAAE,EAC/C,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,GACD,EAA0C,EAAE;IAChE,IAAI,WAAW,GAAmB,qBAAqB,CAAC;IAExD,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACrC,iGAAiG;QACjG,MAAM,0BAA0B,GAC/B,mBAAmB,KAAK,SAAS,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,EAAE,CAAC,CAAC;YACpC,CAAC;QACF,CAAC;QACD,iBAAiB,CAChB,CAAC,WAAW,GAAG;YACd,KAAK,EAAE,mCAAW,CAAC,SAAS;YAC5B,OAAO,EAAE,uBAAuB,CAAC,aAAa,CAAC;YAC/C,KAAK,EAAE,MAAM;SACb,CAAC,CACF,CAAC;IACH,CAAC;IAED,IAAA,iBAAM,EACL,WAAW,CAAC,KAAK,KAAK,mCAAW,CAAC,SAAS,EAC3C,KAAK,CAAC,qCAAqC,CAC3C,CAAC;IAEF,IAAI,WAAW,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QAClC,8CAA8C;QAC9C,kEAAkE;QAClE,2CAA2C;QAC3C,MAAM,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,OAAO,EAAE;YAC3D,uBAAuB,EAAE,CAAC;YAC1B,SAAS,EAAE,SAAS;YACpB,cAAc,EAAE,SAAS;SACzB,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAkC,kBAAkB;QACjE,CAAC,CAAC,IAAA,yDAA8C,EAAC,WAAW,CAAC,OAAO,CAAC;QACrE,CAAC,CAAC,SAAS,CAAC;IAEb,iBAAiB,CAChB,CAAC,WAAW,GAAG;QACd,KAAK,EAAE,mCAAW,CAAC,QAAQ;KAC3B,CAAC,CACF,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AArFW,QAAA,yBAAyB,6BAqFpC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type { IDocumentStorageService } from \"@fluidframework/driver-definitions/internal\";\nimport type { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils/internal\";\n\nimport type { MemoryDetachedBlobStorage } from \"./memoryBlobStorage.js\";\nimport type { SnapshotWithBlobs } from \"./serializedStateManager.js\";\nimport { getSnapshotTreeAndBlobsFromSerializedContainer } from \"./utils.js\";\n\n/**\n * The default state a newly created detached container will have.\n * All but the state are optional and undefined, they just exist\n * to make the union easy to deal with for both Detached types\n */\nexport interface DetachedDefaultData {\n\treadonly state: AttachState.Detached;\n\treadonly blobs?: undefined;\n\treadonly summary?: undefined;\n\treadonly redirectTable?: undefined;\n}\n\n/**\n * This always follows DetachedDefaultData when there are\n * outstanding blobs in the detached blob storage.\n * The redirect table will get filled up to include data\n * about the blobs as they are uploaded.\n */\nexport interface DetachedDataWithOutstandingBlobs {\n\treadonly state: AttachState.Detached;\n\treadonly blobs: \"outstanding\";\n\treadonly summary?: undefined;\n\treadonly redirectTable: Map<string, string>;\n}\n\n/**\n * This state always follows DetachedDataWithOutstandingBlobs.\n * It signals that all outstanding blobs are done being uploaded,\n * so the container can move to the attaching state.\n */\nexport interface AttachingDataWithBlobs {\n\treadonly state: AttachState.Attaching;\n\treadonly blobs: \"done\";\n\treadonly summary: CombinedAppAndProtocolSummary;\n}\n\n/**\n * This always follows DefaultDetachedState when there are\n * no blobs in the detached blob storage. Because there are\n * no blobs we can immediately get the summary and transition\n * to the attaching state.\n */\nexport interface AttachingDataWithoutBlobs {\n\treadonly state: AttachState.Attaching;\n\treadonly summary: CombinedAppAndProtocolSummary;\n\treadonly blobs: \"none\";\n}\n\n/**\n * The final attachment state which signals the container is fully attached.\n * The baseSnapshotAndBlobs will only be enabled when offline load is enabled.\n */\nexport interface AttachedData {\n\treadonly state: AttachState.Attached;\n}\n\n/**\n * A union of all the attachment data types for\n * tracking across all container attachment states\n */\nexport type AttachmentData =\n\t| DetachedDefaultData\n\t| DetachedDataWithOutstandingBlobs\n\t| AttachingDataWithoutBlobs\n\t| AttachingDataWithBlobs\n\t| AttachedData;\n\n/**\n * The data and services necessary for runRetriableAttachProcess.\n */\nexport interface AttachProcessProps {\n\t/**\n\t * The initial attachment data this call should start with\n\t */\n\treadonly initialAttachmentData: Exclude<AttachmentData, AttachedData>;\n\n\t/**\n\t * The caller should use this callback to keep track of the current\n\t * attachment data, and perform any other operations necessary\n\t * for dealing with attachment state changes, like emitting events\n\t *\n\t * @param attachmentData - the updated attachment data\n\t */\n\treadonly setAttachmentData: (attachmentData: AttachmentData) => void;\n\n\t/**\n\t * The caller should create and or get services based on the data, and its own information.\n\t * @param data - the data to create services from,\n\t * the summary property being the most relevant part of the data.\n\t * @returns A compatible storage service\n\t */\n\treadonly createOrGetStorageService: (\n\t\tdata: ISummaryTree | undefined,\n\t) => Promise<Pick<IDocumentStorageService, \"createBlob\" | \"uploadSummaryWithContext\">>;\n\n\t/**\n\t * The detached blob storage if it exists.\n\t */\n\treadonly detachedBlobStorage?: Pick<\n\t\tMemoryDetachedBlobStorage,\n\t\t\"getBlobIds\" | \"readBlob\" | \"size\"\n\t>;\n\n\t/**\n\t * The caller should create the attachment summary for the container.\n\t * @param redirectTable - Maps local blob ids to remote blobs ids.\n\t * @returns The attachment summary for the container.\n\t */\n\treadonly createAttachmentSummary: (\n\t\tredirectTable?: Map<string, string>,\n\t) => CombinedAppAndProtocolSummary;\n\n\t/**\n\t * Whether offline load is enabled or not.\n\t */\n\treadonly offlineLoadEnabled: boolean;\n}\n\n/**\n * Executes the attach process state machine based on the provided data and services.\n * This method is retriable on failure. Based on the provided initialAttachmentData\n * this method will resume the attachment process and attempt to complete it.\n *\n * @param AttachProcessProps - The data and services necessary to run the attachment process\n * @returns - The attach summary (only if offline load is enabled), or undefined\n */\nexport const runRetriableAttachProcess = async ({\n\tdetachedBlobStorage,\n\tcreateOrGetStorageService,\n\tsetAttachmentData,\n\tcreateAttachmentSummary,\n\tofflineLoadEnabled,\n\tinitialAttachmentData,\n}: AttachProcessProps): Promise<SnapshotWithBlobs | undefined> => {\n\tlet currentData: AttachmentData = initialAttachmentData;\n\n\tif (currentData.blobs === undefined) {\n\t\t// If attachment blobs were uploaded in detached state we will go through a different attach flow\n\t\tconst outstandingAttachmentBlobs =\n\t\t\tdetachedBlobStorage !== undefined && detachedBlobStorage.size > 0;\n\t\t// Determine the next phase of attaching which depends on if there are attachment blobs\n\t\t// if there are, we will stay detached, so an empty file can be created, and the blobs\n\t\t// uploaded, otherwise we will get the summary to create the file with and move to attaching\n\t\tcurrentData = outstandingAttachmentBlobs\n\t\t\t? {\n\t\t\t\t\tstate: AttachState.Detached,\n\t\t\t\t\tblobs: \"outstanding\",\n\t\t\t\t\tredirectTable: new Map<string, string>(),\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\t\tsummary: createAttachmentSummary(),\n\t\t\t\t\tblobs: \"none\",\n\t\t\t\t};\n\t\tsetAttachmentData(currentData);\n\t}\n\n\t// this has to run here, as it is what creates the file\n\t// and we need to file for all possible cases after this point\n\tconst storage = await createOrGetStorageService(currentData.summary);\n\n\tif (currentData.blobs === \"outstanding\") {\n\t\tconst { redirectTable } = currentData;\n\t\t// upload blobs to storage\n\t\tassert(!!detachedBlobStorage, 0x24e /* \"assertion for type narrowing\" */);\n\n\t\t// build a table mapping IDs assigned locally to IDs assigned by storage and pass it to runtime to\n\t\t// support blob handles that only know about the local IDs\n\t\twhile (redirectTable.size < detachedBlobStorage.size) {\n\t\t\tconst newIds = detachedBlobStorage.getBlobIds().filter((id) => !redirectTable.has(id));\n\t\t\tfor (const id of newIds) {\n\t\t\t\tconst blob = await detachedBlobStorage.readBlob(id);\n\t\t\t\tconst response = await storage.createBlob(blob);\n\t\t\t\tredirectTable.set(id, response.id);\n\t\t\t}\n\t\t}\n\t\tsetAttachmentData(\n\t\t\t(currentData = {\n\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\tsummary: createAttachmentSummary(redirectTable),\n\t\t\t\tblobs: \"done\",\n\t\t\t}),\n\t\t);\n\t}\n\n\tassert(\n\t\tcurrentData.state === AttachState.Attaching,\n\t\t0x8e2 /* must be attaching by this point */,\n\t);\n\n\tif (currentData.blobs === \"done\") {\n\t\t// done means outstanding blobs were uploaded.\n\t\t// in that case an empty file was created, the blobs were uploaded\n\t\t// and now this finally uploads the summary\n\t\tawait storage.uploadSummaryWithContext(currentData.summary, {\n\t\t\treferenceSequenceNumber: 0,\n\t\t\tackHandle: undefined,\n\t\t\tproposalHandle: undefined,\n\t\t});\n\t}\n\n\tconst snapshot: SnapshotWithBlobs | undefined = offlineLoadEnabled\n\t\t? getSnapshotTreeAndBlobsFromSerializedContainer(currentData.summary)\n\t\t: undefined;\n\n\tsetAttachmentData(\n\t\t(currentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t}),\n\t);\n\treturn snapshot;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"attachment.js","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAAoE;AACpE,kEAA6D;AAS7D,yCAAiE;AAmHjE;;;;;;;GAOG;AACI,MAAM,yBAAyB,GAAG,KAAK,EAAE,EAC/C,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,GACD,EAAsB,EAAE;IAC5C,IAAI,WAAW,GAAmB,qBAAqB,CAAC;IAExD,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACrC,iGAAiG;QACjG,MAAM,0BAA0B,GAC/B,mBAAmB,KAAK,SAAS,IAAI,mBAAmB,CAAC,IAAI,GAAG,CAAC,CAAC;QACnE,uFAAuF;QACvF,sFAAsF;QACtF,4FAA4F;QAC5F,WAAW,GAAG,0BAA0B;YACvC,CAAC,CAAC;gBACA,KAAK,EAAE,mCAAW,CAAC,QAAQ;gBAC3B,KAAK,EAAE,aAAa;gBACpB,aAAa,EAAE,IAAI,GAAG,EAAkB;aACxC;YACF,CAAC,CAAC;gBACA,KAAK,EAAE,mCAAW,CAAC,SAAS;gBAC5B,OAAO,EAAE,uBAAuB,EAAE;gBAClC,KAAK,EAAE,MAAM;aACb,CAAC;QACJ,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACh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QAClE,2CAA2C;QAC3C,MAAM,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,OAAO,EAAE;YAC3D,uBAAuB,EAAE,CAAC;YAC1B,SAAS,EAAE,SAAS;YACpB,cAAc,EAAE,SAAS;SACzB,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,8CAAmC,EAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAE1E,iBAAiB,CAChB,CAAC,WAAW,GAAG;QACd,KAAK,EAAE,mCAAW,CAAC,QAAQ;KAC3B,CAAC,CACF,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAlFW,QAAA,yBAAyB,6BAkFpC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentStorageService,\n\tISnapshot,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { CombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils/internal\";\n\nimport type { MemoryDetachedBlobStorage } from \"./memoryBlobStorage.js\";\nimport { getISnapshotFromSerializedContainer } from \"./utils.js\";\n\n/**\n * The default state a newly created detached container will have.\n * All but the state are optional and undefined, they just exist\n * to make the union easy to deal with for both Detached types\n */\nexport interface DetachedDefaultData {\n\treadonly state: AttachState.Detached;\n\treadonly blobs?: undefined;\n\treadonly summary?: undefined;\n\treadonly redirectTable?: undefined;\n}\n\n/**\n * This always follows DetachedDefaultData when there are\n * outstanding blobs in the detached blob storage.\n * The redirect table will get filled up to include data\n * about the blobs as they are uploaded.\n */\nexport interface DetachedDataWithOutstandingBlobs {\n\treadonly state: AttachState.Detached;\n\treadonly blobs: \"outstanding\";\n\treadonly summary?: undefined;\n\treadonly redirectTable: Map<string, string>;\n}\n\n/**\n * This state always follows DetachedDataWithOutstandingBlobs.\n * It signals that all outstanding blobs are done being uploaded,\n * so the container can move to the attaching state.\n */\nexport interface AttachingDataWithBlobs {\n\treadonly state: AttachState.Attaching;\n\treadonly blobs: \"done\";\n\treadonly summary: CombinedAppAndProtocolSummary;\n}\n\n/**\n * This always follows DefaultDetachedState when there are\n * no blobs in the detached blob storage. Because there are\n * no blobs we can immediately get the summary and transition\n * to the attaching state.\n */\nexport interface AttachingDataWithoutBlobs {\n\treadonly state: AttachState.Attaching;\n\treadonly summary: CombinedAppAndProtocolSummary;\n\treadonly blobs: \"none\";\n}\n\n/**\n * The final attachment state which signals the container is fully attached.\n * The baseSnapshotAndBlobs will only be enabled when offline load is enabled.\n */\nexport interface AttachedData {\n\treadonly state: AttachState.Attached;\n}\n\n/**\n * A union of all the attachment data types for\n * tracking across all container attachment states\n */\nexport type AttachmentData =\n\t| DetachedDefaultData\n\t| DetachedDataWithOutstandingBlobs\n\t| AttachingDataWithoutBlobs\n\t| AttachingDataWithBlobs\n\t| AttachedData;\n\n/**\n * The data and services necessary for runRetriableAttachProcess.\n */\nexport interface AttachProcessProps {\n\t/**\n\t * The initial attachment data this call should start with\n\t */\n\treadonly initialAttachmentData: Exclude<AttachmentData, AttachedData>;\n\n\t/**\n\t * The caller should use this callback to keep track of the current\n\t * attachment data, and perform any other operations necessary\n\t * for dealing with attachment state changes, like emitting events\n\t *\n\t * @param attachmentData - the updated attachment data\n\t */\n\treadonly setAttachmentData: (attachmentData: AttachmentData) => void;\n\n\t/**\n\t * The caller should create and or get services based on the data, and its own information.\n\t * @param data - the data to create services from,\n\t * the summary property being the most relevant part of the data.\n\t * @returns A compatible storage service\n\t */\n\treadonly createOrGetStorageService: (\n\t\tdata: ISummaryTree | undefined,\n\t) => Promise<Pick<IDocumentStorageService, \"createBlob\" | \"uploadSummaryWithContext\">>;\n\n\t/**\n\t * The detached blob storage if it exists.\n\t */\n\treadonly detachedBlobStorage?: Pick<\n\t\tMemoryDetachedBlobStorage,\n\t\t\"getBlobIds\" | \"readBlob\" | \"size\"\n\t>;\n\n\t/**\n\t * The caller should create the attachment summary for the container.\n\t * @param redirectTable - Maps local blob ids to remote blobs ids.\n\t * @returns The attachment summary for the container.\n\t */\n\treadonly createAttachmentSummary: (\n\t\tredirectTable?: Map<string, string>,\n\t) => CombinedAppAndProtocolSummary;\n}\n\n/**\n * Executes the attach process state machine based on the provided data and services.\n * This method is retriable on failure. Based on the provided initialAttachmentData\n * this method will resume the attachment process and attempt to complete it.\n *\n * @param AttachProcessProps - The data and services necessary to run the attachment process\n * @returns - The attach summary (only if offline load is enabled), or undefined\n */\nexport const runRetriableAttachProcess = async ({\n\tdetachedBlobStorage,\n\tcreateOrGetStorageService,\n\tsetAttachmentData,\n\tcreateAttachmentSummary,\n\tinitialAttachmentData,\n}: AttachProcessProps): Promise<ISnapshot> => {\n\tlet currentData: AttachmentData = initialAttachmentData;\n\n\tif (currentData.blobs === undefined) {\n\t\t// If attachment blobs were uploaded in detached state we will go through a different attach flow\n\t\tconst outstandingAttachmentBlobs =\n\t\t\tdetachedBlobStorage !== undefined && detachedBlobStorage.size > 0;\n\t\t// Determine the next phase of attaching which depends on if there are attachment blobs\n\t\t// if there are, we will stay detached, so an empty file can be created, and the blobs\n\t\t// uploaded, otherwise we will get the summary to create the file with and move to attaching\n\t\tcurrentData = outstandingAttachmentBlobs\n\t\t\t? {\n\t\t\t\t\tstate: AttachState.Detached,\n\t\t\t\t\tblobs: \"outstanding\",\n\t\t\t\t\tredirectTable: new Map<string, string>(),\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\t\tsummary: createAttachmentSummary(),\n\t\t\t\t\tblobs: \"none\",\n\t\t\t\t};\n\t\tsetAttachmentData(currentData);\n\t}\n\n\t// this has to run here, as it is what creates the file\n\t// and we need to file for all possible cases after this point\n\tconst storage = await createOrGetStorageService(currentData.summary);\n\n\tif (currentData.blobs === \"outstanding\") {\n\t\tconst { redirectTable } = currentData;\n\t\t// upload blobs to storage\n\t\tassert(!!detachedBlobStorage, 0x24e /* \"assertion for type narrowing\" */);\n\n\t\t// build a table mapping IDs assigned locally to IDs assigned by storage and pass it to runtime to\n\t\t// support blob handles that only know about the local IDs\n\t\twhile (redirectTable.size < detachedBlobStorage.size) {\n\t\t\tconst newIds = detachedBlobStorage.getBlobIds().filter((id) => !redirectTable.has(id));\n\t\t\tfor (const id of newIds) {\n\t\t\t\tconst blob = await detachedBlobStorage.readBlob(id);\n\t\t\t\tconst response = await storage.createBlob(blob);\n\t\t\t\tredirectTable.set(id, response.id);\n\t\t\t}\n\t\t}\n\t\tsetAttachmentData(\n\t\t\t(currentData = {\n\t\t\t\tstate: AttachState.Attaching,\n\t\t\t\tsummary: createAttachmentSummary(redirectTable),\n\t\t\t\tblobs: \"done\",\n\t\t\t}),\n\t\t);\n\t}\n\n\tassert(\n\t\tcurrentData.state === AttachState.Attaching,\n\t\t0x8e2 /* must be attaching by this point */,\n\t);\n\n\tif (currentData.blobs === \"done\") {\n\t\t// done means outstanding blobs were uploaded.\n\t\t// in that case an empty file was created, the blobs were uploaded\n\t\t// and now this finally uploads the summary\n\t\tawait storage.uploadSummaryWithContext(currentData.summary, {\n\t\t\treferenceSequenceNumber: 0,\n\t\t\tackHandle: undefined,\n\t\t\tproposalHandle: undefined,\n\t\t});\n\t}\n\n\tconst snapshot = getISnapshotFromSerializedContainer(currentData.summary);\n\n\tsetAttachmentData(\n\t\t(currentData = {\n\t\t\tstate: AttachState.Attached,\n\t\t}),\n\t);\n\treturn snapshot;\n};\n"]}
|
package/dist/container.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EACN,WAAW,EACX,KAAK,SAAS,EACd,KAAK,uBAAuB,EAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAGX,kBAAkB,EAClB,UAAU,EACV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BrB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA+C5B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,aAAa;YAUP,kBAAkB;IA0FhC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAMxC;IAEF;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAUhC,OAAO,CAAC,wBAAwB;CAuChC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD;;;;;OAKG;IACH,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,CAE9D"}
|
package/dist/container.js
CHANGED
|
@@ -466,7 +466,6 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
466
466
|
};
|
|
467
467
|
let attachP = (0, attachment_js_1.runRetriableAttachProcess)({
|
|
468
468
|
initialAttachmentData: this.attachmentData,
|
|
469
|
-
offlineLoadEnabled: this.serializedStateManager.offlineLoadEnabled,
|
|
470
469
|
detachedBlobStorage: this.detachedBlobStorage,
|
|
471
470
|
setAttachmentData,
|
|
472
471
|
createAttachmentSummary,
|
|
@@ -653,10 +652,11 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
653
652
|
? undefined
|
|
654
653
|
: (0, memoryBlobStorage_js_1.createMemoryDetachedBlobStorage)();
|
|
655
654
|
this.storageAdapter = new containerStorageAdapter_js_1.ContainerStorageAdapter(this.detachedBlobStorage, this.mc.logger, pendingLocalState?.snapshotBlobs, pendingLocalState?.loadedGroupIdSnapshots, addProtocolSummaryIfMissing, enableSummarizeProtocolTree);
|
|
656
|
-
const offlineLoadEnabled =
|
|
657
|
-
this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad")
|
|
658
|
-
|
|
659
|
-
|
|
655
|
+
const offlineLoadEnabled = this.isInteractiveClient &&
|
|
656
|
+
(this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad") ??
|
|
657
|
+
this.mc.config.getBoolean("Fluid.Container.enableOfflineFull") ??
|
|
658
|
+
options.enableOfflineLoad === true);
|
|
659
|
+
this.serializedStateManager = new serializedStateManager_js_1.SerializedStateManager(this.subLogger, this.storageAdapter, offlineLoadEnabled, this, () => this._deltaManager.connectionManager.shouldJoinWrite(), () => this.supportGetSnapshotApi(), this.mc.config.getNumber("Fluid.Container.snapshotRefreshTimeoutMs"));
|
|
660
660
|
const isDomAvailable = typeof document === "object" &&
|
|
661
661
|
document !== null &&
|
|
662
662
|
typeof document.addEventListener === "function" &&
|
|
@@ -728,6 +728,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
728
728
|
}
|
|
729
729
|
this._protocolHandler?.close();
|
|
730
730
|
this.connectionStateHandler.dispose();
|
|
731
|
+
this.serializedStateManager.dispose();
|
|
731
732
|
}
|
|
732
733
|
catch (newError) {
|
|
733
734
|
this.mc.logger.sendErrorEvent({ eventName: "ContainerCloseException" }, newError);
|
|
@@ -764,6 +765,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
764
765
|
}
|
|
765
766
|
this._protocolHandler?.close();
|
|
766
767
|
this.connectionStateHandler.dispose();
|
|
768
|
+
this.serializedStateManager.dispose();
|
|
767
769
|
const maybeError = error === undefined ? undefined : new Error(error.message);
|
|
768
770
|
this._runtime?.dispose(maybeError);
|
|
769
771
|
this.storageAdapter.dispose();
|
|
@@ -816,13 +818,12 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
816
818
|
const attachingData = this.attachmentData.state === container_definitions_1.AttachState.Attaching ? this.attachmentData : undefined;
|
|
817
819
|
const combinedSummary = attachingData?.summary ??
|
|
818
820
|
(0, utils_js_1.combineAppAndProtocolSummary)(this.runtime.createSummary(), this.captureProtocolSummary());
|
|
819
|
-
const
|
|
821
|
+
const snapshot = (0, utils_js_1.getISnapshotFromSerializedContainer)(combinedSummary);
|
|
820
822
|
const pendingRuntimeState = attachingData === undefined ? undefined : this.runtime.getPendingLocalState();
|
|
821
823
|
(0, internal_2.assert)(!(0, internal_2.isPromiseLike)(pendingRuntimeState), 0x8e3 /* should not be a promise */);
|
|
822
824
|
const detachedContainerState = {
|
|
823
825
|
attached: false,
|
|
824
|
-
|
|
825
|
-
snapshotBlobs,
|
|
826
|
+
...(0, utils_js_1.convertISnapshotToSnapshotWithBlobs)(snapshot),
|
|
826
827
|
pendingRuntimeState,
|
|
827
828
|
hasAttachmentBlobs: this.detachedBlobStorage !== undefined && this.detachedBlobStorage.size > 0,
|
|
828
829
|
attachmentBlobs: this.detachedBlobStorage?.serialize(),
|
|
@@ -1020,7 +1021,7 @@ class Container extends internal_5.EventEmitterWithErrorHandling {
|
|
|
1020
1021
|
};
|
|
1021
1022
|
timings.phase2 = (0, client_utils_1.performanceNow)();
|
|
1022
1023
|
// Fetch specified snapshot.
|
|
1023
|
-
const { baseSnapshot, version, attributes } = await this.serializedStateManager.fetchSnapshot(specifiedVersion);
|
|
1024
|
+
const { baseSnapshot, version, attributes } = await this.serializedStateManager.fetchSnapshot(specifiedVersion, pendingLocalState);
|
|
1024
1025
|
const baseSnapshotTree = (0, internal_4.getSnapshotTree)(baseSnapshot);
|
|
1025
1026
|
this._loadedFromVersion = version;
|
|
1026
1027
|
// If we saved ops, we will replay them and don't need DeltaManager to fetch them
|