Skip to main content
Version: v1

ISummarizerNode Interface

Signature​

export interface ISummarizerNode

Properties​

PropertyTypeDescription
referenceSequenceNumbernumberLatest successfully acked summary reference sequence number

Methods​

MethodReturn TypeDescription
createChild(summarizeInternalFn, id, createParam, config)ISummarizerNode
getChild(id)ISummarizerNode | undefined
invalidate(sequenceNumber)voidMarks the node as having a change with the given sequence number.
loadBaseSummary(snapshot, readAndParseBlob)Promise<{ baseSummary: ISnapshotTree; outstandingOps: ISequencedDocumentMessage[]; }>Does all the work of loadBaseSummaryWithoutDifferential. Additionally if the base summary is a differential summary containing handle + outstanding ops blob, then this will return the innermost base summary, and update the state by tracking the outstanding ops.
loadBaseSummaryWithoutDifferential(snapshot)voidChecks if there are any additional path parts for children that need to be loaded from the base summary. Additional path parts represent parts of the path between this SummarizerNode and any child SummarizerNodes that it might have. For example: if datastore "a" contains dds "b", but the path is "/a/.channels/b", then the additional path part is ".channels".
recordChange(op)voidRecords an op representing a change to this node/subtree.
summarize(fullTree, trackState, telemetryContext)Promise<ISummarizeResult>Calls the internal summarize function and handles internal state tracking. If unchanged and fullTree is false, it will reuse previous summary subtree. If an error is encountered and throwOnFailure is false, it will try to make a summary with a pointer to the previous summary + a blob of outstanding ops.

Property Details​

referenceSequenceNumber​

Latest successfully acked summary reference sequence number

Signature​

readonly referenceSequenceNumber: number;

Type: number

Method Details​

createChild​

Signature​

createChild(
summarizeInternalFn: SummarizeInternalFn,
id: string,
createParam: CreateChildSummarizerNodeParam,
config?: ISummarizerNodeConfig): ISummarizerNode;

Parameters​

ParameterModifiersTypeDescription
summarizeInternalFnSummarizeInternalFn
idstring
createParamCreateChildSummarizerNodeParam
configoptionalISummarizerNodeConfig

Returns​

Return type: ISummarizerNode

getChild​

Signature​

getChild(id: string): ISummarizerNode | undefined;

Parameters​

ParameterTypeDescription
idstring

Returns​

Return type: ISummarizerNode | undefined

invalidate​

Marks the node as having a change with the given sequence number.

Signature​

invalidate(sequenceNumber: number): void;

Parameters​

ParameterTypeDescription
sequenceNumbernumbersequence number of change

loadBaseSummary​

Does all the work of loadBaseSummaryWithoutDifferential. Additionally if the base summary is a differential summary containing handle + outstanding ops blob, then this will return the innermost base summary, and update the state by tracking the outstanding ops.

Signature​

loadBaseSummary(snapshot: ISnapshotTree, readAndParseBlob: <T>(id: string) => Promise<T>): Promise<{
baseSummary: ISnapshotTree;
outstandingOps: ISequencedDocumentMessage[];
}>;

Parameters​

ParameterTypeDescription
snapshotISnapshotTreethe base summary to parse
readAndParseBlob<T>(id: string) => Promise<T>function to read and parse blobs from storage

Returns​

the base summary to be used

Return type: Promise<{ baseSummary: ISnapshotTree; outstandingOps: ISequencedDocumentMessage[]; }>

loadBaseSummaryWithoutDifferential​

Checks if there are any additional path parts for children that need to be loaded from the base summary. Additional path parts represent parts of the path between this SummarizerNode and any child SummarizerNodes that it might have. For example: if datastore "a" contains dds "b", but the path is "/a/.channels/b", then the additional path part is ".channels".

Signature​

loadBaseSummaryWithoutDifferential(snapshot: ISnapshotTree): void;

Parameters​

ParameterTypeDescription
snapshotISnapshotTreethe base summary to parse

recordChange​

Records an op representing a change to this node/subtree.

Signature​

recordChange(op: ISequencedDocumentMessage): void;

Parameters​

ParameterTypeDescription
opISequencedDocumentMessageop of change to record

summarize​

Calls the internal summarize function and handles internal state tracking. If unchanged and fullTree is false, it will reuse previous summary subtree. If an error is encountered and throwOnFailure is false, it will try to make a summary with a pointer to the previous summary + a blob of outstanding ops.

Signature​

summarize(fullTree: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummarizeResult>;

Parameters​

ParameterModifiersTypeDescription
fullTreebooleantrue to skip optimizations and always generate the full tree
trackStateoptionalbooleanindicates whether the summarizer node should track the state of the summary or not
telemetryContextoptionalITelemetryContextsummary data passed through the layers for telemetry purposes

Returns​

Return type: Promise<ISummarizeResult>