pub trait PolicyDataRepository: Send + Sync {
    type Error;
    // Required methods
    fn get<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<PolicyData>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        rng: &'life1 mut (dyn RngCore + Send),
        clock: &'life2 dyn Clock,
        data: Value,
    ) -> Pin<Box<dyn Future<Output = Result<PolicyData, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn prune<'life0, 'async_trait>(
        &'life0 mut self,
        keep: usize,
    ) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}Expand description
A PolicyDataRepository helps interacting with the policy data saved in
the storage backend.
Required Associated Types§
Required Methods§
Sourcefn get<'life0, 'async_trait>(
    &'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<PolicyData>, Self::Error>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
 
fn get<'life0, 'async_trait>(
    &'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<PolicyData>, Self::Error>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
Get the latest policy data
Returns the latest policy data, or None if no policy data is
available.
§Errors
Returns Self::Error if the underlying repository fails
Sourcefn set<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 mut self,
    rng: &'life1 mut (dyn RngCore + Send),
    clock: &'life2 dyn Clock,
    data: Value,
) -> Pin<Box<dyn Future<Output = Result<PolicyData, Self::Error>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
 
fn set<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 mut self,
    rng: &'life1 mut (dyn RngCore + Send),
    clock: &'life2 dyn Clock,
    data: Value,
) -> Pin<Box<dyn Future<Output = Result<PolicyData, Self::Error>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
Set the latest policy data
Returns the newly created policy data.
§Parameters
- rng: The random number generator to use
- clock: The clock used to generate the timestamps
- data: The policy data to set
§Errors
Returns Self::Error if the underlying repository fails
Sourcefn prune<'life0, 'async_trait>(
    &'life0 mut self,
    keep: usize,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
 
fn prune<'life0, 'async_trait>(
    &'life0 mut self,
    keep: usize,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
    Self: 'async_trait,
    'life0: 'async_trait,
Prune old policy data
Returns the number of entries pruned.
§Parameters
- keep: the number of old entries to keep
§Errors
Returns Self::Error if the underlying repository fails