pub struct Connection<'a> {
    pub client: Option<Client>,
    pool: &'a ConnectionPool,
}
Expand description

The connection to Remote Settings

Fields

client: Option<Client>

The wrapped connection to Remote Settings.

pool: &'a ConnectionPool

A reference to the pool, used internally for pool management.

Methods from Deref<Target = Client>

Return the records stored locally.

Examples
match client.get().await {
  Ok(records) => println!("{:?}", records),
  Err(error) => println!("Error fetching/verifying records: {:?}", error)
};
Behaviour
  • Return local data by default;
  • If local data is empty and if sync_if_empty is true (default), then synchronize the local data with the server and return records, otherwise return an error.

Note: with the DummyStorage, any call to .get() will trigger a synchronization.

Note: with sync_if_empty as false, if .sync() is never called then .get() will always return an error.

Errors

If an error occurs while fetching or verifying records, a ClientError is returned.

Synchronize the local storage with the content of the server for this collection.

Behaviour
  • If stored data is up-to-date and signature of local data valid, then return local content;
  • Otherwise fetch content from server, merge with local content, verify signature, and return records;
Errors

If an error occurs while fetching or verifying records, a ClientError is returned.

Download the attachment for a record.

Return values:

  • Ok(Some(T)) - There is an attachment for the record and it was successfully downloaded.
  • Err(_) - There is an attachment for the record, and there was a problem while downloading it. This should be considered a temporary error.
  • Ok(None) - There is no attachment for the record

Store a record on the server.

Arguments
  • record - the record to store.

Delete a record from the server.

Arguments
  • id - the record id to delete.

Request review from configured reviewers.

Arguments
  • message - the editor message.

Reject review.

Arguments
  • message - the editor message.

Approve and publish changes.

Rollback pending changes.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more