@fluidframework/runtime-utils 2.0.0-internal.2.3.1 → 2.0.0-internal.2.4.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.
Files changed (45) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/packageVersion.d.ts +1 -1
  5. package/dist/packageVersion.js +1 -1
  6. package/dist/packageVersion.js.map +1 -1
  7. package/dist/summarizerNode/index.d.ts +1 -1
  8. package/dist/summarizerNode/index.d.ts.map +1 -1
  9. package/dist/summarizerNode/index.js.map +1 -1
  10. package/dist/summarizerNode/summarizerNode.d.ts +4 -5
  11. package/dist/summarizerNode/summarizerNode.d.ts.map +1 -1
  12. package/dist/summarizerNode/summarizerNode.js +26 -9
  13. package/dist/summarizerNode/summarizerNode.js.map +1 -1
  14. package/dist/summarizerNode/summarizerNodeUtils.d.ts +14 -5
  15. package/dist/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  16. package/dist/summarizerNode/summarizerNodeUtils.js.map +1 -1
  17. package/dist/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  18. package/dist/summarizerNode/summarizerNodeWithGc.js +3 -1
  19. package/dist/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  20. package/lib/index.d.ts +1 -1
  21. package/lib/index.d.ts.map +1 -1
  22. package/lib/index.js.map +1 -1
  23. package/lib/packageVersion.d.ts +1 -1
  24. package/lib/packageVersion.js +1 -1
  25. package/lib/packageVersion.js.map +1 -1
  26. package/lib/summarizerNode/index.d.ts +1 -1
  27. package/lib/summarizerNode/index.d.ts.map +1 -1
  28. package/lib/summarizerNode/index.js.map +1 -1
  29. package/lib/summarizerNode/summarizerNode.d.ts +4 -5
  30. package/lib/summarizerNode/summarizerNode.d.ts.map +1 -1
  31. package/lib/summarizerNode/summarizerNode.js +26 -9
  32. package/lib/summarizerNode/summarizerNode.js.map +1 -1
  33. package/lib/summarizerNode/summarizerNodeUtils.d.ts +14 -5
  34. package/lib/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  35. package/lib/summarizerNode/summarizerNodeUtils.js.map +1 -1
  36. package/lib/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  37. package/lib/summarizerNode/summarizerNodeWithGc.js +3 -1
  38. package/lib/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  39. package/package.json +22 -16
  40. package/src/index.ts +1 -0
  41. package/src/packageVersion.ts +1 -1
  42. package/src/summarizerNode/index.ts +5 -1
  43. package/src/summarizerNode/summarizerNode.ts +35 -10
  44. package/src/summarizerNode/summarizerNodeUtils.ts +15 -5
  45. package/src/summarizerNode/summarizerNodeWithGc.ts +3 -1
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACH,aAAa,EACb,YAAY,EACZ,aAAa,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAoB,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;;GASG;AACH,oBAAY,oBAAoB,GAAG;IAC/B,oBAAoB,EAAE,KAAK,CAAC;CAC/B,GAAG;IACA,oBAAoB,EAAE,IAAI,CAAC;IAC3B,iBAAiB,EAAE,IAAI,CAAC;CAC3B,GAAG;IACA,oBAAoB,EAAE,IAAI,CAAC;IAC3B,iBAAiB,EAAE,KAAK,CAAC;IACzB,QAAQ,EAAE,aAAa,CAAC;CAC3B,CAAC;AAEF,MAAM,WAAW,2BAA2B;IACxC,YAAY,CAAC,uBAAuB,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACrF,eAAe,CAAC,cAA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,CAEjC;IAED;;;OAGG;IACH,IAAW,mBAAmB,IAAI,WAAW,CAI5C;IAED;;;OAGG;IACI,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW;CAOjD;AAED;;;;;;GAMG;AACH,oBAAY,kBAAkB,GAAG;IAC7B,WAAW,EAAE,IAAI,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;CAC5B,GAAG;IACA,WAAW,EAAE,KAAK,CAAC;IACnB,cAAc,EAAE,qBAAqB,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,qBAAqB,GAAG,SAAS,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,sCAAsC;IACtC,cAAc,EAAE,eAAe,GAAG,SAAS,CAAC;IAC5C,2CAA2C;IAC3C,aAAa,EAAE,WAAW,GAAG,SAAS,CAAC;IACvC,yDAAyD;IACzD,oBAAoB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa;IACjE,4CAA4C;IAC5C,YAAY,EAAE,CAAC,CAAC;IAChB,uDAAuD;IACvD,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC,CAa/F;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC,CAa9F"}
1
+ {"version":3,"file":"summarizerNodeUtils.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACH,aAAa,EACb,Y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,SAAS,CAAC;IACnE,CAAC;IAED;;;OAGG;IACH,IAAW,mBAAmB;QAC1B,OAAO,IAAI,CAAC,cAAc,KAAK,SAAS;YACpC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;YAC3C,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,EAAU;QAC5B,OAAO,IAAI,WAAW,CAAC;YACnB,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,QAAQ,EAAE,IAAI,CAAC,mBAAmB;YAClC,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;SACpC,CAAC,CAAC;IACP,CAAC;CACJ;AA6CD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAA0B;IAC9D,2EAA2E;IAC3E,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC5D,IAAI,eAAe,KAAK,SAAS,EAAE;QAC/B,OAAO;YACH,YAAY,EAAE,eAAe;YAC7B,gBAAgB,EAAE,gBAAgB;SACrC,CAAC;KACL;IACD,OAAO;QACH,YAAY,EAAE,WAAW;QACzB,gBAAgB,EAAE,SAAS;KAC9B,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAqB;IAC7D,2EAA2E;IAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACvD,IAAI,eAAe,KAAK,SAAS,EAAE;QAC/B,OAAO;YACH,YAAY,EAAE,eAAe;YAC7B,gBAAgB,EAAE,gBAAgB;SACrC,CAAC;KACL;IACD,OAAO;QACH,YAAY,EAAE,OAAO;QACrB,gBAAgB,EAAE,SAAS;KAC9B,CAAC;AACN,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n ISnapshotTree,\n ISummaryTree,\n SummaryObject,\n} from \"@fluidframework/protocol-definitions\";\nimport { channelsTreeName, ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { ReadAndParseBlob } from \"../utils\";\n\n/**\n * Return value of refreshSummaryAck function. There can be three different scenarios based on the passed params:\n *\n * 1. The latest summary was not udpated.\n *\n * 2. The latest summary was updated and the summary corresponding to the params was tracked by this client.\n *\n * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this case, the\n * latest summary is updated based on the downloaded snapshot which is also returned.\n */\nexport type RefreshSummaryResult = {\n latestSummaryUpdated: false;\n} | {\n latestSummaryUpdated: true;\n wasSummaryTracked: true;\n} | {\n latestSummaryUpdated: true;\n wasSummaryTracked: false;\n snapshot: ISnapshotTree;\n};\n\nexport interface ISummarizerNodeRootContract {\n startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger): void;\n completeSummary(proposalHandle: string): void;\n clearSummary(): void;\n refreshLatestSummary(\n proposalHandle: string | undefined,\n summaryRefSeq: number,\n getSnapshot: () => Promise<ISnapshotTree>,\n readAndParseBlob: ReadAndParseBlob,\n correlatedSummaryLogger: ITelemetryLogger,\n ): Promise<RefreshSummaryResult>;\n}\n\n/** Path for nodes in a tree with escaped special characters */\nexport class EscapedPath {\n private constructor(public readonly path: string) { }\n public static create(path: string): EscapedPath {\n return new EscapedPath(encodeURIComponent(path));\n }\n public static createAndConcat(pathParts: string[]): EscapedPath {\n let ret = EscapedPath.create(pathParts[0] ?? \"\");\n for (let i = 1; i < pathParts.length; i++) {\n ret = ret.concat(EscapedPath.create(pathParts[i]));\n }\n return ret;\n }\n public toString(): string {\n return this.path;\n }\n public concat(path: EscapedPath): EscapedPath {\n return new EscapedPath(`${this.path}/${path.path}`);\n }\n}\n\n/** Information about a summary relevant to a specific node in the tree */\nexport class SummaryNode {\n /** Creates an instance that is valid for the root with specific basePath and localPath */\n public static createForRoot(referenceSequenceNumber: number): SummaryNode {\n return new SummaryNode({\n referenceSequenceNumber,\n basePath: undefined,\n localPath: EscapedPath.create(\"\"), // root hard-coded to \"\"\n });\n }\n\n /** Summary reference sequence number, i.e. last sequence number seen when it was created */\n public get referenceSequenceNumber(): number {\n return this.summary.referenceSequenceNumber;\n }\n /** Full path to parent node, or undefined if this is the root */\n public get basePath(): EscapedPath | undefined {\n return this.summary.basePath;\n }\n /** Relative path to this node from its parent node */\n public get localPath(): EscapedPath {\n return this.summary.localPath;\n }\n /** Relative path from this node to its node innermost base summary */\n public get additionalPath(): EscapedPath | undefined {\n return this.summary.additionalPath;\n }\n public set additionalPath(additionalPath: EscapedPath | undefined) {\n this.summary.additionalPath = additionalPath;\n }\n constructor(private readonly summary: {\n readonly referenceSequenceNumber: number;\n readonly basePath: EscapedPath | undefined;\n readonly localPath: EscapedPath;\n additionalPath?: EscapedPath;\n }) { }\n\n /** Gets the full path to this node, to be used when sending a handle */\n public get fullPath(): EscapedPath {\n return this.basePath?.concat(this.localPath) ?? this.localPath;\n }\n\n /**\n * Gets the full path to this node's innermost base summary.\n * The children nodes can use this as their basePath to determine their path.\n */\n public get fullPathForChildren(): EscapedPath {\n return this.additionalPath !== undefined\n ? this.fullPath.concat(this.additionalPath)\n : this.fullPath;\n }\n\n /**\n * Creates a new node within the same summary for a child of this node.\n * @param id - id of the child node\n */\n public createForChild(id: string): SummaryNode {\n return new SummaryNode({\n referenceSequenceNumber: this.referenceSequenceNumber,\n basePath: this.fullPathForChildren,\n localPath: EscapedPath.create(id),\n });\n }\n}\n\n/**\n * Parameter to help encode summary with conditional behavior.\n * When fromSummary is true, it will contain the SummaryNode of\n * its previous summary, which it can use to point to with a handle.\n * When fromSummary is false, it will use an actual summary tree\n * as its base summary in case the first summary is a differential summary.\n */\nexport type EncodeSummaryParam = {\n fromSummary: true;\n summaryNode: SummaryNode;\n} | {\n fromSummary: false;\n initialSummary: ISummaryTreeWithStats;\n};\n\n/**\n * Information about the initial summary tree found from an attach op.\n */\nexport interface IInitialSummary {\n sequenceNumber: number;\n id: string;\n summary: ISummaryTreeWithStats | undefined;\n}\n\n/**\n * Represents the details needed to create a child summarizer node.\n */\nexport interface ICreateChildDetails {\n /** Summary from attach op if known */\n initialSummary: IInitialSummary | undefined;\n /** Latest summary from server node data */\n latestSummary: SummaryNode | undefined;\n /** Sequence number of latest known change to the node */\n changeSequenceNumber: number;\n}\n\nexport interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {\n /** Tree to use to find children subtrees */\n childrenTree: T;\n /** Additional path part where children are isolated */\n childrenPathPart: string | undefined;\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryForSubtrees(baseSummary: ISnapshotTree): ISubtreeInfo<ISnapshotTree> {\n // New versions of snapshots have child nodes isolated in .channels subtree\n const channelsSubtree = baseSummary.trees[channelsTreeName];\n if (channelsSubtree !== undefined) {\n return {\n childrenTree: channelsSubtree,\n childrenPathPart: channelsTreeName,\n };\n }\n return {\n childrenTree: baseSummary,\n childrenPathPart: undefined,\n };\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryTreeForSubtrees(summary: ISummaryTree): ISubtreeInfo<SummaryObject> {\n // New versions of snapshots have child nodes isolated in .channels subtree\n const channelsSubtree = summary.tree[channelsTreeName];\n if (channelsSubtree !== undefined) {\n return {\n childrenTree: channelsSubtree,\n childrenPathPart: channelsTreeName,\n };\n }\n return {\n childrenTree: summary,\n childrenPathPart: undefined,\n };\n}\n"]}
1
+ {"version":3,"file":"summarizerNodeUtils.js","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,gBAAgB,EAAyB,MAAM,qCAAqC,CAAC;AA+C9F,+DAA+D;AAC/D,MAAM,OAAO,WAAW;IACpB,Y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AAW;QACzB,gBAAgB,EAAE,SAAS;KAC9B,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAqB;IAC7D,2EAA2E;IAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACvD,IAAI,eAAe,KAAK,SAAS,EAAE;QAC/B,OAAO;YACH,YAAY,EAAE,eAAe;YAC7B,gBAAgB,EAAE,gBAAgB;SACrC,CAAC;KACL;IACD,OAAO;QACH,YAAY,EAAE,OAAO;QACrB,gBAAgB,EAAE,SAAS;KAC9B,CAAC;AACN,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n ISnapshotTree,\n ISummaryTree,\n SummaryObject,\n} from \"@fluidframework/protocol-definitions\";\nimport { channelsTreeName, ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { ReadAndParseBlob } from \"../utils\";\n\n/**\n * Return type of refreshSummaryAck function. There can be three different scenarios based on the passed params:\n *\n * 1. The latest summary was not updated.\n *\n * 2. The latest summary was updated and the summary corresponding to the params was tracked by this client.\n *\n * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this case, the\n * latest snapshot is fetched and the latest summary state is updated based on it.\n */\nexport type RefreshSummaryResult = {\n latestSummaryUpdated: false;\n} | {\n latestSummaryUpdated: true;\n wasSummaryTracked: true;\n summaryRefSeq: number;\n} | {\n latestSummaryUpdated: true;\n wasSummaryTracked: false;\n snapshotTree: ISnapshotTree;\n summaryRefSeq: number;\n};\n\n/**\n * Result of snapshot fetch during refreshing latest summary state.\n */\nexport interface IFetchSnapshotResult {\n snapshotTree: ISnapshotTree;\n snapshotRefSeq: number;\n}\n\nexport interface ISummarizerNodeRootContract {\n startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger): void;\n completeSummary(proposalHandle: string): void;\n clearSummary(): void;\n refreshLatestSummary(\n proposalHandle: string | undefined,\n summaryRefSeq: number,\n fetchLatestSnapshot: () => Promise<IFetchSnapshotResult>,\n readAndParseBlob: ReadAndParseBlob,\n correlatedSummaryLogger: ITelemetryLogger,\n ): Promise<RefreshSummaryResult>;\n}\n\n/** Path for nodes in a tree with escaped special characters */\nexport class EscapedPath {\n private constructor(public readonly path: string) { }\n public static create(path: string): EscapedPath {\n return new EscapedPath(encodeURIComponent(path));\n }\n public static createAndConcat(pathParts: string[]): EscapedPath {\n let ret = EscapedPath.create(pathParts[0] ?? \"\");\n for (let i = 1; i < pathParts.length; i++) {\n ret = ret.concat(EscapedPath.create(pathParts[i]));\n }\n return ret;\n }\n public toString(): string {\n return this.path;\n }\n public concat(path: EscapedPath): EscapedPath {\n return new EscapedPath(`${this.path}/${path.path}`);\n }\n}\n\n/** Information about a summary relevant to a specific node in the tree */\nexport class SummaryNode {\n /** Creates an instance that is valid for the root with specific basePath and localPath */\n public static createForRoot(referenceSequenceNumber: number): SummaryNode {\n return new SummaryNode({\n referenceSequenceNumber,\n basePath: undefined,\n localPath: EscapedPath.create(\"\"), // root hard-coded to \"\"\n });\n }\n\n /** Summary reference sequence number, i.e. last sequence number seen when it was created */\n public get referenceSequenceNumber(): number {\n return this.summary.referenceSequenceNumber;\n }\n /** Full path to parent node, or undefined if this is the root */\n public get basePath(): EscapedPath | undefined {\n return this.summary.basePath;\n }\n /** Relative path to this node from its parent node */\n public get localPath(): EscapedPath {\n return this.summary.localPath;\n }\n /** Relative path from this node to its node innermost base summary */\n public get additionalPath(): EscapedPath | undefined {\n return this.summary.additionalPath;\n }\n public set additionalPath(additionalPath: EscapedPath | undefined) {\n this.summary.additionalPath = additionalPath;\n }\n constructor(private readonly summary: {\n readonly referenceSequenceNumber: number;\n readonly basePath: EscapedPath | undefined;\n readonly localPath: EscapedPath;\n additionalPath?: EscapedPath;\n }) { }\n\n /** Gets the full path to this node, to be used when sending a handle */\n public get fullPath(): EscapedPath {\n return this.basePath?.concat(this.localPath) ?? this.localPath;\n }\n\n /**\n * Gets the full path to this node's innermost base summary.\n * The children nodes can use this as their basePath to determine their path.\n */\n public get fullPathForChildren(): EscapedPath {\n return this.additionalPath !== undefined\n ? this.fullPath.concat(this.additionalPath)\n : this.fullPath;\n }\n\n /**\n * Creates a new node within the same summary for a child of this node.\n * @param id - id of the child node\n */\n public createForChild(id: string): SummaryNode {\n return new SummaryNode({\n referenceSequenceNumber: this.referenceSequenceNumber,\n basePath: this.fullPathForChildren,\n localPath: EscapedPath.create(id),\n });\n }\n}\n\n/**\n * Parameter to help encode summary with conditional behavior.\n * When fromSummary is true, it will contain the SummaryNode of\n * its previous summary, which it can use to point to with a handle.\n * When fromSummary is false, it will use an actual summary tree\n * as its base summary in case the first summary is a differential summary.\n */\nexport type EncodeSummaryParam = {\n fromSummary: true;\n summaryNode: SummaryNode;\n} | {\n fromSummary: false;\n initialSummary: ISummaryTreeWithStats;\n};\n\n/**\n * Information about the initial summary tree found from an attach op.\n */\nexport interface IInitialSummary {\n sequenceNumber: number;\n id: string;\n summary: ISummaryTreeWithStats | undefined;\n}\n\n/**\n * Represents the details needed to create a child summarizer node.\n */\nexport interface ICreateChildDetails {\n /** Summary from attach op if known */\n initialSummary: IInitialSummary | undefined;\n /** Latest summary from server node data */\n latestSummary: SummaryNode | undefined;\n /** Sequence number of latest known change to the node */\n changeSequenceNumber: number;\n}\n\nexport interface ISubtreeInfo<T extends ISnapshotTree | SummaryObject> {\n /** Tree to use to find children subtrees */\n childrenTree: T;\n /** Additional path part where children are isolated */\n childrenPathPart: string | undefined;\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryForSubtrees(baseSummary: ISnapshotTree): ISubtreeInfo<ISnapshotTree> {\n // New versions of snapshots have child nodes isolated in .channels subtree\n const channelsSubtree = baseSummary.trees[channelsTreeName];\n if (channelsSubtree !== undefined) {\n return {\n childrenTree: channelsSubtree,\n childrenPathPart: channelsTreeName,\n };\n }\n return {\n childrenTree: baseSummary,\n childrenPathPart: undefined,\n };\n}\n\n/**\n * Checks if the summary contains .channels subtree where the children subtrees\n * would be located if exists.\n * @param baseSummary - summary to check\n */\nexport function parseSummaryTreeForSubtrees(summary: ISummaryTree): ISubtreeInfo<SummaryObject> {\n // New versions of snapshots have child nodes isolated in .channels subtree\n const channelsSubtree = summary.tree[channelsTreeName];\n if (channelsSubtree !== undefined) {\n return {\n childrenTree: channelsSubtree,\n childrenPathPart: channelsTreeName,\n };\n }\n return {\n childrenTree: summary,\n childrenPathPart: undefined,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNodeWithGc.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeWithGc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EACH,8BAA8B,EAE9B,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,EACxB,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACH,WAAW,EAEX,eAAe,EACf,2BAA2B,EAE3B,WAAW,EACd,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB,EAAE,2BAA2B;CAAG;AAiBxG;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAqB,SAAQ,cAAe,YAAW,yBAAyB;IA6BrF,OAAO,CAAC,QAAQ,CAAC,WAAW;IAW5B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAtCjC,OAAO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,WAAW,EAAE,8BAA8B,EAC3C,MAAM,GAAE,2BAAgC,EACxC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,sBAAsB,CAAC,EACnE,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,6BAA6B,CAAC,GAClE,qBAAqB;IA0CxB;;OAEG;IACI,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACI,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS;IAIvD,YAAY,IAAI,OAAO;IAIvB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE;IAY5C;;OAEG;IACH,SAAS,CAAC,UAAU,IAAI,OAAO;IAI/B;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;CAS9B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,WAC/B,gBAAgB,uBACH,mBAAmB,wBAClB,MAAM,2BACH,MAAM,GAAG,SAAS,WACnC,2BAA2B,mDACC,QAAQ,sBAAsB,CAAC,2CACxC,QAAQ,6BAA6B,CAAC,kBAClE,yBAUF,CAAC"}
@@ -237,7 +237,9 @@ export class SummarizerNodeWithGC extends SummarizerNode {
237
237
  const gcDetailsMap = unpackChildNodesGCDetails(gcDetails);
238
238
  const { childrenTree } = parseSummaryForSubtrees(snapshotTree);
239
239
  gcDetailsMap.forEach((childGCDetails, childId) => {
240
- childrenTree.trees[childId].blobs[gcTreeKey] = JSON.stringify(childGCDetails);
240
+ if (childrenTree.trees[childId] !== undefined) {
241
+ childrenTree.trees[childId].blobs[gcTreeKey] = JSON.stringify(childGCDetails);
242
+ }
241
243
  });
242
244
  }
243
245
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNodeWithGc.js","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeWithGc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA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BAAmB;QACvB,mEAAmE;QACnE,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,IAAI,CAAC,mBAAmB,KAAK,SAAS;YACzC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACrF,CAAC;CACJ;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC1C,MAAwB,EACxB,mBAAwC,EACxC,oBAA4B,EAC5B,uBAA2C,EAC3C,SAAsC,EAAE,EACxC,WAAmE,EACnE,kBAAiE,EACxC,EAAE,CAAC,IAAI,oBAAoB,CACpD,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,oBAAoB,EACpB,uBAAuB,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,uBAAuB,CAAC,EACtG,SAAS,CAAC,oBAAoB,EAC9B,SAAS,CAAC,sBAAsB,EAChC,WAAW,EACX,kBAAkB,CACrB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, LazyPromise } from \"@fluidframework/common-utils\";\nimport { cloneGCData, getGCDataFromSnapshot, runGarbageCollection, unpackChildNodesGCDetails } from \"@fluidframework/garbage-collector\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n CreateChildSummarizerNodeParam,\n gcTreeKey,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n ISummarizeInternalResult,\n ISummarizeResult,\n ISummarizerNodeConfigWithGC,\n ISummarizerNodeWithGC,\n SummarizeInternalFn,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ReadAndParseBlob } from \"../utils\";\nimport { SummarizerNode } from \"./summarizerNode\";\nimport {\n EscapedPath,\n ICreateChildDetails,\n IInitialSummary,\n ISummarizerNodeRootContract,\n parseSummaryForSubtrees,\n SummaryNode,\n} from \"./summarizerNodeUtils\";\n\nexport interface IRootSummarizerNodeWithGC extends ISummarizerNodeWithGC, ISummarizerNodeRootContract {}\n\n// Extend SummaryNode to add used routes tracking to it.\nclass SummaryNodeWithGC extends SummaryNode {\n constructor(\n public readonly serializedUsedRoutes: string,\n summary: {\n readonly referenceSequenceNumber: number;\n readonly basePath: EscapedPath | undefined;\n readonly localPath: EscapedPath;\n additionalPath?: EscapedPath;\n },\n ) {\n super(summary);\n }\n}\n\n/**\n * Extends the functionality of SummarizerNode to manage this node's garbage collection data:\n *\n * - Adds a new API `getGCData` to return GC data of this node.\n *\n * - Caches the result of `getGCData` to be used if nothing changes between summaries.\n *\n * - Manages the used routes of this node. These are used to identify if this node is referenced in the document\n * and to determine if the node's used state changed since last summary.\n *\n * - Adds trackState param to summarize. If trackState is false, it bypasses the SummarizerNode and calls\n * directly into summarizeInternal method.\n */\nexport class SummarizerNodeWithGC extends SummarizerNode implements IRootSummarizerNodeWithGC {\n // Tracks the work-in-progress used routes during summary.\n private wipSerializedUsedRoutes: string | undefined;\n\n // This is the last known used routes of this node as seen by the server as part of a summary.\n private referenceUsedRoutes: string[] | undefined;\n\n // The base GC details of this node used to initialize the GC state.\n private readonly baseGCDetailsP: LazyPromise<IGarbageCollectionDetailsBase>;\n\n // Keeps track of whether we have loaded the base details to ensure that we on;y do it once.\n private baseGCDetailsLoaded: boolean = false;\n\n private gcData: IGarbageCollectionData | undefined;\n\n // Set used routes to have self route by default. This makes the node referenced by default. This is done to ensure\n // that this node is not marked as collected when running GC has been disabled. Once, the option to disable GC is\n // removed (from runGC flag in IContainerRuntimeOptions), this should be changed to be have no routes by default.\n private usedRoutes: string[] = [\"\"];\n\n // True if GC is disabled for this node. If so, do not track GC specific state for a summary.\n private readonly gcDisabled: boolean;\n\n /**\n * Do not call constructor directly.\n * Use createRootSummarizerNodeWithGC to create root node, or createChild to create child nodes.\n */\n public constructor(\n logger: ITelemetryLogger,\n private readonly summarizeFn: (\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n ) => Promise<ISummarizeInternalResult>,\n config: ISummarizerNodeConfigWithGC,\n changeSequenceNumber: number,\n /** Undefined means created without summary */\n latestSummary?: SummaryNode,\n initialSummary?: IInitialSummary,\n wipSummaryLogger?: ITelemetryLogger,\n private readonly getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n ) {\n super(\n logger,\n async (fullTree: boolean, _trackState: boolean, telemetryContext?: ITelemetryContext) =>\n summarizeFn(fullTree, true /* trackState */, telemetryContext),\n config,\n changeSequenceNumber,\n latestSummary,\n initialSummary,\n wipSummaryLogger,\n );\n\n this.gcDisabled = config.gcDisabled === true;\n\n this.baseGCDetailsP = new LazyPromise(async () => {\n return (await getBaseGCDetailsFn?.()) ?? { usedRoutes: [] };\n });\n }\n\n /**\n * Loads state from this node's initial GC summary details. This contains the following data from the last summary\n * seen by the server for this client:\n * - usedRoutes: This is used to figure out if the used state of this node changed since last summary.\n * - gcData: The garbage collection data of this node that is required for running GC.\n */\n private async loadBaseGCDetails() {\n if (this.baseGCDetailsLoaded) {\n return;\n }\n const baseGCDetails = await this.baseGCDetailsP;\n\n // Possible race - If there were parallel calls to loadBaseGCDetails, we want to make sure that we update\n // the state from the base details only once.\n if (this.baseGCDetailsLoaded) {\n return;\n }\n this.baseGCDetailsLoaded = true;\n\n // Update GC data, used routes and reference used routes. The used routes are sorted because they are compared\n // across GC runs to check if they changed. Sorting ensures that the elements are in the same order.\n // If the GC details has GC data, initialize our GC data from it.\n if (baseGCDetails.gcData !== undefined) {\n this.gcData = cloneGCData(baseGCDetails.gcData);\n }\n if (baseGCDetails.usedRoutes !== undefined) {\n this.usedRoutes = Array.from(baseGCDetails.usedRoutes).sort();\n this.referenceUsedRoutes = Array.from(baseGCDetails.usedRoutes).sort()\n }\n }\n\n public async summarize(\n fullTree: boolean,\n trackState: boolean = true,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n // If GC is not disabled and we are tracking a summary, GC should have run and updated the used routes for this\n // summary by calling updateUsedRoutes which sets wipSerializedUsedRoutes.\n if (!this.gcDisabled && this.isTrackingInProgress()) {\n assert(this.wipSerializedUsedRoutes !== undefined,\n 0x1b1 /* \"wip used routes should be set if tracking a summary\" */);\n }\n\n // If trackState is true, get summary from base summarizer node which tracks summary state.\n // If trackState is false, get summary from summarizeInternal.\n return trackState\n ? super.summarize(fullTree, true /* trackState */, telemetryContext)\n : this.summarizeFn(fullTree, trackState, telemetryContext);\n }\n\n /**\n * Returns the GC data of this node. If nothing has changed since last summary, it tries to reuse the data from\n * the previous summary. Else, it gets new GC data from the underlying Fluid object.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n assert(!this.gcDisabled, 0x1b2 /* \"Getting GC data should not be called when GC is disabled!\" */);\n assert(this.getGCDataFn !== undefined, 0x1b3 /* \"GC data cannot be retrieved without getGCDataFn\" */);\n\n // Load GC details from the initial summary, if not already loaded. If this is the first time this function is\n // called and the node's data has not changed since last summary, the GC data in initial details is returned.\n await this.loadBaseGCDetails();\n\n // If there is no new data since last summary and we have GC data from the previous run, return it. The previous\n // GC data may not be available if loaded from a snapshot with either GC disabled or before GC was added.\n // Note - canReuseHandle is checked to be consistent with summarize - generate GC data for nodes for which\n // summary must be generated.\n if (this.canReuseHandle && !fullGC && !this.hasDataChanged() && this.gcData !== undefined) {\n return cloneGCData(this.gcData);\n }\n\n const gcData = await this.getGCDataFn(fullGC);\n this.gcData = cloneGCData(gcData);\n return gcData;\n }\n\n /**\n * Called during the start of a summary. Updates the work-in-progress used routes.\n */\n public startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger) {\n // If GC is disabled, skip setting wip used routes since we should not track GC state.\n if (!this.gcDisabled) {\n assert(\n this.wipSerializedUsedRoutes === undefined,\n 0x1b4 /* \"We should not already be tracking used routes when to track a new summary\" */);\n }\n super.startSummary(referenceSequenceNumber, summaryLogger);\n }\n\n /**\n * Called after summary has been uploaded to the server. Add the work-in-progress state to the pending\n * summary queue. We track this until we get an ack from the server for this summary.\n */\n protected completeSummaryCore(\n proposalHandle: string,\n parentPath: EscapedPath | undefined,\n parentSkipRecursion: boolean,\n ) {\n let wipSerializedUsedRoutes: string | undefined;\n // If GC is disabled, don't set wip used routes.\n if (!this.gcDisabled) {\n wipSerializedUsedRoutes = this.wipSerializedUsedRoutes;\n assert(wipSerializedUsedRoutes !== undefined, 0x1b5 /* \"We should have been tracking used routes\" */);\n }\n\n super.completeSummaryCore(proposalHandle, parentPath, parentSkipRecursion);\n\n // If GC is disabled, skip setting pending summary with GC state.\n if (!this.gcDisabled) {\n const summaryNode = this.pendingSummaries.get(proposalHandle);\n if (summaryNode !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const summaryNodeWithGC = new SummaryNodeWithGC(wipSerializedUsedRoutes!, summaryNode);\n this.pendingSummaries.set(proposalHandle, summaryNodeWithGC);\n }\n }\n }\n\n /**\n * Clears the work-in-progress state.\n */\n public clearSummary() {\n this.wipSerializedUsedRoutes = undefined;\n super.clearSummary();\n }\n\n /**\n * Called when we get an ack from the server for a summary we sent. Update the reference state of this node\n * from the state in the pending summary queue.\n */\n protected refreshLatestSummaryFromPending(\n proposalHandle: string,\n referenceSequenceNumber: number,\n ): void {\n // If GC is disabled, skip setting referenced used routes since we are not tracking GC state.\n if (!this.gcDisabled) {\n const summaryNode = this.pendingSummaries.get(proposalHandle) as SummaryNodeWithGC;\n if (summaryNode?.serializedUsedRoutes !== undefined) {\n this.referenceUsedRoutes = JSON.parse(summaryNode.serializedUsedRoutes);\n }\n }\n\n return super.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n }\n\n /**\n * Called when we need to upload the reference state from the given summary.\n */\n protected async refreshLatestSummaryFromSnapshot(\n referenceSequenceNumber: number,\n snapshotTree: ISnapshotTree,\n basePath: EscapedPath | undefined,\n localPath: EscapedPath,\n correlatedSummaryLogger: ITelemetryLogger,\n readAndParseBlob: ReadAndParseBlob,\n ): Promise<void> {\n await this.refreshGCStateFromSnapshot(referenceSequenceNumber, snapshotTree, readAndParseBlob);\n return super.refreshLatestSummaryFromSnapshot(\n referenceSequenceNumber,\n snapshotTree,\n basePath,\n localPath,\n correlatedSummaryLogger,\n readAndParseBlob,\n );\n }\n\n /**\n * Updates GC state from the given snapshot if GC is enabled and the snapshot is newer than the one this node\n * is tracking.\n */\n private async refreshGCStateFromSnapshot(\n referenceSequenceNumber: number,\n snapshotTree: ISnapshotTree,\n readAndParseBlob: ReadAndParseBlob,\n ): Promise<void> {\n // If GC is disabled or we have seen a newer summary, skip updating GC state.\n if (this.gcDisabled || this.referenceSequenceNumber >= referenceSequenceNumber) {\n return;\n }\n\n // Load the base GC details before proceeding because if that happens later it can overwrite the GC details\n // written by the following code.\n await this.loadBaseGCDetails();\n\n // Possible re-entrancy. We may already have processed this while loading base GC details.\n if (this.referenceSequenceNumber >= referenceSequenceNumber) {\n return;\n }\n\n /**\n * GC data is written at root of the snapshot tree under \"gc\" sub-tree. This data needs to be propagated to\n * all the nodes in the container.\n * The root summarizer node reads the GC data from the \"gc\" sub-tree, runs GC on it to get used routes in\n * the container and updates its GC data and referenced used routes. It then gets the GC data and used\n * routes of all its children and adds it to their snapshot tree.\n * All the other nodes gets the GC data and used routes from their snapshot tree and updates their state.\n * They get the GC data and used routes of their children and add it to their snapshot tree and so on.\n *\n * Note that if the snapshot does not have GC tree, GC data will be set to undefined and used routes will be\n * set to self-route (meaning referenced) for all nodes. This is important because the GC data needs to be\n * regenerated in the next summary.\n */\n let gcDetails: IGarbageCollectionDetailsBase | undefined;\n const gcSnapshotTree = snapshotTree.trees[gcTreeKey];\n if (gcSnapshotTree !== undefined) {\n // If there is a GC tree in the snapshot, this is the root summarizer node. Read GC data from the tree\n // process it as explained above.\n const gcSnapshotData = await getGCDataFromSnapshot(gcSnapshotTree, readAndParseBlob);\n\n const gcNodes: { [id: string]: string[]; } = {};\n for (const [nodeId, nodeData] of Object.entries(gcSnapshotData.gcState.gcNodes)) {\n gcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n }\n // Run GC on the nodes in the snapshot to get the used routes for each node in the container.\n const usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n gcDetails = { gcData: { gcNodes }, usedRoutes };\n } else {\n // If there is a GC blob in the snapshot, it's a non-root summarizer nodes - The root summarizer node\n // writes GC blob in the snapshot of child nodes. Get GC data and used routes from the blob.\n const gcDetailsBlob = snapshotTree.blobs[gcTreeKey];\n if (gcDetailsBlob !== undefined) {\n gcDetails = JSON.parse(gcDetailsBlob) as IGarbageCollectionDetailsBase;\n }\n }\n\n // Update this node to the same GC state it was when the ack corresponding to this summary was processed.\n this.gcData = gcDetails?.gcData !== undefined ? cloneGCData(gcDetails.gcData) : undefined;\n this.referenceUsedRoutes = gcDetails?.usedRoutes !== undefined ? Array.from(gcDetails.usedRoutes) : undefined;\n // If there are no used routes in the GC details, set it to have self route which will make the node\n // referenced. This scenario can only happen if the snapshot is from a client where GC was not run or\n // disabled. In both the cases, the node should be referenced.\n this.usedRoutes = gcDetails?.usedRoutes !== undefined ? Array.from(gcDetails.usedRoutes) : [\"\"];\n\n if (gcDetails === undefined) {\n return;\n }\n\n // Generate the GC data and used routes of children GC nodes and add it to their snapshot tree.\n const gcDetailsMap = unpackChildNodesGCDetails(gcDetails);\n const { childrenTree } = parseSummaryForSubtrees(snapshotTree);\n gcDetailsMap.forEach((childGCDetails: IGarbageCollectionDetailsBase, childId: string) => {\n childrenTree.trees[childId].blobs[gcTreeKey] = JSON.stringify(childGCDetails);\n });\n }\n\n /**\n * Override the createChild method to return an instance of SummarizerNodeWithGC.\n */\n public createChild(\n /** Summarize function */\n summarizeInternalFn: SummarizeInternalFn,\n /** Initial id or path part of this node */\n id: string,\n /**\n * Information needed to create the node.\n * If it is from a base summary, it will assert that a summary has been seen.\n * Attach information if it is created from an attach op.\n */\n createParam: CreateChildSummarizerNodeParam,\n config: ISummarizerNodeConfigWithGC = {},\n getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n ): ISummarizerNodeWithGC {\n assert(!this.children.has(id), 0x1b6 /* \"Create SummarizerNode child already exists\" */);\n\n /**\n * Update the child node's base GC details from this node's current GC details instead of updating from the base\n * GC details of this node. This will handle scenarios where the GC details was updated during refresh from\n * snapshot and the child node wasn't created then. If a child is created after that, its GC details should be\n * the one from the downloaded snapshot and not the base GC details.\n */\n const getChildBaseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n // Ensure that the base GC details is loaded because a child can be created before GC runs which is when\n // base GC details is usually loaded.\n await this.loadBaseGCDetails();\n const childBaseGCDetails = unpackChildNodesGCDetails({ gcData: this.gcData, usedRoutes: this.usedRoutes });\n return childBaseGCDetails.get(id) ?? {};\n });\n\n const createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n const child = new SummarizerNodeWithGC(\n this.defaultLogger,\n summarizeInternalFn,\n {\n ...config,\n // Propagate our gcDisabled state to the child if its not explicity specified in child's config.\n gcDisabled: config.gcDisabled ?? this.gcDisabled,\n },\n createDetails.changeSequenceNumber,\n createDetails.latestSummary,\n createDetails.initialSummary,\n this.wipSummaryLogger,\n getGCDataFn,\n async () => getChildBaseGCDetailsP,\n );\n\n // There may be additional state that has to be updated in this child. For example, if a summary is being\n // tracked, the child's summary tracking state needs to be updated too.\n this.maybeUpdateChildState(child);\n\n this.children.set(id, child);\n return child;\n }\n\n /**\n * Deletes the child node with the given id.\n */\n public deleteChild(id: string): void {\n this.children.delete(id);\n }\n\n /**\n * Override the getChild method to return an instance of SummarizerNodeWithGC.\n */\n public getChild(id: string): ISummarizerNodeWithGC | undefined {\n return this.children.get(id) as SummarizerNodeWithGC;\n }\n\n public isReferenced(): boolean {\n return this.usedRoutes.includes(\"\") || this.usedRoutes.includes(\"/\");\n }\n\n public updateUsedRoutes(usedRoutes: string[]) {\n // Sort the given routes before updating. This will ensure that the routes compared in hasUsedStateChanged()\n // are in the same order.\n this.usedRoutes = usedRoutes.sort();\n\n // If GC is not disabled and we are tracking a summary, update the work-in-progress used routes so that it can\n // be tracked for this summary.\n if (!this.gcDisabled && this.isTrackingInProgress()) {\n this.wipSerializedUsedRoutes = JSON.stringify(this.usedRoutes);\n }\n }\n\n /**\n * Override the hasChanged method. If this node data or its used state changed, the node is considered changed.\n */\n protected hasChanged(): boolean {\n return this.hasDataChanged() || this.hasUsedStateChanged();\n }\n\n /**\n * This tells whether the data in this node has changed or not.\n */\n private hasDataChanged(): boolean {\n return super.hasChanged();\n }\n\n /**\n * This tells whether the used state of this node has changed since last successful summary. If the used routes\n * of this node changed, its used state is considered changed. Basically, if this node or any of its child nodes\n * was previously used and became unused (or vice versa), its used state has changed.\n */\n private hasUsedStateChanged(): boolean {\n // If GC is disabled, we are not tracking used state, return false.\n if (this.gcDisabled) {\n return false;\n }\n\n return this.referenceUsedRoutes === undefined ||\n JSON.stringify(this.usedRoutes) !== JSON.stringify(this.referenceUsedRoutes);\n }\n}\n\n/**\n * Creates a root summarizer node with GC functionality built-in.\n * @param logger - Logger to use within SummarizerNode\n * @param summarizeInternalFn - Function to generate summary\n * @param changeSequenceNumber - Sequence number of latest change to new node/subtree\n * @param referenceSequenceNumber - Reference sequence number of last acked summary,\n * or undefined if not loaded from summary\n * @param config - Configure behavior of summarizer node\n * @param getGCDataFn - Function to get the GC data of this node\n * @param baseGCDetailsP - Function to get the initial GC details of this node\n */\nexport const createRootSummarizerNodeWithGC = (\n logger: ITelemetryLogger,\n summarizeInternalFn: SummarizeInternalFn,\n changeSequenceNumber: number,\n referenceSequenceNumber: number | undefined,\n config: ISummarizerNodeConfigWithGC = {},\n getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n): IRootSummarizerNodeWithGC => new SummarizerNodeWithGC(\n logger,\n summarizeInternalFn,\n config,\n changeSequenceNumber,\n referenceSequenceNumber === undefined ? undefined : SummaryNode.createForRoot(referenceSequenceNumber),\n undefined /* initialSummary */,\n undefined /* wipSummaryLogger */,\n getGCDataFn,\n getBaseGCDetailsFn,\n);\n"]}
1
+ {"version":3,"file":"summarizerNodeWithGc.js","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNodeWithGc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAExI,OAAO,EAEH,SAAS,GASZ,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAKH,uBAAuB,EACvB,WAAW,GACd,MAAM,uBAAuB,CAAC;AAI/B,wDAAwD;AACxD,MAAM,iBAAkB,SAAQ,WAAW;IACvC,YACoB,oBAA4B,EAC5C,OAKC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QARC,yBAAoB,GAApB,oBAAoB,CAAQ;IAShD,CAAC;CACJ;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IAuBpD;;;OAGG;IACH,YACI,MAAwB,EACP,WAIqB,EACtC,MAAmC,EACnC,oBAA4B;IAC5B,8CAA8C;IAC9C,aAA2B,EAC3B,cAAgC,EAChC,gBAAmC,EAClB,WAAmE,EACpF,kBAAiE;QAEjE,KAAK,CACD,MAAM,EACN,KAAK,EAAE,QAAiB,EAAE,WAAoB,EAAE,gBAAoC,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cesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, LazyPromise } from \"@fluidframework/common-utils\";\nimport { cloneGCData, getGCDataFromSnapshot, runGarbageCollection, unpackChildNodesGCDetails } from \"@fluidframework/garbage-collector\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n CreateChildSummarizerNodeParam,\n gcTreeKey,\n IGarbageCollectionData,\n IGarbageCollectionDetailsBase,\n ISummarizeInternalResult,\n ISummarizeResult,\n ISummarizerNodeConfigWithGC,\n ISummarizerNodeWithGC,\n SummarizeInternalFn,\n ITelemetryContext,\n} from \"@fluidframework/runtime-definitions\";\nimport { ReadAndParseBlob } from \"../utils\";\nimport { SummarizerNode } from \"./summarizerNode\";\nimport {\n EscapedPath,\n ICreateChildDetails,\n IInitialSummary,\n ISummarizerNodeRootContract,\n parseSummaryForSubtrees,\n SummaryNode,\n} from \"./summarizerNodeUtils\";\n\nexport interface IRootSummarizerNodeWithGC extends ISummarizerNodeWithGC, ISummarizerNodeRootContract {}\n\n// Extend SummaryNode to add used routes tracking to it.\nclass SummaryNodeWithGC extends SummaryNode {\n constructor(\n public readonly serializedUsedRoutes: string,\n summary: {\n readonly referenceSequenceNumber: number;\n readonly basePath: EscapedPath | undefined;\n readonly localPath: EscapedPath;\n additionalPath?: EscapedPath;\n },\n ) {\n super(summary);\n }\n}\n\n/**\n * Extends the functionality of SummarizerNode to manage this node's garbage collection data:\n *\n * - Adds a new API `getGCData` to return GC data of this node.\n *\n * - Caches the result of `getGCData` to be used if nothing changes between summaries.\n *\n * - Manages the used routes of this node. These are used to identify if this node is referenced in the document\n * and to determine if the node's used state changed since last summary.\n *\n * - Adds trackState param to summarize. If trackState is false, it bypasses the SummarizerNode and calls\n * directly into summarizeInternal method.\n */\nexport class SummarizerNodeWithGC extends SummarizerNode implements IRootSummarizerNodeWithGC {\n // Tracks the work-in-progress used routes during summary.\n private wipSerializedUsedRoutes: string | undefined;\n\n // This is the last known used routes of this node as seen by the server as part of a summary.\n private referenceUsedRoutes: string[] | undefined;\n\n // The base GC details of this node used to initialize the GC state.\n private readonly baseGCDetailsP: LazyPromise<IGarbageCollectionDetailsBase>;\n\n // Keeps track of whether we have loaded the base details to ensure that we on;y do it once.\n private baseGCDetailsLoaded: boolean = false;\n\n private gcData: IGarbageCollectionData | undefined;\n\n // Set used routes to have self route by default. This makes the node referenced by default. This is done to ensure\n // that this node is not marked as collected when running GC has been disabled. Once, the option to disable GC is\n // removed (from runGC flag in IContainerRuntimeOptions), this should be changed to be have no routes by default.\n private usedRoutes: string[] = [\"\"];\n\n // True if GC is disabled for this node. If so, do not track GC specific state for a summary.\n private readonly gcDisabled: boolean;\n\n /**\n * Do not call constructor directly.\n * Use createRootSummarizerNodeWithGC to create root node, or createChild to create child nodes.\n */\n public constructor(\n logger: ITelemetryLogger,\n private readonly summarizeFn: (\n fullTree: boolean,\n trackState: boolean,\n telemetryContext?: ITelemetryContext,\n ) => Promise<ISummarizeInternalResult>,\n config: ISummarizerNodeConfigWithGC,\n changeSequenceNumber: number,\n /** Undefined means created without summary */\n latestSummary?: SummaryNode,\n initialSummary?: IInitialSummary,\n wipSummaryLogger?: ITelemetryLogger,\n private readonly getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n ) {\n super(\n logger,\n async (fullTree: boolean, _trackState: boolean, telemetryContext?: ITelemetryContext) =>\n summarizeFn(fullTree, true /* trackState */, telemetryContext),\n config,\n changeSequenceNumber,\n latestSummary,\n initialSummary,\n wipSummaryLogger,\n );\n\n this.gcDisabled = config.gcDisabled === true;\n\n this.baseGCDetailsP = new LazyPromise(async () => {\n return (await getBaseGCDetailsFn?.()) ?? { usedRoutes: [] };\n });\n }\n\n /**\n * Loads state from this node's initial GC summary details. This contains the following data from the last summary\n * seen by the server for this client:\n * - usedRoutes: This is used to figure out if the used state of this node changed since last summary.\n * - gcData: The garbage collection data of this node that is required for running GC.\n */\n private async loadBaseGCDetails() {\n if (this.baseGCDetailsLoaded) {\n return;\n }\n const baseGCDetails = await this.baseGCDetailsP;\n\n // Possible race - If there were parallel calls to loadBaseGCDetails, we want to make sure that we update\n // the state from the base details only once.\n if (this.baseGCDetailsLoaded) {\n return;\n }\n this.baseGCDetailsLoaded = true;\n\n // Update GC data, used routes and reference used routes. The used routes are sorted because they are compared\n // across GC runs to check if they changed. Sorting ensures that the elements are in the same order.\n // If the GC details has GC data, initialize our GC data from it.\n if (baseGCDetails.gcData !== undefined) {\n this.gcData = cloneGCData(baseGCDetails.gcData);\n }\n if (baseGCDetails.usedRoutes !== undefined) {\n this.usedRoutes = Array.from(baseGCDetails.usedRoutes).sort();\n this.referenceUsedRoutes = Array.from(baseGCDetails.usedRoutes).sort()\n }\n }\n\n public async summarize(\n fullTree: boolean,\n trackState: boolean = true,\n telemetryContext?: ITelemetryContext,\n ): Promise<ISummarizeResult> {\n // If GC is not disabled and we are tracking a summary, GC should have run and updated the used routes for this\n // summary by calling updateUsedRoutes which sets wipSerializedUsedRoutes.\n if (!this.gcDisabled && this.isTrackingInProgress()) {\n assert(this.wipSerializedUsedRoutes !== undefined,\n 0x1b1 /* \"wip used routes should be set if tracking a summary\" */);\n }\n\n // If trackState is true, get summary from base summarizer node which tracks summary state.\n // If trackState is false, get summary from summarizeInternal.\n return trackState\n ? super.summarize(fullTree, true /* trackState */, telemetryContext)\n : this.summarizeFn(fullTree, trackState, telemetryContext);\n }\n\n /**\n * Returns the GC data of this node. If nothing has changed since last summary, it tries to reuse the data from\n * the previous summary. Else, it gets new GC data from the underlying Fluid object.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n public async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n assert(!this.gcDisabled, 0x1b2 /* \"Getting GC data should not be called when GC is disabled!\" */);\n assert(this.getGCDataFn !== undefined, 0x1b3 /* \"GC data cannot be retrieved without getGCDataFn\" */);\n\n // Load GC details from the initial summary, if not already loaded. If this is the first time this function is\n // called and the node's data has not changed since last summary, the GC data in initial details is returned.\n await this.loadBaseGCDetails();\n\n // If there is no new data since last summary and we have GC data from the previous run, return it. The previous\n // GC data may not be available if loaded from a snapshot with either GC disabled or before GC was added.\n // Note - canReuseHandle is checked to be consistent with summarize - generate GC data for nodes for which\n // summary must be generated.\n if (this.canReuseHandle && !fullGC && !this.hasDataChanged() && this.gcData !== undefined) {\n return cloneGCData(this.gcData);\n }\n\n const gcData = await this.getGCDataFn(fullGC);\n this.gcData = cloneGCData(gcData);\n return gcData;\n }\n\n /**\n * Called during the start of a summary. Updates the work-in-progress used routes.\n */\n public startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger) {\n // If GC is disabled, skip setting wip used routes since we should not track GC state.\n if (!this.gcDisabled) {\n assert(\n this.wipSerializedUsedRoutes === undefined,\n 0x1b4 /* \"We should not already be tracking used routes when to track a new summary\" */);\n }\n super.startSummary(referenceSequenceNumber, summaryLogger);\n }\n\n /**\n * Called after summary has been uploaded to the server. Add the work-in-progress state to the pending\n * summary queue. We track this until we get an ack from the server for this summary.\n */\n protected completeSummaryCore(\n proposalHandle: string,\n parentPath: EscapedPath | undefined,\n parentSkipRecursion: boolean,\n ) {\n let wipSerializedUsedRoutes: string | undefined;\n // If GC is disabled, don't set wip used routes.\n if (!this.gcDisabled) {\n wipSerializedUsedRoutes = this.wipSerializedUsedRoutes;\n assert(wipSerializedUsedRoutes !== undefined, 0x1b5 /* \"We should have been tracking used routes\" */);\n }\n\n super.completeSummaryCore(proposalHandle, parentPath, parentSkipRecursion);\n\n // If GC is disabled, skip setting pending summary with GC state.\n if (!this.gcDisabled) {\n const summaryNode = this.pendingSummaries.get(proposalHandle);\n if (summaryNode !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const summaryNodeWithGC = new SummaryNodeWithGC(wipSerializedUsedRoutes!, summaryNode);\n this.pendingSummaries.set(proposalHandle, summaryNodeWithGC);\n }\n }\n }\n\n /**\n * Clears the work-in-progress state.\n */\n public clearSummary() {\n this.wipSerializedUsedRoutes = undefined;\n super.clearSummary();\n }\n\n /**\n * Called when we get an ack from the server for a summary we sent. Update the reference state of this node\n * from the state in the pending summary queue.\n */\n protected refreshLatestSummaryFromPending(\n proposalHandle: string,\n referenceSequenceNumber: number,\n ): void {\n // If GC is disabled, skip setting referenced used routes since we are not tracking GC state.\n if (!this.gcDisabled) {\n const summaryNode = this.pendingSummaries.get(proposalHandle) as SummaryNodeWithGC;\n if (summaryNode?.serializedUsedRoutes !== undefined) {\n this.referenceUsedRoutes = JSON.parse(summaryNode.serializedUsedRoutes);\n }\n }\n\n return super.refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber);\n }\n\n /**\n * Called when we need to upload the reference state from the given summary.\n */\n protected async refreshLatestSummaryFromSnapshot(\n referenceSequenceNumber: number,\n snapshotTree: ISnapshotTree,\n basePath: EscapedPath | undefined,\n localPath: EscapedPath,\n correlatedSummaryLogger: ITelemetryLogger,\n readAndParseBlob: ReadAndParseBlob,\n ): Promise<void> {\n await this.refreshGCStateFromSnapshot(referenceSequenceNumber, snapshotTree, readAndParseBlob);\n return super.refreshLatestSummaryFromSnapshot(\n referenceSequenceNumber,\n snapshotTree,\n basePath,\n localPath,\n correlatedSummaryLogger,\n readAndParseBlob,\n );\n }\n\n /**\n * Updates GC state from the given snapshot if GC is enabled and the snapshot is newer than the one this node\n * is tracking.\n */\n private async refreshGCStateFromSnapshot(\n referenceSequenceNumber: number,\n snapshotTree: ISnapshotTree,\n readAndParseBlob: ReadAndParseBlob,\n ): Promise<void> {\n // If GC is disabled or we have seen a newer summary, skip updating GC state.\n if (this.gcDisabled || this.referenceSequenceNumber >= referenceSequenceNumber) {\n return;\n }\n\n // Load the base GC details before proceeding because if that happens later it can overwrite the GC details\n // written by the following code.\n await this.loadBaseGCDetails();\n\n // Possible re-entrancy. We may already have processed this while loading base GC details.\n if (this.referenceSequenceNumber >= referenceSequenceNumber) {\n return;\n }\n\n /**\n * GC data is written at root of the snapshot tree under \"gc\" sub-tree. This data needs to be propagated to\n * all the nodes in the container.\n * The root summarizer node reads the GC data from the \"gc\" sub-tree, runs GC on it to get used routes in\n * the container and updates its GC data and referenced used routes. It then gets the GC data and used\n * routes of all its children and adds it to their snapshot tree.\n * All the other nodes gets the GC data and used routes from their snapshot tree and updates their state.\n * They get the GC data and used routes of their children and add it to their snapshot tree and so on.\n *\n * Note that if the snapshot does not have GC tree, GC data will be set to undefined and used routes will be\n * set to self-route (meaning referenced) for all nodes. This is important because the GC data needs to be\n * regenerated in the next summary.\n */\n let gcDetails: IGarbageCollectionDetailsBase | undefined;\n const gcSnapshotTree = snapshotTree.trees[gcTreeKey];\n if (gcSnapshotTree !== undefined) {\n // If there is a GC tree in the snapshot, this is the root summarizer node. Read GC data from the tree\n // process it as explained above.\n const gcSnapshotData = await getGCDataFromSnapshot(gcSnapshotTree, readAndParseBlob);\n\n const gcNodes: { [id: string]: string[]; } = {};\n for (const [nodeId, nodeData] of Object.entries(gcSnapshotData.gcState.gcNodes)) {\n gcNodes[nodeId] = Array.from(nodeData.outboundRoutes);\n }\n // Run GC on the nodes in the snapshot to get the used routes for each node in the container.\n const usedRoutes = runGarbageCollection(gcNodes, [\"/\"]).referencedNodeIds;\n gcDetails = { gcData: { gcNodes }, usedRoutes };\n } else {\n // If there is a GC blob in the snapshot, it's a non-root summarizer nodes - The root summarizer node\n // writes GC blob in the snapshot of child nodes. Get GC data and used routes from the blob.\n const gcDetailsBlob = snapshotTree.blobs[gcTreeKey];\n if (gcDetailsBlob !== undefined) {\n gcDetails = JSON.parse(gcDetailsBlob) as IGarbageCollectionDetailsBase;\n }\n }\n\n // Update this node to the same GC state it was when the ack corresponding to this summary was processed.\n this.gcData = gcDetails?.gcData !== undefined ? cloneGCData(gcDetails.gcData) : undefined;\n this.referenceUsedRoutes = gcDetails?.usedRoutes !== undefined ? Array.from(gcDetails.usedRoutes) : undefined;\n // If there are no used routes in the GC details, set it to have self route which will make the node\n // referenced. This scenario can only happen if the snapshot is from a client where GC was not run or\n // disabled. In both the cases, the node should be referenced.\n this.usedRoutes = gcDetails?.usedRoutes !== undefined ? Array.from(gcDetails.usedRoutes) : [\"\"];\n\n if (gcDetails === undefined) {\n return;\n }\n\n // Generate the GC data and used routes of children GC nodes and add it to their snapshot tree.\n const gcDetailsMap = unpackChildNodesGCDetails(gcDetails);\n const { childrenTree } = parseSummaryForSubtrees(snapshotTree);\n gcDetailsMap.forEach((childGCDetails: IGarbageCollectionDetailsBase, childId: string) => {\n if (childrenTree.trees[childId] !== undefined) {\n childrenTree.trees[childId].blobs[gcTreeKey] = JSON.stringify(childGCDetails);\n }\n });\n }\n\n /**\n * Override the createChild method to return an instance of SummarizerNodeWithGC.\n */\n public createChild(\n /** Summarize function */\n summarizeInternalFn: SummarizeInternalFn,\n /** Initial id or path part of this node */\n id: string,\n /**\n * Information needed to create the node.\n * If it is from a base summary, it will assert that a summary has been seen.\n * Attach information if it is created from an attach op.\n */\n createParam: CreateChildSummarizerNodeParam,\n config: ISummarizerNodeConfigWithGC = {},\n getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n ): ISummarizerNodeWithGC {\n assert(!this.children.has(id), 0x1b6 /* \"Create SummarizerNode child already exists\" */);\n\n /**\n * Update the child node's base GC details from this node's current GC details instead of updating from the base\n * GC details of this node. This will handle scenarios where the GC details was updated during refresh from\n * snapshot and the child node wasn't created then. If a child is created after that, its GC details should be\n * the one from the downloaded snapshot and not the base GC details.\n */\n const getChildBaseGCDetailsP = new LazyPromise<IGarbageCollectionDetailsBase>(async () => {\n // Ensure that the base GC details is loaded because a child can be created before GC runs which is when\n // base GC details is usually loaded.\n await this.loadBaseGCDetails();\n const childBaseGCDetails = unpackChildNodesGCDetails({ gcData: this.gcData, usedRoutes: this.usedRoutes });\n return childBaseGCDetails.get(id) ?? {};\n });\n\n const createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam);\n const child = new SummarizerNodeWithGC(\n this.defaultLogger,\n summarizeInternalFn,\n {\n ...config,\n // Propagate our gcDisabled state to the child if its not explicity specified in child's config.\n gcDisabled: config.gcDisabled ?? this.gcDisabled,\n },\n createDetails.changeSequenceNumber,\n createDetails.latestSummary,\n createDetails.initialSummary,\n this.wipSummaryLogger,\n getGCDataFn,\n async () => getChildBaseGCDetailsP,\n );\n\n // There may be additional state that has to be updated in this child. For example, if a summary is being\n // tracked, the child's summary tracking state needs to be updated too.\n this.maybeUpdateChildState(child);\n\n this.children.set(id, child);\n return child;\n }\n\n /**\n * Deletes the child node with the given id.\n */\n public deleteChild(id: string): void {\n this.children.delete(id);\n }\n\n /**\n * Override the getChild method to return an instance of SummarizerNodeWithGC.\n */\n public getChild(id: string): ISummarizerNodeWithGC | undefined {\n return this.children.get(id) as SummarizerNodeWithGC;\n }\n\n public isReferenced(): boolean {\n return this.usedRoutes.includes(\"\") || this.usedRoutes.includes(\"/\");\n }\n\n public updateUsedRoutes(usedRoutes: string[]) {\n // Sort the given routes before updating. This will ensure that the routes compared in hasUsedStateChanged()\n // are in the same order.\n this.usedRoutes = usedRoutes.sort();\n\n // If GC is not disabled and we are tracking a summary, update the work-in-progress used routes so that it can\n // be tracked for this summary.\n if (!this.gcDisabled && this.isTrackingInProgress()) {\n this.wipSerializedUsedRoutes = JSON.stringify(this.usedRoutes);\n }\n }\n\n /**\n * Override the hasChanged method. If this node data or its used state changed, the node is considered changed.\n */\n protected hasChanged(): boolean {\n return this.hasDataChanged() || this.hasUsedStateChanged();\n }\n\n /**\n * This tells whether the data in this node has changed or not.\n */\n private hasDataChanged(): boolean {\n return super.hasChanged();\n }\n\n /**\n * This tells whether the used state of this node has changed since last successful summary. If the used routes\n * of this node changed, its used state is considered changed. Basically, if this node or any of its child nodes\n * was previously used and became unused (or vice versa), its used state has changed.\n */\n private hasUsedStateChanged(): boolean {\n // If GC is disabled, we are not tracking used state, return false.\n if (this.gcDisabled) {\n return false;\n }\n\n return this.referenceUsedRoutes === undefined ||\n JSON.stringify(this.usedRoutes) !== JSON.stringify(this.referenceUsedRoutes);\n }\n}\n\n/**\n * Creates a root summarizer node with GC functionality built-in.\n * @param logger - Logger to use within SummarizerNode\n * @param summarizeInternalFn - Function to generate summary\n * @param changeSequenceNumber - Sequence number of latest change to new node/subtree\n * @param referenceSequenceNumber - Reference sequence number of last acked summary,\n * or undefined if not loaded from summary\n * @param config - Configure behavior of summarizer node\n * @param getGCDataFn - Function to get the GC data of this node\n * @param baseGCDetailsP - Function to get the initial GC details of this node\n */\nexport const createRootSummarizerNodeWithGC = (\n logger: ITelemetryLogger,\n summarizeInternalFn: SummarizeInternalFn,\n changeSequenceNumber: number,\n referenceSequenceNumber: number | undefined,\n config: ISummarizerNodeConfigWithGC = {},\n getGCDataFn?: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n getBaseGCDetailsFn?: () => Promise<IGarbageCollectionDetailsBase>,\n): IRootSummarizerNodeWithGC => new SummarizerNodeWithGC(\n logger,\n summarizeInternalFn,\n config,\n changeSequenceNumber,\n referenceSequenceNumber === undefined ? undefined : SummaryNode.createForRoot(referenceSequenceNumber),\n undefined /* initialSummary */,\n undefined /* wipSummaryLogger */,\n getGCDataFn,\n getBaseGCDetailsFn,\n);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/runtime-utils",
3
- "version": "2.0.0-internal.2.3.1",
3
+ "version": "2.0.0-internal.2.4.1",
4
4
  "description": "Collection of utility functions for Fluid Runtime",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -64,27 +64,27 @@
64
64
  "dependencies": {
65
65
  "@fluidframework/common-definitions": "^0.20.1",
66
66
  "@fluidframework/common-utils": "^1.0.0",
67
- "@fluidframework/container-definitions": ">=2.0.0-internal.2.3.1 <2.0.0-internal.3.0.0",
68
- "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.2.3.1 <2.0.0-internal.3.0.0",
69
- "@fluidframework/core-interfaces": ">=2.0.0-internal.2.3.1 <2.0.0-internal.3.0.0",
70
- "@fluidframework/datastore-definitions": ">=2.0.0-internal.2.3.1 <2.0.0-internal.3.0.0",
71
- "@fluidframework/garbage-collector": ">=2.0.0-internal.2.3.1 <2.0.0-internal.3.0.0",
67
+ "@fluidframework/container-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
68
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
69
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
70
+ "@fluidframework/datastore-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
71
+ "@fluidframework/garbage-collector": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
72
72
  "@fluidframework/protocol-base": "^0.1038.2000",
73
73
  "@fluidframework/protocol-definitions": "^1.1.0",
74
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.2.3.1 <2.0.0-internal.3.0.0",
75
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.2.3.1 <2.0.0-internal.3.0.0"
74
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
75
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@fluid-tools/build-cli": "^0.7.0",
78
+ "@fluid-tools/build-cli": "^0.8.0",
79
79
  "@fluidframework/build-common": "^1.1.0",
80
- "@fluidframework/build-tools": "^0.7.0",
80
+ "@fluidframework/build-tools": "^0.8.0",
81
81
  "@fluidframework/eslint-config-fluid": "^2.0.0",
82
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.3.1 <2.0.0-internal.3.0.0",
83
- "@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@2.0.0-internal.2.3.0",
82
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.2.4.1 <2.0.0-internal.3.0.0",
83
+ "@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@2.0.0-internal.2.4.0",
84
84
  "@microsoft/api-extractor": "^7.22.2",
85
85
  "@rushstack/eslint-config": "^2.5.1",
86
86
  "@types/mocha": "^9.1.1",
87
- "@types/node": "^14.18.0",
87
+ "@types/node": "^14.18.36",
88
88
  "concurrently": "^6.2.0",
89
89
  "copyfiles": "^2.4.1",
90
90
  "cross-env": "^7.0.2",
@@ -98,8 +98,14 @@
98
98
  "typescript": "~4.5.5"
99
99
  },
100
100
  "typeValidation": {
101
- "version": "2.0.0-internal.2.3.1",
102
- "baselineRange": "2.0.0-internal.2.3.0",
103
- "broken": {}
101
+ "version": "2.0.0-internal.2.4.0",
102
+ "previousVersionStyle": "previousPatch",
103
+ "baselineRange": "2.0.0-internal.2.4.0",
104
+ "broken": {
105
+ "TypeAliasDeclaration_RefreshSummaryResult": {
106
+ "forwardCompat": false,
107
+ "backCompat": false
108
+ }
109
+ }
104
110
  }
105
111
  }
package/src/index.ts CHANGED
@@ -21,6 +21,7 @@ export { RuntimeFactoryHelper } from "./runtimeFactoryHelper";
21
21
  export {
22
22
  createRootSummarizerNode,
23
23
  createRootSummarizerNodeWithGC,
24
+ IFetchSnapshotResult,
24
25
  IRootSummarizerNode,
25
26
  IRootSummarizerNodeWithGC,
26
27
  ISummarizerNodeRootContract,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/runtime-utils";
9
- export const pkgVersion = "2.0.0-internal.2.3.1";
9
+ export const pkgVersion = "2.0.0-internal.2.4.1";
@@ -3,6 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- export { ISummarizerNodeRootContract, RefreshSummaryResult } from "./summarizerNodeUtils";
6
+ export {
7
+ IFetchSnapshotResult,
8
+ ISummarizerNodeRootContract,
9
+ RefreshSummaryResult,
10
+ } from "./summarizerNodeUtils";
7
11
  export { IRootSummarizerNode, createRootSummarizerNode } from "./summarizerNode";
8
12
  export { IRootSummarizerNodeWithGC, createRootSummarizerNodeWithGC } from "./summarizerNodeWithGc";
@@ -26,6 +26,7 @@ import { ReadAndParseBlob } from "../utils";
26
26
  import {
27
27
  EscapedPath,
28
28
  ICreateChildDetails,
29
+ IFetchSnapshotResult,
29
30
  IInitialSummary,
30
31
  ISummarizerNodeRootContract,
31
32
  parseSummaryForSubtrees,
@@ -202,12 +203,11 @@ export class SummarizerNode implements IRootSummarizerNode {
202
203
  /**
203
204
  * Refreshes the latest summary tracked by this node. If we have a pending summary for the given proposal handle,
204
205
  * it becomes the latest summary. If the current summary is already ahead (e.g., loaded from a service summary),
205
- * we skip the update. Otherwise, we get the snapshot by calling `getSnapshot` and update latest
206
- * summary based off of that.
206
+ * we skip the update. Otherwise, we fetch the latest snapshot and update latest summary based off of that.
207
207
  *
208
208
  * @returns A RefreshSummaryResult type which returns information based on the following three scenarios:
209
209
  *
210
- * 1. The latest summary was not udpated.
210
+ * 1. The latest summary was not updated.
211
211
  *
212
212
  * 2. The latest summary was updated and the summary corresponding to the params was being tracked.
213
213
  *
@@ -217,16 +217,26 @@ export class SummarizerNode implements IRootSummarizerNode {
217
217
  public async refreshLatestSummary(
218
218
  proposalHandle: string | undefined,
219
219
  summaryRefSeq: number,
220
- getSnapshot: () => Promise<ISnapshotTree>,
220
+ fetchLatestSnapshot: () => Promise<IFetchSnapshotResult>,
221
221
  readAndParseBlob: ReadAndParseBlob,
222
222
  correlatedSummaryLogger: ITelemetryLogger,
223
223
  ): Promise<RefreshSummaryResult> {
224
+ this.defaultLogger.sendTelemetryEvent({
225
+ eventName: "refreshLatestSummary_start",
226
+ proposalHandle,
227
+ referenceSequenceNumber: this.referenceSequenceNumber,
228
+ summaryRefSeq,
229
+ });
230
+
224
231
  if (proposalHandle !== undefined) {
225
232
  const maybeSummaryNode = this.pendingSummaries.get(proposalHandle);
226
233
 
227
234
  if (maybeSummaryNode !== undefined) {
228
- this.refreshLatestSummaryFromPending(proposalHandle, maybeSummaryNode.referenceSequenceNumber);
229
- return { latestSummaryUpdated: true, wasSummaryTracked: true };
235
+ this.refreshLatestSummaryFromPending(
236
+ proposalHandle,
237
+ maybeSummaryNode.referenceSequenceNumber,
238
+ );
239
+ return { latestSummaryUpdated: true, wasSummaryTracked: true, summaryRefSeq };
230
240
  }
231
241
 
232
242
  const props = {
@@ -241,21 +251,36 @@ export class SummarizerNode implements IRootSummarizerNode {
241
251
  });
242
252
  }
243
253
 
244
- // If we have seen a summary same or later as the current one, ignore it.
254
+ // If the summary for which refresh is called is older than the latest tracked summary, ignore it.
245
255
  if (this.referenceSequenceNumber >= summaryRefSeq) {
246
256
  return { latestSummaryUpdated: false };
247
257
  }
248
258
 
249
- const snapshotTree = await getSnapshot();
259
+ // Fetch the latest snapshot and refresh state from it. Note that we need to use the reference sequence number
260
+ // of the fetched snapshot and not the "summaryRefSeq" that was passed in.
261
+ const { snapshotTree, snapshotRefSeq: fetchedSnapshotRefSeq } = await fetchLatestSnapshot();
262
+
263
+ // Possible re-entrancy. We may have updated latest summary state while fetching the snapshot. If the fetched
264
+ // snapshot is older than the latest tracked summary, ignore it.
265
+ if (this.referenceSequenceNumber >= fetchedSnapshotRefSeq) {
266
+ return { latestSummaryUpdated: false };
267
+ }
268
+
250
269
  await this.refreshLatestSummaryFromSnapshot(
251
- summaryRefSeq,
270
+ fetchedSnapshotRefSeq,
252
271
  snapshotTree,
253
272
  undefined,
254
273
  EscapedPath.create(""),
255
274
  correlatedSummaryLogger,
256
275
  readAndParseBlob,
257
276
  );
258
- return { latestSummaryUpdated: true, wasSummaryTracked: false, snapshot: snapshotTree };
277
+
278
+ return {
279
+ latestSummaryUpdated: true,
280
+ wasSummaryTracked: false,
281
+ snapshotTree,
282
+ summaryRefSeq: fetchedSnapshotRefSeq,
283
+ };
259
284
  }
260
285
  /**
261
286
  * Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node
@@ -13,26 +13,36 @@ import { channelsTreeName, ISummaryTreeWithStats } from "@fluidframework/runtime
13
13
  import { ReadAndParseBlob } from "../utils";
14
14
 
15
15
  /**
16
- * Return value of refreshSummaryAck function. There can be three different scenarios based on the passed params:
16
+ * Return type of refreshSummaryAck function. There can be three different scenarios based on the passed params:
17
17
  *
18
- * 1. The latest summary was not udpated.
18
+ * 1. The latest summary was not updated.
19
19
  *
20
20
  * 2. The latest summary was updated and the summary corresponding to the params was tracked by this client.
21
21
  *
22
22
  * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this case, the
23
- * latest summary is updated based on the downloaded snapshot which is also returned.
23
+ * latest snapshot is fetched and the latest summary state is updated based on it.
24
24
  */
25
25
  export type RefreshSummaryResult = {
26
26
  latestSummaryUpdated: false;
27
27
  } | {
28
28
  latestSummaryUpdated: true;
29
29
  wasSummaryTracked: true;
30
+ summaryRefSeq: number;
30
31
  } | {
31
32
  latestSummaryUpdated: true;
32
33
  wasSummaryTracked: false;
33
- snapshot: ISnapshotTree;
34
+ snapshotTree: ISnapshotTree;
35
+ summaryRefSeq: number;
34
36
  };
35
37
 
38
+ /**
39
+ * Result of snapshot fetch during refreshing latest summary state.
40
+ */
41
+ export interface IFetchSnapshotResult {
42
+ snapshotTree: ISnapshotTree;
43
+ snapshotRefSeq: number;
44
+ }
45
+
36
46
  export interface ISummarizerNodeRootContract {
37
47
  startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger): void;
38
48
  completeSummary(proposalHandle: string): void;
@@ -40,7 +50,7 @@ export interface ISummarizerNodeRootContract {
40
50
  refreshLatestSummary(
41
51
  proposalHandle: string | undefined,
42
52
  summaryRefSeq: number,
43
- getSnapshot: () => Promise<ISnapshotTree>,
53
+ fetchLatestSnapshot: () => Promise<IFetchSnapshotResult>,
44
54
  readAndParseBlob: ReadAndParseBlob,
45
55
  correlatedSummaryLogger: ITelemetryLogger,
46
56
  ): Promise<RefreshSummaryResult>;
@@ -363,7 +363,9 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari
363
363
  const gcDetailsMap = unpackChildNodesGCDetails(gcDetails);
364
364
  const { childrenTree } = parseSummaryForSubtrees(snapshotTree);
365
365
  gcDetailsMap.forEach((childGCDetails: IGarbageCollectionDetailsBase, childId: string) => {
366
- childrenTree.trees[childId].blobs[gcTreeKey] = JSON.stringify(childGCDetails);
366
+ if (childrenTree.trees[childId] !== undefined) {
367
+ childrenTree.trees[childId].blobs[gcTreeKey] = JSON.stringify(childGCDetails);
368
+ }
367
369
  });
368
370
  }
369
371