@fluidframework/container-runtime 2.60.0 → 2.61.0-355054
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/.mocharc.cjs +1 -2
- package/container-runtime.test-files.tar +0 -0
- package/dist/blobManager/blobManager.d.ts +21 -15
- package/dist/blobManager/blobManager.d.ts.map +1 -1
- package/dist/blobManager/blobManager.js +105 -102
- package/dist/blobManager/blobManager.js.map +1 -1
- package/dist/blobManager/blobManagerSnapSum.d.ts +4 -4
- package/dist/blobManager/blobManagerSnapSum.d.ts.map +1 -1
- package/dist/blobManager/blobManagerSnapSum.js +30 -33
- package/dist/blobManager/blobManagerSnapSum.js.map +1 -1
- package/dist/containerRuntime.js +1 -1
- package/dist/containerRuntime.js.map +1 -1
- package/dist/legacy.d.ts +2 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/internal.d.ts +1 -1
- package/legacy.d.ts +1 -1
- package/lib/blobManager/blobManager.d.ts +21 -15
- package/lib/blobManager/blobManager.d.ts.map +1 -1
- package/lib/blobManager/blobManager.js +105 -102
- package/lib/blobManager/blobManager.js.map +1 -1
- package/lib/blobManager/blobManagerSnapSum.d.ts +4 -4
- package/lib/blobManager/blobManagerSnapSum.d.ts.map +1 -1
- package/lib/blobManager/blobManagerSnapSum.js +26 -29
- package/lib/blobManager/blobManagerSnapSum.js.map +1 -1
- package/lib/containerRuntime.js +1 -1
- package/lib/containerRuntime.js.map +1 -1
- package/lib/legacy.d.ts +2 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +26 -26
- package/src/blobManager/blobManager.ts +118 -121
- package/src/blobManager/blobManagerSnapSum.ts +31 -53
- package/src/containerRuntime.ts +1 -1
- package/src/packageVersion.ts +1 -1
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
AttachState,
|
|
8
|
-
type IContainerContext,
|
|
9
|
-
} from "@fluidframework/container-definitions/internal";
|
|
10
|
-
import { assert } from "@fluidframework/core-utils/internal";
|
|
6
|
+
import type { IContainerContext } from "@fluidframework/container-definitions/internal";
|
|
11
7
|
import { readAndParse } from "@fluidframework/driver-utils/internal";
|
|
12
8
|
import type { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions/internal";
|
|
13
9
|
import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
|
|
@@ -60,72 +56,54 @@ const loadV1 = async (
|
|
|
60
56
|
export const toRedirectTable = (
|
|
61
57
|
blobManagerLoadInfo: IBlobManagerLoadInfo,
|
|
62
58
|
logger: ITelemetryLoggerExt,
|
|
63
|
-
|
|
64
|
-
): Map<string, string | undefined> => {
|
|
59
|
+
): Map<string, string> => {
|
|
65
60
|
logger.sendTelemetryEvent({
|
|
66
61
|
eventName: "AttachmentBlobsLoaded",
|
|
67
62
|
count: blobManagerLoadInfo.ids?.length ?? 0,
|
|
68
63
|
redirectTable: blobManagerLoadInfo.redirectTable?.length,
|
|
69
64
|
});
|
|
70
|
-
const redirectTable = new Map<string, string
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
const redirectTable = new Map<string, string>(blobManagerLoadInfo.redirectTable);
|
|
66
|
+
if (blobManagerLoadInfo.ids !== undefined) {
|
|
67
|
+
for (const storageId of blobManagerLoadInfo.ids) {
|
|
68
|
+
// Older versions of the runtime used the storage ID directly in the handle,
|
|
69
|
+
// rather than routing through the redirectTable. To support old handles that
|
|
70
|
+
// were created in this way but unify handling through the redirectTable, we
|
|
71
|
+
// add identity mappings to the redirect table at load. These identity entries
|
|
72
|
+
// will be excluded during summarization.
|
|
73
|
+
redirectTable.set(storageId, storageId);
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
76
|
return redirectTable;
|
|
80
77
|
};
|
|
81
78
|
|
|
82
79
|
export const summarizeBlobManagerState = (
|
|
83
|
-
redirectTable: Map<string, string
|
|
84
|
-
|
|
85
|
-
): ISummaryTreeWithStats => summarizeV1(redirectTable, attachState);
|
|
80
|
+
redirectTable: Map<string, string>,
|
|
81
|
+
): ISummaryTreeWithStats => summarizeV1(redirectTable);
|
|
86
82
|
|
|
87
|
-
const summarizeV1 = (
|
|
88
|
-
redirectTable: Map<string, string | undefined>,
|
|
89
|
-
attachState: AttachState,
|
|
90
|
-
): ISummaryTreeWithStats => {
|
|
91
|
-
const storageIds = getStorageIds(redirectTable, attachState);
|
|
92
|
-
|
|
93
|
-
// if storageIds is empty, it means we are detached and have only local IDs, or that there are no blobs attached
|
|
94
|
-
const blobIds = storageIds.size > 0 ? [...storageIds] : [...redirectTable.keys()];
|
|
83
|
+
const summarizeV1 = (redirectTable: Map<string, string>): ISummaryTreeWithStats => {
|
|
95
84
|
const builder = new SummaryTreeBuilder();
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
const storageIds = getStorageIds(redirectTable);
|
|
86
|
+
for (const storageId of storageIds) {
|
|
87
|
+
// The Attachment is inspectable by storage, which lets it detect that the blob is referenced
|
|
88
|
+
// and therefore should not be GC'd.
|
|
89
|
+
builder.addAttachment(storageId);
|
|
98
90
|
}
|
|
99
91
|
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
92
|
+
// Exclude identity mappings from the redirectTable summary. Note that
|
|
93
|
+
// the storageIds of the identity mappings are still included in the Attachments
|
|
94
|
+
// above, so we expect these identity mappings will be recreated at load
|
|
95
|
+
// time in toRedirectTable even if there is no non-identity mapping in
|
|
96
|
+
// the redirectTable.
|
|
97
|
+
const nonIdentityRedirectTableEntries = [...redirectTable.entries()].filter(
|
|
98
|
+
([localId, storageId]) => localId !== storageId,
|
|
99
|
+
);
|
|
100
|
+
if (nonIdentityRedirectTableEntries.length > 0) {
|
|
101
|
+
builder.addBlob(redirectTableBlobName, JSON.stringify(nonIdentityRedirectTableEntries));
|
|
109
102
|
}
|
|
110
103
|
|
|
111
104
|
return builder.getSummaryTree();
|
|
112
105
|
};
|
|
113
106
|
|
|
114
|
-
export const getStorageIds = (
|
|
115
|
-
|
|
116
|
-
attachState: AttachState,
|
|
117
|
-
): Set<string> => {
|
|
118
|
-
const ids = new Set<string | undefined>(redirectTable.values());
|
|
119
|
-
|
|
120
|
-
// If we are detached, we will not have storage IDs, only undefined
|
|
121
|
-
const undefinedValueInTable = ids.delete(undefined);
|
|
122
|
-
|
|
123
|
-
// For a detached container, entries are inserted into the redirect table with an undefined storage ID.
|
|
124
|
-
// For an attached container, entries are inserted w/storage ID after the BlobAttach op round-trips.
|
|
125
|
-
assert(
|
|
126
|
-
!undefinedValueInTable || (attachState === AttachState.Detached && ids.size === 0),
|
|
127
|
-
0x382 /* 'redirectTable' must contain only undefined while detached / defined values while attached */,
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
return ids as Set<string>;
|
|
107
|
+
export const getStorageIds = (redirectTable: Map<string, string>): Set<string> => {
|
|
108
|
+
return new Set<string>(redirectTable.values());
|
|
131
109
|
};
|
package/src/containerRuntime.ts
CHANGED
|
@@ -3708,7 +3708,7 @@ export class ContainerRuntime
|
|
|
3708
3708
|
telemetryContext?: ITelemetryContext,
|
|
3709
3709
|
): ISummaryTree {
|
|
3710
3710
|
if (blobRedirectTable) {
|
|
3711
|
-
this.blobManager.
|
|
3711
|
+
this.blobManager.patchRedirectTable(blobRedirectTable);
|
|
3712
3712
|
}
|
|
3713
3713
|
|
|
3714
3714
|
// We can finalize any allocated IDs since we're the only client
|
package/src/packageVersion.ts
CHANGED