You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-fluid-relay/how-tos/container-recovery.md
+53-39Lines changed: 53 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,55 +12,69 @@ In this scenario, we explore data recovery. We consider data to be corrupted whe
12
12
13
13
## How Fluid Framework and Azure Fluid Relay save state
14
14
15
-
Fluid framework periodically saves state, called summary, without any explicit backup action initiated by the user. This workflow occurs every one (1) minute if there's no user activity, or sooner if there are more than 1000 pending ops present. Each pending op roughly translates to an individual user action (select, text input etc.) that wasn't summarized yet.
15
+
Fluid Framework periodically saves snapshots of the data in the container, which summarize all changes made to the data up to that point. During normal loading the latest snapshot is retrieved, and any subsequent changes are applied on top of that state.
16
+
17
+
If the latest snapshot or subsequent changes are corrupt, Fluid may not be able to load them normally. In this case, Fluid offers a collection of APIs to view the stored snapshot versions and load them in a view-only mode with no subsequent changes applied. This allows the data to be extracted and optionally injected into a new container to resume collaboration.
16
18
17
19
## Azure client APIs
18
20
19
-
We added the following methods to AzureClient that enable developers to recover data from corrupted containers.
21
+
### APIs for viewing and loading container versions
20
22
21
-
`getContainerVersions(ID, options)`
23
+
The AzureClient has the following methods to support this scenario:
22
24
23
-
`getContainerVersions` allows developers to view the previously generated versions of the container.
25
+
#### Get container versions
24
26
25
-
`copyContainer(ID, containerSchema)`
27
+
`getContainerVersions(id, options?)`
26
28
27
-
`copyContainer` allows developers to generate a new detached container from a specific version of another container.
29
+
Retrieve a list of available versions that may be loaded from.
28
30
29
-
## Example recovery flow
31
+
`Parameters:`
30
32
31
-
```typescript
33
+
*`id`: The container ID. This is the same ID used when calling `getContainer`.
34
+
*`options?`: Optionally, an options object to specify:
35
+
*`maxCount`: The maximum number of versions to retrieve. If there are more versions available than requested, the newest versions will be retrieved. **Default: 5**
36
+
37
+
`Returns:` A promise which resolves to an array of objects that represent available versions (sorted newest to oldest). The objects have the following properties:
38
+
39
+
*`id`: The version ID.
40
+
**Note*: This is different from the container ID, and specifically references a snapshot version rather than the container.
41
+
*`date`: The timestamp when the version was generated.
Load a specific version of a container for viewing only. Any version retrieved from `getContainerVersions` may be used, but for the purpose of recovering corrupted data it is recommended to start with the most-recent version and work backwards to find the most-recent uncorrupted version.
returnPromise.reject(newError("Could not recreate document"));
62
-
}
49
+
The container is loaded in a paused state, meaning it will not apply the subsequent changes to the data that happened after the generation of that snapshot. When loaded in this state the container data may be read, but not edited.
63
50
51
+
`Parameters:`
52
+
53
+
*`id`: The container ID. This is the same ID used when calling `getContainer`.
54
+
*`containerSchema`: The container schema. This is the same schema used when calling `getContainer`.
55
+
*`version`: The version object referencing the version to load from. The version object can be retrieved via `getContainerVersions`.
56
+
*`compatibilityMode`: The compatibility mode. This is the same compatibility mode used when calling `getContainer`.
57
+
58
+
`Returns:` A promise which resolves to an object representing the loaded container with a single property:
59
+
60
+
*`container`: The container object. This is the same type of object as the container object returned by `getContainer`, but is paused in its prior state from the selected version.
@@ -73,7 +87,7 @@ We aren't recovering (rolling back) existing container. `copyContainer` will giv
73
87
74
88
New container is initially in `detached` state. We can continue working with detached container, or immediately attach. After calling `attach` we'll get back unique Container ID, representing newly created instance.
75
89
76
-
## Post-recovery considerations
90
+
## Post-recovery considerations
77
91
78
92
When it comes to building use cases around post-recovery scenarios, here are couple of considerations on what application might want do to get its remote collaborators all working on the same container again.
0 commit comments