pub struct RemoteSettingsClient { /* private fields */ }
Expand description
Client for a single Remote Settings collection
Use RemoteSettingsService::make_client to create these.
Implementations§
source§impl RemoteSettingsClient
impl RemoteSettingsClient
sourcepub fn collection_name(&self) -> String
pub fn collection_name(&self) -> String
Collection this client is for
sourcepub fn get_records(
&self,
sync_if_empty: bool,
) -> Option<Vec<RemoteSettingsRecord>>
pub fn get_records( &self, sync_if_empty: bool, ) -> Option<Vec<RemoteSettingsRecord>>
Get the current set of records.
This method normally fetches records from the last sync. This means that it returns fast and does not make any network requests.
If records have not yet been synced it will return None. Use sync_if_empty = true
to
change this behavior and perform a network request in this case. That this is probably a
bad idea if you want to fetch the setting in application startup or when building the UI.
None will also be returned on disk IO errors or other unexpected errors. The reason for this is that there is not much an application can do in this situation other than fall back to the same default handling as if records have not been synced.
Application-services schedules regular dumps of the server data for specific collections.
For these collections, get_records
will never return None. If you would like to add your
collection to this list, please reach out to the DISCO team.
sourcepub fn get_records_map(
&self,
sync_if_empty: bool,
) -> Option<HashMap<String, RemoteSettingsRecord>>
pub fn get_records_map( &self, sync_if_empty: bool, ) -> Option<HashMap<String, RemoteSettingsRecord>>
Get the current set of records as a map of record_id -> record.
See Self::get_records for an explanation of when this makes network requests, error
handling, and how the sync_if_empty
param works.
sourcepub fn get_attachment(&self, record: RemoteSettingsRecord) -> ApiResult<Vec<u8>>
pub fn get_attachment(&self, record: RemoteSettingsRecord) -> ApiResult<Vec<u8>>
Get attachment data for a remote settings record
Attachments are large binary blobs used for data that doesn’t fit in a normal record. They are handled differently than other record data:
- Attachments are not downloaded in RemoteSettingsService::sync
- This method will make network requests if the attachment is not cached
- This method will throw if there is a network or other error when fetching the attachment data.
Trait Implementations§
source§impl<UT> LiftRef<UT> for RemoteSettingsClient
impl<UT> LiftRef<UT> for RemoteSettingsClient
type LiftType = Arc<RemoteSettingsClient>
source§impl<UT> LowerError<UT> for RemoteSettingsClient
impl<UT> LowerError<UT> for RemoteSettingsClient
source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
source§impl<UT> LowerReturn<UT> for RemoteSettingsClient
impl<UT> LowerReturn<UT> for RemoteSettingsClient
source§type ReturnType = <Arc<RemoteSettingsClient> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<RemoteSettingsClient> as LowerReturn<UniFfiTag>>::ReturnType
source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
source§impl<UT> TypeId<UT> for RemoteSettingsClient
impl<UT> TypeId<UT> for RemoteSettingsClient
const TYPE_ID_META: MetadataBuffer = _
Auto Trait Implementations§
impl !Freeze for RemoteSettingsClient
impl !RefUnwindSafe for RemoteSettingsClient
impl Send for RemoteSettingsClient
impl Sync for RemoteSettingsClient
impl Unpin for RemoteSettingsClient
impl !UnwindSafe for RemoteSettingsClient
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
Read more