pub struct EventSystem { /* private fields */ }Expand description
Owns an event-system directory and creates typed event streams within it.
Implementations§
Source§impl EventSystem
impl EventSystem
Sourcepub fn new(
event_system_directory: impl AsRef<Path>,
) -> Result<Self, CreateEventSystemError>
pub fn new( event_system_directory: impl AsRef<Path>, ) -> Result<Self, CreateEventSystemError>
Creates an event system directory in the given path, event_system_directory.
§Note:
- If the directory path already exists, it must be empty.
- This functions creates the given directory and any missing parents.
- The given path is canonicalized.
- The directory is emptied once this
EventSystem, its clones, and all of its streams (including theirPublisherFactorys and publishers) are dropped. The directory itself is left in place, and can be reused by a later call toEventSystem::new.
Sourcepub fn stub() -> Self
pub fn stub() -> Self
Creates a no-op event system on any platform, including Linux.
No filesystem access is performed. Streams ignore their configuration and policy, and their factories always return publishers that discard events without serializing them.
Sourcepub fn create_stream<E: Event>(
&self,
stream_name: StreamName,
stream_config: StreamConfig,
) -> Result<PublisherFactory<E>, CreateStreamError>
pub fn create_stream<E: Event>( &self, stream_name: StreamName, stream_config: StreamConfig, ) -> Result<PublisherFactory<E>, CreateStreamError>
Creates a stream named stream_name for event type E
and returns its PublisherFactory.
Sourcepub fn set_stream_policy(&self, stream_policy: StreamPolicy)
pub fn set_stream_policy(&self, stream_policy: StreamPolicy)
Applies the given StreamPolicy on the streams created by this
EventSystem.
The applied stream policy will also be applied to future stream creations of this event system.
Trait Implementations§
Source§impl Clone for EventSystem
impl Clone for EventSystem
Auto Trait Implementations§
impl Freeze for EventSystem
impl RefUnwindSafe for EventSystem
impl Send for EventSystem
impl Sync for EventSystem
impl Unpin for EventSystem
impl UnsafeUnpin for EventSystem
impl UnwindSafe for EventSystem
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