Skip to main content

LiveReplayStore

Trait LiveReplayStore 

Source
pub trait LiveReplayStore: Send + Sync {
    // Required methods
    fn append(
        &self,
        session_id: &str,
        revision: SessionRevision,
        payload: SessionObservationEventPayload,
    ) -> Result<SessionObservationEvent, LiveReplayStoreError>;
    fn replay_after_cursor(
        &self,
        cursor: &SessionCursor,
    ) -> Result<LiveReplayResult, LiveReplayStoreError>;
    fn subscribe_after_cursor(
        &self,
        cursor: &SessionCursor,
    ) -> Result<LiveReplaySubscribeResult, LiveReplayStoreError>;
    fn current_cursor(
        &self,
        session_id: &str,
        revision: SessionRevision,
    ) -> SessionCursor;
    fn trim_session(&self, session_id: &str) -> Result<(), LiveReplayStoreError>;
}
Expand description

Bounded, best-effort live replay for host reconnects.

Runtime turn execution calls this trait from synchronous boundary code. All methods must therefore be fast and nonblocking from the runtime’s point of view. A custom external store should expose local or buffered behavior here, or offload blocking transport and durability work internally. Runtime turn execution must not wait for slow network or storage durability in this path.

Required Methods§

Source

fn append( &self, session_id: &str, revision: SessionRevision, payload: SessionObservationEventPayload, ) -> Result<SessionObservationEvent, LiveReplayStoreError>

Append one observation event and return its assigned cursor.

This must be fast and nonblocking from the runtime’s point of view.

Source

fn replay_after_cursor( &self, cursor: &SessionCursor, ) -> Result<LiveReplayResult, LiveReplayStoreError>

Return buffered events after cursor, or report a recoverable gap.

This must be fast and nonblocking from the runtime’s point of view.

Source

fn subscribe_after_cursor( &self, cursor: &SessionCursor, ) -> Result<LiveReplaySubscribeResult, LiveReplayStoreError>

Subscribe after cursor, replaying buffered events before live events.

This must be fast and nonblocking from the runtime’s point of view.

Source

fn current_cursor( &self, session_id: &str, revision: SessionRevision, ) -> SessionCursor

Return the latest cursor known locally for a session.

This must be fast and nonblocking from the runtime’s point of view.

Source

fn trim_session(&self, session_id: &str) -> Result<(), LiveReplayStoreError>

Apply best-effort retention trimming for a session.

This must be fast and nonblocking from the runtime’s point of view.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§