@fluidframework/runtime-utils 2.0.0-internal.3.0.5 → 2.0.0-internal.3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +5 -7
- package/.mocharc.js +2 -2
- package/api-extractor.json +2 -2
- package/dist/dataStoreHandleContextUtils.d.ts.map +1 -1
- package/dist/dataStoreHandleContextUtils.js +3 -1
- package/dist/dataStoreHandleContextUtils.js.map +1 -1
- package/dist/dataStoreHelpers.d.ts.map +1 -1
- package/dist/dataStoreHelpers.js +23 -7
- package/dist/dataStoreHelpers.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/objectstoragepartition.d.ts.map +1 -1
- package/dist/objectstoragepartition.js.map +1 -1
- package/dist/objectstorageutils.d.ts.map +1 -1
- package/dist/objectstorageutils.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/requestParser.d.ts.map +1 -1
- package/dist/requestParser.js.map +1 -1
- package/dist/runtimeFactoryHelper.d.ts.map +1 -1
- package/dist/runtimeFactoryHelper.js +6 -2
- package/dist/runtimeFactoryHelper.js.map +1 -1
- package/dist/summarizerNode/summarizerNode.d.ts +1 -1
- package/dist/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summarizerNode/summarizerNode.js +12 -9
- package/dist/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/dist/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/dist/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summarizerNode/summarizerNodeWithGc.js +24 -16
- package/dist/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summaryUtils.d.ts +0 -4
- package/dist/summaryUtils.d.ts.map +1 -1
- package/dist/summaryUtils.js +3 -11
- package/dist/summaryUtils.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/lib/dataStoreHandleContextUtils.d.ts.map +1 -1
- package/lib/dataStoreHandleContextUtils.js +3 -1
- package/lib/dataStoreHandleContextUtils.js.map +1 -1
- package/lib/dataStoreHelpers.d.ts.map +1 -1
- package/lib/dataStoreHelpers.js +23 -7
- package/lib/dataStoreHelpers.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/objectstoragepartition.d.ts.map +1 -1
- package/lib/objectstoragepartition.js.map +1 -1
- package/lib/objectstorageutils.d.ts.map +1 -1
- package/lib/objectstorageutils.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/requestParser.d.ts.map +1 -1
- package/lib/requestParser.js.map +1 -1
- package/lib/runtimeFactoryHelper.d.ts.map +1 -1
- package/lib/runtimeFactoryHelper.js +6 -2
- package/lib/runtimeFactoryHelper.js.map +1 -1
- package/lib/summarizerNode/summarizerNode.d.ts +1 -1
- package/lib/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summarizerNode/summarizerNode.js +12 -9
- package/lib/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
- package/lib/summarizerNode/summarizerNodeUtils.js.map +1 -1
- package/lib/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summarizerNode/summarizerNodeWithGc.js +25 -17
- package/lib/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summaryUtils.d.ts +0 -4
- package/lib/summaryUtils.d.ts.map +1 -1
- package/lib/summaryUtils.js +3 -11
- package/lib/summaryUtils.js.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +110 -112
- package/prettier.config.cjs +1 -1
- package/src/dataStoreHandleContextUtils.ts +23 -16
- package/src/dataStoreHelpers.ts +104 -86
- package/src/index.ts +2 -2
- package/src/objectstoragepartition.ts +13 -13
- package/src/objectstorageutils.ts +31 -28
- package/src/packageVersion.ts +1 -1
- package/src/requestParser.ts +80 -82
- package/src/runtimeFactoryHelper.ts +24 -17
- package/src/summarizerNode/summarizerNode.ts +602 -574
- package/src/summarizerNode/summarizerNodeUtils.ts +154 -151
- package/src/summarizerNode/summarizerNodeWithGc.ts +508 -472
- package/src/summaryUtils.ts +299 -305
- package/src/utils.ts +6 -6
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +8 -12
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
7
|
-
import {
|
|
8
|
-
ISnapshotTree,
|
|
9
|
-
ISummaryTree,
|
|
10
|
-
SummaryObject,
|
|
11
|
-
} from "@fluidframework/protocol-definitions";
|
|
7
|
+
import { ISnapshotTree, ISummaryTree, SummaryObject } from "@fluidframework/protocol-definitions";
|
|
12
8
|
import { channelsTreeName, ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
13
9
|
import { ReadAndParseBlob } from "../utils";
|
|
14
10
|
|
|
@@ -22,124 +18,129 @@ import { ReadAndParseBlob } from "../utils";
|
|
|
22
18
|
* 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this case, the
|
|
23
19
|
* latest snapshot is fetched and the latest summary state is updated based on it.
|
|
24
20
|
*/
|
|
25
|
-
export type RefreshSummaryResult =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
export type RefreshSummaryResult =
|
|
22
|
+
| {
|
|
23
|
+
latestSummaryUpdated: false;
|
|
24
|
+
}
|
|
25
|
+
| {
|
|
26
|
+
latestSummaryUpdated: true;
|
|
27
|
+
wasSummaryTracked: true;
|
|
28
|
+
summaryRefSeq: number;
|
|
29
|
+
}
|
|
30
|
+
| {
|
|
31
|
+
latestSummaryUpdated: true;
|
|
32
|
+
wasSummaryTracked: false;
|
|
33
|
+
snapshotTree: ISnapshotTree;
|
|
34
|
+
summaryRefSeq: number;
|
|
35
|
+
};
|
|
37
36
|
|
|
38
37
|
/**
|
|
39
38
|
* Result of snapshot fetch during refreshing latest summary state.
|
|
40
39
|
*/
|
|
41
40
|
export interface IFetchSnapshotResult {
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
snapshotTree: ISnapshotTree;
|
|
42
|
+
snapshotRefSeq: number;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
export interface ISummarizerNodeRootContract {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger): void;
|
|
47
|
+
completeSummary(proposalHandle: string): void;
|
|
48
|
+
clearSummary(): void;
|
|
49
|
+
refreshLatestSummary(
|
|
50
|
+
proposalHandle: string | undefined,
|
|
51
|
+
summaryRefSeq: number,
|
|
52
|
+
fetchLatestSnapshot: () => Promise<IFetchSnapshotResult>,
|
|
53
|
+
readAndParseBlob: ReadAndParseBlob,
|
|
54
|
+
correlatedSummaryLogger: ITelemetryLogger,
|
|
55
|
+
): Promise<RefreshSummaryResult>;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
/** Path for nodes in a tree with escaped special characters */
|
|
60
59
|
export class EscapedPath {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
private constructor(public readonly path: string) {}
|
|
61
|
+
public static create(path: string): EscapedPath {
|
|
62
|
+
return new EscapedPath(encodeURIComponent(path));
|
|
63
|
+
}
|
|
64
|
+
public static createAndConcat(pathParts: string[]): EscapedPath {
|
|
65
|
+
let ret = EscapedPath.create(pathParts[0] ?? "");
|
|
66
|
+
for (let i = 1; i < pathParts.length; i++) {
|
|
67
|
+
ret = ret.concat(EscapedPath.create(pathParts[i]));
|
|
68
|
+
}
|
|
69
|
+
return ret;
|
|
70
|
+
}
|
|
71
|
+
public toString(): string {
|
|
72
|
+
return this.path;
|
|
73
|
+
}
|
|
74
|
+
public concat(path: EscapedPath): EscapedPath {
|
|
75
|
+
return new EscapedPath(`${this.path}/${path.path}`);
|
|
76
|
+
}
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
/** Information about a summary relevant to a specific node in the tree */
|
|
81
80
|
export class SummaryNode {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
81
|
+
/** Creates an instance that is valid for the root with specific basePath and localPath */
|
|
82
|
+
public static createForRoot(referenceSequenceNumber: number): SummaryNode {
|
|
83
|
+
return new SummaryNode({
|
|
84
|
+
referenceSequenceNumber,
|
|
85
|
+
basePath: undefined,
|
|
86
|
+
localPath: EscapedPath.create(""), // root hard-coded to ""
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Summary reference sequence number, i.e. last sequence number seen when it was created */
|
|
91
|
+
public get referenceSequenceNumber(): number {
|
|
92
|
+
return this.summary.referenceSequenceNumber;
|
|
93
|
+
}
|
|
94
|
+
/** Full path to parent node, or undefined if this is the root */
|
|
95
|
+
public get basePath(): EscapedPath | undefined {
|
|
96
|
+
return this.summary.basePath;
|
|
97
|
+
}
|
|
98
|
+
/** Relative path to this node from its parent node */
|
|
99
|
+
public get localPath(): EscapedPath {
|
|
100
|
+
return this.summary.localPath;
|
|
101
|
+
}
|
|
102
|
+
/** Relative path from this node to its node innermost base summary */
|
|
103
|
+
public get additionalPath(): EscapedPath | undefined {
|
|
104
|
+
return this.summary.additionalPath;
|
|
105
|
+
}
|
|
106
|
+
public set additionalPath(additionalPath: EscapedPath | undefined) {
|
|
107
|
+
this.summary.additionalPath = additionalPath;
|
|
108
|
+
}
|
|
109
|
+
constructor(
|
|
110
|
+
private readonly summary: {
|
|
111
|
+
readonly referenceSequenceNumber: number;
|
|
112
|
+
readonly basePath: EscapedPath | undefined;
|
|
113
|
+
readonly localPath: EscapedPath;
|
|
114
|
+
additionalPath?: EscapedPath;
|
|
115
|
+
},
|
|
116
|
+
) {}
|
|
117
|
+
|
|
118
|
+
/** Gets the full path to this node, to be used when sending a handle */
|
|
119
|
+
public get fullPath(): EscapedPath {
|
|
120
|
+
return this.basePath?.concat(this.localPath) ?? this.localPath;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Gets the full path to this node's innermost base summary.
|
|
125
|
+
* The children nodes can use this as their basePath to determine their path.
|
|
126
|
+
*/
|
|
127
|
+
public get fullPathForChildren(): EscapedPath {
|
|
128
|
+
return this.additionalPath !== undefined
|
|
129
|
+
? this.fullPath.concat(this.additionalPath)
|
|
130
|
+
: this.fullPath;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Creates a new node within the same summary for a child of this node.
|
|
135
|
+
* @param id - id of the child node
|
|
136
|
+
*/
|
|
137
|
+
public createForChild(id: string): SummaryNode {
|
|
138
|
+
return new SummaryNode({
|
|
139
|
+
referenceSequenceNumber: this.referenceSequenceNumber,
|
|
140
|
+
basePath: this.fullPathForChildren,
|
|
141
|
+
localPath: EscapedPath.create(id),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
/**
|
|
@@ -149,40 +150,42 @@ export class SummaryNode {
|
|
|
149
150
|
* When fromSummary is false, it will use an actual summary tree
|
|
150
151
|
* as its base summary in case the first summary is a differential summary.
|
|
151
152
|
*/
|
|
152
|
-
export type EncodeSummaryParam =
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
export type EncodeSummaryParam =
|
|
154
|
+
| {
|
|
155
|
+
fromSummary: true;
|
|
156
|
+
summaryNode: SummaryNode;
|
|
157
|
+
}
|
|
158
|
+
| {
|
|
159
|
+
fromSummary: false;
|
|
160
|
+
initialSummary: ISummaryTreeWithStats;
|
|
161
|
+
};
|
|
159
162
|
|
|
160
163
|
/**
|
|
161
164
|
* Information about the initial summary tree found from an attach op.
|
|
162
165
|
*/
|
|
163
166
|
export interface IInitialSummary {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
+
sequenceNumber: number;
|
|
168
|
+
id: string;
|
|
169
|
+
summary: ISummaryTreeWithStats | undefined;
|
|
167
170
|
}
|
|
168
171
|
|
|
169
172
|
/**
|
|
170
173
|
* Represents the details needed to create a child summarizer node.
|
|
171
174
|
*/
|
|
172
175
|
export interface ICreateChildDetails {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
/** Summary from attach op if known */
|
|
177
|
+
initialSummary: IInitialSummary | undefined;
|
|
178
|
+
/** Latest summary from server node data */
|
|
179
|
+
latestSummary: SummaryNode | undefined;
|
|
180
|
+
/** Sequence number of latest known change to the node */
|
|
181
|
+
changeSequenceNumber: number;
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
export interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
/** Tree to use to find children subtrees */
|
|
186
|
+
childrenTree: T;
|
|
187
|
+
/** Additional path part where children are isolated */
|
|
188
|
+
childrenPathPart: string | undefined;
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
/**
|
|
@@ -191,18 +194,18 @@ export interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {
|
|
|
191
194
|
* @param baseSummary - summary to check
|
|
192
195
|
*/
|
|
193
196
|
export function parseSummaryForSubtrees(baseSummary: ISnapshotTree): ISubtreeInfo<ISnapshotTree> {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
197
|
+
// New versions of snapshots have child nodes isolated in .channels subtree
|
|
198
|
+
const channelsSubtree = baseSummary.trees[channelsTreeName];
|
|
199
|
+
if (channelsSubtree !== undefined) {
|
|
200
|
+
return {
|
|
201
|
+
childrenTree: channelsSubtree,
|
|
202
|
+
childrenPathPart: channelsTreeName,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
childrenTree: baseSummary,
|
|
207
|
+
childrenPathPart: undefined,
|
|
208
|
+
};
|
|
206
209
|
}
|
|
207
210
|
|
|
208
211
|
/**
|
|
@@ -211,16 +214,16 @@ export function parseSummaryForSubtrees(baseSummary: ISnapshotTree): ISubtreeInf
|
|
|
211
214
|
* @param baseSummary - summary to check
|
|
212
215
|
*/
|
|
213
216
|
export function parseSummaryTreeForSubtrees(summary: ISummaryTree): ISubtreeInfo<SummaryObject> {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
217
|
+
// New versions of snapshots have child nodes isolated in .channels subtree
|
|
218
|
+
const channelsSubtree = summary.tree[channelsTreeName];
|
|
219
|
+
if (channelsSubtree !== undefined) {
|
|
220
|
+
return {
|
|
221
|
+
childrenTree: channelsSubtree,
|
|
222
|
+
childrenPathPart: channelsTreeName,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
childrenTree: summary,
|
|
227
|
+
childrenPathPart: undefined,
|
|
228
|
+
};
|
|
226
229
|
}
|