pub trait Repository<V: RepositoryItem>: Send + Sync {
// Required methods
fn get<'life0, 'async_trait>(
&'life0 self,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Option<V>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<V>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set<'life0, 'async_trait>(
&'life0 self,
key: String,
value: V,
) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove<'life0, 'async_trait>(
&'life0 self,
key: String,
) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
This trait represents a generic repository interface, capable of storing and retrieving items using a key-value API.
Required Methods§
Sourcefn get<'life0, 'async_trait>(
&'life0 self,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Option<V>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
key: String,
) -> Pin<Box<dyn Future<Output = Result<Option<V>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves an item from the repository by its key.
Sourcefn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<V>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<V>, RepositoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists all items in the repository.