SnapshotSchemaCompatibilityOptions Interface
The options for snapshotSchemaCompatibility(options).
To use, import via @fluidframework/tree/alpha.
For more information about our API support guarantees, see here.
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 SnapshotSchemaCompatibilityOptions
Properties
| Property | Alerts | Modifiers | Type | Description |
|---|---|---|---|---|
| fileSystem | Alpha | readonly | SnapshotFileSystem | How the snapshotDirectory is accessed. |
| minVersionForCollaboration | Alpha | readonly | string | The minimum version that the current version is expected to be able to collaborate with. |
| mode | Alpha | readonly | "assert" | "update" | The mode of operation, either "assert" or "update". |
| rejectSchemaChangesWithNoVersionChange | Alpha | optional, readonly | true | When true, it is an error if a schema change occurs without a corresponding version change. |
| rejectVersionsWithNoSchemaChange | Alpha | optional, readonly | true | When true, it is an error if a new a snapshot for a new version would be created, but the schema compatibility is identical to the previous snapshot. |
| schema | Alpha | readonly | TreeViewConfiguration | The current view schema. |
| snapshotDirectory | Alpha | readonly | string | Directory where historical schema snapshots are stored. |
| snapshotUnchangedVersions | Alpha | optional, readonly | true | When true, every version must be snapshotted, and an increased version number will require a new snapshot. |
| version | Alpha | readonly | string | The version which will be associated with this version of the schema. |
| versionComparer | Alpha | optional, readonly | (a: string, b: string) => number | A comparison function for version strings. |
Property Details
fileSystem
How the snapshotDirectory is accessed.
For more information about our API support guarantees, see here.
Signature
readonly fileSystem: SnapshotFileSystem;
Type: SnapshotFileSystem
minVersionForCollaboration
The minimum version that the current version is expected to be able to collaborate with.
For more information about our API support guarantees, see here.
Signature
readonly minVersionForCollaboration: string;
Type: string
Remarks
Can use any format supported by versionComparer.
This defines a range of versions whose schema must be forwards compatible with trees using the current schema: Any schema from snapshots with a version greater than or equal to this must be able to view documents created with the current schema. This means that if the current schema is used to create a TreeView, then upgradeSchema() is used, the older clients, all the way back to this minVersionForCollaboration will be able to view and edit the tree using their schema and thus collaborate.
Typically applications will attempt to manage their deployment/update schedule such that all versions concurrently deployed can collaborate to avoid users losing access to documents when other users upgrade the schema. Such applications can set this to the oldest version currently deployed, then rely on snapshotSchemaCompatibility(options) to verify that no schema changes are made which would break collaboration with that (or newer) versions.
This is the same approach used by MinimumVersionForCollab except that type is specifically for use with the version of the Fluid Framework client packages, and this corresponds to whatever versioning scheme is used with version.
mode
The mode of operation, either "assert" or "update".
For more information about our API support guarantees, see here.
Signature
readonly mode: "assert" | "update";
Type: "assert" | "update"
Remarks
Both modes will throw errors if any compatibility issues are detected (but after updating snapshots in "update" mode so the diff can be used to help debug).
In "assert" mode, an error is additionally thrown if the latest snapshot is not up to date (meaning "update" mode would make a change).
In "update" mode, a new snapshot is created if the current schema differs from the latest existing snapshot. If rejectVersionsWithNoSchemaChange or rejectSchemaChangesWithNoVersionChange disallows the update, an error is thrown instead.
It is recommended that "assert" mode be used in automated tests to verify schema compatibility, and "update" mode only be used manually to update snapshots when making schema or version changes.
rejectSchemaChangesWithNoVersionChange
When true, it is an error if a schema change occurs without a corresponding version change.
For more information about our API support guarantees, see here.
Signature
readonly rejectSchemaChangesWithNoVersionChange?: true;
Type: true