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