Skip to main content
Version: v1

@fluidframework/runtime-utils Package

Interfaces

Interface Description
IRootSummarizerNode
IRootSummarizerNodeWithGC
ISummarizerNodeRootContract

Classes

Class Description
ObjectStoragePartition Returns a new IChannelStorageService that resolves the given path as root.
RequestParser The Request Parser takes an IRequest provides parsing and sub request creation
RuntimeFactoryHelper
SummaryTreeBuilder
TelemetryContext

Types

TypeAlias Description
Factory
ReadAndParseBlob Reads a blob from storage and parses it from JSON.
RefreshSummaryResult Return value of refreshSummaryAck function. There can be three different scenarios based on the passed params: 1. The latest summary was not udpated. 2. The latest summary was updated and the summary corresponding to the params was tracked by this client. 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this case, the latest summary is updated based on the downloaded snapshot which is also returned.

Functions

Function Return Type Description
addBlobToSummary(summary, key, content) void
addSummarizeResultToSummary(summary, key, summarizeResult) void
addTreeToSummary(summary, key, summarizeResult) void
calculateStats(summary) ISummaryStats
convertSnapshotTreeToSummaryTree(snapshot) ISummaryTreeWithStats Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was was taken by serialize api in detached container.
convertSummaryTreeToITree(summaryTree) ITree Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
convertToSummaryTree(snapshot, fullTree) ISummarizeResult Converts snapshot ITree to ISummaryTree format and tracks stats.
convertToSummaryTreeWithStats(snapshot, fullTree) ISummaryTreeWithStats Converts snapshot ITree to ISummaryTree format and tracks stats.
createDataStoreFactory(type, factory) IFluidDataStoreFactory & IFluidDataStoreRegistry
createResponseError(status, value, request) IResponse
exceptionToResponse(err) IResponse
generateHandleContextPath(path, routeContext) string Generates the absolute path for a Fluid object given its path and its parent routeContext.
getBlobSize(content) number
getNormalizedObjectStoragePathParts(path) string[]
listBlobsAtTreePath(inputTree, path) Promise<string[]>
mergeStats(stats) ISummaryStats Combines summary stats by adding their totals together. Returns empty stats if called without args.
requestFluidObject(router, url) Promise<T>
responseToException(response, request) Error
seqFromTree(tree, readAndParseBlob) Promise<number> Fetches the sequence number of the snapshot tree by examining the protocol.
utf8ByteLength(str) number

Variables

Variable Type Description
create404Response (request: IRequest) => IResponse
createRootSummarizerNode (logger: ITelemetryLogger, summarizeInternalFn: SummarizeInternalFn, changeSequenceNumber: number, referenceSequenceNumber: number | undefined, config?: ISummarizerNodeConfig) => IRootSummarizerNode Creates a root summarizer node.
createRootSummarizerNodeWithGC (logger: ITelemetryLogger, summarizeInternalFn: SummarizeInternalFn, changeSequenceNumber: number, referenceSequenceNumber: number | undefined, config?: ISummarizerNodeConfigWithGC, getGCDataFn?: ((fullGC?: boolean | undefined) => Promise<IGarbageCollectionData>) | undefined, getBaseGCDetailsFn?: (() => Promise<IGarbageCollectionDetailsBase>) | undefined) => IRootSummarizerNodeWithGC Creates a root summarizer node with GC functionality built-in.

Function Details

addBlobToSummary

Signature

export declare function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;

Parameters

Parameter Type Description
summary ISummaryTreeWithStats
key string
content string | Uint8Array

addSummarizeResultToSummary

Signature

export declare function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;

Parameters

Parameter Type Description
summary ISummaryTreeWithStats
key string
summarizeResult ISummarizeResult

addTreeToSummary

Signature

export declare function addTreeToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;

Parameters

Parameter Type Description
summary ISummaryTreeWithStats
key string
summarizeResult ISummarizeResult

calculateStats

Signature

export declare function calculateStats(summary: SummaryObject): ISummaryStats;

Parameters

Parameter Type Description
summary SummaryObject

Returns

Return type: ISummaryStats

convertSnapshotTreeToSummaryTree

Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was was taken by serialize api in detached container.

Signature

export declare function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTree): ISummaryTreeWithStats;

Parameters

Parameter Type Description
snapshot ISnapshotTree snapshot in ISnapshotTree format

Returns

Return type: ISummaryTreeWithStats

convertSummaryTreeToITree

Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.

Signature

export declare function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;

Parameters

Parameter Type Description
summaryTree ISummaryTree summary tree in ISummaryTree format

Returns

Return type: ITree

convertToSummaryTree

Converts snapshot ITree to ISummaryTree format and tracks stats.

Signature

export declare function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;

Parameters

Parameter Modifiers Type Description
snapshot ITree snapshot in ITree format
fullTree optional boolean true to never use handles, even if id is specified

Returns

Return type: ISummarizeResult

convertToSummaryTreeWithStats

Converts snapshot ITree to ISummaryTree format and tracks stats.

Signature

export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;

Parameters

Parameter Modifiers Type Description
snapshot ITree snapshot in ITree format
fullTree optional boolean true to never use handles, even if id is specified

Returns

Return type: ISummaryTreeWithStats

createDataStoreFactory

Signature

export declare function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;

Parameters

Parameter Type Description
type string
factory Factory | Promise<Factory>

Returns

Return type: IFluidDataStoreFactory & IFluidDataStoreRegistry

createResponseError

Signature

export declare function createResponseError(status: number, value: string, request: IRequest): IResponse;

Parameters

Parameter Type Description
status number
value string
request IRequest

Returns

Return type: IResponse

exceptionToResponse

Signature

export declare function exceptionToResponse(err: any): IResponse;

Parameters

Parameter Type Description
err any

Returns

Return type: IResponse

generateHandleContextPath

Generates the absolute path for a Fluid object given its path and its parent routeContext.

Signature

export declare function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;

Parameters

Parameter Modifiers Type Description
path string The path to the Fluid object relative to the route context.
routeContext optional IFluidHandleContext The route context that contains the Fluid object.

Returns

The absolute path to the Fluid object from the root of the Container.

Return type: string

getBlobSize

Signature

export declare function getBlobSize(content: ISummaryBlob["content"]): number;

Parameters

Parameter Type Description
content ISummaryBlob["content"]

Returns

Return type: number

getNormalizedObjectStoragePathParts

Signature

export declare function getNormalizedObjectStoragePathParts(path: string): string[];

Parameters

Parameter Type Description
path string

Returns

Return type: string[]

listBlobsAtTreePath

Signature

export declare function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;

Parameters

Parameter Type Description
inputTree ITree | undefined
path string

Returns

Return type: Promise<string[]>

mergeStats

Combines summary stats by adding their totals together. Returns empty stats if called without args.

Signature

export declare function mergeStats(...stats: ISummaryStats[]): ISummaryStats;

Parameters

Parameter Type Description
stats ISummaryStats[] stats to merge

Returns

Return type: ISummaryStats

requestFluidObject

Signature

export declare function requestFluidObject<T = FluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;
Type Parameters
Parameter Default Description
T FluidObject

Parameters

Parameter Type Description
router IFluidRouter
url string | IRequest

Returns

Return type: Promise<T>

responseToException

Signature

export declare function responseToException(response: IResponse, request: IRequest): Error;

Parameters

Parameter Type Description
response IResponse
request IRequest

Returns

Return type: Error

seqFromTree

Fetches the sequence number of the snapshot tree by examining the protocol.

Signature

export declare function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;

Parameters

Parameter Type Description
tree ISnapshotTree snapshot tree to examine
readAndParseBlob ReadAndParseBlob function to read blob contents from storage and parse the result from JSON.

Returns

Return type: Promise<number>

utf8ByteLength

Signature

export declare function utf8ByteLength(str: string): number;

Parameters

Parameter Type Description
str string

Returns

Return type: number

Variable Details

create404Response

Signature

create404Response: (request: IRequest) => IResponse

Type: (request: IRequest) => IResponse

createRootSummarizerNode

Creates a root summarizer node.

Signature

createRootSummarizerNode: (logger: ITelemetryLogger, summarizeInternalFn: SummarizeInternalFn, changeSequenceNumber: number, referenceSequenceNumber: number | undefined, config?: ISummarizerNodeConfig) => IRootSummarizerNode

Type: (logger: ITelemetryLogger, summarizeInternalFn: SummarizeInternalFn, changeSequenceNumber: number, referenceSequenceNumber: number | undefined, config?: ISummarizerNodeConfig) => IRootSummarizerNode

createRootSummarizerNodeWithGC

Creates a root summarizer node with GC functionality built-in.

Signature

createRootSummarizerNodeWithGC: (logger: ITelemetryLogger, summarizeInternalFn: SummarizeInternalFn, changeSequenceNumber: number, referenceSequenceNumber: number | undefined, config?: ISummarizerNodeConfigWithGC, getGCDataFn?: ((fullGC?: boolean | undefined) => Promise<IGarbageCollectionData>) | undefined, getBaseGCDetailsFn?: (() => Promise<IGarbageCollectionDetailsBase>) | undefined) => IRootSummarizerNodeWithGC

Type: (logger: ITelemetryLogger, summarizeInternalFn: SummarizeInternalFn, changeSequenceNumber: number, referenceSequenceNumber: number | undefined, config?: ISummarizerNodeConfigWithGC, getGCDataFn?: ((fullGC?: boolean | undefined) => Promise<IGarbageCollectionData>) | undefined, getBaseGCDetailsFn?: (() => Promise<IGarbageCollectionDetailsBase>) | undefined) => IRootSummarizerNodeWithGC