Trait vfs::file::FileIo

source ·
pub trait FileIo: Send + Sync {
    // Required methods
    fn read_at(
        &self,
        offset: u64,
        buffer: &mut [u8],
    ) -> impl Future<Output = Result<u64, Status>> + Send;
    fn write_at(
        &self,
        offset: u64,
        content: &[u8],
    ) -> impl Future<Output = Result<u64, Status>> + Send;
    fn append(
        &self,
        content: &[u8],
    ) -> impl Future<Output = Result<(u64, u64), Status>> + Send;
}

Required Methods§

source

fn read_at( &self, offset: u64, buffer: &mut [u8], ) -> impl Future<Output = Result<u64, Status>> + Send

Read at most |buffer.len()| bytes starting at |offset| into |buffer|. The function may read less than |count| bytes and still return success, in which case read_at returns the number of bytes read into |buffer|.

source

fn write_at( &self, offset: u64, content: &[u8], ) -> impl Future<Output = Result<u64, Status>> + Send

Write |content| starting at |offset|, returning the number of bytes that were successfully written.

If there are pending attributes to update (see update_attributes), they should also be flushed at this time. Otherwise, no attributes should be updated, other than size as needed.

source

fn append( &self, content: &[u8], ) -> impl Future<Output = Result<(u64, u64), Status>> + Send

Appends |content| returning, if successful, the number of bytes written, and the file offset after writing. Implementations should make the writes atomic, so in the event that multiple requests to append are in-flight, it should appear that the two writes are applied in sequence.

If there are pending attributes to update (see update_attributes), they should also be flushed at this time. Otherwise, no attributes should be updated, other than size as needed.

Object Safety§

This trait is not object safe.

Implementors§