* create-fake-visits will create a (possibly large) number of visits.
* delete-history will remove all history
* show-stats will show some stats for the places DB.
This was part of my work for the auth PR, but I think it's useful
separatedly.
- Updated `fxa-client` to be a single binary.
- Added a cargo alias so it can be run with `cargo fxa [args]`.
I think this makes it easier to use and also will make it easier to
expand the functionality. It's easier to add another clap subcommand
than to add a new binary.
Made `FirefoxAccount` input a single `FxaConfig` instance for all of
it's configuration. I want to add more constructor arguments but don't
want to end up with a huge argument count.
Made the example code use the public API, not the internal module.
`FxaConfig` helps ease this transition. The motivation for this is that
I want to move FxaClent and some other fields to the public
`FirefoxAccount` instance, which means the example code needs to start
using it. This also results in some nice code cleanups.
Deleted the `fxa-client/migration` example, we're not really
using the migration code anymore.
Now that we're not exposing the `internal` module as pub, Rust is
noticing a lot of dead code. For the serde JSON structs, I kept the
dead fields and added an annotation. For the unused functions, I just
deleted them.
Created an `FxaServer` enum. This matches how the android wrapper
handles it and I don't think we need to input arbitrary URLs here.
It steals a cute function from webext-storage which can dump any
arbitrary query.
It also allows for the use of a `dbg()` sql function which can be
helpful trying to debug SQL as it is executing. The function is also
available as a no-op when the feature is not available to prevent us
accidently using it in released code.
Sadly this required updating the use of prettytable-rs as the old
version crashed on Apple silicon, which had a bit of a blow-on effect
on other dependencies.
* Consolidate the various types used for a "collection name" - now we
use `Cow` rather than the various `&'static str`, `&str` and `String`
used previously.
* This made it easier to clean up the `LocalCollState` state machine
to have the `Ready` state directly provide the `CollState` due to
a mismatch between `'static str` and `String` reprs of collections.
* No longer store the outgoing timestamp in an OutgoingChangeset - it was
never actually used and just creates unnecessary complexity.
* OutgoingChangsets now always supply the BSOs as they are created,
meaning less `mut` objects.
* Bonus fix to unbreak the `places-utils` example.
Metrics from GLAM indicate the VACUUM command is taking a long time and
doesn't seem to be dropping. After reading the docs a bit, it seems to
me that VACUUM always copies the entire database which could indeed be
slow for large DBs.
Switched to using an incremental vacuum. This only tries to truncate N
pages (set to 2 here) at time rather than all free pages. Also it
doesn't try to defragment the pages.
Incremental vacuum requires a PRAGMA setting and for non-empty databases
a VACUUM run. This means that existing databases will require one full
vacuum, then future vacuums should run faster.
Also added a places-utils command to run maintenance. I used this to
test that the incremental vacuum is ineed faster.
- 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`.
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`.
* 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
* Moves sync15::error to a simple enum in line with most other crates.
* Cleanups to Cargo.toml in sync15 and sync15-traits
* Remove old unused sync15::migrate_state
If the new feature is enabled, tabs can sync - otherwise it can not.
The intention is that later there will be a "bridged-sync" feature,
and that in-practice, one or the other will be enabled - however, the
way features work, it must be possible that no features are enabled.
The new feature is not a default feature because I expect we will
want the default features to be what desktop consumes - ie, that
the default feature will be bridged-sync once that exists.
This isn't strictly required yet, but is being done now to make
future reviews of the bridged engine easier to reason about.
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.
- Use `thiserror` only to define our errors rather than a weird
combination of `thiserror` and `error_support`
- There's now a few error enums:
- `LoginsStorageError` is for public API errors
- `LoginsError` is for internal errors
- `InvalidLoginsReason` is a subtype for `LoginsError::InvalidLogin`
- Extracted the error tracking code from `impl From<LoginsError>
for LoginsStorageError` and put it in its own methods.
- Made `LoginsError::InvalidKey` convert to
`LoginsStorageError::CryptoError`. I think this makes sense since
from the app's point of view an invalid key is the same thing as
data that can't be decrypted. Note: that `InvalidKey` used to mean
something different when we were using sqlcipher databases, but that's
not applicable anymore.
- Dropped the `throw!` macro. The error types are simple enough now
that we can just use a return statement.
- Added note about PII
- Renamed `LoginsError::label()` to `LoginsError::group_name()`
- Updated the rest of the code to use the new API
- Removed the backtrace functionality from `sync-pass`. I'm kind of
doubt it was working anyways.
* 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>
- 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.
The `SqlInterruptHandle` and `SqlInterruptScope` types and especially
the shutdown code feels like belongs in `interrupt-support` better than
`sql-support`.
Removed the `implement_into_ffi_by_pointer!(SqlInterruptHandle)` call.
I don't think we need that now that everything is UniFFIed.
When the user wants to shutdown the application, we should:
- Interrupt all current `SqlInterruptScope`s
- Interrupt all future `SqlInterruptScope`s when they're created.
The nice thing about this approach is that it didn't require invasive
changes in places to support it. The main new requirement was we need
to have a way to get a `Weak<AsRef<SqlInterruptHandler>>` for each
database. In order to support that, I needed to:
- For the read/write and read-only connections: have `PlacesConnection`
store an `SqlInterruptHandler` and implement `AsRef`.
- For the sync connection: Added struct that wraps the
`Mutex<PlacesDb>` and also stores a `SqlInterruptHandler` and
implements `AsRef`.
Updated `places-utils` so that ctrl-c starts shutdown mode.
* 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>
* upgrades rust to 1.57
* fixes clippy
* Document where to find the latest version moz-central uses
* an attempt to fix broken cargo bench
* Uses _ instead of dead_code where possible
* runs cargo update