SharedObject Class
SharedObject with simplified, synchronous summarization and GC. DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.
Signature
export declare abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends SharedObjectCore<TEvent>
Extends: SharedObjectCore
Type Parameters
Parameter | Constraint | Default | Description |
---|---|---|---|
TEvent | ISharedObjectEvents | ISharedObjectEvents |
Constructors
Constructor | Description |
---|---|
(constructor)(id, runtime, attributes, telemetryContextPrefix) | Constructs a new instance of the SharedObject class |
Properties
Property | Type | Description |
---|---|---|
serializer | IFluidSerializer |
Methods
Method | Return Type | Description |
---|---|---|
getAttachSummary(fullTree, trackState, telemetryContext) | ISummaryTreeWithStats | Generates summary of the channel synchronously. It is called when an attach message for a local channel is generated. In other words, when the channel is being attached to make it visible to other clients. Note: Since Attach Summary is generated for local channels when making them visible to remote clients, they don't have any previous summaries to compare against. For this reason, The attach summary cannot contain summary handles (paths to sub-trees or blobs). It can, however, contain ISummaryAttachment (handles to blobs uploaded async via the blob manager). |
getGCData(fullGC) | IGarbageCollectionData | Returns the GC data for this shared object. It contains a list of GC nodes that contains references to other GC nodes. |
processGCDataCore(serializer) | void | Calls the serializer over all data in this object that reference other GC nodes. Derived classes must override this to provide custom list of references to other GC nodes. |
summarize(fullTree, trackState, telemetryContext) | Promise<ISummaryTreeWithStats> | Generates summary of the channel asynchronously. This should not be called where the channel can be modified while summarization is in progress. |
summarizeCore(serializer, telemetryContext) | ISummaryTreeWithStats | Gets a form of the object that can be serialized. |
Constructor Details
(constructor)
Constructs a new instance of the SharedObject
class
Signature
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, telemetryContextPrefix: string);
Parameters
Parameter | Type | Description |
---|---|---|
id | string | The id of the shared object |
runtime | IFluidDataStoreRuntime | The IFluidDataStoreRuntime which contains the shared object |
attributes | IChannelAttributes | Attributes of the shared object |
telemetryContextPrefix | string |
Property Details
serializer
Signature
protected get serializer(): IFluidSerializer;
Type: IFluidSerializer
Method Details
getAttachSummary
Generates summary of the channel synchronously. It is called when an attach message
for a local channel is generated. In other words, when the channel is being attached to make it visible to other clients. Note: Since Attach Summary is generated for local channels when making them visible to remote clients, they don't have any previous summaries to compare against. For this reason, The attach summary cannot contain summary handles (paths to sub-trees or blobs). It can, however, contain ISummaryAttachment (handles to blobs uploaded async via the blob manager).
Signature
getAttachSummary(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
fullTree | optional | boolean | flag indicating whether the attempt should generate a full summary tree without any handles for unchanged subtrees. |
trackState | optional | boolean | optimization for tracking state of objects across summaries. If the state of an object did not change since last successful summary, an 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. Note: The goal is to remove the trackState and automatically decided whether the handles will be used or not: https://github.com/microsoft/FluidFramework/issues/10455 |
telemetryContext | optional | ITelemetryContext |
Returns
A summary capturing the current state of the channel.
Return type: ISummaryTreeWithStats
getGCData
Returns the GC data for this shared object. It contains a list of GC nodes that contains references to other GC nodes.
Signature
getGCData(fullGC?: boolean): IGarbageCollectionData;
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
fullGC | optional | boolean | true to bypass optimizations and force full generation of GC data. |
Returns
Return type: IGarbageCollectionData
processGCDataCore
Calls the serializer over all data in this object that reference other GC nodes. Derived classes must override this to provide custom list of references to other GC nodes.
Signature
protected processGCDataCore(serializer: SummarySerializer): void;
Parameters
Parameter | Type | Description |
---|---|---|
serializer | SummarySerializer |
summarize
Generates summary of the channel asynchronously. This should not be called where the channel can be modified while summarization is in progress.
Signature
summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
fullTree | optional | boolean | flag indicating whether the attempt should generate a full summary tree without any handles for unchanged subtrees. It is only set to true when generating a summary from the entire container. |
trackState | optional | boolean | This tells whether we should track state from this summary. |
telemetryContext | optional | ITelemetryContext |
Returns
A summary capturing the current state of the channel.
Return type: Promise<ISummaryTreeWithStats>
summarizeCore
Gets a form of the object that can be serialized.
Signature
protected abstract summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
serializer | IFluidSerializer | ||
telemetryContext | optional | ITelemetryContext |
Returns
A tree representing the snapshot of the shared object.
Return type: ISummaryTreeWithStats