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

Implement RefreshAsync in native #2995

Merged
merged 9 commits into from
Dec 13, 2022
Merged

Implement RefreshAsync in native #2995

merged 9 commits into from
Dec 13, 2022

Conversation

nirinchev
Copy link
Member

@nirinchev nirinchev commented Aug 16, 2022

Description

Related to realm/realm-core#5246

TODO

  • Changelog entry
  • Tests (if applicable)

@cla-bot cla-bot bot added the cla: yes label Aug 16, 2022

try
{
var didRegister = NativeMethods.refresh_async(this, GCHandle.ToIntPtr(tcsHandle), out var ex);

Check notice

Code scanning / CodeQL

Calls to unmanaged code

Replace this call with a call to managed code if possible.
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "shared_realm_get_subscriptions_version", CallingConvention = CallingConvention.Cdecl)]
public static extern Int64 get_subscriptions_version(SharedRealmHandle realm, out NativeException ex);

[DllImport(InteropConfig.DLL_NAME, EntryPoint = "shared_realm_refresh_async", CallingConvention = CallingConvention.Cdecl)]
public static extern bool refresh_async(SharedRealmHandle realm, IntPtr tcs_handle, out NativeException ex);

Check notice

Code scanning / CodeQL

Unmanaged code

Minimise the use of unmanaged code.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2871119489

  • 17 of 17 (100.0%) changed or added relevant lines in 2 files are covered.
  • 7 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.08%) to 83.557%

Files with Coverage Reduction New Missed Lines %
Realm/Realm/Exceptions/RealmException.cs 2 43.16%
Realm/Realm/Realm.cs 2 90.6%
Realm/Realm/Handles/SessionHandle.cs 3 87.17%
Totals Coverage Status
Change from base Build 2871087372: -0.08%
Covered Lines: 5870
Relevant Lines: 6909

💛 - Coveralls

@nirinchev nirinchev marked this pull request as ready for review December 1, 2022 10:44
@nirinchev nirinchev self-assigned this Dec 1, 2022
@nirinchev nirinchev requested review from papafe, LaPeste and fealebenpae and removed request for papafe December 1, 2022 14:09
{
HandleTaskCompletion(tcs_ptr, () => (object)true, ex);
}, null);
// The task awaiting on this tcs should only continue once the native method Realm::run_writes has finished to run.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generalize this comment a little

}

private:
std::map<uint64_t, std::pair<uint64_t, void*>> m_tcs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::map<uint64_t, std::pair<uint64_t, void*>> m_tcs;
std::map<uint64_t, std::pair<DB::version_type, void*>> m_tcs;

@nirinchev nirinchev merged commit ace5ce5 into main Dec 13, 2022
@nirinchev nirinchev deleted the ni/refresh-async branch December 13, 2022 12:52
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants