Struct merino_adm::remote_settings::connection_pool::Connection   
source · [−]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 ConnectionPoolA reference to the pool, used internally for pool management.
Methods from Deref<Target = Client>
sourcepub async fn get(&mut self) -> Result<Vec<Record, Global>, ClientError>
 
pub async fn get(&mut self) -> Result<Vec<Record, Global>, ClientError>
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_emptyistrue(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.
sourcepub async fn sync<T>(&mut self, expected: T) -> Result<Collection, ClientError> where
    T: Into<Option<u64>>, 
 
pub async fn sync<T>(&mut self, expected: T) -> Result<Collection, ClientError> where
    T: Into<Option<u64>>, 
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.
pub async fn server_info(&mut self) -> Result<&Value, ClientError>
sourcepub async fn fetch_attachment<T, E>(
    &mut self, 
    record: &mut Record
) -> Result<Option<T>, ClientError> where
    T: TryFrom<Vec<u8, Global>, Error = E>,
    E: 'static + Send + Sync + Error, 
 
pub async fn fetch_attachment<T, E>(
    &mut self, 
    record: &mut Record
) -> Result<Option<T>, ClientError> where
    T: TryFrom<Vec<u8, Global>, Error = E>,
    E: 'static + Send + Sync + Error, 
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
 
sourcepub async fn store_record(&self, record: Record) -> Result<Value, ClientError>
 
pub async fn store_record(&self, record: Record) -> Result<Value, ClientError>
sourcepub async fn delete_record(&self, id: &str) -> Result<Value, ClientError>
 
pub async fn delete_record(&self, id: &str) -> Result<Value, ClientError>
sourcepub async fn request_review(&self, message: &str) -> Result<Value, ClientError>
 
pub async fn request_review(&self, message: &str) -> Result<Value, ClientError>
sourcepub async fn reject_review(&self, message: &str) -> Result<Value, ClientError>
 
pub async fn reject_review(&self, message: &str) -> Result<Value, ClientError>
sourcepub async fn approve_changes(&self) -> Result<Value, ClientError>
 
pub async fn approve_changes(&self) -> Result<Value, ClientError>
Approve and publish changes.
sourcepub async fn rollback_changes(&self) -> Result<Value, ClientError>
 
pub async fn rollback_changes(&self) -> Result<Value, ClientError>
Rollback pending changes.
Trait Implementations
sourceimpl Deref for Connection<'_>
 
impl Deref for Connection<'_>
sourceimpl DerefMut for Connection<'_>
 
impl DerefMut for Connection<'_>
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Connection<'a>
impl<'a> Send for Connection<'a>
impl<'a> Sync for Connection<'a>
impl<'a> Unpin for Connection<'a>
impl<'a> !UnwindSafe for Connection<'a>
Blanket Implementations
sourceimpl<'a, T, E> AsTaggedExplicit<'a, E> for T where
    T: 'a, 
 
impl<'a, T, E> AsTaggedExplicit<'a, E> for T where
    T: 'a, 
sourceimpl<'a, T, E> AsTaggedImplicit<'a, E> for T where
    T: 'a, 
 
impl<'a, T, E> AsTaggedImplicit<'a, E> for T where
    T: 'a, 
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
 
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
 
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
 
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
 
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more