Skip to main content

ReadObjectHandle

Trait ReadObjectHandle 

Source
pub trait ReadObjectHandle: ObjectHandle {
    // Required methods
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 self,
        offset: u64,
        buf: MutableBufferRef<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_size(&self) -> u64;
}

Required Methods§

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 self, offset: u64, buf: MutableBufferRef<'life1>, ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fills |buf| with up to |buf.len()| bytes read from |offset| on the underlying device. |offset| and |buf| must both be block-aligned.

Source

fn get_size(&self) -> u64

Returns the size of the object.

Trait Implementations§

Source§

impl LayerObject for dyn ReadObjectHandle + '_

Source§

fn as_slice(&self) -> Option<&[u8]>

Returns a memory-mapped slice of the entire layer file if supported (e.g. when backed by a pager-managed VMO).
Source§

fn has_io_error(&self) -> bool

Returns true if an underlying I/O error occurred while paging in data for this object.
Source§

fn purge_cached_data(&self)

Requests that cached data (such as paged-in pages) for this object be purged.
Source§

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Called when the layer is closed to release any external resources (such as pager registrations).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: ReadObjectHandle + ?Sized> ReadObjectHandle for Arc<T>

Source§

fn read<'life0, 'life1, 'async_trait>( &'life0 self, offset: u64, buf: MutableBufferRef<'life1>, ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_size(&self) -> u64

Source§

impl<T: ReadObjectHandle + ?Sized> ReadObjectHandle for Box<T>

Source§

fn read<'life0, 'life1, 'async_trait>( &'life0 self, offset: u64, buf: MutableBufferRef<'life1>, ) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_size(&self) -> u64

Implementors§