pub struct SimStorageBackend { /* private fields */ }Expand description
In-memory storage backend for testing.
TigerStyle:
- Deterministic via SimClock and DeterministicRng
- Fault injection via FaultInjector
- Thread-safe with RwLock
Implementations§
Source§impl SimStorageBackend
impl SimStorageBackend
Sourcepub fn with_faults(self, config: FaultConfig) -> Self
pub fn with_faults(self, config: FaultConfig) -> Self
Add fault configuration.
Note: Creates a new backend with the fault registered. FaultInjector uses interior mutability, but register needs &mut self which we can’t do through Arc. So we create with faults upfront.
Sourcepub fn fault_injector(&self) -> &Arc<FaultInjector>
pub fn fault_injector(&self) -> &Arc<FaultInjector>
Get fault injector for inspection.
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Get entity count (for testing).
Trait Implementations§
Source§impl Clone for SimStorageBackend
impl Clone for SimStorageBackend
Source§fn clone(&self) -> SimStorageBackend
fn clone(&self) -> SimStorageBackend
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SimStorageBackend
impl Debug for SimStorageBackend
Source§impl StorageBackend for SimStorageBackend
impl StorageBackend for SimStorageBackend
Source§fn store_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
entity: &'life1 Entity,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
entity: &'life1 Entity,
) -> Pin<Box<dyn Future<Output = StorageResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store or update an entity. Read more
Source§fn get_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Entity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Entity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get an entity by ID. Read more
Source§fn delete_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_entity<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete an entity by ID. Read more
Source§fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<Entity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<Entity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search entities by text query. Read more
Source§fn list_entities<'life0, 'async_trait>(
&'life0 self,
entity_type: Option<EntityType>,
limit: usize,
offset: usize,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<Entity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_entities<'life0, 'async_trait>(
&'life0 self,
entity_type: Option<EntityType>,
limit: usize,
offset: usize,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<Entity>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List entities with optional type filter.
Source§fn count_entities<'life0, 'async_trait>(
&'life0 self,
entity_type: Option<EntityType>,
) -> Pin<Box<dyn Future<Output = StorageResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn count_entities<'life0, 'async_trait>(
&'life0 self,
entity_type: Option<EntityType>,
) -> Pin<Box<dyn Future<Output = StorageResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Count entities with optional type filter.
Auto Trait Implementations§
impl Freeze for SimStorageBackend
impl RefUnwindSafe for SimStorageBackend
impl Send for SimStorageBackend
impl Sync for SimStorageBackend
impl Unpin for SimStorageBackend
impl UnwindSafe for SimStorageBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more