Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarinofaggiana <marino@marinofaggiana.com>2020-06-25 12:58:31 +0300
committermarinofaggiana <marino@marinofaggiana.com>2020-06-25 12:58:31 +0300
commit4aec62b0f48ebcb14b13391b73e435117ebccca6 (patch)
tree84ea99995fcac297ff4efbdc3c911ea2d16a0acd /Carthage
parent12df15f99ff7f0dcc2849287b234c0f284c459ed (diff)
coding
Diffstat (limited to 'Carthage')
-rw-r--r--Carthage/Checkouts/realm-cocoa/CHANGELOG.md28
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm97
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m30
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h6
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm46
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.mm7
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.h24
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.mm20
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.mm15
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist4
-rw-r--r--Carthage/Checkouts/realm-cocoa/Realm/Tests/RealmTests.mm21
-rw-r--r--Carthage/Checkouts/realm-cocoa/RealmSwift/RealmConfiguration.swift20
-rw-r--r--Carthage/Checkouts/realm-cocoa/dependencies.list2
13 files changed, 299 insertions, 21 deletions
diff --git a/Carthage/Checkouts/realm-cocoa/CHANGELOG.md b/Carthage/Checkouts/realm-cocoa/CHANGELOG.md
index 116416945..95e195dfb 100644
--- a/Carthage/Checkouts/realm-cocoa/CHANGELOG.md
+++ b/Carthage/Checkouts/realm-cocoa/CHANGELOG.md
@@ -1,3 +1,31 @@
+5.1.0 Release notes (2020-06-22)
+=============================================================
+
+### Enhancements
+
+* Allow opening full-sync Realms in read-only mode. This disables local schema
+ initialization, which makes it possible to open a Realm which the user does
+ not have write access to without using asyncOpen. In addition, it will report
+ errors immediately when an operation would require writing to the Realm
+ rather than reporting it via the sync error handler only after the server
+ rejects the write.
+
+### Fixed
+
+* Opening a Realm using a configuration object read from an existing Realm
+ would incorrectly bind the new Realm to the original Realm's thread/queue,
+ resulting in "Realm accessed from incorrect thread." exceptions.
+ ([#6574](https://github.com/realm/realm-cocoa/issues/6574),
+ [#6559](https://github.com/realm/realm-cocoa/issues/6559), since 5.0.0).
+
+### Compatibility
+
+* File format: Generates Realms with format v10 (Reads and upgrades all previous formats)
+* Realm Object Server: 3.21.0 or later.
+* Realm Studio: 3.11 or later.
+* APIs are backwards compatible with all previous releases in the 5.x.y series.
+* Carthage release for Swift is built with Xcode 11.5.
+
5.0.3 Release notes (2020-06-10)
=============================================================
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm
index 7395428ad..1841ba933 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm
+++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMObjectServerTests.mm
@@ -21,12 +21,15 @@
#import "RLMSyncSessionRefreshHandle+ObjectServerTests.h"
#import "RLMSyncUser+ObjectServerTests.h"
+#import "RLMObjectSchema_Private.hpp"
#import "RLMRealm+Sync.h"
#import "RLMRealmConfiguration_Private.h"
#import "RLMRealmUtil.hpp"
#import "RLMRealm_Dynamic.h"
#import "RLMRealm_Private.hpp"
+#import "RLMSchema_Private.h"
#import "RLMSyncUtil_Private.h"
+
#import "shared_realm.hpp"
#pragma mark - Test objects
@@ -2351,4 +2354,98 @@ static NSURL *certificateURL(NSString *filename) {
[self waitForExpectations:@[ex3, ex4] timeout:4.0];
}
+#pragma mark - Read Only
+
+- (RLMSyncUser *)userForTest:(SEL)sel {
+ return [self logInUserForCredentials:[RLMObjectServerTests basicCredentialsWithName:NSStringFromSelector(sel)
+ register:self.isParent]
+ server:[RLMObjectServerTests authServerURL]];
+}
+
+- (void)testPartialSyncCannotBeReadOnly {
+ RLMSyncUser *user = [self userForTest:_cmd];
+ RLMRealmConfiguration *config = [user configurationWithURL:nil fullSynchronization:NO];
+ RLMAssertThrowsWithReason(config.readOnly = true,
+ @"Read-only mode is not supported for query-based sync.");
+}
+
+- (void)testOpenSynchronouslyInReadOnlyBeforeRemoteSchemaIsInitialized {
+ NSURL *url = REALM_URL();
+ RLMSyncUser *user = [self userForTest:_cmd];
+
+ if (self.isParent) {
+ RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:YES];
+ config.readOnly = true;
+ RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];
+ CHECK_COUNT(0, SyncObject, realm);
+ RLMRunChildAndWait();
+ [self waitForDownloadsForUser:user realms:@[realm] realmURLs:@[url] expectedCounts:@[@3]];
+ } else {
+ RLMRealm *realm = [self openRealmForURL:url user:user];
+ [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
+ [self waitForUploadsForRealm:realm];
+ CHECK_COUNT(3, SyncObject, realm);
+ }
+}
+
+- (void)testAddPropertyToReadOnlyRealmWithExistingLocalCopy {
+ NSURL *url = REALM_URL();
+ RLMSyncUser *user = [self userForTest:_cmd];
+
+ if (!self.isParent) {
+ RLMRealm *realm = [self openRealmForURL:url user:user];
+ [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
+ [self waitForUploadsForRealm:realm];
+ return;
+ }
+ RLMRunChildAndWait();
+
+ RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:YES];
+ config.readOnly = true;
+ @autoreleasepool {
+ (void)[self asyncOpenRealmWithConfiguration:config];
+ }
+
+ RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:SyncObject.class];
+ objectSchema.properties = [RLMObjectSchema schemaForObjectClass:HugeSyncObject.class].properties;
+ config.customSchema = [[RLMSchema alloc] init];
+ config.customSchema.objectSchema = @[objectSchema];
+
+ RLMAssertThrowsWithReason([RLMRealm realmWithConfiguration:config error:nil],
+ @"Property 'SyncObject.dataProp' has been added.");
+
+ @autoreleasepool {
+ NSError *error = [self asyncOpenErrorWithConfiguration:config];
+ XCTAssertNotEqual([error.localizedDescription rangeOfString:@"Property 'SyncObject.dataProp' has been added."].location,
+ NSNotFound);
+ }
+}
+
+- (void)testAddPropertyToReadOnlyRealmWithAsyncOpen {
+ NSURL *url = REALM_URL();
+ RLMSyncUser *user = [self userForTest:_cmd];
+
+ if (!self.isParent) {
+ RLMRealm *realm = [self openRealmForURL:url user:user];
+ [self addSyncObjectsToRealm:realm descriptions:@[@"child-1", @"child-2", @"child-3"]];
+ [self waitForUploadsForRealm:realm];
+ return;
+ }
+ RLMRunChildAndWait();
+
+ RLMRealmConfiguration *config = [user configurationWithURL:url fullSynchronization:YES];
+ config.readOnly = true;
+
+ RLMObjectSchema *objectSchema = [RLMObjectSchema schemaForObjectClass:SyncObject.class];
+ objectSchema.properties = [RLMObjectSchema schemaForObjectClass:HugeSyncObject.class].properties;
+ config.customSchema = [[RLMSchema alloc] init];
+ config.customSchema.objectSchema = @[objectSchema];
+
+ @autoreleasepool {
+ NSError *error = [self asyncOpenErrorWithConfiguration:config];
+ XCTAssertNotEqual([error.localizedDescription rangeOfString:@"Property 'SyncObject.dataProp' has been added."].location,
+ NSNotFound);
+ }
+}
+
@end
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m
index ce2d13166..6a47ff75d 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m
+++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMPermissionsAPITests.m
@@ -555,6 +555,36 @@ static NSURL *makeTildeSubstitutedURL(NSURL *url, RLMSyncUser *user) {
REVOKE_PERMISSION(p, admin);
}
+- (void)testReadAccessWithClassSuperset {
+ NSString *testName = NSStringFromSelector(_cmd);
+
+ // Create a Realm with only a single object type
+ NSURL *userAURL = makeTestURL(testName, nil);
+ RLMRealmConfiguration *userAConfig = [self.userA configurationWithURL:userAURL fullSynchronization:YES];
+ userAConfig.objectClasses = @[SyncObject.self];
+ RLMRealm *userARealm = [self asyncOpenRealmWithConfiguration:userAConfig];
+ [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-1", @"child-2", @"child-3"]];
+ [self waitForUploadsForRealm:userARealm];
+ CHECK_COUNT(3, SyncObject, userARealm);
+
+ // Give user B read-only permissions to that Realm so that it can't add new object types
+ RLMSyncPermission *p = [[RLMSyncPermission alloc] initWithRealmPath:[userAURL path]
+ identity:self.userB.identity
+ accessLevel:RLMSyncAccessLevelRead];
+ APPLY_PERMISSION(p, self.userA);
+
+ // Open the same Realm s user B without limiting the set of object classes
+ NSURL *userBURL = makeTestURL(testName, self.userA);
+ RLMRealmConfiguration *userBConfig = [self.userB configurationWithURL:userBURL fullSynchronization:YES];
+ userBConfig.readOnly = YES;
+ RLMRealm *userBRealm = [self asyncOpenRealmWithConfiguration:userBConfig];
+ CHECK_COUNT(3, SyncObject, userBRealm);
+
+ // Verify that syncing is actually working and new objects written by A show up in B's Realm
+ [self addSyncObjectsToRealm:userARealm descriptions:@[@"child-4"]];
+ CHECK_COUNT_PENDING_DOWNLOAD(4, SyncObject, userBRealm);
+}
+
#pragma mark - Permission change API
/// Setting a permission should work, and then that permission should be able to be retrieved.
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h
index 42a23fbdc..e9ef6a4bb 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h
+++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.h
@@ -58,6 +58,12 @@ NS_ASSUME_NONNULL_BEGIN
/// Synchronously open a synced Realm and wait until the binding process has completed or failed.
- (RLMRealm *)openRealmWithConfiguration:(RLMRealmConfiguration *)configuration;
+/// Synchronously open a synced Realm via asyncOpen and return the Realm.
+- (RLMRealm *)asyncOpenRealmWithConfiguration:(RLMRealmConfiguration *)configuration;
+
+/// Synchronously open a synced Realm via asyncOpen and return the expected error.
+- (NSError *)asyncOpenErrorWithConfiguration:(RLMRealmConfiguration *)configuration;
+
/// Synchronously open a synced Realm. Also run a block right after the Realm is created.
- (RLMRealm *)openRealmForURL:(NSURL *)url
user:(RLMSyncUser *)user
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm
index d114d0597..330c70581 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm
+++ b/Carthage/Checkouts/realm-cocoa/Realm/ObjectServerTests/RLMSyncTestCase.mm
@@ -349,6 +349,37 @@ static NSURL *syncDirectoryForChildProcess() {
@"Timed out while trying to asynchronously open Realm for URL: %@", syncConfig.realmURL);
return realm;
}
+
+- (RLMRealm *)asyncOpenRealmWithConfiguration:(RLMRealmConfiguration *)config {
+ __block RLMRealm *realm = nil;
+ XCTestExpectation *ex = [self expectationWithDescription:@"Should asynchronously open a Realm"];
+ [RLMRealm asyncOpenWithConfiguration:config
+ callbackQueue:dispatch_get_main_queue()
+ callback:^(RLMRealm *r, NSError *err){
+ XCTAssertNil(err);
+ XCTAssertNotNil(r);
+ realm = r;
+ [ex fulfill];
+ }];
+ [self waitForExpectationsWithTimeout:10.0 handler:nil];
+ return realm;
+}
+
+- (NSError *)asyncOpenErrorWithConfiguration:(RLMRealmConfiguration *)config {
+ __block NSError *error = nil;
+ XCTestExpectation *ex = [self expectationWithDescription:@"Should fail to asynchronously open a Realm"];
+ [RLMRealm asyncOpenWithConfiguration:config
+ callbackQueue:dispatch_get_main_queue()
+ callback:^(RLMRealm *r, NSError *err){
+ XCTAssertNotNil(err);
+ XCTAssertNil(r);
+ error = err;
+ [ex fulfill];
+ }];
+ [self waitForExpectationsWithTimeout:10.0 handler:nil];
+ return error;
+}
+
- (RLMRealm *)immediatelyOpenRealmForURL:(NSURL *)url user:(RLMSyncUser *)user {
return [self immediatelyOpenRealmForURL:url
user:user
@@ -542,7 +573,20 @@ static NSURL *syncDirectoryForChildProcess() {
}
- (void)resetSyncManager {
- [RLMSyncManager.sharedManager._allUsers makeObjectsPerformSelector:@selector(logOut)];
+ NSMutableArray *expectations = [NSMutableArray new];
+ for (RLMSyncUser *user in RLMSyncManager.sharedManager._allUsers) {
+ [user logOut];
+ // Sessions are removed from the user asynchronously after a logout.
+ // We need to wait for this to happen before calling resetForTesting as
+ // that expects all sessions to be cleaned up first. This doesn't apply
+ // to admin token users, which don't logout at all (and don't have an
+ // auth server).
+ if (user.authenticationServer && user.allSessions.count) {
+ [expectations addObject:[self expectationForPredicate:[NSPredicate predicateWithFormat:@"allSessions.@count == 0"]
+ evaluatedWithObject:user handler:nil]];
+ }
+ }
+ [self waitForExpectations:expectations timeout:5.0];
[RLMSyncManager resetForTesting];
[RLMSyncSessionRefreshHandle calculateFireDateUsingTestLogic:NO blockOnRefreshCompletion:nil];
}
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.mm b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.mm
index f8eb3fe73..e25bbefc6 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.mm
+++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealm.mm
@@ -450,7 +450,7 @@ REALM_NOINLINE static void translateSharedGroupOpenException(NSError **error) {
}
{
- Realm::Config& config = configuration.config;
+ Realm::Config const& config = configuration.config;
// try to reuse existing realm first
if (cache || dynamic) {
@@ -496,6 +496,11 @@ REALM_NOINLINE static void translateSharedGroupOpenException(NSError **error) {
throw RLMException(@"Realm opened from incorrect dispatch queue.");
}
}
+ else {
+ // If the source config was read from a Realm it may already have a
+ // scheduler, and we don't want to reuse it.
+ config.scheduler = nullptr;
+ }
realm->_realm = Realm::get_shared_realm(config);
}
catch (...) {
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.h b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.h
index 04eba7a5f..4689f4899 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.h
+++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.h
@@ -79,13 +79,23 @@ typedef BOOL (^RLMShouldCompactOnLaunchBlock)(NSUInteger totalBytes, NSUInteger
/// Whether to open the Realm in read-only mode.
///
-/// This is required to be able to open Realm files which are not writeable or
-/// are in a directory which is not writeable. This should only be used on files
-/// which will not be modified by anyone while they are open, and not just to
-/// get a read-only view of a file which may be written to by another thread or
-/// process. Opening in read-only mode requires disabling Realm's reader/writer
-/// coordination, so committing a write transaction from another process will
-/// result in crashes.
+/// For non-synchronized Realms, this is required to be able to open Realm
+/// files which are not writeable or are in a directory which is not writeable.
+/// This should only be used on files which will not be modified by anyone
+/// while they are open, and not just to get a read-only view of a file which
+/// may be written to by another thread or process. Opening in read-only mode
+/// requires disabling Realm's reader/writer coordination, so committing a
+/// write transaction from another process will result in crashes.
+///
+/// Syncronized Realms must always be writeable (as otherwise no
+/// synchronization could happen), and this instead merely disallows performing
+/// write transactions on the Realm. In addition, it will skip some automatic
+/// writes made to the Realm, such as to initialize the Realm's schema. Setting
+/// `readOnly = YES` is not strictly required for Realms which the sync user
+/// does not have write access to, but is highly recommended as it will improve
+/// error reporting and catch some errors earlier.
+///
+/// Realms using query-based sync cannot be opened in read-only mode.
@property (nonatomic) BOOL readOnly;
/// The current schema version.
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.mm b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.mm
index 96ff08db4..aa6218966 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.mm
+++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMRealmConfiguration.mm
@@ -205,7 +205,14 @@ static void RLMNSStringToStdString(std::string &out, NSString *in) {
}
- (BOOL)readOnly {
- return _config.immutable();
+ return _config.immutable() || _config.read_only_alternative();
+}
+
+static bool isSync(realm::Realm::Config const& config) {
+#if REALM_ENABLE_SYNC
+ return !!config.sync_config;
+#endif
+ return false;
}
- (void)setReadOnly:(BOOL)readOnly {
@@ -215,10 +222,15 @@ static void RLMNSStringToStdString(std::string &out, NSString *in) {
} else if (self.shouldCompactOnLaunch) {
@throw RLMException(@"Cannot set `readOnly` when `shouldCompactOnLaunch` is set.");
}
- _config.schema_mode = realm::SchemaMode::Immutable;
+#if REALM_ENABLE_SYNC
+ if (_config.sync_config && _config.sync_config->is_partial) {
+ @throw RLMException(@"Read-only mode is not supported for query-based sync.");
+ }
+#endif
+ _config.schema_mode = isSync(_config) ? realm::SchemaMode::ReadOnlyAlternative : realm::SchemaMode::Immutable;
}
else if (self.readOnly) {
- _config.schema_mode = realm::SchemaMode::Automatic;
+ _config.schema_mode = isSync(_config) ? realm::SchemaMode::Additive : realm::SchemaMode::Automatic;
}
}
@@ -300,7 +312,7 @@ static void RLMNSStringToStdString(std::string &out, NSString *in) {
- (void)setShouldCompactOnLaunch:(RLMShouldCompactOnLaunchBlock)shouldCompactOnLaunch {
if (shouldCompactOnLaunch) {
- if (self.readOnly) {
+ if (_config.immutable()) {
@throw RLMException(@"Cannot set `shouldCompactOnLaunch` when `readOnly` is set.");
}
_config.should_compact_on_launch_function = [=](size_t totalBytes, size_t usedBytes) {
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.mm b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.mm
index cddaade2f..f0a844be6 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.mm
+++ b/Carthage/Checkouts/realm-cocoa/Realm/RLMSyncSession.mm
@@ -231,6 +231,21 @@ static RLMSyncConnectionState convertConnectionState(SyncSession::ConnectionStat
return nil;
}
+- (NSString *)description {
+ return [NSString stringWithFormat:
+ @"<RLMSyncSession: %p> {\n"
+ "\tstate = %d;\n"
+ "\tconnectionState = %d;\n"
+ "\trealmURL = %@;\n"
+ "\tuser = %@;\n"
+ "}",
+ (__bridge void *)self,
+ static_cast<int>(self.state),
+ static_cast<int>(self.connectionState),
+ self.realmURL,
+ self.parentUser.identity];
+}
+
@end
// MARK: - Error action token
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist b/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist
index 144ebe539..86e830a2e 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist
+++ b/Carthage/Checkouts/realm-cocoa/Realm/Realm-Info.plist
@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
- <string>5.0.3</string>
+ <string>5.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>5.0.3</string>
+ <string>5.1.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014 Realm. All rights reserved.</string>
<key>NSPrincipalClass</key>
diff --git a/Carthage/Checkouts/realm-cocoa/Realm/Tests/RealmTests.mm b/Carthage/Checkouts/realm-cocoa/Realm/Tests/RealmTests.mm
index 176e85fa1..0f5eea7cf 100644
--- a/Carthage/Checkouts/realm-cocoa/Realm/Tests/RealmTests.mm
+++ b/Carthage/Checkouts/realm-cocoa/Realm/Tests/RealmTests.mm
@@ -1621,6 +1621,27 @@
});
}
+- (void)testReusingConfigOnMultipleQueues {
+ auto config = [RLMRealmConfiguration defaultConfiguration];
+ auto q1 = dispatch_queue_create("queue 1", DISPATCH_QUEUE_SERIAL);
+ auto q2 = dispatch_queue_create("queue 2", DISPATCH_QUEUE_SERIAL);
+
+ dispatch_sync(q1, ^{
+ XCTAssertNoThrow([RLMRealm realmWithConfiguration:config queue:q1 error:nil]);
+ });
+ dispatch_sync(q2, ^{
+ XCTAssertNoThrow([RLMRealm realmWithConfiguration:config queue:q2 error:nil]);
+ });
+}
+
+- (void)testConfigurationFromExistingRealmOnNewThread {
+ auto r1 = [RLMRealm defaultRealm];
+ [self dispatchAsyncAndWait:^{
+ auto r2 = [RLMRealm realmWithConfiguration:r1.configuration error:nil];
+ XCTAssertNoThrow([r2 refresh]);
+ }];
+}
+
#pragma mark - In-memory Realms
- (void)testInMemoryRealm {
diff --git a/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmConfiguration.swift b/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmConfiguration.swift
index 7db110a8e..e97ebc8d7 100644
--- a/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmConfiguration.swift
+++ b/Carthage/Checkouts/realm-cocoa/RealmSwift/RealmConfiguration.swift
@@ -160,11 +160,21 @@ extension Realm {
/**
Whether to open the Realm in read-only mode.
- This is required to be able to open Realm files which are not writeable or are in a directory which is not
- writeable. This should only be used on files which will not be modified by anyone while they are open, and not
- just to get a read-only view of a file which may be written to by another thread or process. Opening in
- read-only mode requires disabling Realm's reader/writer coordination, so committing a write transaction from
- another process will result in crashes.
+ For non-synchronized Realms, this is required to be able to open Realm files which are not
+ writeable or are in a directory which is not writeable. This should only be used on files
+ which will not be modified by anyone while they are open, and not just to get a read-only
+ view of a file which may be written to by another thread or process. Opening in read-only
+ mode requires disabling Realm's reader/writer coordination, so committing a write
+ transaction from another process will result in crashes.
+
+ Syncronized Realms must always be writeable (as otherwise no synchronization could happen),
+ and this instead merely disallows performing write transactions on the Realm. In addition,
+ it will skip some automatic writes made to the Realm, such as to initialize the Realm's
+ schema. Setting `readOnly = YES` is not strictly required for Realms which the sync user
+ does not have write access to, but is highly recommended as it will improve error reporting
+ and catch some errors earlier.
+
+ Realms using query-based sync cannot be opened in read-only mode.
*/
public var readOnly: Bool = false
diff --git a/Carthage/Checkouts/realm-cocoa/dependencies.list b/Carthage/Checkouts/realm-cocoa/dependencies.list
index a73995ce3..7b304d2ab 100644
--- a/Carthage/Checkouts/realm-cocoa/dependencies.list
+++ b/Carthage/Checkouts/realm-cocoa/dependencies.list
@@ -1,4 +1,4 @@
-VERSION=5.0.3
+VERSION=5.1.0
REALM_CORE_VERSION=6.0.6
REALM_SYNC_VERSION=5.0.5
REALM_OBJECT_SERVER_VERSION=3.28.5