pub struct FileBackedBus { /* private fields */ }Expand description
File-backed event bus: wraps InMemoryBus with append-only JSONL persistence.
Every published event is serialized to a JSONL log file before being
broadcast to live subscribers. Use FileBackedBus::replay to read
back all persisted events (e.g. after a restart).
Implementations§
Source§impl FileBackedBus
impl FileBackedBus
Sourcepub async fn open(path: impl AsRef<Path>, capacity: usize) -> Result<Self>
pub async fn open(path: impl AsRef<Path>, capacity: usize) -> Result<Self>
Open (or create) a JSONL event log at path with the given broadcast capacity.
Trait Implementations§
Source§impl EventBus for FileBackedBus
impl EventBus for FileBackedBus
Source§fn publish<'life0, 'async_trait>(
&'life0 self,
event: Event,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish<'life0, 'async_trait>(
&'life0 self,
event: Event,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Publish an event to all subscribers.
Source§fn subscribe(&self) -> Box<dyn EventSubscriber>
fn subscribe(&self) -> Box<dyn EventSubscriber>
Create a new subscriber that receives all future events.
Source§fn subscriber_count(&self) -> usize
fn subscriber_count(&self) -> usize
Number of active subscribers.
Auto Trait Implementations§
impl !Freeze for FileBackedBus
impl !RefUnwindSafe for FileBackedBus
impl Send for FileBackedBus
impl Sync for FileBackedBus
impl Unpin for FileBackedBus
impl UnsafeUnpin for FileBackedBus
impl UnwindSafe for FileBackedBus
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