Skip to main content

DataWriter

Trait DataWriter 

Source
pub trait DataWriter: Send + 'static {
    // Required methods
    fn set_next_term_data_source<'life0, 'async_trait>(
        &'life0 mut self,
        byte_range: FileRange,
        permit: Option<AdjustableSemaphorePermit>,
        data_future: Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'static>>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn finish<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait;
}

Required Methods§

Source

fn set_next_term_data_source<'life0, 'async_trait>( &'life0 mut self, byte_range: FileRange, permit: Option<AdjustableSemaphorePermit>, data_future: Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'static>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets the data source for the next sequential term.

The byte range must be sequential - its start must match the end of the previous range (or 0 for the first call). The data future will be spawned as a task and its result will be written when ready.

SequentialWriter will ensure that the actual writes happen in order.

An optional semaphore permit can be passed for rate limiting. The permit will be released by the background writer after the data has been written.

Source

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

Consumes the writer, waits until all data has been written, and returns the number of bytes written. Dropping the writer without calling finish cancels the reconstruction via the shared run state.

Implementors§