pub struct MemoryProvider { /* private fields */ }Expand description
In-memory event provider
Uses tokio::sync::broadcast for pub/sub and a Vec for persistence.
Suitable for testing, development, and single-process deployments.
Implementations§
Source§impl MemoryProvider
impl MemoryProvider
Sourcepub fn new(config: MemoryConfig) -> Self
pub fn new(config: MemoryConfig) -> Self
Create a new in-memory provider
Trait Implementations§
Source§impl Default for MemoryProvider
impl Default for MemoryProvider
Source§impl EventProvider for MemoryProvider
impl EventProvider for MemoryProvider
Source§fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 Event,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 Event,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Publish an event, returning the provider-assigned sequence number
Source§fn subscribe_durable<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_consumer_name: &'life1 str,
filter_subject: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Subscription>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn subscribe_durable<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_consumer_name: &'life1 str,
filter_subject: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Subscription>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a durable subscription (survives reconnects) Read more
Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
filter_subject: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Subscription>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
filter_subject: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Subscription>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create an ephemeral subscription (cleaned up on disconnect)
Source§fn history<'life0, 'life1, 'async_trait>(
&'life0 self,
filter_subject: Option<&'life1 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn history<'life0, 'life1, 'async_trait>(
&'life0 self,
filter_subject: Option<&'life1 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Event>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch historical events from the backend
Source§fn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
_consumer_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unsubscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
_consumer_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a durable subscription by consumer name
Source§fn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ProviderInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ProviderInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get provider info (message count, etc.)
Source§fn build_subject(&self, category: &str, topic: &str) -> String
fn build_subject(&self, category: &str, topic: &str) -> String
Build a full subject from category and topic
Source§fn category_subject(&self, category: &str) -> String
fn category_subject(&self, category: &str) -> String
Build a wildcard subject for a category
Source§fn publish_with_options<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
event: &'life1 Event,
_opts: &'life2 PublishOptions,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn publish_with_options<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
event: &'life1 Event,
_opts: &'life2 PublishOptions,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Publish an event with provider-specific options Read more
Source§fn subscribe_durable_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
consumer_name: &'life1 str,
filter_subject: &'life2 str,
_opts: &'life3 SubscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Subscription>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn subscribe_durable_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
consumer_name: &'life1 str,
filter_subject: &'life2 str,
_opts: &'life3 SubscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Subscription>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Create a durable subscription with provider-specific options Read more
Source§fn subscribe_with_options<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
filter_subject: &'life1 str,
_opts: &'life2 SubscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Subscription>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn subscribe_with_options<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
filter_subject: &'life1 str,
_opts: &'life2 SubscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Subscription>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create an ephemeral subscription with provider-specific options Read more
Auto Trait Implementations§
impl Freeze for MemoryProvider
impl !RefUnwindSafe for MemoryProvider
impl Send for MemoryProvider
impl Sync for MemoryProvider
impl Unpin for MemoryProvider
impl UnsafeUnpin for MemoryProvider
impl !UnwindSafe for MemoryProvider
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