Uploaded image for project: 'Realm Dart SDK'
  1. Realm Dart SDK
  2. RDART-669

Add a SyncState feature in SyncSession

      Description

      Often times, there is a need to determine the state of the local data in comparison to the remote data. That is, only work with the most up to date data from remote where local data has been successfully synced with the remote. I mean, this is a feature that most cloud sync service provide out of the box (e.g. OneDrive, Dropbox).

      SyncSession has the following great features as described in #567:

      • Get the current SessionState (active, inactive)
      • Get the current ConnectionState (disconnected, connected, connecting)
      • Listen to ConnectionState via ConnectStateChanges stream

      What is missing are the following features:

      • Get the current SyncState (synced, syncing, disconnected)
      • Listen to SyncState via a SyncStateChanges stream

      From an implementation point of view, SyncState can be resolved as follow:

      • The session is 'synced' when SessionState is active, the ConnectionState is connected, and waitForUpload and waitForDownload are completed.
      • The session is 'syncing' when SessionState is active, the ConnectionState is connected and while waitForUpload and waitForDownload have not completed.
      • The session is 'disconnected' when ConnectionState is disconnected.

      The SyncStateChanges stream can piggy-back off of the existing streams by implementing a sink on each ConnectStateChanges and on each SyncProgress update.

      How important is this improvement for you?

      Would be a major improvement

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: