[][src]Trait random_access_storage::RandomAccess

pub trait RandomAccess {
    type Error;
    fn write<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        offset: u64,
        data: &'life1 [u8]
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn read<'life0, 'async_trait>(
        &'life0 mut self,
        offset: u64,
        length: u64
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn read_to_writer<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        offset: u64,
        length: u64,
        buf: &'life1 mut impl AsyncWrite + Send
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn del<'life0, 'async_trait>(
        &'life0 mut self,
        offset: u64,
        length: u64
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn truncate<'life0, 'async_trait>(
        &'life0 mut self,
        length: u64
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn len<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn is_empty<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn sync_all<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }

The RandomAccess trait allows for reading from and writing to a randomly accessible storage of bytes.

Associated Types

type Error

An error.

Loading content...

Required methods

fn write<'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    offset: u64,
    data: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Write bytes at an offset to the backend.

fn read<'life0, 'async_trait>(
    &'life0 mut self,
    offset: u64,
    length: u64
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Self::Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Read a sequence of bytes at an offset from the backend.

fn read_to_writer<'life0, 'life1, 'async_trait>(
    &'life0 mut self,
    offset: u64,
    length: u64,
    buf: &'life1 mut impl AsyncWrite + Send
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Read a sequence of bytes at an offset from the backend.

fn del<'life0, 'async_trait>(
    &'life0 mut self,
    offset: u64,
    length: u64
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Delete a sequence of bytes at an offset from the backend.

fn truncate<'life0, 'async_trait>(
    &'life0 mut self,
    length: u64
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Resize the sequence of bytes, possibly discarding or zero-padding bytes from the end.

fn len<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Get the size of the storage in bytes.

fn is_empty<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Whether the storage is empty. For some storage backends it may be cheaper to calculate whether the storage is empty than to calculate the length.

fn sync_all<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Flush buffered data on the underlying storage resource.

Loading content...

Implementors

Loading content...