-
Notifications
You must be signed in to change notification settings - Fork 221
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 register_with_sync_manager for places #4617
Comments
This sounds fine, but it might even be possible to go further before the uniffi work is ready - particularly if what you outline end up being a bit of a problem. If we take inspiration from the metadata functions, we could add, say, |
After trying to implement this I realize there's an underlying issues that needs to be resolved first: places tends to use regular refs, with lifetimes, while the other components use
So I think we should try to refactor things to use
What do you all think about the plan? I guess the question is how does migrating to |
It thought about this one some more and I think there's a fairly straightforward way to evolve this code. I laid out the overall plan and implemented the first step in #4627 |
- Changed the bookmarks/history sync engines to use an Arc<Mutex<PlacesDb>>, which matches the other engines better - Made these sync engines create their own `SqlInterruptScope`. The interrupt code is still not working, but I think this is the direction we want to go for mozilla#1684. If not, it should be easy to replace. - Removed the old `PlacesApi.open_sync_connection()` method and replaced it with the new `get_sync_connection()` method - Lots of unit test updates. I didn't take the time to understand these fully. I just made changes until it compiled, didn't deadlock, and passed.
- Changed the bookmarks/history sync engines to use an Arc<Mutex<PlacesDb>>, which matches the other engines better - Made these sync engines create their own `SqlInterruptScope`. The interrupt code is still not working, but I think this is the direction we want to go for mozilla#1684. If not, it should be easy to replace. - Updated the `PlacesApi` syncing code to use the new sync engines. One thing to note here is that the SyncManager has its own system of managing the global state, so the fact that those methods update it outside of the Mutex lock that the `SyncEngine` takes is not a problem. - Updated the importer code to use the new `get_sync_connection()` method. The only difference here is that the importer code needs to lock the mutex, this replaces the old system where `open_sync_connection()` would return an error if a previously returned connection was still alive. - Removed the old `PlacesApi.open_sync_connection()` method and replaced it with the new `get_sync_connection()` method - Lots of unit test updates. I didn't take the time to understand these fully. I just made changes until it compiled, didn't deadlock, and passed.
- Changed the bookmarks/history sync engines to use an Arc<Mutex<PlacesDb>>, which matches the other engines better - Made these sync engines create their own `SqlInterruptScope`. The interrupt code is still not working, but I think this is the direction we want to go for mozilla#1684. If not, it should be easy to replace. - Updated the `PlacesApi` syncing code to use the new sync engines. One thing to note here is that the SyncManager has its own system of managing the global state, so the fact that those methods update it outside of the Mutex lock that the `SyncEngine` takes is not a problem. - Updated the importer code to use the new `get_sync_connection()` method. The only difference here is that the importer code needs to lock the mutex, this replaces the old system where `open_sync_connection()` would return an error if a previously returned connection was still alive. - Removed the old `PlacesApi.open_sync_connection()` method and replaced it with the new `get_sync_connection()` method - Lots of unit test updates. I didn't take the time to understand these fully. I just made changes until it compiled, didn't deadlock, and passed.
- Changed the bookmarks/history sync engines to use an Arc<Mutex<PlacesDb>>, which matches the other engines better - Made these sync engines create their own `SqlInterruptScope`. The interrupt code is still not working, but I think this is the direction we want to go for mozilla#1684. If not, it should be easy to replace. - Updated the `PlacesApi` syncing code to use the new sync engines. One thing to note here is that the SyncManager has its own system of managing the global state, so the fact that those methods update it outside of the Mutex lock that the `SyncEngine` takes is not a problem. - Updated the importer code to use the new `get_sync_connection()` method. The only difference here is that the importer code needs to lock the mutex, this replaces the old system where `open_sync_connection()` would return an error if a previously returned connection was still alive. - Removed the old `PlacesApi.open_sync_connection()` method and replaced it with the new `get_sync_connection()` method - Lots of unit test updates. I didn't take the time to understand these fully. I just made changes until it compiled, didn't deadlock, and passed.
- Changed the bookmarks/history sync engines to use an Arc<Mutex<PlacesDb>>, which matches the other engines better - Made these sync engines create their own `SqlInterruptScope`. The interrupt code is still not working, but I think this is the direction we want to go for mozilla#1684. If not, it should be easy to replace. - Updated the `PlacesApi` syncing code to use the new sync engines. One thing to note here is that the SyncManager has its own system of managing the global state, so the fact that those methods update it outside of the Mutex lock that the `SyncEngine` takes is not a problem. - Updated the importer code to use the new `get_sync_connection()` method. The only difference here is that the importer code needs to lock the mutex, this replaces the old system where `open_sync_connection()` would return an error if a previously returned connection was still alive. - Removed the old `PlacesApi.open_sync_connection()` method and replaced it with the new `get_sync_connection()` method - Lots of unit test updates. I didn't take the time to understand these fully. I just made changes until it compiled, didn't deadlock, and passed.
- Changed the bookmarks/history sync engines to use an Arc<Mutex<PlacesDb>>, which matches the other engines better - Made these sync engines create their own `SqlInterruptScope`. The interrupt code is still not working, but I think this is the direction we want to go for #1684. If not, it should be easy to replace. - Updated the `PlacesApi` syncing code to use the new sync engines. One thing to note here is that the SyncManager has its own system of managing the global state, so the fact that those methods update it outside of the Mutex lock that the `SyncEngine` takes is not a problem. - Updated the importer code to use the new `get_sync_connection()` method. The only difference here is that the importer code needs to lock the mutex, this replaces the old system where `open_sync_connection()` would return an error if a previously returned connection was still alive. - Removed the old `PlacesApi.open_sync_connection()` method and replaced it with the new `get_sync_connection()` method - Lots of unit test updates. I didn't take the time to understand these fully. I just made changes until it compiled, didn't deadlock, and passed.
Make places use
register_with_sync_manager
like the other components do. This will require a bit of care, since we are going to be doing UniFFI work for both places and sync-manager at the same time. Here's how I think it could work:PlacesApi.register_with_sync_manager
setPlaces
callregister_with_sync_manager
registerWithSyncManager
in the UniFFI APIregisterWithSyncManager
and delete theSyncManager.setPlaces
method.┆Issue is synchronized with this Jira Task
┆epic: Uniffi Sync Manager
┆sprintEndDate: 2021-12-10
The text was updated successfully, but these errors were encountered: