You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Increases the size of the max payload we support to 2MB.
* Primary intent was to make sure the sync-specific code and structures exist in the
sync module.
* In addition, all of the checks for "can this tab fit" relied on a struct that wasn't
actually used by Sync. That wasn't a problem in practice but will be as we change these
structs.
* Also removed old support for returning tabs about clients we don't know about. This impacted
tests which often required them too to know about the devices under test.
The intent is that this should have no functional changes, but puts us in a better place to
start metadata improvements.
This crate implements an in-memory syncing engine for remote tabs.
5
+
6
+
This crate implements storage and a syncing engine for remote tabs, including
7
+
for "tab commands" (such as closing a remote tab).
8
+
9
+
It uses a sqlite database, but only creates the database when remote tabs need
10
+
to be stored; eg, just telling this component about local tabs will not create a database.
11
+
12
+
It is used on Desktop and mobile and uses UniFFI.
8
13
9
14
## Directory structure
10
15
The relevant directories are as follows:
11
16
12
17
-`src`: The meat of the library. This contains cross-platform rust code that
13
18
implements the syncing of tabs.
14
-
-`ffi`: The Rust public FFI bindings. This is a (memory-unsafe, by necessity)
15
-
API that is exposed to Kotlin and Swift. It leverages the `ffi_support` crate
16
-
to avoid many issues and make it more safe than it otherwise would be.
17
-
It uses protocol buffers for marshalling data over the FFI.
18
-
-`android`: This contains android bindings to synced tabs, written in Kotlin. These
19
-
use JNA to call into to the code in `ffi`.
20
-
-`ios`: This contains the iOS binding to synced tabs, written in Swift. These use
21
-
Swift's native support for calling code written in C to call into the code in
22
-
`ffi`.
23
-
24
-
## Features
25
-
- Synchronization of the local and remote session states.
19
+
-`android`: A kotlin wrapper we should try and remove.
26
20
27
21
## Business Logic
28
22
29
-
### Storage
23
+
Each client tells the component about its local tabs, and can query for other devices and their
24
+
tabs.
30
25
31
-
The storage is all done in memory for simplicity purposes. The host applications are free to persist the remote tabs list if it makes sense to them.
26
+
This all then feeds into the single Sync payload for tabs. The core shape is very old,
27
+
predating this component. b/w compat concerns always apply, but can safely be "upgraded"
28
+
over time.
32
29
33
-
### Payload format
30
+
Tab commands add a layer of complexity - if we've been asked to close a remote tab, we pretend
31
+
that tab doesn't exist on the remote for some period, giving that remote device a chance to act
32
+
on the request and re-upload its tabs.
33
+
34
+
## Payload format
34
35
35
36
Every remote sync record is roughly a list of tabs with their URL history (think of the back button). There is one record for each client.
36
37
@@ -39,24 +40,3 @@ Every remote sync record is roughly a list of tabs with their URL history (think
39
40
Each remote tabs sync record is associated to a "client" using a `client_id` field, which is really a foreign-key to a `clients` collection record.
40
41
However, because we'd like to move away from the clients collection, which is why this crate associates these records with Firefox Accounts device ids.
41
42
Currently for platforms using the sync-manager provided in this repo, the `client_id` is really the Firefox Accounts device ID and all is well, however for older platforms it is a distinct ID, which is why we have to feed the `clients` collection to this Tabs Sync engine to associate the correct Firefox Account device id.
42
-
43
-
## Getting started
44
-
45
-
**Prerequisites**: Firefox account authentication is necessary to obtain the keys to decrypt synced tabs data. See the [android-components FxA Client readme](https://github.com/mozilla-mobile/android-components/blob/master/components/service/firefox-accounts/README.md) for details on how to implement on Android. For iOS, Firefox for iOS still implement the legacy oauth.
46
-
47
-
**Platform-specific details**:
48
-
- <TODO-ST> Android
49
-
- iOS: start with the [guide to consuming rust components on iOS](https://github.com/mozilla/application-services/blob/main/docs/howtos/consuming-rust-components-on-ios.md)
0 commit comments