application-services/components/sync_manager
Ben Dean-Kawamura eb1f268654 Build improvements with UniFFI library mode
Bumped UniFFI to 0.28.2

Added a tool to run uniffi-bindgen in library mode.  It can input either
a specific library path or the megazord crate name.

Use that simplify several build scripts -- especially the generate docs
ones.  The best part of this is that we no longer have to maintain
hand-written modulemaps, which makes adding a new component harder than
it needs to be.

Split out the uniffi-bindgen commands from `build-xcframework.sh`.  This
way you can run them standalone and see the results, even if you don't
have XCode setup.

One change is that
automation/swift-components-docs/generate-swift-project.sh now uses
`megazord_ios` rather than `megazord`.  I think this should result in
slightly more accurate docs, since historically some components in the
Android megazord aren't in the iOS one (Although, I think they match at
the present).
2024-10-17 17:59:42 +00:00
..
android Switch to UniFFI library mode 2024-09-18 20:31:35 +00:00
ios/SyncManager Fixup SwiftFormat failures following upgrade 2024-01-11 15:55:53 +00:00
src fix: add proper Rust doc comments to UDL files 2024-09-16 07:42:17 +00:00
Cargo.toml Use uniffi as a workspace dependency 2023-12-15 18:32:25 +00:00
README.md Typos 2024-05-24 20:17:12 +00:00
build.rs Updating UniFFI to version 0.23 2023-01-27 12:38:55 -05:00
metrics.yaml move/port sync manager metrics from android into appservices and rename to fix iOS name collision 2023-06-07 00:52:32 +00:00
pings.yaml move/port sync manager metrics from android into appservices and rename to fix iOS name collision 2023-06-07 00:52:32 +00:00
uniffi.toml Build improvements with UniFFI library mode 2024-10-17 17:59:42 +00:00

README.md

Sync Manager

The sync manager designed to integrate multiple sync engines/stores into a single coherent framework. There are multiple, independent rust components, all of which know how to sync - but when an app uses multiple components, something must tie them together so that, eg, a single "sync now" function exists to sync all components, and to help the app manage the "enabled" state of these engines. There's other non-obvious "global state" which should also be shared - eg, we only need a single token from the token-server and can share it across all components, if the server is under load and wants clients to back off, that state should be shared.

This crate relies very heavily on sync15, so you should read the documentation in that crate. Indeed, you can almost see this as a wrapper around that crate, but there's other "global functionality" managed by this crate that doesn't fit well in any other place. For example, each application should have a single "device record" which describes the app and not individual stores. There's also the concept of "commands" which are sent to a device, and then delegated to the correct store - those concepts are implemented in this crate.

Other notes:

It's a bit unfortunate this component can't just be part of sync15. Conceptually and functionally, it shares most in common with with the sync15 crate, and in some cases stretches (or arguably breaks) the abstraction barrier that sync15 puts up.

Unfortunately, places/logins/etc depend on sync15 directly, and so to prevent a dependency cycle (which is disallowed by cargo), doing so would require implementing the manager in a fully generic manner, with no specific handling of underlying crates. This seems extremely difficult, so this is split out into it's own crate, which might happen to reach into the guts of sync15 in some cases.

Note also that the world has changed a little since then - in particular, we now have sync15-traits - there might now be an opportunity to move all the types into that crate, and merge sync15 and sync_manager