SyncConfiguration - compactOnLaunch

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: 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
            Reporter:
            Christian Melchior (Inactive)
            Archiver:
            Marc Greenfield

              Created:
              Updated:
              Resolved:
              Archived: