PolicyStore

Trait PolicyStore 

Source
pub trait PolicyStore: Send + Sync {
    // Required methods
    fn create_policy<'life0, 'async_trait>(
        &'life0 self,
        content: String,
    ) -> Pin<Box<dyn Future<Output = Result<String, PolicyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_policy<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, PolicyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_policies<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, PolicyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_policy<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        content: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), PolicyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_policy<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), PolicyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn load_all_policies<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<PolicySet, PolicyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for policy storage backends

Required Methods§

Source

fn create_policy<'life0, 'async_trait>( &'life0 self, content: String, ) -> Pin<Box<dyn Future<Output = Result<String, PolicyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new policy and return its ID

Source

fn get_policy<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, PolicyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a policy by ID

Source

fn list_policies<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, PolicyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all policies as (id, content) tuples

Source

fn update_policy<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, content: String, ) -> Pin<Box<dyn Future<Output = Result<(), PolicyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update an existing policy

Source

fn delete_policy<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), PolicyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a policy by ID

Source

fn load_all_policies<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PolicySet, PolicyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load all policies as a PolicySet

Implementors§