Uploaded image for project: 'Realm Kotlin'
  1. Realm Kotlin
  2. RKOTLIN-289

SyncConfiguration - compactOnLaunch

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      See https://github.com/realm/realm-kotlin/issues/195

       

      Similar to Realm Java we should expose the option of compacting on launch.

      This also involves exposing an interface like

      public interface CompactOnLaunchCallback {
      
          /**
           * This method determines if the Realm file should be compacted before opened and returned to the user. It is passed
           * the total file size (data + free space) and the bytes used by data in the file.
           *
           * @param totalBytes the total file size (data + free space).
           * @param usedBytes the total bytes used by data in the file.
           * @return {code true} to indicate an attempt to compact the file should be made. Otherwise, the compaction will be
           * skipped.
           */
          boolean shouldCompact(long totalBytes, long usedBytes);
      }
      
      

      And with a similar configuration with a similar API to Realm Java

      SyncConfiguration.Builder(user, partition)
       .compactOnLaunch() // Default policy
       .compactOnLaunch(callback: CompactOnLaunchCallback)
       .build()

            Assignee:
            Unassigned Unassigned
            Reporter:
            christian.melchior@mongodb.com Christian Melchior (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: