-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Expose a block to determine if the Realm should be compacted on launch #4755
Conversation
900634c
to
a1cd4ae
Compare
a1cd4ae
to
8415d8a
Compare
8415d8a
to
2a7ca93
Compare
c6bac68
to
418470c
Compare
418470c
to
eae469b
Compare
This is now ready for review. |
|
||
- (void)testCompactOnLaunchCannotBeSet { | ||
// This test just needs a single process, so skip child. | ||
if (!self.isParent) { return; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The child process is created by RLMRunChildAndWait()
, so there's no need to do anything other than just not call that if only one process is needed.
Realm/RLMRealmConfiguration.mm
Outdated
@@ -275,4 +279,21 @@ - (NSString *)pathOnDisk { | |||
return @(_config.path.c_str()); | |||
} | |||
|
|||
- (void)setShouldCompactOnLaunch:(RLMShouldCompactOnLaunchBlock)shouldCompactOnLaunch { | |||
_shouldCompactOnLaunch = shouldCompactOnLaunch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should set this after validation so that the object isn't left in an inconsistent state when validation fails.
to prevent the configuration from being left in an inconsistent state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -0,0 +1,86 @@ | |||
//////////////////////////////////////////////////////////////////////////// | |||
// | |||
// Copyright 2015 Realm Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2017
Addresses #3289.