pub struct SeekableAsyncFile { /* private fields */ }

Implementations§

source§

impl SeekableAsyncFile

source

pub async fn open(
    path: &Path,
    size: u64,
    metrics: Arc<SeekableAsyncFileMetrics>,
    delayed_sync_us: u64,
    io_direct: bool,
    io_dsync: bool
) -> Self

Open a file descriptor in read and write modes, creating it if it doesn’t exist. If it already exists, the contents won’t be truncated.

To save a stat call, the size must be provided. This also allows opening non-standard files which may have a size of zero (e.g. block devices). If the mmap feature is being used, a different size value also allows only using a portion of the beginning of the file.

The io_direct and io_dsync parameters set the O_DIRECT and O_DSYNC flags, respectively. Unless you need those flags, provide false.

Make sure to execute start_delayed_data_sync_background_loop in the background after this call.

source

pub async fn read_at(&self, offset: u64, len: u64) -> Vec<u8>

source

pub async fn read_u16_at(&self, offset: u64) -> u16

source

pub async fn read_u64_at(&self, offset: u64) -> u64

source

pub async fn write_at(&self, offset: u64, data: Vec<u8>)

source

pub async fn write_at_with_delayed_sync(&self, writes: Vec<WriteRequest>)

source

pub async fn start_delayed_data_sync_background_loop(&self)

source

pub async fn sync_data(&self)

Trait Implementations§

source§

impl Clone for SeekableAsyncFile

source§

fn clone(&self) -> SeekableAsyncFile

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere
    T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.