Skip to main content

SummaryTreeBuilder Class

A helper class for building summary trees.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/runtime-utils/legacy.

For more information about our API support guarantees, see here.

Signature

export declare class SummaryTreeBuilder implements ISummaryTreeWithStats

Implements: ISummaryTreeWithStats

Remarks

Uses the builder pattern. \

Constructors

Constructor Alerts Description
(constructor)(params) Beta Constructs a new instance of the SummaryTreeBuilder class

Properties

Property Alerts Modifiers Type Description
stats Beta readonly Readonly<ISummaryStats>
summary Beta readonly ISummaryTree

Methods

Method Alerts Return Type Description
addAttachment(id) Beta void Adds an ISummaryAttachment to the summary. This blob needs to already be uploaded to storage.
addBlob(key, content) Beta void Add a blob to the summary tree. This blob will be stored at the given key in the summary tree.
addHandle(key, handleType, handle) Beta void Adds an ISummaryHandle that references a subtree, blob, or attachment in a previous summary.
addWithStats(key, summarizeResult) Beta void Adds a child and updates the stats accordingly.
getSummaryTree() Beta ISummaryTreeWithStats Gives you the in-memory summary tree with stats built by the SummaryTreeBuilder.

Constructor Details

(constructor)

Constructs a new instance of the SummaryTreeBuilder class

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
constructor(params?: {
groupId?: string;
});

Parameters

Parameter Modifiers Type Description
params optional { groupId?: string; }

Property Details

stats

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
get stats(): Readonly<ISummaryStats>;

Type: Readonly<ISummaryStats>

summary

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
get summary(): ISummaryTree;

Type: ISummaryTree

Method Details

addAttachment

Adds an ISummaryAttachment to the summary. This blob needs to already be uploaded to storage.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
addAttachment(id: string): void;

Parameters

Parameter Type Description
id string The id of the uploaded attachment to be added to the summary tree.

addBlob

Add a blob to the summary tree. This blob will be stored at the given key in the summary tree.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
addBlob(key: string, content: string | Uint8Array): void;

Parameters

Parameter Type Description
key string The key to store the blob at in the current summary tree being generated. Should not contain any "/" characters.
content string | Uint8Array The content of the blob to be added to the summary tree.

addHandle

Adds an ISummaryHandle that references a subtree, blob, or attachment in a previous summary.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;

Parameters

Parameter Type Description
key string The key to store the handle at in the current summary tree being generated. Should not contain any "/" characters.
handleType SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment the type of SummaryObject besides a SummaryHandle, i.e. @fluidframework/driver-definitions#SummaryType.Tree, @fluidframework/driver-definitions#SummaryType.Blob, @fluidframework/driver-definitions#SummaryType.Attachment
handle string The path pointing to the part of the previous summary being used to duplicate the data. Use handle to help generate proper handle strings. Should not contain any "/" characters.

addWithStats

Adds a child and updates the stats accordingly.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
addWithStats(key: string, summarizeResult: ISummarizeResult): void;

Parameters

Parameter Type Description
key string The key to store the handle at in the current summary tree being generated. Should not contain any "/" characters. The key should be unique within the current summary tree, and not transform when encodeURIComponent is called.
summarizeResult ISummarizeResult Similar to ISummaryTreeWithStats. The provided summary can be either a ISummaryHandle or ISummaryTree.

getSummaryTree

Gives you the in-memory summary tree with stats built by the SummaryTreeBuilder.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature
getSummaryTree(): ISummaryTreeWithStats;
Remarks

Use this once you're done building the summary tree, the stats should automatically be generated.

Returns

The summary tree and stats built by the SummaryTreeBuilder.

Return type: ISummaryTreeWithStats