1. 21 Oct, 2019 1 commit
  2. 27 Sep, 2019 3 commits
  3. 10 Jul, 2019 1 commit
    • Grisha Kruglov's avatar
      Move sync scope ownership into account manager; API simplification · 7afec7d4
      Grisha Kruglov authored
      I've started pulling on one little thread, and ended up with a few more changes than initially anticipated.
      
      Raison d'être for this PR - introducing access token caching for Sync.
      - Some background on the issue: Rust FirefoxAccount object maintains an in-memory cache of access tokens, keyed by 'scope'. During every sync, we "rehydrate" an instance of FirefoxAccount, starting with a fresh cache. We then obtain an access token from it to sync; this performs a network request (since the internal cache is empty), which is quite costly at scale for our services. This creates a situation when we may overwhelm our own servers with a large enough, actively syncing user base.
      - This PR adds a caching layer for sync authInfo objects. Sync workers no longer interact with the account directly, and instead look into the cache to obtain authentication info necessary for syncing. No more "talk to the FxA server before every sync".
      Account manager is responsible for keeping the cache up-to-date, and resetting it when necessary. Cache is currently updated: on startup (but only if access token has expired), on authentication, and when we recover from auth problems.
      
      And this is where the "thread pulling" begins! In order to "own" the access token for sync, account manager needs to be aware of the "sync scope".
      Before, we just relied on the application to specify that scope. Instead, I've changed account manager's constructor to take a SyncConfig object which allows consuming application to configure how sync should behave (enabled at all?, periodic syncing enabled? how often to sync? which stores should be synced?).
      Ownership of the "sync manager" moved down the stack, from the application layer into the account manager.
      
      Application is now expected to interact with sync only via AccountManager's `sync` method, which exposes an internal SyncManager instance (if sync is enabled).
      
      Above changes were a good reason to move support classes from feature-sync and into services-firefox-account. Note that since "sync" is part of our "storage" modules, this change doesn't mean that you need to take an extra native dependency on your classpath simply if you need to use FxA. Thanks to concept-sync, actual "Firefox Sync" machinery (within libplaces) is still fully decoupled from FxA. `feature-sync` has been removed entirely.
      
      Since we're churning the public API anyway, I took the chance to introduce a few more simplifications at the API layer:
      - 'SyncManager' interface was removed, since we're not expecting to have multiple implementations of it
      - 'Config' was renamed to 'ServerConfig'
      - 'DeviceTuple' was renamed to 'DeviceConfig'
      - account manager grew a new public API, 'setSyncConfig', which allows application to re-configure how it wants sync to behave
      - 'AuthInfo' was renamed to 'SyncAuthInfo', and a bunch of cleanup happened in that area
      - 'AccountObservable'@'onError' method was removed. The only error that could have been passed into it (unable to restore account) wasn't actionable by the application anyway, and none of the integrations did anything with that call
      
      Documentation of public APIs and classes was improved.
      7afec7d4
  4. 02 Jul, 2019 1 commit
  5. 11 Jun, 2019 1 commit
    • Lina Cambridge's avatar
      Record Sync engine telemetry in Glean. · ca58aa14
      Lina Cambridge authored
      This commit adds two Glean pings to the Storage-Sync browser component:
      one for history, and one for bookmarks. Both pings record the same set
      of base metrics, including incoming and outgoing counts, sync duration,
      the hashed FxA UID, and, most importantly, the failure reason if the
      store fails to sync. The bookmarks ping records additional validation
      data.
      
      The Glean schema is a flattened version of the Sync ping that's
      currently sent on Firefox Desktop and Firefox for iOS. Instead of
      sending a single ping with multiple syncs, each having multiple
      engines, we send one Glean ping per engine per sync.
      
      The pings are recorded directly in the component, so any app that
      consumes it should get pings for free.
      ca58aa14
  6. 09 May, 2019 1 commit
  7. 02 May, 2019 1 commit
  8. 23 Apr, 2019 1 commit
  9. 27 Mar, 2019 1 commit
  10. 20 Mar, 2019 1 commit
  11. 14 Mar, 2019 1 commit
  12. 30 Nov, 2018 1 commit
    • Grisha Kruglov's avatar
      Allow creating new instances of PlacesConnection · 0df4ad7c
      Grisha Kruglov authored
      For history sync, we'd like to use a separate connection, since internally
      sync operation is blocking and potentially very long-running.
      At the same time, we'd like to maintain a shared connection for general browser
      tasks.
      0df4ad7c
  13. 20 Nov, 2018 1 commit
    • Grisha Kruglov's avatar
      Use `filesDir` as the parent folder for the places database file · 5a35bedd
      Grisha Kruglov authored
      Using getDatabasePath doesn't work without extra work on older API versions.
      That location doesn't exist, and it seems like we'd need to add a bit of code
      to check for its presence, create it, etc., before we can rely on that location.
      
      All of our other code which stores files just uses `filesDir`, and I don't see
      a reason not to put `places.sqlite` into that location as well. There isn't much
      value in that file living in a "databases" folder.
      5a35bedd
  14. 06 Nov, 2018 1 commit