Skip to content

Commit

Permalink
Update realm-core to v13.1.0 (#1042)
Browse files Browse the repository at this point in the history
* Update realm-core to v13.1.0

* Update CHANGELOG

* Small changes to CHANGELOG
  • Loading branch information
nielsenko authored Nov 25, 2022
1 parent d9d04e1 commit 9e887f4
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 130 deletions.
19 changes: 14 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,29 @@
**This project is in Release Candidate stage.**

### Breaking Changes
* None
* File format version bumped.
* The layout of the lock-file has changed, the lock file format version is bumped and all participants in a multiprocess scenario needs to be up to date so they expect the same format. This requires an update of Studio. (Core upgrade)

### Enhancements
* Support setting `maxNumberOfActiveVersions` when creating a `Configuration`. ([#1036](https://github.com/realm/realm-dart/pull/1036))
* Add List.move extension method that moves an element from one index to another. Delegates to ManagedRealmList.move for managed lists. This allows notifications to correctly report moves, as opposed to reporting moves as deletes + inserts. ([#1037](https://github.com/realm/realm-dart/issues/1037))

### Fixed
* Support mapping into `SyncSessionErrorCode` for "Compensating write" with error code 231. ([#1022](https://github.com/realm/realm-dart/pull/1022))
* Errors from core will be raised correctly for `beginWriteAsync` and `commitAsync`. ([#1042](https://github.com/realm/realm-dart/pull/1042))
* The realm file will be shrunk if the larger file size is no longer needed. (Core upgrade)
* Most of the file growth caused by version pinning is eliminated. (Core upgrade)
* Fetching a user's profile while the user logs out would result in an assertion failure. (Core upgrade)
* Removed the ".tmp_compaction_space" file being left over after compacting a Realm on Windows. (Core upgrade).
* Restore fallback to full barrier when F_BARRIERSYNC is not available on Apple platforms. (Core upgrade, since v0.8.0+rc)
* Fixed wrong assertion on query error that could result in a crash. (Core upgrade)

### Compatibility
* Realm Studio: 12.0.0 or later.
* Realm Studio: 13.0.0 or later.
* Fileformat: Generates files with format v23. Reads and automatically upgrades from fileformat v5.

### Internal
* Using Core 12.12.0.
* Using Core 13.1.0.

## 0.8.0+rc (2022-11-14)

Expand All @@ -35,7 +44,7 @@
* Realm Studio: 12.0.0 or later.

### Internal
* Using Core 12.12.0. ([#1025](https://github.com/realm/realm-dart/pull/1025))
* Using Core 12.12.0.

## 0.7.0+rc (2022-11-04)

Expand Down Expand Up @@ -88,7 +97,7 @@
* Realm Studio: 12.0.0 or later.

### Internal
* Using Core 12.11.0. ([#988](https://github.com/realm/realm-dart/pull/988))
* Using Core 12.11.0.

## 0.6.0+beta (2022-10-21)

Expand Down
174 changes: 82 additions & 92 deletions lib/src/native/realm_bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1672,33 +1672,41 @@ class RealmLibrary {
realm_free_userdata_func_t)>();

/// start a new write transaction asynchronously for the realm passed as argument.
int realm_async_begin_write(
bool realm_async_begin_write(
ffi.Pointer<realm_t> realm,
realm_async_begin_write_func_t arg1,
ffi.Pointer<ffi.Void> userdata,
realm_free_userdata_func_t userdata_free,
bool notify_only,
ffi.Pointer<ffi.UnsignedInt> transaction_id,
) {
return _realm_async_begin_write(
realm,
arg1,
userdata,
userdata_free,
notify_only,
transaction_id,
);
}

late final _realm_async_begin_writePtr = _lookup<
ffi.NativeFunction<
ffi.UnsignedInt Function(
ffi.Bool Function(
ffi.Pointer<realm_t>,
realm_async_begin_write_func_t,
ffi.Pointer<ffi.Void>,
realm_free_userdata_func_t,
ffi.Bool)>>('realm_async_begin_write');
ffi.Bool,
ffi.Pointer<ffi.UnsignedInt>)>>('realm_async_begin_write');
late final _realm_async_begin_write = _realm_async_begin_writePtr.asFunction<
int Function(ffi.Pointer<realm_t>, realm_async_begin_write_func_t,
ffi.Pointer<ffi.Void>, realm_free_userdata_func_t, bool)>();
bool Function(
ffi.Pointer<realm_t>,
realm_async_begin_write_func_t,
ffi.Pointer<ffi.Void>,
realm_free_userdata_func_t,
bool,
ffi.Pointer<ffi.UnsignedInt>)>();

/// Cancel the transaction referenced by the token passed as argument and set the optional boolean flag in order to
/// inform the caller if the transaction was cancelled.
Expand All @@ -1722,33 +1730,41 @@ class RealmLibrary {
bool Function(ffi.Pointer<realm_t>, int, ffi.Pointer<ffi.Bool>)>();

/// commit a transaction asynchronously for the realm passed as argument.
int realm_async_commit(
bool realm_async_commit(
ffi.Pointer<realm_t> realm,
realm_async_commit_func_t arg1,
ffi.Pointer<ffi.Void> userdata,
realm_free_userdata_func_t userdata_free,
bool allow_grouping,
ffi.Pointer<ffi.UnsignedInt> transaction_id,
) {
return _realm_async_commit(
realm,
arg1,
userdata,
userdata_free,
allow_grouping,
transaction_id,
);
}

late final _realm_async_commitPtr = _lookup<
ffi.NativeFunction<
ffi.UnsignedInt Function(
ffi.Bool Function(
ffi.Pointer<realm_t>,
realm_async_commit_func_t,
ffi.Pointer<ffi.Void>,
realm_free_userdata_func_t,
ffi.Bool)>>('realm_async_commit');
ffi.Bool,
ffi.Pointer<ffi.UnsignedInt>)>>('realm_async_commit');
late final _realm_async_commit = _realm_async_commitPtr.asFunction<
int Function(ffi.Pointer<realm_t>, realm_async_commit_func_t,
ffi.Pointer<ffi.Void>, realm_free_userdata_func_t, bool)>();
bool Function(
ffi.Pointer<realm_t>,
realm_async_commit_func_t,
ffi.Pointer<ffi.Void>,
realm_free_userdata_func_t,
bool,
ffi.Pointer<ffi.UnsignedInt>)>();

void realm_async_open_task_cancel(
ffi.Pointer<realm_async_open_task_t> arg0,
Expand All @@ -1765,7 +1781,8 @@ class RealmLibrary {
late final _realm_async_open_task_cancel = _realm_async_open_task_cancelPtr
.asFunction<void Function(ffi.Pointer<realm_async_open_task_t>)>();

int realm_async_open_task_register_download_progress_notifier(
ffi.Pointer<realm_async_open_task_progress_notification_token_t>
realm_async_open_task_register_download_progress_notifier(
ffi.Pointer<realm_async_open_task_t> arg0,
realm_sync_progress_func_t arg1,
ffi.Pointer<ffi.Void> userdata,
Expand All @@ -1782,15 +1799,15 @@ class RealmLibrary {
late final _realm_async_open_task_register_download_progress_notifierPtr =
_lookup<
ffi.NativeFunction<
ffi.Uint64 Function(
ffi.Pointer<realm_async_open_task_progress_notification_token_t> Function(
ffi.Pointer<realm_async_open_task_t>,
realm_sync_progress_func_t,
ffi.Pointer<ffi.Void>,
realm_free_userdata_func_t)>>(
'realm_async_open_task_register_download_progress_notifier');
late final _realm_async_open_task_register_download_progress_notifier =
_realm_async_open_task_register_download_progress_notifierPtr.asFunction<
int Function(
ffi.Pointer<realm_async_open_task_progress_notification_token_t> Function(
ffi.Pointer<realm_async_open_task_t>,
realm_sync_progress_func_t,
ffi.Pointer<ffi.Void>,
Expand Down Expand Up @@ -1825,27 +1842,6 @@ class RealmLibrary {
ffi.Pointer<ffi.Void>,
realm_free_userdata_func_t)>();

void realm_async_open_task_unregister_download_progress_notifier(
ffi.Pointer<realm_async_open_task_t> arg0,
int token,
) {
return _realm_async_open_task_unregister_download_progress_notifier(
arg0,
token,
);
}

late final _realm_async_open_task_unregister_download_progress_notifierPtr =
_lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<realm_async_open_task_t>, ffi.Uint64)>>(
'realm_async_open_task_unregister_download_progress_notifier');
late final _realm_async_open_task_unregister_download_progress_notifier =
_realm_async_open_task_unregister_download_progress_notifierPtr
.asFunction<
void Function(ffi.Pointer<realm_async_open_task_t>, int)>();

ffi.Pointer<ffi.Void> realm_attach_finalizer(
Object handle,
ffi.Pointer<ffi.Void> realmPtr,
Expand Down Expand Up @@ -7675,6 +7671,28 @@ class RealmLibrary {
bool Function(
ffi.Pointer<realm_set_t>, ffi.Pointer<realm_value_t>, int)>();

/// Register a callback handler for bindings interested in registering callbacks before/after the ObjectStore thread
/// runs.
/// @param thread_observer a ptr to an implementation class that can receive these notifications. If nullptr is passed
/// instead, this will have the effect of unregistering the callback.
void realm_set_binding_callback_thread_observer(
ffi.Pointer<realm_interface_callback_thread_observer_t> thread_observer,
) {
return _realm_set_binding_callback_thread_observer(
thread_observer,
);
}

late final _realm_set_binding_callback_thread_observerPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<realm_interface_callback_thread_observer_t>)>>(
'realm_set_binding_callback_thread_observer');
late final _realm_set_binding_callback_thread_observer =
_realm_set_binding_callback_thread_observerPtr.asFunction<
void Function(
ffi.Pointer<realm_interface_callback_thread_observer_t>)>();

/// Clear a set of values.
///
/// @return True if no exception occurred.
Expand Down Expand Up @@ -9040,8 +9058,9 @@ class RealmLibrary {

/// Register a callback that will be invoked every time the session's connection state changes.
///
/// @return A token value that can be used to unregiser the callback.
int realm_sync_session_register_connection_state_change_callback(
/// @return a notification token object. Dispose it to stop receiving notifications.
ffi.Pointer<realm_sync_session_connection_state_notification_token_t>
realm_sync_session_register_connection_state_change_callback(
ffi.Pointer<realm_sync_session_t> arg0,
realm_sync_connection_state_changed_func_t arg1,
ffi.Pointer<ffi.Void> userdata,
Expand All @@ -9058,20 +9077,19 @@ class RealmLibrary {
late final _realm_sync_session_register_connection_state_change_callbackPtr =
_lookup<
ffi.NativeFunction<
ffi.Uint64 Function(
ffi.Pointer<realm_sync_session_connection_state_notification_token_t> Function(
ffi.Pointer<realm_sync_session_t>,
realm_sync_connection_state_changed_func_t,
ffi.Pointer<ffi.Void>,
realm_free_userdata_func_t)>>(
'realm_sync_session_register_connection_state_change_callback');
late final _realm_sync_session_register_connection_state_change_callback =
_realm_sync_session_register_connection_state_change_callbackPtr
.asFunction<
int Function(
ffi.Pointer<realm_sync_session_t>,
realm_sync_connection_state_changed_func_t,
ffi.Pointer<ffi.Void>,
realm_free_userdata_func_t)>();
_realm_sync_session_register_connection_state_change_callbackPtr.asFunction<
ffi.Pointer<realm_sync_session_connection_state_notification_token_t> Function(
ffi.Pointer<realm_sync_session_t>,
realm_sync_connection_state_changed_func_t,
ffi.Pointer<ffi.Void>,
realm_free_userdata_func_t)>();

/// Register a callback that will be invoked every time the session reports progress.
///
Expand All @@ -9080,8 +9098,9 @@ class RealmLibrary {
/// Otherwise, the number of downloaded or uploaded bytes will always be reported
/// relative to the number of downloadable or uploadable bytes at the point in time
/// when the notifier was registered.
/// @return A token value that can be used to unregiser the notifier.
int realm_sync_session_register_progress_notifier(
/// @return a notification token object. Dispose it to stop receiving notifications.
ffi.Pointer<realm_sync_session_connection_state_notification_token_t>
realm_sync_session_register_progress_notifier(
ffi.Pointer<realm_sync_session_t> arg0,
realm_sync_progress_func_t arg1,
int arg2,
Expand All @@ -9101,7 +9120,7 @@ class RealmLibrary {

late final _realm_sync_session_register_progress_notifierPtr = _lookup<
ffi.NativeFunction<
ffi.Uint64 Function(
ffi.Pointer<realm_sync_session_connection_state_notification_token_t> Function(
ffi.Pointer<realm_sync_session_t>,
realm_sync_progress_func_t,
ffi.Int32,
Expand All @@ -9111,7 +9130,7 @@ class RealmLibrary {
'realm_sync_session_register_progress_notifier');
late final _realm_sync_session_register_progress_notifier =
_realm_sync_session_register_progress_notifierPtr.asFunction<
int Function(
ffi.Pointer<realm_sync_session_connection_state_notification_token_t> Function(
ffi.Pointer<realm_sync_session_t>,
realm_sync_progress_func_t,
int,
Expand All @@ -9137,50 +9156,6 @@ class RealmLibrary {
late final _realm_sync_session_resume = _realm_sync_session_resumePtr
.asFunction<void Function(ffi.Pointer<realm_sync_session_t>)>();

/// Unregister a callback that will be invoked every time the session's connection state changes.
/// @param session ptr to a valid sync session
/// @param token the token returned by `realm_sync_session_register_connection_state_change_callback`
void realm_sync_session_unregister_connection_state_change_callback(
ffi.Pointer<realm_sync_session_t> session,
int token,
) {
return _realm_sync_session_unregister_connection_state_change_callback(
session,
token,
);
}

late final _realm_sync_session_unregister_connection_state_change_callbackPtr =
_lookup<
ffi.NativeFunction<
ffi.Void Function(
ffi.Pointer<realm_sync_session_t>, ffi.Uint64)>>(
'realm_sync_session_unregister_connection_state_change_callback');
late final _realm_sync_session_unregister_connection_state_change_callback =
_realm_sync_session_unregister_connection_state_change_callbackPtr
.asFunction<void Function(ffi.Pointer<realm_sync_session_t>, int)>();

/// Unregister a callback that will be invoked every time the session reports progress.
/// @param session ptr to a valid sync session
/// @param token the token returned by `realm_sync_session_register_progress_notifier`
void realm_sync_session_unregister_progress_notifier(
ffi.Pointer<realm_sync_session_t> session,
int token,
) {
return _realm_sync_session_unregister_progress_notifier(
session,
token,
);
}

late final _realm_sync_session_unregister_progress_notifierPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<realm_sync_session_t>,
ffi.Uint64)>>('realm_sync_session_unregister_progress_notifier');
late final _realm_sync_session_unregister_progress_notifier =
_realm_sync_session_unregister_progress_notifierPtr
.asFunction<void Function(ffi.Pointer<realm_sync_session_t>, int)>();

/// Register a callback that will be invoked when all pending downloads have completed.
void realm_sync_session_wait_for_download_completion(
ffi.Pointer<realm_sync_session_t> arg0,
Expand Down Expand Up @@ -10358,6 +10333,11 @@ typedef realm_async_open_task_completion_func_t = ffi.Pointer<
ffi.Pointer<ffi.Void>,
ffi.Pointer<realm_thread_safe_reference_t>,
ffi.Pointer<realm_async_error_t>)>>;

class realm_async_open_task_progress_notification_token extends ffi.Opaque {}

typedef realm_async_open_task_progress_notification_token_t
= realm_async_open_task_progress_notification_token;
typedef realm_async_open_task_t = realm_async_open_task;

abstract class realm_auth_provider {
Expand All @@ -10382,6 +10362,8 @@ class realm_binary extends ffi.Struct {

typedef realm_binary_t = realm_binary;

class realm_callback_interface_thread_observer extends ffi.Opaque {}

class realm_callback_token extends ffi.Opaque {}

typedef realm_callback_token_t = realm_callback_token;
Expand Down Expand Up @@ -10639,6 +10621,8 @@ class realm_index_range extends ffi.Struct {
}

typedef realm_index_range_t = realm_index_range;
typedef realm_interface_callback_thread_observer_t
= realm_callback_interface_thread_observer;

class realm_key_path extends ffi.Struct {
@ffi.Size()
Expand Down Expand Up @@ -11153,6 +11137,12 @@ typedef realm_sync_progress_func_t = ffi.Pointer<

class realm_sync_session extends ffi.Opaque {}

class realm_sync_session_connection_state_notification_token
extends ffi.Opaque {}

typedef realm_sync_session_connection_state_notification_token_t
= realm_sync_session_connection_state_notification_token;

abstract class realm_sync_session_resync_mode {
static const int RLM_SYNC_SESSION_RESYNC_MODE_MANUAL = 0;
static const int RLM_SYNC_SESSION_RESYNC_MODE_DISCARD_LOCAL = 1;
Expand Down
Loading

0 comments on commit 9e887f4

Please sign in to comment.