@fluidframework/runtime-utils 0.59.4001 → 1.1.0-75972
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 +1 -1
- package/dist/objectstorageutils.d.ts +1 -1
- package/dist/objectstorageutils.d.ts.map +1 -1
- package/dist/objectstorageutils.js +7 -6
- package/dist/objectstorageutils.js.map +1 -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/dist/summarizerNode/summarizerNode.d.ts +5 -5
- package/dist/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/dist/summarizerNode/summarizerNode.js +2 -2
- package/dist/summarizerNode/summarizerNode.js.map +1 -1
- package/dist/summarizerNode/summarizerNodeWithGc.d.ts +5 -5
- package/dist/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/dist/summarizerNode/summarizerNodeWithGc.js +5 -3
- package/dist/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/dist/summaryUtils.d.ts +17 -1
- package/dist/summaryUtils.d.ts.map +1 -1
- package/dist/summaryUtils.js +29 -1
- package/dist/summaryUtils.js.map +1 -1
- package/lib/objectstorageutils.d.ts +1 -1
- package/lib/objectstorageutils.d.ts.map +1 -1
- package/lib/objectstorageutils.js +7 -6
- package/lib/objectstorageutils.js.map +1 -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/summarizerNode/summarizerNode.d.ts +5 -5
- package/lib/summarizerNode/summarizerNode.d.ts.map +1 -1
- package/lib/summarizerNode/summarizerNode.js +2 -2
- package/lib/summarizerNode/summarizerNode.js.map +1 -1
- package/lib/summarizerNode/summarizerNodeWithGc.d.ts +5 -5
- package/lib/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
- package/lib/summarizerNode/summarizerNodeWithGc.js +5 -3
- package/lib/summarizerNode/summarizerNodeWithGc.js.map +1 -1
- package/lib/summaryUtils.d.ts +17 -1
- package/lib/summaryUtils.d.ts.map +1 -1
- package/lib/summaryUtils.js +27 -0
- package/lib/summaryUtils.js.map +1 -1
- package/package.json +14 -27
- package/src/objectstorageutils.ts +10 -8
- package/src/packageVersion.ts +1 -1
- package/src/summarizerNode/summarizerNode.ts +11 -6
- package/src/summarizerNode/summarizerNodeWithGc.ts +19 -6
- package/src/summaryUtils.ts +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/runtime-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0-75972",
|
|
4
4
|
"description": "Collection of utility functions for Fluid Runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -62,43 +62,30 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
64
64
|
"@fluidframework/common-utils": "^0.32.1",
|
|
65
|
-
"@fluidframework/container-definitions": "
|
|
66
|
-
"@fluidframework/container-runtime-definitions": "
|
|
67
|
-
"@fluidframework/core-interfaces": "
|
|
68
|
-
"@fluidframework/datastore-definitions": "
|
|
69
|
-
"@fluidframework/garbage-collector": "
|
|
70
|
-
"@fluidframework/protocol-base": "^0.1036.
|
|
65
|
+
"@fluidframework/container-definitions": "1.1.0-75972",
|
|
66
|
+
"@fluidframework/container-runtime-definitions": "1.1.0-75972",
|
|
67
|
+
"@fluidframework/core-interfaces": "1.1.0-75972",
|
|
68
|
+
"@fluidframework/datastore-definitions": "1.1.0-75972",
|
|
69
|
+
"@fluidframework/garbage-collector": "1.1.0-75972",
|
|
70
|
+
"@fluidframework/protocol-base": "^0.1036.5000-0",
|
|
71
71
|
"@fluidframework/protocol-definitions": "^0.1028.2000",
|
|
72
|
-
"@fluidframework/runtime-definitions": "
|
|
73
|
-
"@fluidframework/telemetry-utils": "
|
|
72
|
+
"@fluidframework/runtime-definitions": "1.1.0-75972",
|
|
73
|
+
"@fluidframework/telemetry-utils": "1.1.0-75972"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@fluidframework/build-common": "^0.
|
|
77
|
-
"@fluidframework/build-tools": "^0.2.
|
|
76
|
+
"@fluidframework/build-common": "^0.24.0-0",
|
|
77
|
+
"@fluidframework/build-tools": "^0.2.71273",
|
|
78
78
|
"@fluidframework/eslint-config-fluid": "^0.28.2000",
|
|
79
|
-
"@fluidframework/mocha-test-setup": "
|
|
80
|
-
"@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils
|
|
79
|
+
"@fluidframework/mocha-test-setup": "1.1.0-75972",
|
|
80
|
+
"@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@^1.0.0",
|
|
81
81
|
"@microsoft/api-extractor": "^7.22.2",
|
|
82
82
|
"@rushstack/eslint-config": "^2.5.1",
|
|
83
83
|
"@types/mocha": "^9.1.1",
|
|
84
84
|
"@types/node": "^14.18.0",
|
|
85
|
-
"@typescript-eslint/eslint-plugin": "~5.9.0",
|
|
86
|
-
"@typescript-eslint/parser": "~5.9.0",
|
|
87
85
|
"concurrently": "^6.2.0",
|
|
88
86
|
"copyfiles": "^2.1.0",
|
|
89
87
|
"cross-env": "^7.0.2",
|
|
90
88
|
"eslint": "~8.6.0",
|
|
91
|
-
"eslint-plugin-editorconfig": "~3.2.0",
|
|
92
|
-
"eslint-plugin-eslint-comments": "~3.2.0",
|
|
93
|
-
"eslint-plugin-import": "~2.25.4",
|
|
94
|
-
"eslint-plugin-jest": "~26.1.3",
|
|
95
|
-
"eslint-plugin-jsdoc": "~39.3.0",
|
|
96
|
-
"eslint-plugin-mocha": "~10.0.3",
|
|
97
|
-
"eslint-plugin-promise": "~6.0.0",
|
|
98
|
-
"eslint-plugin-react": "~7.28.0",
|
|
99
|
-
"eslint-plugin-tsdoc": "~0.2.14",
|
|
100
|
-
"eslint-plugin-unicorn": "~40.0.0",
|
|
101
|
-
"eslint-plugin-unused-imports": "~2.0.0",
|
|
102
89
|
"mocha": "^10.0.0",
|
|
103
90
|
"nyc": "^15.0.0",
|
|
104
91
|
"rimraf": "^2.6.2",
|
|
@@ -108,7 +95,7 @@
|
|
|
108
95
|
"typescript-formatter": "7.1.0"
|
|
109
96
|
},
|
|
110
97
|
"typeValidation": {
|
|
111
|
-
"version": "
|
|
98
|
+
"version": "1.1.0",
|
|
112
99
|
"broken": {}
|
|
113
100
|
}
|
|
114
101
|
}
|
|
@@ -19,24 +19,26 @@ export function getNormalizedObjectStoragePathParts(path: string) {
|
|
|
19
19
|
return [];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export async function listBlobsAtTreePath(inputTree: ITree, path: string): Promise<string[]> {
|
|
22
|
+
export async function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]> {
|
|
23
23
|
const pathParts = getNormalizedObjectStoragePathParts(path);
|
|
24
24
|
let tree: ITree | undefined = inputTree;
|
|
25
25
|
while (tree?.entries !== undefined && pathParts.length > 0) {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const index = tree.entries.findIndex((value) => {
|
|
26
|
+
const part = pathParts.shift();
|
|
27
|
+
const treeEntry = tree.entries.find((value) => {
|
|
29
28
|
if (value.type === "Tree" && value.path === part) {
|
|
30
29
|
return true;
|
|
31
30
|
} else {
|
|
32
31
|
return false;
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
|
|
35
|
+
// this check is largely superfluous due to the same check being done
|
|
36
|
+
// immediately above. the type system, however, is not aware of this.
|
|
37
|
+
// so we must redundantly determine that the entry's type is "Tree"
|
|
38
|
+
if (treeEntry?.type === "Tree") {
|
|
39
39
|
tree = treeEntry.value;
|
|
40
|
+
} else {
|
|
41
|
+
tree = undefined;
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
if (tree?.entries === undefined || pathParts.length !== 0) {
|
package/src/packageVersion.ts
CHANGED
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
import {
|
|
7
7
|
ISummarizerNode,
|
|
8
8
|
ISummarizerNodeConfig,
|
|
9
|
-
ISummarizeInternalResult,
|
|
10
9
|
ISummarizeResult,
|
|
11
10
|
ISummaryTreeWithStats,
|
|
12
11
|
CreateChildSummarizerNodeParam,
|
|
13
12
|
CreateSummarizerNodeSource,
|
|
13
|
+
SummarizeInternalFn,
|
|
14
|
+
ITelemetryContext,
|
|
14
15
|
} from "@fluidframework/runtime-definitions";
|
|
15
16
|
import {
|
|
16
17
|
ISequencedDocumentMessage,
|
|
@@ -80,7 +81,11 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
80
81
|
this.wipReferenceSequenceNumber = referenceSequenceNumber;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
public async summarize(
|
|
84
|
+
public async summarize(
|
|
85
|
+
fullTree: boolean,
|
|
86
|
+
trackState: boolean = true,
|
|
87
|
+
telemetryContext?: ITelemetryContext,
|
|
88
|
+
): Promise<ISummarizeResult> {
|
|
84
89
|
assert(this.isTrackingInProgress(), 0x1a1 /* "summarize should not be called when not tracking the summary" */);
|
|
85
90
|
assert(this.wipSummaryLogger !== undefined,
|
|
86
91
|
0x1a2 /* "wipSummaryLogger should have been set in startSummary or ctor" */);
|
|
@@ -108,7 +113,7 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
try {
|
|
111
|
-
const result = await this.summarizeInternalFn(fullTree);
|
|
116
|
+
const result = await this.summarizeInternalFn(fullTree, true, telemetryContext);
|
|
112
117
|
this.wipLocalPaths = { localPath: EscapedPath.create(result.id) };
|
|
113
118
|
if (result.pathPartsForChildren !== undefined) {
|
|
114
119
|
this.wipLocalPaths.additionalPath = EscapedPath.createAndConcat(result.pathPartsForChildren);
|
|
@@ -469,7 +474,7 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
469
474
|
*/
|
|
470
475
|
public constructor(
|
|
471
476
|
protected readonly defaultLogger: ITelemetryLogger,
|
|
472
|
-
private readonly summarizeInternalFn:
|
|
477
|
+
private readonly summarizeInternalFn: SummarizeInternalFn,
|
|
473
478
|
config: ISummarizerNodeConfig,
|
|
474
479
|
private _changeSequenceNumber: number,
|
|
475
480
|
/** Undefined means created without summary */
|
|
@@ -487,7 +492,7 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
487
492
|
|
|
488
493
|
public createChild(
|
|
489
494
|
/** Summarize function */
|
|
490
|
-
summarizeInternalFn:
|
|
495
|
+
summarizeInternalFn: SummarizeInternalFn,
|
|
491
496
|
/** Initial id or path part of this node */
|
|
492
497
|
id: string,
|
|
493
498
|
/**
|
|
@@ -644,7 +649,7 @@ export class SummarizerNode implements IRootSummarizerNode {
|
|
|
644
649
|
*/
|
|
645
650
|
export const createRootSummarizerNode = (
|
|
646
651
|
logger: ITelemetryLogger,
|
|
647
|
-
summarizeInternalFn:
|
|
652
|
+
summarizeInternalFn: SummarizeInternalFn,
|
|
648
653
|
changeSequenceNumber: number,
|
|
649
654
|
referenceSequenceNumber: number | undefined,
|
|
650
655
|
config: ISummarizerNodeConfig = {},
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
ISummarizeResult,
|
|
18
18
|
ISummarizerNodeConfigWithGC,
|
|
19
19
|
ISummarizerNodeWithGC,
|
|
20
|
+
SummarizeInternalFn,
|
|
21
|
+
ITelemetryContext,
|
|
20
22
|
} from "@fluidframework/runtime-definitions";
|
|
21
23
|
import { ReadAndParseBlob } from "../utils";
|
|
22
24
|
import { SummarizerNode } from "./summarizerNode";
|
|
@@ -86,7 +88,11 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
86
88
|
*/
|
|
87
89
|
public constructor(
|
|
88
90
|
logger: ITelemetryLogger,
|
|
89
|
-
private readonly summarizeFn: (
|
|
91
|
+
private readonly summarizeFn: (
|
|
92
|
+
fullTree: boolean,
|
|
93
|
+
trackState: boolean,
|
|
94
|
+
telemetryContext?: ITelemetryContext,
|
|
95
|
+
) => Promise<ISummarizeInternalResult>,
|
|
90
96
|
config: ISummarizerNodeConfigWithGC,
|
|
91
97
|
changeSequenceNumber: number,
|
|
92
98
|
/** Undefined means created without summary */
|
|
@@ -98,7 +104,8 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
98
104
|
) {
|
|
99
105
|
super(
|
|
100
106
|
logger,
|
|
101
|
-
async (fullTree: boolean
|
|
107
|
+
async (fullTree: boolean, _trackState: boolean, telemetryContext?: ITelemetryContext) =>
|
|
108
|
+
summarizeFn(fullTree, true /* trackState */, telemetryContext),
|
|
102
109
|
config,
|
|
103
110
|
changeSequenceNumber,
|
|
104
111
|
latestSummary,
|
|
@@ -155,7 +162,11 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
155
162
|
this.unreferencedTimestampMs = baseGCDetails.unrefTimestamp;
|
|
156
163
|
}
|
|
157
164
|
|
|
158
|
-
public async summarize(
|
|
165
|
+
public async summarize(
|
|
166
|
+
fullTree: boolean,
|
|
167
|
+
trackState: boolean = true,
|
|
168
|
+
telemetryContext?: ITelemetryContext,
|
|
169
|
+
): Promise<ISummarizeResult> {
|
|
159
170
|
// If GC is not disabled and we are tracking a summary, GC should have run and updated the used routes for this
|
|
160
171
|
// summary by calling updateUsedRoutes which sets wipSerializedUsedRoutes.
|
|
161
172
|
if (!this.gcDisabled && this.isTrackingInProgress()) {
|
|
@@ -165,7 +176,9 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
165
176
|
|
|
166
177
|
// If trackState is true, get summary from base summarizer node which tracks summary state.
|
|
167
178
|
// If trackState is false, get summary from summarizeInternal.
|
|
168
|
-
return trackState
|
|
179
|
+
return trackState
|
|
180
|
+
? super.summarize(fullTree, true /* trackState */, telemetryContext)
|
|
181
|
+
: this.summarizeFn(fullTree, trackState, telemetryContext);
|
|
169
182
|
}
|
|
170
183
|
|
|
171
184
|
/**
|
|
@@ -304,7 +317,7 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
304
317
|
*/
|
|
305
318
|
public createChild(
|
|
306
319
|
/** Summarize function */
|
|
307
|
-
summarizeInternalFn:
|
|
320
|
+
summarizeInternalFn: SummarizeInternalFn,
|
|
308
321
|
/** Initial id or path part of this node */
|
|
309
322
|
id: string,
|
|
310
323
|
/**
|
|
@@ -427,7 +440,7 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
|
|
|
427
440
|
*/
|
|
428
441
|
export const createRootSummarizerNodeWithGC = (
|
|
429
442
|
logger: ITelemetryLogger,
|
|
430
|
-
summarizeInternalFn:
|
|
443
|
+
summarizeInternalFn: SummarizeInternalFn,
|
|
431
444
|
changeSequenceNumber: number,
|
|
432
445
|
referenceSequenceNumber: number | undefined,
|
|
433
446
|
config: ISummarizerNodeConfigWithGC = {},
|
package/src/summaryUtils.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { TelemetryEventPropertyType } from "@fluidframework/common-definitions";
|
|
6
7
|
import {
|
|
7
8
|
bufferToString,
|
|
8
9
|
fromBase64ToUtf8,
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
ISummaryStats,
|
|
26
27
|
ISummarizeResult,
|
|
27
28
|
ISummaryTreeWithStats,
|
|
29
|
+
ITelemetryContext,
|
|
28
30
|
} from "@fluidframework/runtime-definitions";
|
|
29
31
|
|
|
30
32
|
/**
|
|
@@ -342,3 +344,32 @@ export function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree {
|
|
|
342
344
|
unreferenced: summaryTree.unreferenced,
|
|
343
345
|
};
|
|
344
346
|
}
|
|
347
|
+
|
|
348
|
+
export class TelemetryContext implements ITelemetryContext {
|
|
349
|
+
private readonly telemetry = new Map<string, TelemetryEventPropertyType>();
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.set}
|
|
353
|
+
*/
|
|
354
|
+
set(prefix: string, property: string, value: TelemetryEventPropertyType): void {
|
|
355
|
+
this.telemetry.set(`${prefix}${property}`, value);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.get}
|
|
360
|
+
*/
|
|
361
|
+
get(prefix: string, property: string): TelemetryEventPropertyType {
|
|
362
|
+
return this.telemetry.get(`${prefix}${property}`);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.serialize}
|
|
367
|
+
*/
|
|
368
|
+
serialize(): string {
|
|
369
|
+
const jsonObject = {};
|
|
370
|
+
this.telemetry.forEach((value, key) => {
|
|
371
|
+
jsonObject[key] = value;
|
|
372
|
+
});
|
|
373
|
+
return JSON.stringify(jsonObject);
|
|
374
|
+
}
|
|
375
|
+
}
|