Skip to main content

GraphDriver

Trait GraphDriver 

Source
pub trait GraphDriver: Driver {
    type Executable;

    // Required methods
    fn begin(stream: &mut Self::Stream) -> Result<(), ServerError>;
    fn instantiate(
        stream: &mut Self::Stream,
        doomed: Option<ServerError>,
    ) -> Result<Self::Executable, ServerError>;
    fn upload(exec: &Self::Executable, stream: &mut Self::Stream);
    fn replay(
        exec: &Self::Executable,
        stream: &mut Self::Stream,
    ) -> Result<(), ServerError>;
}
Expand description

A driver that can record a stream’s launches into a replayable graph.

Required Associated Types§

Source

type Executable

An instantiated graph, released when it drops.

Dropping is how it is destroyed, so no path can hand back a graph and leak the executable behind it — including the ones that instantiate successfully and then find the window was abandoned.

Required Methods§

Source

fn begin(stream: &mut Self::Stream) -> Result<(), ServerError>

Put stream into recording mode: from here the driver records every launch issued on it.

§Errors

The driver’s refusal to begin recording. The caller restores the stream to what it was, so the whole sequence can be retried.

Source

fn instantiate( stream: &mut Self::Stream, doomed: Option<ServerError>, ) -> Result<Self::Executable, ServerError>

Close the recording on stream and instantiate what it recorded.

doomed is a recording already known not to become a graph — work inside the window failed or was skipped, so an operation is missing. The driver capture is closed either way: a stream left in capture mode records every launch that follows it.

A recording that allocated is refused here too. A graph owning memory nodes allocates on launch and never frees, so the driver rejects every relaunch while the first quietly succeeds.

§Errors

Whatever stopped the recording from becoming a graph, doomed included.

Source

fn upload(exec: &Self::Executable, stream: &mut Self::Stream)

Pre-stage exec so the first replay does not pay the upload cost.

Non-fatal by contract: a replay uploads on demand if this does nothing.

Source

fn replay( exec: &Self::Executable, stream: &mut Self::Stream, ) -> Result<(), ServerError>

Enqueue exec’s recorded sequence on stream.

§Errors

The driver’s refusal to enqueue the replay.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§