pub struct OrbitEventBus { /* private fields */ }Expand description
Fleet-shared raw event bus. Cheap to clone.
Implementations§
Source§impl OrbitEventBus
impl OrbitEventBus
pub fn new(fleet: Arc<Fleet>) -> Self
pub fn node_id(&self) -> NodeId
Sourcepub fn cursor_at_head(&self) -> OrbitEventCursor
pub fn cursor_at_head(&self) -> OrbitEventCursor
Cursor that starts after all events currently in the ring. Useful for subscribers that only want future events.
Sourcepub const fn cursor_from_start(&self) -> OrbitEventCursor
pub const fn cursor_from_start(&self) -> OrbitEventCursor
Cursor that starts at counter 0 and replays whatever history has not wrapped out of the ring.
Sourcepub fn reset_ring(&self) -> Result<()>
pub fn reset_ring(&self) -> Result<()>
Clear the shared event ring.
Intended for owner-controlled boot-time cleanup before peer processes publish events into the ring. This prevents stale events from a previous process lifetime from being replayed or counted as current runtime state.
Sourcepub fn publish(&self, topic: &str, payload: &[u8]) -> Result<NetId64>
pub fn publish(&self, topic: &str, payload: &[u8]) -> Result<NetId64>
Publish one event under topic.
Sourcepub fn poll(&self, cursor: &mut OrbitEventCursor) -> OrbitEventPoll
pub fn poll(&self, cursor: &mut OrbitEventCursor) -> OrbitEventPoll
Poll all events since cursor, advancing the cursor to the
current ring head. If the cursor has fallen behind the ring
capacity, older overwritten counters are reported as lagged.
Sourcepub fn poll_topic(
&self,
cursor: &mut OrbitEventCursor,
topic: &str,
) -> OrbitEventPoll
pub fn poll_topic( &self, cursor: &mut OrbitEventCursor, topic: &str, ) -> OrbitEventPoll
Poll and keep only events whose topic matches topic.
The cursor still advances past all events, including filtered topics. Use separate cursors for independent consumers.
Trait Implementations§
Source§impl Clone for OrbitEventBus
impl Clone for OrbitEventBus
Source§fn clone(&self) -> OrbitEventBus
fn clone(&self) -> OrbitEventBus
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more