pub struct MemoryStateStoreProvider { /* private fields */ }Expand description
In-memory implementation of StateStoreProvider.
This is the default state store provider used when no external provider is configured. Data is stored in memory and does not persist across restarts.
§Thread Safety
This implementation is thread-safe and supports concurrent access from multiple plugins.
§Usage
ⓘ
use drasi_lib::MemoryStateStoreProvider;
let provider = MemoryStateStoreProvider::new();
// Store some data
provider.set("my-plugin", "key1", b"value1".to_vec()).await?;
// Retrieve data
if let Some(value) = provider.get("my-plugin", "key1").await? {
println!("Value: {:?}", value);
}Implementations§
Trait Implementations§
Source§impl Default for MemoryStateStoreProvider
impl Default for MemoryStateStoreProvider
Source§impl StateStoreProvider for MemoryStateStoreProvider
impl StateStoreProvider for MemoryStateStoreProvider
Source§fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get a single value by key from a store partition. Read more
Source§fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
key: &'life2 str,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = StateStoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
key: &'life2 str,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = StateStoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Set a single value by key in a store partition. Read more
Source§fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete a single key from a store partition. Read more
Source§fn contains_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn contains_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check if a key exists in a store partition without retrieving its value. Read more
Source§fn get_many<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
keys: &'life2 [&'life3 str],
) -> Pin<Box<dyn Future<Output = StateStoreResult<HashMap<String, Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_many<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
keys: &'life2 [&'life3 str],
) -> Pin<Box<dyn Future<Output = StateStoreResult<HashMap<String, Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Get multiple values by keys from a store partition. Read more
Source§fn set_many<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
entries: &'life2 [(&'life3 str, &'life4 [u8])],
) -> Pin<Box<dyn Future<Output = StateStoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn set_many<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
entries: &'life2 [(&'life3 str, &'life4 [u8])],
) -> Pin<Box<dyn Future<Output = StateStoreResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Set multiple key-value pairs in a store partition. Read more
Source§fn delete_many<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
keys: &'life2 [&'life3 str],
) -> Pin<Box<dyn Future<Output = StateStoreResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn delete_many<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
keys: &'life2 [&'life3 str],
) -> Pin<Box<dyn Future<Output = StateStoreResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Delete multiple keys from a store partition. Read more
Source§fn clear_store<'life0, 'life1, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn clear_store<'life0, 'life1, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete all data for a store partition. Read more
Source§fn list_keys<'life0, 'life1, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_keys<'life0, 'life1, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all keys in a store partition. Read more
Source§fn store_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
store_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = StateStoreResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a store partition exists and has any data. Read more
Auto Trait Implementations§
impl Freeze for MemoryStateStoreProvider
impl !RefUnwindSafe for MemoryStateStoreProvider
impl Send for MemoryStateStoreProvider
impl Sync for MemoryStateStoreProvider
impl Unpin for MemoryStateStoreProvider
impl !UnwindSafe for MemoryStateStoreProvider
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