mozilla/application-services

UniFFI the `GetItemsOptions` builder in Remote Settings

linabutler opened this issue · 1 comments

#5591 added a GetItemsOptions builder, and a Rust-only Client::get_records_raw_with_options interface, to the Remote Settings component. https://github.com/mozilla/application-services/pull/5591/files#r1200749247 pointed out that this could be useful to expose to applications—that is, UniFFI consumers—too, not just other Rust consumers.

This ticket would involve:

  • Adding a UDL definition for GetItemsOptions, or a wrapper around it with a different name.
  • Implementing the new UDL definition in Rust. The way we do this depends on what we expose. If we opt to expose GetItemsOptions directly, we'll need to make it thread-safe, because UniFFI requires all interfaces to be Send + Sync. This would involve protecting its mutable state with a mutex. If we instead expose a UniFFI-compatible wrapper around GetItemsOptions, then GetItemsOptions can remain mutable, and the wrapper can just hold a Mutex<GetItemsOptions>.
  • Adding new methods to remote_settings::Client and remote_settings::RemoteSettings that return a RemoteSettingsResponse. This new method would call get_records_raw_with_options, just like the existing RemoteSettings::get_records eventually calls Client::get_records_raw.
  • Adding Rust and Kotlin tests for the new interfaces.

This is a good next bug for folks interested in getting more familiar with UniFFI, and how we ship Rust code in Application Services. I'd be happy to mentor!

┆Issue is synchronized with this Jira Task