pub trait VhostUserDeviceBuilder {
    // Required method
    fn build(self: Box<Self>, ex: &Executor) -> Result<Box<dyn Backend>>;
}
Expand description

A trait for not-yet-built vhost-user devices.

Upon being given an [Executor], a builder can be converted into a [vmm_vhost::Backend], which can then process the requests from the front-end.

We don’t build the device directly to ensure that the device only starts threads in the jailed process, not in the main process. [VhostUserDeviceBuilder::build()] is called only after jailing, which ensures that any operations by the device are done in the jailed process.

TODO: Ideally this would return a [VhostUserDevice] instead of [vmm_vhost::Backend]. Only the vhost-user vhost-vsock device uses the latter and it can probably be migrated to [VhostUserDevice].

Required Methods§

source

fn build(self: Box<Self>, ex: &Executor) -> Result<Box<dyn Backend>>

Create the vhost-user device.

ex is an executor the device can use to schedule its tasks.

Implementors§