pub trait VhostUserBackendReqHandler {
Show 35 methods
// Required methods
fn set_owner(&self) -> Result<()>;
fn reset_owner(&self) -> Result<()>;
fn reset_device(&self) -> Result<()>;
fn get_features(&self) -> Result<u64>;
fn set_features(&self, features: u64) -> Result<()>;
fn set_mem_table(
&self,
ctx: &[VhostUserMemoryRegion],
files: Vec<File>,
postcopy_listening: Option<bool>,
) -> Result<Option<Vec<VhostUserMemoryRegionBase>>>;
fn set_vring_num(&self, index: u32, num: u32) -> Result<()>;
fn set_vring_addr(
&self,
index: u32,
flags: VhostUserVringAddrFlags,
descriptor: u64,
used: u64,
available: u64,
log: u64,
) -> Result<()>;
fn set_vring_base(&self, index: u32, base: u32) -> Result<()>;
fn get_vring_base(&self, index: u32) -> Result<VhostUserVringState>;
fn set_vring_kick(&self, index: u8, fd: Option<File>) -> Result<()>;
fn set_vring_call(&self, index: u8, fd: Option<File>) -> Result<()>;
fn set_vring_err(&self, index: u8, fd: Option<File>) -> Result<()>;
fn get_protocol_features(&self) -> Result<VhostUserProtocolFeatures>;
fn set_protocol_features(&self, features: u64) -> Result<()>;
fn get_queue_num(&self) -> Result<u64>;
fn set_vring_enable(&self, index: u32, enable: bool) -> Result<()>;
fn get_config(
&self,
offset: u32,
size: u32,
flags: VhostUserConfigFlags,
) -> Result<Vec<u8>>;
fn set_config(
&self,
offset: u32,
buf: &[u8],
flags: VhostUserConfigFlags,
) -> Result<()>;
fn set_gpu_socket(&self, _gpu_backend: GpuBackend) -> Result<()>;
fn get_shared_object(&self, uuid: VhostUserSharedMsg) -> Result<File>;
fn get_inflight_fd(
&self,
inflight: &VhostUserInflight,
) -> Result<(VhostUserInflight, File)>;
fn set_inflight_fd(
&self,
inflight: &VhostUserInflight,
file: File,
) -> Result<()>;
fn get_max_mem_slots(&self) -> Result<u64>;
fn add_mem_region(
&self,
region: &VhostUserSingleMemoryRegion,
fd: File,
postcopy_listening: Option<bool>,
) -> Result<Option<VhostUserMemoryRegionBase>>;
fn remove_mem_region(
&self,
region: &VhostUserSingleMemoryRegion,
) -> Result<()>;
fn set_device_state_fd(
&self,
direction: VhostTransferStateDirection,
phase: VhostTransferStatePhase,
fd: File,
) -> Result<Option<File>>;
fn check_device_state(&self) -> Result<()>;
fn get_shmem_config(&self) -> Result<VhostUserShMemConfig>;
fn postcopy_advice(&self) -> Result<File>;
fn postcopy_listen(&self) -> Result<()>;
fn postcopy_end(&self) -> Result<()>;
fn postcopy_ack_mem_regions(&self) -> Result<()>;
fn set_log_base(&self, log: &VhostUserLog, file: File) -> Result<()>;
// Provided method
fn set_backend_req_fd(&self, _backend: Backend) { ... }
}Expand description
Services provided to the frontend by the backend with interior mutability.
The VhostUserBackendReqHandler trait defines the services provided to the frontend by the backend. And the VhostUserBackendReqHandlerMut trait is a helper mirroring VhostUserBackendReqHandler, but without interior mutability. The vhost-user specification defines a frontend communication channel, by which frontends could request services from backends. The VhostUserBackendReqHandler trait defines services provided by backends, and it’s used both on the frontend side and backend side.
- on the frontend side, a stub forwarder implementing VhostUserBackendReqHandler will proxy service requests to backends.
- on the backend side, the BackendReqHandler will forward service requests to a handler implementing VhostUserBackendReqHandler.
The VhostUserBackendReqHandler trait is design with interior mutability to improve performance for multi-threading.
Required Methods§
fn set_owner(&self) -> Result<()>
fn reset_owner(&self) -> Result<()>
fn reset_device(&self) -> Result<()>
fn get_features(&self) -> Result<u64>
fn set_features(&self, features: u64) -> Result<()>
fn set_mem_table( &self, ctx: &[VhostUserMemoryRegion], files: Vec<File>, postcopy_listening: Option<bool>, ) -> Result<Option<Vec<VhostUserMemoryRegionBase>>>
fn set_vring_num(&self, index: u32, num: u32) -> Result<()>
fn set_vring_addr( &self, index: u32, flags: VhostUserVringAddrFlags, descriptor: u64, used: u64, available: u64, log: u64, ) -> Result<()>
fn set_vring_base(&self, index: u32, base: u32) -> Result<()>
fn get_vring_base(&self, index: u32) -> Result<VhostUserVringState>
fn set_vring_kick(&self, index: u8, fd: Option<File>) -> Result<()>
fn set_vring_call(&self, index: u8, fd: Option<File>) -> Result<()>
fn set_vring_err(&self, index: u8, fd: Option<File>) -> Result<()>
fn get_protocol_features(&self) -> Result<VhostUserProtocolFeatures>
fn set_protocol_features(&self, features: u64) -> Result<()>
fn get_queue_num(&self) -> Result<u64>
fn set_vring_enable(&self, index: u32, enable: bool) -> Result<()>
fn get_config( &self, offset: u32, size: u32, flags: VhostUserConfigFlags, ) -> Result<Vec<u8>>
fn set_config( &self, offset: u32, buf: &[u8], flags: VhostUserConfigFlags, ) -> Result<()>
fn set_gpu_socket(&self, _gpu_backend: GpuBackend) -> Result<()>
fn get_inflight_fd( &self, inflight: &VhostUserInflight, ) -> Result<(VhostUserInflight, File)>
fn set_inflight_fd( &self, inflight: &VhostUserInflight, file: File, ) -> Result<()>
fn get_max_mem_slots(&self) -> Result<u64>
fn add_mem_region( &self, region: &VhostUserSingleMemoryRegion, fd: File, postcopy_listening: Option<bool>, ) -> Result<Option<VhostUserMemoryRegionBase>>
fn remove_mem_region(&self, region: &VhostUserSingleMemoryRegion) -> Result<()>
fn set_device_state_fd( &self, direction: VhostTransferStateDirection, phase: VhostTransferStatePhase, fd: File, ) -> Result<Option<File>>
fn check_device_state(&self) -> Result<()>
fn get_shmem_config(&self) -> Result<VhostUserShMemConfig>
fn postcopy_advice(&self) -> Result<File>
fn postcopy_listen(&self) -> Result<()>
fn postcopy_end(&self) -> Result<()>
fn postcopy_ack_mem_regions(&self) -> Result<()>
fn set_log_base(&self, log: &VhostUserLog, file: File) -> Result<()>
Provided Methods§
fn set_backend_req_fd(&self, _backend: Backend)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".