Skip to main content

EventStreamBackend

Trait EventStreamBackend 

Source
pub trait EventStreamBackend: 'static {
    type Stream: Debug + StreamMemory;
    type Event: Send + 'static;

    // Required methods
    fn create_stream(&self) -> Self::Stream;
    fn handle_cursor(stream: &Self::Stream, handle: &BufferBinding) -> u64;
    fn flush(
        stream: &mut Self::Stream,
        failures: &mut ErrorGraph,
    ) -> Self::Event;
    fn wait_event(stream: &mut Self::Stream, event: Self::Event);
    fn wait_event_sync(event: Self::Event) -> Result<(), ServerError>;
}
Expand description

Trait defining the backend operations for managing streams and events.

This trait provides the necessary methods for initializing streams, flushing them to create events, and waiting on events for synchronization purposes.

Required Associated Types§

Source

type Stream: Debug + StreamMemory

The type representing a stream in this backend, which exposes the memory its kernels see through StreamMemory.

Source

type Event: Send + 'static

The type representing an event in this backend.

Required Methods§

Source

fn create_stream(&self) -> Self::Stream

Initializes and returns a new stream associated with the given stream ID.

Source

fn handle_cursor(stream: &Self::Stream, handle: &BufferBinding) -> u64

Returns the cursor of the given handle on the given stream.

Source

fn flush(stream: &mut Self::Stream, failures: &mut ErrorGraph) -> Self::Event

Flushes the given stream, ensuring all pending operations are submitted, and returns an event that can be used for synchronization.

failures is the device’s failure store, handed down because a flush may drive the stream’s periodic memory cleanup, and cleaning up is where a pool sheds the failures its slices carry.

Source

fn wait_event(stream: &mut Self::Stream, event: Self::Event)

Makes the stream wait for the specified event to complete before proceeding with further operations.

Source

fn wait_event_sync(event: Self::Event) -> Result<(), ServerError>

Wait for the given event synching the CPU.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§