Skip to content

Commit 3450711

Browse files
committed
Merge branch 'master' into release/14.5.1
2 parents 316889b + 5c64253 commit 3450711

File tree

95 files changed

+5218
-6108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+5218
-6108
lines changed

CHANGELOG.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
1+
# NEXT RELEASE
2+
3+
### Enhancements
4+
* <New feature description> (PR [#????](https://github.com/realm/realm-core/pull/????))
5+
* Add `SyncClientConfig::security_access_group` which allows specifying the access group to use for the sync metadata Realm's encryption key. Setting this is required when sharing the metadata Realm between apps on Apple platforms ([#7552](https://github.com/realm/realm-core/pull/7552)).
6+
* When connecting to multiple server apps, a unique encryption key is used for each of the metadata Realms rather than sharing one between them ([#7552](https://github.com/realm/realm-core/pull/7552)).
7+
* Introduce the new `SyncUser` interface which can be implemented by SDKs to use sync without the core App Services implementation (or just for greater control over user behavior in tests). ([PR #7300](https://github.com/realm/realm-core/pull/7300).
8+
9+
### Fixed
10+
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
11+
* SyncUser::all_sessions() included sessions in every state *except* for waiting for access token, which was weirdly inconsistent. It now includes all sessions. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
12+
* App::all_users() included logged out users only if they were logged out while the App instance existed. It now always includes all logged out users. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
13+
* Deleting the active user left the active user unset rather than selecting another logged-in user as the active user like logging out and removing users did. ([PR #7300](https://github.com/realm/realm-core/pull/7300)).
14+
15+
### Breaking changes
16+
* The following things have been renamed or moved as part of moving all of the App Services functionality to the app namespace:
17+
- SyncUser -> app::User. Note that there is a new, different type named SyncUser.
18+
- SyncUser::identity -> app::User::user_id. The "identity" word was overloaded to mean two unrelated things, and one has been changed to user_id everywhere.
19+
- SyncUserSubscriptionToken -> app::UserSubscriptionToken
20+
- SyncUserProfile -> app::UserProfile
21+
- App::Config -> AppConfig
22+
- SyncConfig::MetadataMode -> AppConfig::MetadataMode
23+
- MetadataMode::NoMetadata -> MetadataMode::InMemory
24+
- SyncUser::session_for_on_disk_path() -> SyncManager::get_existing_session()
25+
- SyncUser::all_sessions() -> SyncManager::get_all_sessions_for(User&)
26+
- SyncManager::immediately_run_file_actions() -> App::immediately_run_file_actions()
27+
- realm_sync_user_subscription_token -> realm_app_user_subscription_token
28+
([PR #7300](https://github.com/realm/realm-core/pull/7300).
29+
* The `ClientAppDeallocated` error code no longer exists as this error code can no longer occur. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
30+
* Some fields have moved from SyncClientConfig to AppConfig. AppConfig now has a SyncClientConfig field rather than it being passed separately to App::get_app(). ([PR #7300](https://github.com/realm/realm-core/pull/7300).
31+
* Sync user management has been removed from SyncManager. This functionality was already additionally available on App. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
32+
* AuditConfig now has a base_file_path field which must be set by the SDK rather than inheriting it from the SyncManager. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
33+
* App::switch_user() no longer returns a user. The return value was always exactly the passed-in user and any code which needs it can just use that. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
34+
35+
### Compatibility
36+
* Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier.
37+
38+
-----------
39+
40+
### Internals
41+
* App metadata storage has been entirely rewritten in preparation for supporting sharing metadata realms between processes. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
42+
* The metadata disabled mode has been replaced with an in-memory metadata mode which performs similarly and doesn't work weirdly differently from the normal mode. The new mode is intended for testing purposes, but should be suitable for production usage if there is a scenario where metadata persistence is not needed. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
43+
* The ownership relationship between App and User has changed. User now strongly retains App and App has a weak cache of Users. This means that creating a SyncConfig or opening a Realm will keep the parent App alive, rather than things being in a broken state if the App is deallocated. ([PR #7300](https://github.com/realm/realm-core/pull/7300).
44+
45+
----------------------------------------------
46+
147
# 14.5.1 Release notes
248

349
### Fixed
@@ -8,6 +54,7 @@
854
### Compatibility
955
* Fileformat: Generates files with format v24. Reads and automatically upgrade from fileformat v10. If you want to upgrade from an earlier file format version you will have to use RealmCore v13.x.y or earlier.
1056

57+
----------------------------------------------
1158
# 14.5.0 Release notes
1259

1360
### Enhancements
@@ -258,7 +305,7 @@
258305
* Fixed a crash with `Assertion failed: m_initiated` during sync session startup ([#7074](https://github.com/realm/realm-core/issues/7074), since v10.0.0).
259306
* Fixed a TSAN violation where the user thread could race to read `m_finalized` with the sync event loop ([#6844](https://github.com/realm/realm-core/issues/6844), since v13.15.1)
260307
* Fix a minor race condition when backing up Realm files before a client reset which could have lead to overwriting an existing file. ([PR #7341](https://github.com/realm/realm-core/pull/7341)).
261-
308+
262309
### Breaking changes
263310
* SyncManager no longer supports reconfiguring after calling reset_for_testing(). SyncManager::configure() has been folded into the constructor, and reset_for_testing() has been renamed to tear_down_for_testing(). ([PR #7351](https://github.com/realm/realm-core/pull/7351))
264311

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This repository holds the source code for the core database component used by al
2020

2121
Realm Core is not in itself an "end-user" product with a publicly stable and supported API.
2222

23-
Refer to the [Realm documentation](https://www.mongodb.com/docs/realm) for information about Realm and using the SDKs.
23+
Refer to the [Atlas Device SDK documentation](https://www.mongodb.com/docs/atlas/device-sdks/) for information about Realm and using the SDKs.
2424

2525
## Building Realm
2626

bindgen/spec.yml

Lines changed: 67 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ enums:
227227
- RecoverOrDiscard
228228

229229
MetadataMode:
230-
cppName: SyncClientConfig::MetadataMode
230+
cppName: app::AppConfig::MetadataMode
231231
values:
232232
- NoEncryption
233233
- Encryption
@@ -288,14 +288,20 @@ enums:
288288
- ClientReset
289289
- ClientResetNoRecovery
290290

291+
SyncFileAction:
292+
cppName: SyncFileAction
293+
values:
294+
- DeleteRealm
295+
- BackUpThenDeleteRealm
296+
291297
ProgressDirection:
292298
cppName: SyncSession::ProgressDirection
293299
values:
294300
- upload
295301
- download
296302

297303
SyncUserState:
298-
cppName: SyncUser::State
304+
cppName: UserState
299305
values:
300306
- LoggedOut
301307
- LoggedIn
@@ -451,7 +457,7 @@ records:
451457
default: false
452458

453459
UserIdentity:
454-
cppName: SyncUserIdentity
460+
cppName: app::UserIdentity
455461
fields:
456462
id:
457463
type: std::string
@@ -593,11 +599,6 @@ records:
593599

594600
SyncClientConfig:
595601
fields:
596-
base_file_path: std::string
597-
metadata_mode:
598-
type: MetadataMode
599-
default: MetadataMode::Encryption
600-
custom_encryption_key: std::optional<EncryptionKey>
601602
logger_factory: Nullable<LoggerFactory>
602603
log_level:
603604
type: LoggerLevel
@@ -656,7 +657,7 @@ records:
656657
body: std::string
657658

658659
DeviceInfo:
659-
cppName: app::App::Config::DeviceInfo
660+
cppName: app::AppConfig::DeviceInfo
660661
fields:
661662
platform_version: std::string
662663
sdk_version: std::string
@@ -668,13 +669,22 @@ records:
668669
bundle_id: std::string
669670

670671
AppConfig:
671-
cppName: app::App::Config
672+
cppName: app::AppConfig
672673
fields:
673674
app_id: std::string
674675
transport: SharedGenericNetworkTransport
675676
base_url: std::optional<std::string>
676677
default_request_timeout_ms: std::optional<uint64_t>
677678
device_info: DeviceInfo
679+
base_file_path: std::string
680+
sync_client_config: SyncClientConfig
681+
metadata_mode:
682+
type: MetadataMode
683+
default: MetadataMode::Encryption
684+
custom_encryption_key: std::optional<EncryptionKey>
685+
security_access_group:
686+
type: std::string
687+
default: ""
678688

679689
CompensatingWriteErrorInfo:
680690
cppName: sync::CompensatingWriteErrorInfo
@@ -1190,36 +1200,49 @@ classes:
11901200
provider: AuthProvider
11911201
provider_as_string: std::string
11921202

1193-
SyncUserSubscriptionToken:
1194-
cppName: SyncUser::Token
1203+
UserSubscriptionToken:
1204+
cppName: app::User::Token
11951205

11961206
SyncUser:
11971207
sharedPtrWrapped: SharedSyncUser
11981208
properties:
1199-
all_sessions: std::vector<SharedSyncSession>
12001209
is_logged_in: bool
1201-
identity: const std::string&
1202-
provider_type: const std::string&
1203-
local_identity: const std::string&
1210+
user_id: std::string
1211+
app_id: std::string
1212+
legacy_identities: std::vector<std::string>
12041213
access_token: std::string
12051214
refresh_token: std::string
1215+
state: SyncUserState
1216+
sync_manager: SharedSyncManager
1217+
methods:
1218+
access_token_refresh_required: bool
1219+
request_log_out: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1220+
request_refresh_user: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1221+
request_refresh_location: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1222+
request_access_token: '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1223+
track_realm: '(std::string_view)'
1224+
create_file_action: '(action: SyncFileAction, original_path: std::string_view, requested_recovery_dir: std::optional<std::string>, partition_value: std::string_view) -> std::string'
1225+
1226+
User:
1227+
base: SyncUser
1228+
cppName: app::User
1229+
sharedPtrWrapped: SharedUser
1230+
properties:
1231+
is_anonymous: bool
12061232
device_id: std::string
12071233
has_device_id: bool
12081234
user_profile: UserProfile
12091235
identities: std::vector<UserIdentity>
12101236
custom_data: std::optional<bson::BsonDocument>
1211-
sync_manager: SharedSyncManager
1212-
state: SyncUserState
12131237
subscribers_count: count_t
1238+
app: SharedApp
12141239
methods:
12151240
log_out: ()
1216-
session_for_on_disk_path: '(path: StringData) -> Nullable<SharedSyncSession>'
1217-
subscribe: '(observer: (user: IgnoreArgument<const SyncUser&>)) -> SyncUserSubscriptionToken'
1218-
unsubscribe: '(token: SyncUserSubscriptionToken)'
1219-
# TODO update methods?
1241+
subscribe: '(observer: (user: IgnoreArgument<const app::User&>)) -> UserSubscriptionToken'
1242+
unsubscribe: '(token: UserSubscriptionToken)'
12201243

12211244
UserProfile:
1222-
cppName: SyncUserProfile
1245+
cppName: app::UserProfile
12231246
methods:
12241247
name: '() -> std::optional<std::string>'
12251248
email: '() -> std::optional<std::string>'
@@ -1240,27 +1263,27 @@ classes:
12401263
sharedPtrWrapped: SharedApp
12411264
properties:
12421265
config: const AppConfig&
1243-
current_user: Nullable<SharedSyncUser>
1244-
all_users: std::vector<SharedSyncUser>
1266+
current_user: Nullable<SharedUser>
1267+
all_users: std::vector<SharedUser>
12451268
sync_manager: SharedSyncManager
12461269
subscribers_count: count_t
12471270
staticMethods:
1248-
get_app: '(mode: AppCacheMode, config: AppConfig, sync_client_config: SyncClientConfig) -> SharedApp'
1271+
get_app: '(mode: AppCacheMode, config: const AppConfig&) -> SharedApp'
12491272
get_cached_app: '(app_id: const std::string&) -> SharedApp'
12501273
clear_cached_apps: ()
12511274
close_all_sync_sessions: ()
12521275

12531276
methods:
1254-
log_in_with_credentials: '(credentials: AppCredentials, cb: AsyncCallback<(user: const Nullable<SharedSyncUser>&, err: std::optional<AppError>)>&&)'
1277+
log_in_with_credentials: '(credentials: AppCredentials, cb: AsyncCallback<(user: const Nullable<SharedUser>&, err: std::optional<AppError>)>&&)'
12551278
log_out:
12561279
- '(cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1257-
- sig: '(user: SharedSyncUser, cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1280+
- sig: '(user: SharedUser, cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
12581281
suffix: user
1259-
refresh_custom_data: '(user: SharedSyncUser, cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1260-
link_user: '(user: SharedSyncUser, credentials: const AppCredentials&, cb: AsyncCallback<(user: const Nullable<SharedSyncUser>&, err: std::optional<AppError>)>&&)'
1261-
switch_user: '(user: SharedSyncUser)'
1262-
remove_user: '(user: SharedSyncUser, cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1263-
delete_user: '(user: SharedSyncUser, cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1282+
refresh_custom_data: '(user: SharedUser, cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1283+
link_user: '(user: SharedUser, credentials: const AppCredentials&, cb: AsyncCallback<(user: const Nullable<SharedUser>&, err: std::optional<AppError>)>&&)'
1284+
switch_user: '(user: SharedUser)'
1285+
remove_user: '(user: SharedUser, cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
1286+
delete_user: '(user: SharedUser, cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
12641287
usernamePasswordProviderClient:
12651288
- sig: () -> UsernamePasswordProviderClient
12661289
cppName: provider_client<app::App::UsernamePasswordProviderClient>
@@ -1270,8 +1293,8 @@ classes:
12701293
push_notification_client: '(service_name: const std::string&) -> PushClient'
12711294
subscribe: '(observer: (app: IgnoreArgument<const App&>)) -> AppSubscriptionToken'
12721295
unsubscribe: '(token: AppSubscriptionToken)'
1273-
call_function: '(user: const SharedSyncUser&, name: std::string, args: EJsonArray, service_name: std::optional<std::string>, cb: AsyncCallback<(result: Nullable<const EJson*>, err: std::optional<AppError>)>)'
1274-
make_streaming_request: '(user: SharedSyncUser, name: std::string, args: bson::BsonArray, service_name: std::optional<std::string>) -> Request'
1296+
call_function: '(user: const SharedUser&, name: std::string, args: EJsonArray, service_name: std::optional<std::string>, cb: AsyncCallback<(result: Nullable<const EJson*>, err: std::optional<AppError>)>)'
1297+
make_streaming_request: '(user: SharedUser, name: std::string, args: bson::BsonArray, service_name: std::optional<std::string>) -> Request'
12751298
update_base_url: '(base_url: std::optional<std::string>, cb: AsyncCallback<(err: std::optional<AppError>)>&&)'
12761299
get_base_url: '() const -> std::string'
12771300

@@ -1288,8 +1311,8 @@ classes:
12881311
PushClient:
12891312
cppName: app::PushClient
12901313
methods:
1291-
register_device: '(registration_token: const std::string&, sync_user: const SharedSyncUser&, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
1292-
deregister_device: '(sync_user: const SharedSyncUser&, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
1314+
register_device: '(registration_token: const std::string&, sync_user: const SharedUser&, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
1315+
deregister_device: '(sync_user: const SharedUser&, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
12931316

12941317
UsernamePasswordProviderClient:
12951318
cppName: app::App::UsernamePasswordProviderClient
@@ -1305,12 +1328,12 @@ classes:
13051328
UserAPIKeyProviderClient:
13061329
cppName: app::App::UserAPIKeyProviderClient
13071330
methods:
1308-
create_api_key: '(name: const std::string&, user: SharedSyncUser, completion: AsyncCallback<(apiKey: UserAPIKey&&, err: std::optional<AppError>)>&&)'
1309-
fetch_api_key: '(id: ObjectId&, user: const SharedSyncUser, completion: AsyncCallback<(apiKey: UserAPIKey&&, err: std::optional<AppError>)>&&)'
1310-
fetch_api_keys: '(user: const SharedSyncUser, completion: AsyncCallback<(apiKeys: std::vector<UserAPIKey>&&, err: std::optional<AppError>)>&&)'
1311-
delete_api_key: '(id: ObjectId&, user: const SharedSyncUser, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
1312-
enable_api_key: '(id: ObjectId&, user: const SharedSyncUser, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
1313-
disable_api_key: '(id: ObjectId&, user: const SharedSyncUser, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
1331+
create_api_key: '(name: const std::string&, user: SharedUser, completion: AsyncCallback<(apiKey: UserAPIKey&&, err: std::optional<AppError>)>&&)'
1332+
fetch_api_key: '(id: ObjectId&, user: const SharedUser, completion: AsyncCallback<(apiKey: UserAPIKey&&, err: std::optional<AppError>)>&&)'
1333+
fetch_api_keys: '(user: const SharedUser, completion: AsyncCallback<(apiKeys: std::vector<UserAPIKey>&&, err: std::optional<AppError>)>&&)'
1334+
delete_api_key: '(id: ObjectId&, user: const SharedUser, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
1335+
enable_api_key: '(id: ObjectId&, user: const SharedUser, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
1336+
disable_api_key: '(id: ObjectId&, user: const SharedUser, completion: AsyncCallback<(err: std::optional<AppError>)>&&)'
13141337

13151338
# See Helpers::make_loger_factory to construct one.
13161339
# Using an opaque class here rather than exposing the factory to avoid having to
@@ -1327,16 +1350,15 @@ classes:
13271350
log_level: LoggerLevel
13281351
has_existing_sessions: bool
13291352
methods:
1330-
immediately_run_file_actions: '(original_name: std::string) -> bool'
13311353
set_session_multiplexing: '(allowed: bool)'
13321354
set_log_level: '(level: LoggerLevel)'
13331355
set_logger_factory: '(factory: LoggerFactory)'
13341356
set_user_agent: '(user_agent: std::string)'
13351357
set_timeouts: '(timeouts: SyncClientTimeouts)'
13361358
reconnect: ()
13371359
wait_for_sessions_to_terminate: ()
1338-
path_for_realm: '(config: SyncConfig, custom_file_name: std::optional<std::string>) -> StringData'
13391360
get_existing_active_session: '(path: const std::string&) -> SharedSyncSession'
1361+
get_all_sessions_for: '(user: const SyncUser&) -> std::vector<SharedSyncSession>'
13401362

13411363
ThreadSafeReference: {}
13421364
AsyncOpenTask:

0 commit comments

Comments
 (0)