pub trait Interface:
Send
+ Sync
+ Unpin
+ 'static {
Show 13 methods
// Required methods
fn get_info(
&self,
) -> impl Future<Output = Result<Cow<'_, DeviceInfo>, Status>> + Send;
fn read(
&self,
device_block_offset: u64,
block_count: u32,
vmo: &Arc<Vmo>,
vmo_offset: u64,
trace_flow_id: Option<NonZero<u64>>,
) -> impl Future<Output = Result<(), Status>> + Send;
fn write(
&self,
device_block_offset: u64,
block_count: u32,
vmo: &Arc<Vmo>,
vmo_offset: u64,
opts: WriteOptions,
trace_flow_id: Option<NonZero<u64>>,
) -> impl Future<Output = Result<(), Status>> + Send;
fn barrier(&self) -> Result<(), Status>;
fn flush(
&self,
trace_flow_id: Option<NonZero<u64>>,
) -> impl Future<Output = Result<(), Status>> + Send;
fn trim(
&self,
device_block_offset: u64,
block_count: u32,
trace_flow_id: Option<NonZero<u64>>,
) -> impl Future<Output = Result<(), Status>> + Send;
// Provided methods
fn open_session(
&self,
session_manager: Arc<SessionManager<Self>>,
stream: SessionRequestStream,
offset_map: OffsetMap,
block_size: u32,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn on_attach_vmo(
&self,
_vmo: &Vmo,
) -> impl Future<Output = Result<(), Status>> + Send { ... }
fn on_detach_vmo(&self, _vmo: &Vmo) { ... }
fn get_volume_info(
&self,
) -> impl Future<Output = Result<(VolumeManagerInfo, VolumeInfo), Status>> + Send { ... }
fn query_slices(
&self,
_start_slices: &[u64],
) -> impl Future<Output = Result<Vec<VsliceRange>, Status>> + Send { ... }
fn extend(
&self,
_start_slice: u64,
_slice_count: u64,
) -> impl Future<Output = Result<(), Status>> + Send { ... }
fn shrink(
&self,
_start_slice: u64,
_slice_count: u64,
) -> impl Future<Output = Result<(), Status>> + Send { ... }
}
Required Methods§
Sourcefn get_info(
&self,
) -> impl Future<Output = Result<Cow<'_, DeviceInfo>, Status>> + Send
fn get_info( &self, ) -> impl Future<Output = Result<Cow<'_, DeviceInfo>, Status>> + Send
Called to get block/partition information.
Sourcefn read(
&self,
device_block_offset: u64,
block_count: u32,
vmo: &Arc<Vmo>,
vmo_offset: u64,
trace_flow_id: Option<NonZero<u64>>,
) -> impl Future<Output = Result<(), Status>> + Send
fn read( &self, device_block_offset: u64, block_count: u32, vmo: &Arc<Vmo>, vmo_offset: u64, trace_flow_id: Option<NonZero<u64>>, ) -> impl Future<Output = Result<(), Status>> + Send
Called for a request to read bytes.
Sourcefn write(
&self,
device_block_offset: u64,
block_count: u32,
vmo: &Arc<Vmo>,
vmo_offset: u64,
opts: WriteOptions,
trace_flow_id: Option<NonZero<u64>>,
) -> impl Future<Output = Result<(), Status>> + Send
fn write( &self, device_block_offset: u64, block_count: u32, vmo: &Arc<Vmo>, vmo_offset: u64, opts: WriteOptions, trace_flow_id: Option<NonZero<u64>>, ) -> impl Future<Output = Result<(), Status>> + Send
Called for a request to write bytes. WriteOptions::PRE_BARRIER should never be seen for this call. See barrier().
Sourcefn barrier(&self) -> Result<(), Status>
fn barrier(&self) -> Result<(), Status>
Indicates that all previously completed write operations should be made persistent prior to any write operations issued after this call. It is not specified how the barrier affects currently in-flight write operations. This corresponds to the use of the PRE_BARRIER flag that can be used on a write request. Requests with that flag will be converted into separate barrier and write calls, and the write call above will not ever include the WriteOptions::PRE_BARRIER within opts.
Provided Methods§
Sourcefn open_session(
&self,
session_manager: Arc<SessionManager<Self>>,
stream: SessionRequestStream,
offset_map: OffsetMap,
block_size: u32,
) -> impl Future<Output = Result<(), Error>> + Send
fn open_session( &self, session_manager: Arc<SessionManager<Self>>, stream: SessionRequestStream, offset_map: OffsetMap, block_size: u32, ) -> impl Future<Output = Result<(), Error>> + Send
Runs stream
to completion.
Implementors can override this method if they want to create a passthrough session instead
(and can use [PassthroughSession]
below to do so). See
fuchsia.hardware.block.Block/OpenSessionWithOffsetMap.
If the implementor uses a [PassthroughSession]
, the following Interface methods
will not be called, and can be stubbed out:
- on_attach_vmo
- on_detach_vmo
- read
- write
- flush
- trim
Sourcefn on_attach_vmo(
&self,
_vmo: &Vmo,
) -> impl Future<Output = Result<(), Status>> + Send
fn on_attach_vmo( &self, _vmo: &Vmo, ) -> impl Future<Output = Result<(), Status>> + Send
Called whenever a VMO is attached, prior to the VMO’s usage in any other methods. Whilst
the VMO is attached, vmo
will keep the same address so it is safe to use the pointer
value (as, say, a key into a HashMap).
Sourcefn on_detach_vmo(&self, _vmo: &Vmo)
fn on_detach_vmo(&self, _vmo: &Vmo)
Called whenever a VMO is detached.
Sourcefn get_volume_info(
&self,
) -> impl Future<Output = Result<(VolumeManagerInfo, VolumeInfo), Status>> + Send
fn get_volume_info( &self, ) -> impl Future<Output = Result<(VolumeManagerInfo, VolumeInfo), Status>> + Send
Called to handle the GetVolumeInfo FIDL call.
Sourcefn query_slices(
&self,
_start_slices: &[u64],
) -> impl Future<Output = Result<Vec<VsliceRange>, Status>> + Send
fn query_slices( &self, _start_slices: &[u64], ) -> impl Future<Output = Result<Vec<VsliceRange>, Status>> + Send
Called to handle the QuerySlices FIDL call.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.