Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyncConfiguration - compactOnLaunch #418

Closed
sync-by-unito bot opened this issue Sep 1, 2021 · 1 comment
Closed

SyncConfiguration - compactOnLaunch #418

sync-by-unito bot opened this issue Sep 1, 2021 · 1 comment

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented Sep 1, 2021

See #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()
@cmelchior
Copy link
Contributor

Added to both RealmConfiguration and SyncConfiguration here: #658

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant