On this page
Strategy that automatically resolves a Client Reset by discarding any unsynced data, but otherwise keep the Realm open. Any changes will be reported through the normal collection and object notifications.A synced Realm may need to be reset because the MongoDB Realm Server encountered an error and had to be restored from a backup or because it has been too long since the client connected to the server so the server has rotated the logs.
The Client Reset thus occurs because the server does not have the full information required to bring the Client fully up to date.
The discard unsynced changes reset process is as follows: when a client reset is triggered the onBeforeReset(Realm) callback is invoked, providing an instance of the Realm before the reset and another after the reset, both read-only. Once the reset has concluded the callback onAfterReset(Realm, Realm) would be invoked with an instance of the final Realm.
In the event that discarding the unsynced data is not enough to resolve the reset the onError(SyncSession, ClientResetRequiredError) would be invoked, it allows to manually resolve the reset as it would be done in ManuallyRecoverUnsyncedChangesStrategy.onClientReset(SyncSession, ClientResetRequiredError) .
Modifier and Type
Method and Description
Callback invoked once the Client Reset happens. It provides of two Realm instances, a frozen one displaying the state before the reset and a regular Realm with the current state, that can be used to recover objects from the reset.
Callback that indicates the seamless Client reset couldn't complete. It should be handled as ManuallyRecoverUnsyncedChangesStrategy.onClientReset(SyncSession, ClientResetRequiredError) .