-
Notifications
You must be signed in to change notification settings - Fork 549
(tree) Unify summarize and getAttachSummary methods on summarizables #24761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,8 @@ | ||||||
--- | ||||||
"@fluidframework/shared-object-base": minor | ||||||
"__section": legacy | ||||||
--- | ||||||
Added an optional boolean parameter `fullTree` to `SharedObject`'s `summarizeCore` method | ||||||
Check failure on line 5 in .changeset/loud-dolls-appear.md
|
||||||
|
||||||
This parameter tells the shared object that it should generate a full tree summary, i.e., it must not summarize incrementally. | ||||||
Check failure on line 7 in .changeset/loud-dolls-appear.md
|
||||||
Currently no known SharedObjects's do incremental summaries; however any that do exist or are made in the future must take this "fullTree" parameter into consideration to function correctly. | ||||||
Check warning on line 8 in .changeset/loud-dolls-appear.md
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (we do like
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -212,20 +212,30 @@ export class SharedTreeCore<TEditor extends ChangeFamilyEditor, TChange> | |||||
serializer: IFluidSerializer, | ||||||
telemetryContext?: ITelemetryContext, | ||||||
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext, | ||||||
fullTree?: boolean, | ||||||
): ISummaryTreeWithStats { | ||||||
const builder = new SummaryTreeBuilder(); | ||||||
const summarizableBuilder = new SummaryTreeBuilder(); | ||||||
// Merge the summaries of all summarizables together under a single ISummaryTree | ||||||
for (const s of this.summarizables) { | ||||||
// Add the summarizable's path in the summary tree to the incremental summary context's | ||||||
// summary path, so that the summarizable can use it to generate incremental summaries. | ||||||
const childIncrementalSummaryContext = | ||||||
incrementalSummaryContext === undefined | ||||||
? undefined | ||||||
: { | ||||||
...incrementalSummaryContext, | ||||||
summaryPath: `${incrementalSummaryContext.summaryPath}/${summarizablesTreeKey}/${s.key}`, | ||||||
}; | ||||||
summarizableBuilder.addWithStats( | ||||||
s.key, | ||||||
s.getAttachSummary( | ||||||
(contents) => serializer.stringify(contents, this.sharedObject.handle), | ||||||
undefined, | ||||||
undefined, | ||||||
s.summarize({ | ||||||
stringify: (contents: unknown) => | ||||||
serializer.stringify(contents, this.sharedObject.handle), | ||||||
fullTree, | ||||||
telemetryContext, | ||||||
incrementalSummaryContext, | ||||||
), | ||||||
incrementalSummaryContext: childIncrementalSummaryContext, | ||||||
}), | ||||||
); | ||||||
} | ||||||
|
||||||
|
@@ -434,28 +444,27 @@ export interface Summarizable { | |||||
*/ | ||||||
readonly key: string; | ||||||
|
||||||
/** | ||||||
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary} | ||||||
* @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage. | ||||||
*/ | ||||||
getAttachSummary( | ||||||
stringify: SummaryElementStringifier, | ||||||
fullTree?: boolean, | ||||||
trackState?: boolean, | ||||||
telemetryContext?: ITelemetryContext, | ||||||
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext, | ||||||
): ISummaryTreeWithStats; | ||||||
|
||||||
/** | ||||||
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize} | ||||||
* @param stringify - Serializes the contents of the component (including {@link (IFluidHandle:interface)}s) for storage. | ||||||
* @param fullTree - flag indicating whether the attempt should generate a full | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: can we call out the default value explicitly here? Also, I'm pushing for us to use full sentence casing consistently when possible.
Suggested change
|
||||||
* summary tree without any handles for unchanged subtrees. It should only be set to true when generating | ||||||
* a summary from the entire container. | ||||||
* @param trackState - An optimization for tracking state of objects across summaries. If the state | ||||||
* of an object did not change since last successful summary, an | ||||||
* {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used | ||||||
* instead of re-summarizing it. If this is `false`, the expectation is that you should never | ||||||
* send an `ISummaryHandle`, since you are not expected to track state. | ||||||
* @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}. | ||||||
* @param incrementalSummaryContext - See {@link @fluidframework/runtime-definitions#IExperimentalIncrementalSummaryContext}. | ||||||
*/ | ||||||
summarize( | ||||||
stringify: SummaryElementStringifier, | ||||||
fullTree?: boolean, | ||||||
trackState?: boolean, | ||||||
telemetryContext?: ITelemetryContext, | ||||||
): Promise<ISummaryTreeWithStats>; | ||||||
summarize(props: { | ||||||
stringify: SummaryElementStringifier; | ||||||
fullTree?: boolean; | ||||||
trackState?: boolean; | ||||||
telemetryContext?: ITelemetryContext; | ||||||
incrementalSummaryContext?: IExperimentalIncrementalSummaryContext; | ||||||
}): ISummaryTreeWithStats; | ||||||
|
||||||
/** | ||||||
* Allows the component to perform custom loading. The storage service is scoped to this component and therefore | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our most recent guidance for changeset titles is to not use
inlineCode
syntax (to prevent the generated changelogs from appearing too noisy). This still needs to be documented in a more accessible place, but here are the guidelines we're using when reviewing: https://eng.ms/docs/experiences-devices/opg/office-shared/fluid-framework/fluid-framework-internal/fluid-framework/docs/on-call/release/release-prep