ISummarizerNode Interface
Signature
export interface ISummarizerNode
Properties
Property | Type | Description |
---|---|---|
referenceSequenceNumber | number | Latest successfully acked summary reference sequence number |
Methods
Method | Return Type | Description |
---|---|---|
createChild(summarizeInternalFn, id, createParam, config) | ISummarizerNode | |
getChild(id) | ISummarizerNode | undefined | |
invalidate(sequenceNumber) | void | Marks 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) | void | 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". |
recordChange(op) | void | Records 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
Parameter | Modifiers | Type | Description |
---|---|---|---|
summarizeInternalFn | SummarizeInternalFn | ||
id | string | ||
createParam | CreateChildSummarizerNodeParam | ||
config | optional | ISummarizerNodeConfig |
Returns
Return type: ISummarizerNode
getChild
Signature
getChild(id: string): ISummarizerNode | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
id | string |
Returns
Return type: ISummarizerNode | undefined
invalidate
Marks the node as having a change with the given sequence number.
Signature
invalidate(sequenceNumber: number): void;
Parameters
Parameter | Type | Description |
---|---|---|
sequenceNumber | number | sequence 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
Parameter | Type | Description |
---|---|---|
snapshot | ISnapshotTree | the 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
Parameter | Type | Description |
---|---|---|
snapshot | ISnapshotTree | the base summary to parse |
recordChange
Records an op representing a change to this node/subtree.
Signature
recordChange(op: ISequencedDocumentMessage): void;
Parameters
Parameter | Type | Description |
---|---|---|
op | ISequencedDocumentMessage | op 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
Parameter | Modifiers | Type | Description |
---|---|---|---|
fullTree | boolean | true to skip optimizations and always generate the full tree | |
trackState | optional | boolean | indicates whether the summarizer node should track the state of the summary or not |
telemetryContext | optional | ITelemetryContext | summary data passed through the layers for telemetry purposes |
Returns
Return type: Promise<ISummarizeResult>