Skip to main content

Interface

Trait Interface 

Source
pub trait Interface:
    Send
    + Sync
    + Unpin
    + 'static {
    type Orchestrator: Borrow<SessionManager<Self>> + Send + Sync;

    // Required methods
    fn get_info(&self) -> Cow<'_, DeviceInfo>;
    fn spawn_session(&self, session: Arc<Session<Self>>);
    fn on_requests(&self, requests: &[Request]);

    // Provided method
    fn into_block_service(
        self: Arc<Self>,
        orchestrator: &Arc<Self::Orchestrator>,
    ) -> Arc<dyn BlockService>  { ... }
}

Required Associated Types§

Required Methods§

Source

fn get_info(&self) -> Cow<'_, DeviceInfo>

Called to get block/partition information.

Source

fn spawn_session(&self, session: Arc<Session<Self>>)

Start running a new session. The interface must ensure that Session::run is called on a different thread.

Source

fn on_requests(&self, requests: &[Request])

Starts a batch of requests. The implementation may block if there are too many in-flight requests, providing pushback. The interface is responsible for eventually calling SessionManager::complete_request for each request (even during server shutdown).

Implementations are responsible for checking that request block ranges fall within valid device/partition bounds, and completing with zx::Status::OUT_OF_RANGE if out of bounds.

Provided Methods§

Source

fn into_block_service( self: Arc<Self>, orchestrator: &Arc<Self::Orchestrator>, ) -> Arc<dyn BlockService>

Returns the BlockService implementation for this interface.

By default, returns the fallback DefaultCallbackBlockService.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§