@fluidframework/runtime-utils Package

Packages > @fluidframework/runtime-utils

Classes

List of classes contained in this package or namespace
Class Description
FluidSerializer Data Store serializer implementation
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
SummaryTreeBuilder

Functions

List of functions contained in this package or namespace
Function Description
addBlobToSummary(summary, key, content)
addTreeToSummary(summary, key, summarizeResult)
calculateStats(summary)
convertContainerToDriverSerializedFormat(serializedSnapshotTree) Utility to convert serialized snapshot taken in detached container to format where we can use it to attach the container.
convertSnapshotTreeToSummaryTree(snapshot) Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was was taken by serialize api in detached container.
convertSummaryTreeToITree(summaryTree) Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
convertToSummaryTree(snapshot, fullTree) Converts snapshot ITree to ISummaryTree format and tracks stats.
convertToSummaryTreeWithStats(snapshot, fullTree) Converts snapshot ITree to ISummaryTree format and tracks stats.
createDataStoreFactory(type, factory)
generateHandleContextPath(path, routeContext) Generates the absolute path for an IFluidHandleContext given its path and its parent routeContext.
getBlobSize(content)
getNormalizedObjectStoragePathParts(path)
listBlobsAtTreePath(inputTree, path)
mergeStats(stats) Combines summary stats by adding their totals together. Returns empty stats if called without args.
requestFluidObject(router, url)

Interfaces

List of interfaces contained in this package or namespace
Interface Description
IRootSummarizerNode
IRootSummarizerNodeWithGC
ISummarizerNodeRootContract

Variables

List of variables contained in this package or namespace
Variable Description
createRootSummarizerNode Creates a root summarizer node.
createRootSummarizerNodeWithGC Creates a root summarizer node with GC functionality built-in.
isSerializedHandle

Type Aliases

List of type aliases contained in this package or namespace
Type Alias Description
Factory
ReadAndParseBlob Reads a blob from storage and parses it from JSON.

Functions

addBlobToSummary

Signature:

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

Parameters

List of parameters
Parameter Type Description
summary ISummaryTreeWithStats
key string
content string | Uint8Array

Returns:

void

addTreeToSummary

Signature:

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

Parameters

List of parameters
Parameter Type Description
summary ISummaryTreeWithStats
key string
summarizeResult ISummarizeResult

Returns:

void

calculateStats

Signature:

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

Parameters

List of parameters
Parameter Type Description
summary ISummaryTree

Returns:

ISummaryStats

convertContainerToDriverSerializedFormat

Utility to convert serialized snapshot taken in detached container to format where we can use it to attach the container.

Signature:

export declare function convertContainerToDriverSerializedFormat(serializedSnapshotTree: string): ISummaryTree;

Parameters

List of parameters
Parameter Type Description
serializedSnapshotTree string serialized snapshot tree to be converted to summary tree for attach.

Returns:

ISummaryTree

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

List of parameters
Parameter Type Description
snapshot ISnapshotTree snapshot in ISnapshotTree format

Returns:

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

List of parameters
Parameter Type Description
summaryTree ISummaryTree summary tree in ISummaryTree format

Returns:

ITree

convertToSummaryTree

Converts snapshot ITree to ISummaryTree format and tracks stats.

Signature:

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

Parameters

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

Returns:

ISummarizeResult

convertToSummaryTreeWithStats

Converts snapshot ITree to ISummaryTree format and tracks stats.

Signature:

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

Parameters

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

Returns:

ISummaryTreeWithStats

createDataStoreFactory

Signature:

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

Parameters

List of parameters
Parameter Type Description
type string
factory Factory | Promise<Factory>

Returns:

IFluidDataStoreFactory & IFluidDataStoreRegistry

generateHandleContextPath

Generates the absolute path for an IFluidHandleContext given its path and its parent routeContext.

Signature:

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

Parameters

List of parameters
Parameter Type Description
path string
routeContext IFluidHandleContext

Returns:

string

getBlobSize

Signature:

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

Parameters

List of parameters
Parameter Type Description
content ISummaryBlob["content"]

Returns:

number

getNormalizedObjectStoragePathParts

Signature:

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

Parameters

List of parameters
Parameter Type Description
path string

Returns:

string[]

listBlobsAtTreePath

Signature:

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

Parameters

List of parameters
Parameter Type Description
inputTree ITree
path string

Returns:

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

List of parameters
Parameter Type Description
stats ISummaryStats[] stats to merge

Returns:

ISummaryStats

requestFluidObject

Signature:

export declare function requestFluidObject<T = IFluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;

Parameters

List of parameters
Parameter Type Description
router IFluidRouter
url string | IRequest

Returns:

Promise<T>

Variables

createRootSummarizerNode

Creates a root summarizer node.

Signature:

createRootSummarizerNode: (logger: ITelemetryLogger, summarizeInternalFn: (fullTree: boolean) => Promise<ISummarizeInternalResult>, changeSequenceNumber: number, referenceSequenceNumber: number | undefined, config?: ISummarizerNodeConfig) => IRootSummarizerNode

createRootSummarizerNodeWithGC

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

Signature:

createRootSummarizerNodeWithGC: (logger: ITelemetryLogger, summarizeInternalFn: (fullTree: boolean, trackState: boolean) => Promise<ISummarizeInternalResult>, changeSequenceNumber: number, referenceSequenceNumber: number | undefined, config?: ISummarizerNodeConfigWithGC, getGCDataFn?: (() => Promise<IGarbageCollectionData>) | undefined, getInitialGCSummaryDetailsFn?: (() => Promise<IGarbageCollectionSummaryDetails>) | undefined) => IRootSummarizerNodeWithGC

isSerializedHandle

Signature:

isSerializedHandle: (value: any) => value is ISerializedHandle

Type Aliases

Factory

Signature:

export declare type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;

ReadAndParseBlob

Reads a blob from storage and parses it from JSON.

Signature:

export declare type ReadAndParseBlob = <T>(id: string) => Promise<T>;