@fluidframework/driver-utils Package
Packages > @fluidframework/driver-utils
Classes
Class | Description |
---|---|
AuthorizationError | |
BlobAggregationStorage | |
BlobCacheStorageService | IDocumentStorageService adapter with pre-cached blobs. |
DocumentStorageServiceProxy | |
GenericNetworkError | Generic network error class. |
MultiDocumentServiceFactory | |
MultiUrlResolver | |
NetworkErrorBasic | |
NonRetryableError | |
ParallelRequests | Helper class to organize parallel fetching of data It can be used to concurrently do many requests, while consuming data in the right order. Take a look at UT for examples. |
Queue | Helper queue class to allow async push / pull It's essentially a pipe allowing multiple writers, and single reader |
SnapshotExtractor | |
ThrottlingError | Throttling error class - used to communicate all throttling errors |
Enumerations
Enumeration | Description |
---|---|
OnlineStatus |
Functions
Function | Description |
---|---|
buildSnapshotTree(entries, blobMap) | Build a tree hierarchy base on an array of ITreeEntry |
combineAppAndProtocolSummary(appSummary, protocolSummary) | Combine the app summary and protocol summary in 1 tree. |
configurableUrlResolver(resolversList, request) | Resolver that takes a list of url resolvers and then try each of them to resolve the url. |
createGenericNetworkError(errorMessage, canRetry, retryAfterSeconds, statusCode) | |
ensureFluidResolvedUrl(resolved) | |
getDocAttributesFromProtocolSummary(protocolSummary) | Extract the attributes from the protocol summary. |
getQuorumValuesFromProtocolSummary(protocolSummary) | Extract quorum values from the protocol summary. |
isOnline() | |
logNetworkFailure(logger, event, error) | |
readAndParse(storage, id) | Read a blob from IDocumentStorageService and JSON.parse it into object of type T |
readAndParseFromBlobs(blobs, id) | Read a blob from map, decode it (from "base64") and JSON.parse it into object of type T |
requestOps(get, concurrency, from, to, payloadSize, logger, signal) | |
streamFromMessages(messagesArg) | |
streamObserver(stream, handler) | |
waitForConnectedState(minDelay) | Wait for browser to get to connected state. If connected, waits minimum of minDelay anyway (between network retries) If disconnected, polls every 30 seconds anyway, to make sure we are not getting stuck because of wrong signal Note that browsers will have false positives (like having Hyper-V adapter on machine, or machine connected to router that is not connected to internet) But there should be no false negatives. The only exception - Opera returns false when user enters "Work Offline" mode, regardless of actual connectivity. |
Variables
Variable | Description |
---|---|
canRetryOnError | Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed. I.e. asserts or unexpected exceptions in our code result in container failure. |
createWriteError | |
emptyMessageStream | |
getRetryDelayFromError | |
isFluidResolvedUrl |
Enumerations
OnlineStatus enum
Signature:
export declare enum OnlineStatus
Enumeration Members
Member | Value | Description |
---|---|---|
Offline | 0 |
|
Online | 1 |
|
Unknown | 2 |
Functions
buildSnapshotTree
Build a tree hierarchy base on an array of ITreeEntry
Signature:
export declare function buildSnapshotTree(entries: ITreeEntry[], blobMap: Map<string, ArrayBufferLike>): ISnapshotTree;
Parameters
Parameter | Type | Description |
---|---|---|
entries | ITreeEntry[] | an array of ITreeEntry to flatten |
blobMap | Map |
a map of blob's sha1 to content that gets filled with content from entries NOTE: blobMap's validity is contingent on the returned promise's resolution |
Returns:
the hierarchical tree
combineAppAndProtocolSummary
Combine the app summary and protocol summary in 1 tree.
Signature:
export declare function combineAppAndProtocolSummary(appSummary: ISummaryTree, protocolSummary: ISummaryTree): ISummaryTree;
Parameters
Parameter | Type | Description |
---|---|---|
appSummary | ISummaryTree | Summary of the app. |
protocolSummary | ISummaryTree | Summary of the protocol. |
Returns:
configurableUrlResolver
Resolver that takes a list of url resolvers and then try each of them to resolve the url.
Signature:
export declare function configurableUrlResolver(resolversList: IUrlResolver[], request: IRequest): Promise<IResolvedUrl | undefined>;
Parameters
Parameter | Type | Description |
---|---|---|
resolversList | IUrlResolver[] | List of url resolvers to be used to resolve the request. |
request | IRequest | Request to be resolved. |
Returns:
Promise<IResolvedUrl | undefined>
createGenericNetworkError
Signature:
export declare function createGenericNetworkError(errorMessage: string, canRetry: boolean, retryAfterSeconds?: number, statusCode?: number): GenericNetworkError | ThrottlingError;
Parameters
Parameter | Type | Description |
---|---|---|
errorMessage | string | |
canRetry | boolean | |
retryAfterSeconds | number | |
statusCode | number |
Returns:
GenericNetworkError | ThrottlingError
ensureFluidResolvedUrl
Signature:
export declare function ensureFluidResolvedUrl(resolved: IResolvedUrl | undefined): asserts resolved is IFluidResolvedUrl;
Parameters
Parameter | Type | Description |
---|---|---|
resolved | IResolvedUrl | undefined |
Returns:
asserts resolved is IFluidResolvedUrl
getDocAttributesFromProtocolSummary
Extract the attributes from the protocol summary.
Signature:
export declare function getDocAttributesFromProtocolSummary(protocolSummary: ISummaryTree): IDocumentAttributes;
Parameters
Parameter | Type | Description |
---|---|---|
protocolSummary | ISummaryTree | protocol summary from which the values are to be extracted. |
Returns:
getQuorumValuesFromProtocolSummary
Extract quorum values from the protocol summary.
Signature:
export declare function getQuorumValuesFromProtocolSummary(protocolSummary: ISummaryTree): [string, ICommittedProposal][];
Parameters
Parameter | Type | Description |
---|---|---|
protocolSummary | ISummaryTree | protocol summary from which the values are to be extracted. |
Returns:
[string, ICommittedProposal][]
isOnline
Signature:
export declare function isOnline(): OnlineStatus;
Returns:
logNetworkFailure
Signature:
export declare function logNetworkFailure(logger: ITelemetryLogger, event: ITelemetryErrorEvent, error?: any): void;
Parameters
Parameter | Type | Description |
---|---|---|
logger | ITelemetryLogger | |
event | ITelemetryErrorEvent | |
error | any |
Returns:
void
readAndParse
Read a blob from IDocumentStorageService and JSON.parse it into object of type T
Signature:
export declare function readAndParse<T>(storage: Pick<IDocumentStorageService, "readBlob">, id: string): Promise<T>;
Parameters
Parameter | Type | Description |
---|---|---|
storage | Pick<IDocumentStorageService, "readBlob"> | the IDocumentStorageService to read from |
id | string | the id of the blob to read and parse |
Returns:
Promise<T>
the object that we decoded and JSON.parse
readAndParseFromBlobs
Read a blob from map, decode it (from “base64”) and JSON.parse it into object of type T
Signature:
export declare function readAndParseFromBlobs<T>(blobs: {
[index: string]: string;
}, id: string): T;
Parameters
Parameter | Type | Description |
---|---|---|
blobs | { [index: string]: string; } | the blob map to read from |
id | string | the id of the blob to read and parse |
Returns:
T
the object that we decoded and JSON.parse
requestOps
Signature:
export declare function requestOps(get: (from: number, to: number) => Promise<IDeltasFetchResult>, concurrency: number, from: number, to: number | undefined, payloadSize: number, logger: ITelemetryLogger, signal?: AbortSignal): IStream<ISequencedDocumentMessage[]>;
Parameters
Parameter | Type | Description |
---|---|---|
get | (from: number, to: number) => Promise<IDeltasFetchResult> | |
concurrency | number | |
from | number | |
to | number | undefined | |
payloadSize | number | |
logger | ITelemetryLogger | |
signal | AbortSignal |
Returns:
IStream<ISequencedDocumentMessage[]>
streamFromMessages
Signature:
export declare function streamFromMessages(messagesArg: Promise<ISequencedDocumentMessage[]>): IStream<ISequencedDocumentMessage[]>;
Parameters
Parameter | Type | Description |
---|---|---|
messagesArg | Promise<ISequencedDocumentMessage[]> |
Returns:
IStream<ISequencedDocumentMessage[]>
streamObserver
Signature:
export declare function streamObserver<T>(stream: IStream<T>, handler: (value: T) => void): IStream<T>;
Parameters
Parameter | Type | Description |
---|---|---|
stream | IStream |
|
handler | (value: T) => void |
Returns:
IStream<T>
waitForConnectedState
Wait for browser to get to connected state. If connected, waits minimum of minDelay anyway (between network retries) If disconnected, polls every 30 seconds anyway, to make sure we are not getting stuck because of wrong signal Note that browsers will have false positives (like having Hyper-V adapter on machine, or machine connected to router that is not connected to internet) But there should be no false negatives. The only exception - Opera returns false when user enters “Work Offline” mode, regardless of actual connectivity.
Signature:
export declare function waitForConnectedState(minDelay: number): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
minDelay | number |
Returns:
Promise<void>
Variables
canRetryOnError
Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed. I.e. asserts or unexpected exceptions in our code result in container failure.
Signature:
canRetryOnError: (error: any) => boolean
createWriteError
Signature:
createWriteError: (errorMessage: string) => NonRetryableError<DriverErrorType>
emptyMessageStream
Signature:
emptyMessageStream: IStream<ISequencedDocumentMessage[]>
getRetryDelayFromError
Signature:
getRetryDelayFromError: (error: any) => number | undefined
isFluidResolvedUrl
Signature:
isFluidResolvedUrl: (resolved: IResolvedUrl | undefined) => resolved is IFluidResolvedUrl