Skip to main content

AsyncSpillWriter

Trait AsyncSpillWriter 

Source
pub trait AsyncSpillWriter: Send {
    // Required methods
    fn write_all<'life0, 'async_trait>(
        &'life0 mut self,
        data: Bytes,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn finish<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn flush<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn abort<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Asynchronous writer for spill file backends.

The writer accepts owned Bytes so asynchronous backends can retain a buffer across an await within Self::write_all without copying it. Calls are made sequentially and buffers must be persisted in the order received. After write_all returns, implementations must not retain the input’s backing allocation unless that retained memory is accounted for separately. Backends that buffer a tail for a later call should copy that tail into an allocation sized for the retained bytes.

DataFusion makes a best-effort attempt to abort writers dropped by query cancellation. Backends should still configure lifecycle cleanup for abandoned uploads because cleanup cannot run after process termination.

Required Methods§

Source

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

Writes all bytes in data to the spill file.

Source

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

Finishes and commits the spill file.

A successful call is terminal. If committing returns an error, the caller will invoke Self::abort before dropping the writer.

Provided Methods§

Source

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

Flushes buffered data, if supported by the backend.

This does not finish the writer or require the spill file to become visible to readers. Self::finish is the commit boundary.

Source

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

Aborts an uncommitted spill write and cleans up backend resources.

Multipart backends should override this method to explicitly abort an in-progress upload. A successful call is terminal. DataFusion may retry an abort that returns an error, including during best-effort drop cleanup.

Implementations should bound their own abort latency to avoid holding DataFusion’s limited cleanup slots indefinitely. DataFusion does not impose a timeout because the caller’s runtime may not have a time driver.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§