Граф коммитов

41 Коммитов

Автор SHA1 Сообщение Дата
Ben Dean-Kawamura 7625a2cecc Switch to UniFFI library mode
This removes the need for a lot configuration in our `uniffi.toml`
files.
2024-09-18 20:31:35 +00:00
Alexander Cyon d73a4c7a45 Typos 2024-05-24 20:17:12 +00:00
Mark Hammond f538529f15 Update a number of crate package versions.
This was largely done manually to try and bring app-services and
mozilla-central closer together. With this patch we can vendor
into mozilla-central, including when most of our mobile crates are
built into libxul in the Android monorepo, oak.

This patch also re-forks find-places-db to avoid using a now orhpaned
crate which no mozilla staff had access to update.
2024-02-06 15:43:45 +00:00
Ben Dean-Kawamura 8d1cf0f5e9 Updating the criterion version
The old version conflicted with some other changes I'm working on, so
let's upgrade it.
2023-12-20 21:01:46 +00:00
Mark Hammond 0c2109c89d Move rusqlite/libslite3-sys to workspace dependencies 2023-12-13 15:53:26 +00:00
Sammy Khamis 8a23472daa Refactor VisitTransition to be VisitType 2023-10-16 21:13:39 +00:00
Tarik Eshaq ffb06acd44 Updates rusqlite to 0.29.0 and libsqlite to 0.26.0 2023-06-13 01:11:26 +00:00
Ben Dean-Kawamura b3a573164e Clippy and check-dependency fixes 2023-01-27 15:32:17 -05:00
Tarik Eshaq b8ba517115
remove iOS bookmarks migration code (#5276)
* Removes old iOS bookmarks migration code

* Adds changelog

* Fixes cargo clippy
2023-01-04 17:53:31 -05:00
Tarik Eshaq 43b5269403
Adds a 10,000 visit limit to the history migration (#5310)
* Implements limiting visits migrated to 10000

* adds changelog

* Improves test performance
2023-01-04 13:58:00 -05:00
Mark Hammond ba67a665dd
Update rusqlite to 0.28.0 (#5282) 2022-12-08 15:01:25 +11:00
Mark Hammond 61952065d1
Remove the not-quite-functional test-utils feature from sync15 (#5275)
When doing #5139 I tried to have a test-utils feature for sync15,
which didn't really work out for various reasons but it was left in.

Currently `cargo test -p sync15 --features=sync-client` fails, although
CI doesn't every run that (it runs with default and all features)

This PR kills that feature entirely.
2022-12-06 10:42:52 +11:00
Mark Hammond eb804faf80
Update sync15 BSO concept to use envelopes and kill sync15::Payload. (#5139)
Reworks how BSOs work in all syncable components.

This adopts some of the BridgedEngine model - specifically, there's now
an IncomingBso and OutgoingBso, each with a corresponding IncomingEnvelope
and OutgoingEnvelope. There's also a new formalized "content" mechanism
for serializing and deserializing payloads to and from some T, with a
sane and consistent procedure for handling tomebstones and malformed
records.

BridgedEngine and SyncEngine now work using these new types, getting us
closer to fully integrating these engines into a single trait.

This kills sync15::Payload entirely in favor of the new system.
2022-12-02 11:31:06 +11:00
Tarik Eshaq e15122cec7
Removes fennec migration code (#5268) 2022-12-01 17:06:17 -05:00
Ben Dean-Kawamura 8f9d0d365c Make places metrics more fine-grained (#5246)
Added `execute_one()` method to `ConnExt`.  I've wanted this a few times
before, but it's really nice for this new code.
2022-11-17 18:28:53 -05:00
Ben Dean-Kawamura 01aeb370c3 Further reworked the places errors
- Renamed `PlacesInternalError` to `Error` because it seems more
  idiomatic
- Renamed `PlacesError` to `PlacesApiError` to make it consistent with
  the logins errors.  I considered just calling this `ApiError` but I
  thought that would be confusing for consumers since they won't always
  have the `places::` prefix before the class name.
- Removed `JsonError`, which seems like it was unusped
- Merged `InternalError` into `UnexpectedPlacesException`
- Merged `UrlTooLong` into `UrlParseFailed` for `PlacesApiError`
- Merged `InvalidBookmarkUpdate`, `CannotUpdateRoot`, `InvalidParent`
  into `InvalidBookmarkOperation` for `PlacesApiError`

Use the fielded style for `PlacesApiError` in places.udl.  Updated
`PlacesApiError` to use named fields to be compatible with this.

On swift renamed `PlacesApiError`, which was defined on top of the
normal errors to `PlacesConnectionError`.
2022-10-27 18:37:45 -04:00
Ben Dean-Kawamura 1c4093bb3d Refactored places to use the new error handling system
Replaced the error_support method with the new system that consists of:
  - `PlacesInternalError`: used internally in the crate.  This replaces
    the old `ErrorKind` enum and is the error for `Result<>`.
  - `PlacesError`: used for external errors that we return to UniFFI
    consumers.  This replaces the old `Error` enum and is the error for
    `ApiResult<>`
  - A `GetErrorHandling` impl to convert internal errors to external
    errors and report to sentry.  For now, I tried to make the sentry
    error reporting more-or-less match the old error reporting, which
    means reporting lots of internal errors.  The plan is going to be to
    check sentry and most likely turn some of those into logs rather
    than errors.

Reworked all top-level API methods to return `PlacesApiResults` and use
the `handle_error!` macro to do the error conversion/reporting.

Use `thiserror` to handle converting errors from other crates into
`PlacesInternalError`.
2022-10-20 09:05:59 -04:00
Tarik Eshaq 0d420f1895
Fixes missing titles in iOS history migration (#5182)
* Fixes missing titles

* Adds test for title recovery

* Uses a different transaction for running the frecency update

* Fix clippy

* Uses proper transactions
2022-10-17 20:55:56 -07:00
Tarik Eshaq 1094f87f24
Adds ios history migration and example (#5077)
* Adds ios history migration and example

* Exposes history migration function to iOS

* Adds changelog

* Adds basic test case for migration

* Moves timestamp computation to places

* Adds sync last timestamp
2022-09-15 15:15:06 -07:00
Mark Hammond d8503475f4
Merge sync15-traits back into sync15 via features. (#5125) 2022-09-15 11:09:04 +10:00
Ben Dean-Kawamura 46c31af855 Adding history pruning (#5011)
Added parameter to `run_maintanance()` to allow applications to request a maximum DB size and
prune the database if it's bigger than that.

Added code to find the best visits to prune and delete them.
2022-07-28 17:49:25 -04:00
Mark Hammond 627426f567
Depend on parking_lot 0.11 or 0.12 so app-services and mozilla-central can use different versions (#4962) 2022-05-20 11:03:16 +10:00
Emilio Cobos Álvarez 5ad5931c2d
Follow-up to #4933: Remove tempdir, use tempfile instead. (#4935)
tempdir is unmaintained and uses an outdated version of rand. We already
depend on tempfile.
2022-05-02 20:15:12 -07:00
Tarik Eshaq f7c5588b1e
Update rand and parking lot (#4937)
* Update rand and parking_lot.

I need this to update other Gecko dependencies.

* Update dependency_summary to account for various windows-rs crates.

I'm not sure why it wasn't failing to find the relevant licenses before,
it was likely a pre-existing issue.

* Update dependency summaries.

* Runs dependency summaries on a mac

Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>
2022-05-02 17:18:12 -07:00
Thom Chiovoloni f8f3589be3
Update everything to non-depreceated rusqlite functions 2022-03-06 20:27:49 -08:00
Thom Chiovoloni 4d3f7db7fc
Bump versions of `rusqlite`/`libsqlite3-sys` in `Cargo.toml`s 2022-03-06 20:27:06 -08:00
Ben Dean-Kawamura f504aa09ae Refactoring the interrupt code
- Refactored the `SqlInterruptHandle` and `SqlInterruptScope` types to
  work better with the new code.

  - Types now store an `SqlInterruptHandle` and use that to create
    `SqlInterruptScope` instances. This seems more natural than storing
    an `Arc<AtomicUsize>` and using that to create both the scope and
    handle.
  - Creating an `SqlInterruptScope` can fail if we are in shutdown mode.
    Updated the calling code to handle this error.
  - We now use `Ordering::Relaxed`.  This has less overhead compared to
    `Ordering::SeqCst` and I'm pretty sure we don't need the extra
    synchronization guarantees

- Moved the `Interrupted` and `Interuptee` types to their own modules.
  Updated the shutdown module documentation.

- Changed the `PlacesApi` sync methods to to just send `NeverInterrupts`
  to the `sync_multiple()`.  I think this is fine given that we only use
  these methods on iOS and we don't have actual interruption support
  there yet.

- Removed the `PlacesApi::new_sync_conn_interrupt_handle()` method.  If we want
  to interrupt syncing, then we should just enter shutdown mode.
2022-02-16 10:57:10 -05:00
Tarik Eshaq 68c10e0673
upgrades to rust 2021 [ci full] (#4822)
* upgrades to rust 2021

* Push rust minimum version to 1.57
2022-02-07 09:38:05 -08:00
Sammy Khamis 73427f79a6
Places uniffication (#4770)
* initial conversion of errors for places uniffication

* Converted history metadata functions for places uniffication

* Converted kotlin history metadata functions

* Converted iOS history metadata functions

* [Places uniffication] Fix places error issues (#4687)

* remove uniffi-specific wrapper and updated error test

* Uniffi VisitObservation and apply_observation (#4689)

* uniffied VisitObservation, HistoryVisitInfo and methods using those structs

* Uniffi top frecent site info (#4711)

* Uniffi top frecent site info

* Uniffis FrecencyThresholdOption

* Uniffi Places Sync (#4714)

* uniffi places sync and sync15 functions

* Uniffi Search result and match url (#4720)

* Uniffi query autocomplete

* uniffi places_accept_result

* uniffi places_match_url

* cargo fmt

* cargo clippy

* remove accept_result from ffi crate

* Adds comment on the uniffi bug with varaint shadowing type

* Uniffi Places Interrupt methods (#4726)

* uniffi places interrupt functions

* Consolidate types (#4736)

* Updates the visit observation to use URL

* Uses VisitTransition for HistoryVisitInfo

* updates uniffi to 0.16

* Uniffied bookmarks

* switch to use uint in the apis for adding bookmarks (#4747)

* Remove the manual places FFI entirely.

* folders and separators now have non-nullable parents

* Always insert via Insertable items, and clarify separation between node types.

* Add json_tree module with all json-based types and implementation.

* Fix swift warnings re non-null parentGuid

* bookmarks: Remove public_node and introduce a fetch module

* Update swift code to make breaking changes fixes cleaner (#4766)

* rebased and added changelog entry

Co-authored-by: lougeniac64 <lougeniaC64@users.noreply.github.com>
Co-authored-by: Tarik Eshaq <teshaq@mozilla.com>
Co-authored-by: Mark Hammond <mhammond@skippinet.com.au>
2022-01-20 15:00:00 -05:00
Mark Hammond 2661c5d74c
Move to parking_lot::Mutex in logins, places and sync_manager (#4663) 2021-11-22 11:00:53 +11:00
Ben Dean-Kawamura 4e55cd8733 Use the new places sync manager code
- Updated sync_manager to use `places::get_registered_sync_engine` rather
  than having places call `sync_manager::set_places`.

- Updated the FFI code
2021-11-17 09:28:37 -05:00
Sammy Khamis 41575c3502
Update rust according to moz-central updates [ci full] (#4486)
* update rust to 1.55 according to moz-central updates
2021-09-22 15:24:00 -10:00
Mark Hammond ff6156416b
We rely on url version 2.2 and just got lucky that we had it (#4489) 2021-09-22 07:56:29 +10:00
Ryan Kelly 5fc2d7841c
Remove the `ffi-support` crate sources from this repo.
As of https://github.com/mozilla/application-services/issues/3463
the `ffi-support` crate lives in its own repo, and it's confusing
having an old copy of it still hanging around in this one.
2021-06-01 15:56:49 +10:00
dependabot-preview[bot] 5220605d08 Bump rusqlite from 0.24.1 to 0.24.2
Bumps [rusqlite](https://github.com/rusqlite/rusqlite) from 0.24.1 to 0.24.2.
- [Release notes](https://github.com/rusqlite/rusqlite/releases)
- [Changelog](https://github.com/rusqlite/rusqlite/blob/master/Changelog.md)
- [Commits](https://github.com/rusqlite/rusqlite/compare/v0.24.1...v0.24.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-11 10:14:54 +11:00
Mark Hammond 2ea35a574d
Rename 'engine' and 'store' to conform with the sync15 readme. (#3757)
* Rename 'engine' and 'store' to conform with the sync15 readme.

In many cases, this was literally changing 'engine' to 'store' and
'store' to 'engine', but now we have mostly consistent naming
throughout the repo, and consistency with desktop.

The sync trait is now called `SyncEngine` just to drive home the
fact that 'engine' relates to syncing.

This was largely a mechanical change. No changes were made to
the FFI functions, so this is not a breaking change.
2020-12-15 11:14:43 +11:00
Mark Hammond 63e9eb6c11
Avoid using eprintln in tests to avoid always seeing them in circle (#3711) 2020-11-11 13:22:38 +11:00
Mark Hammond adb8907e00
Update rusqlite to 0.24.1 and libsqlite3-sys to 0.20.1 (#3633) 2020-10-08 14:27:52 +11:00
lougeniac64 f14634bcc9 Removed duplicate timestamp code from places component 2020-09-21 15:00:30 -04:00
Thom Chiovoloni 6212c5bc18 Review feedback 2020-07-20 10:02:11 -07:00
Thom Chiovoloni 821c163ba3 Optimize project layout to avoid bad build performance 2020-07-20 09:56:36 -07:00