Skip to main content

SharedTreeOptions Interface

Configuration options for SharedTree with alpha features.

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here.

Input

This type is "input," meaning that code outside of the library defining it should not read from it. Future versions of this type may add optional members or make typing of members more general.

Signature

export interface SharedTreeOptions extends SharedTreeOptionsBeta, Partial<CodecWriteOptions>, Partial<SharedTreeFormatOptions>

Extends: SharedTreeOptionsBeta, Partial<CodecWriteOptions>, Partial<SharedTreeFormatOptions>

Properties

PropertyAlertsModifiersDefault ValueTypeDescription
enableSharedBranchesAlphaoptional, readonlybooleanExperimental feature flag to enable shared branches. This feature is not yet complete and should not be used in production. Defaults to false.
retainHistoryAlphaoptional, readonlyfalsebooleanWhen true, prevents trunk commits from being trimmed/evicted, even after they fall outside the collaboration window.
shouldEncodeIncrementallyAlphaoptionalIncrementalEncodingPolicyReturns whether a node / field should be incrementally encoded.
validateCommitsOnFirstSubmissionAlphaoptional, readonlyfalseboolean

When true, validates that commits being submitted for the first time can be applied without errors to a view. In the event that a commit cannot be applied, SharedTree will throw an error and will enter a "broken" state, preventing the offending commit (and any further commits) from being submitted.

This can be enabled (at the cost of performance) to improve safety against document corruption in the event of a bug in the SharedTree code: when the additional validation is enabled, a client will error instead of potentially corrupting the document.

validateRebasedCommitsBeforeResubmissionAlphaoptional, readonlyfalseboolean

When true, validates that the commits being resubmitted can be applied without errors to a view. In the event that a commit cannot be applied, SharedTree will throw an error and will enter a "broken" state, preventing the offending commit (and any further commits) from being submitted.

This can be enabled (at the cost of performance) to improve safety against document corruption in the event of a bug in the SharedTree code: when the additional validation is enabled, a client will error instead of potentially corrupting the document.

Property Details

enableSharedBranches

Experimental feature flag to enable shared branches. This feature is not yet complete and should not be used in production. Defaults to false.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly enableSharedBranches?: boolean;

Type: boolean

retainHistory

When true, prevents trunk commits from being trimmed/evicted, even after they fall outside the collaboration window.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly retainHistory?: boolean;

Type: boolean

Remarks

By default, SharedTree evicts trunk commits once all peers have acknowledged them (i.e. once they are outside the collaboration window), and they are not otherwise retained (e.g. by revertibles or local branches), to bound memory usage. Enabling this flag retains the full trunk history for the lifetime of the client, which increases memory usage over time and should be used with care.

shouldEncodeIncrementally

Returns whether a node / field should be incrementally encoded.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

shouldEncodeIncrementally?: IncrementalEncodingPolicy;

Type: IncrementalEncodingPolicy

Remarks

See IncrementalEncodingPolicy.

validateCommitsOnFirstSubmission

When true, validates that commits being submitted for the first time can be applied without errors to a view. In the event that a commit cannot be applied, SharedTree will throw an error and will enter a "broken" state, preventing the offending commit (and any further commits) from being submitted.

This can be enabled (at the cost of performance) to improve safety against document corruption in the event of a bug in the SharedTree code: when the additional validation is enabled, a client will error instead of potentially corrupting the document.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly validateCommitsOnFirstSubmission?: boolean;

Type: boolean

Remarks

This validation is more expensive than validateRebasedCommitsBeforeResubmission because it is likely to be performed more often. We recommend configuring SharedTree with the optimized forest implementation to reduce its performance impact.

validateRebasedCommitsBeforeResubmission

When true, validates that the commits being resubmitted can be applied without errors to a view. In the event that a commit cannot be applied, SharedTree will throw an error and will enter a "broken" state, preventing the offending commit (and any further commits) from being submitted.

This can be enabled (at the cost of performance) to improve safety against document corruption in the event of a bug in the SharedTree code: when the additional validation is enabled, a client will error instead of potentially corrupting the document.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly validateRebasedCommitsBeforeResubmission?: boolean;

Type: boolean

Remarks

We recommend configuring SharedTree with the optimized forest implementation to reduce the performance impact of this validation.