public static interface SyncSession.ClientResetHandler
ErrorCode.CLIENT_RESET
.
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 reset process is as follows: the local copy of the Realm is copied into a recovery directory for safekeeping, and then deleted from the original location. The next time the Realm for that URL is opened, the Realm will automatically be re-downloaded from MongoDB Realm, and can be used as normal.
Data written to the Realm after the local copy of the Realm diverged from the backup remote copy will be present in the local recovery copy of the Realm file. The re-downloaded Realm will initially contain only the data present at the time the Realm was backed up on the server.
The client reset process can be initiated in one of two ways:
ClientResetRequiredError.executeClientReset()
manually. All Realm instances must be
closed before this method is called.
Modifier and Type | Method and Description |
---|---|
void |
onClientReset(SyncSession session,
ClientResetRequiredError error)
Callback that indicates a Client Reset has happened.
|
void onClientReset(SyncSession session, ClientResetRequiredError error)
session
- SyncSession
this error happened on.error
- ClientResetRequiredError
the specific Client Reset error.