[−][src]Function places::import::ios_bookmarks::import_ios_bookmarks
pub fn import_ios_bookmarks(
places_api: &PlacesApi,
path: impl AsRef<Path>
) -> Result<()>
This import is used for iOS sync users migrating from browser.db
-based
bookmark storage to the new rust-places store.
It is only used for users who are not connected to sync, as syncing bookmarks will go through a more reliable, robust, and well-tested path, and will migrate things that are unavailable on iOS due to the unfortunate history of iOS bookmark sync (accurate last modified times, for example).
As a result, the goals of this import are as follows:
-
Any locally created items must be persisted.
-
Any items from remote machines that are visible to the user must be persisted. (Note: before writing this, most of us believed that iOS wiped its view of remote bookmarks on sync sign-out. Apparently it does not, and its unclear if it ever did).
Additionally, it's worth noting that we assume that the iOS tree is
relatively well-formed. We do leverage dogear
for the merge, to avoid
anything absurd, but for the most part the validation is fairly loose. If we
see anything we don't like (URL we don't allow, for example), we skip it.
Unsupported features
As such, the following things are explicitly not imported:
- Livemarks: We don't support them in our database anyway.
- Tombstones: This shouldn't matter for non-sync users.
- Queries: Not displayed or creatable in iOS UI, and only half-supported in this database.
Some of this (queries, really) is a little unfortunate, since it's theoretically possible for someone to care, but this should only happen for users:
- Who once used sync, but no longer do.
- Who used this feature when they used sync.
- Who no longer have access to any firefoxes from when they were sync users, other than this iOS device.
For these users, upon signing into sync once again, they will lose the data in question.
Basic process
- Attach the iOS database.
- Slurp records into a temp table "iosBookmarksStaging" from iOS database.
- This is mostly done for convenience, and some performance benefits over
using a view or reading things into Rust (we'd rather not have to go
through
IncomingApplicator
, since it would require us forgesync15::Payload
s with this data).
- This is mostly done for convenience, and some performance benefits over
using a view or reading things into Rust (we'd rather not have to go
through
- Add any entries to moz_places that are needed (in practice, they'll all be needed, we don't yet store history for iOS).
- Fill mirror using iosBookmarksStaging.
- Fill mirror with tags from iosBookmarksStaging.
- Fill mirror structure using both iOS database and iosBookmarksStaging.
- Run dogear merge
- Use iosBookmarksStaging to fixup the data that was actually inserted.
- Update frecency for new items.
- Cleanup (Delete mirror and mirror structure, detach iOS database, etc).