pub trait SpillFile: Send + Sync {
// Required methods
fn size(&self) -> Option<u64>;
fn read_stream(
&self,
) -> Result<Pin<Box<dyn Stream<Item = Result<Bytes>> + Send>>>;
fn open_writer(&self) -> Result<Box<dyn SpillWriter>>;
// Provided methods
fn path(&self) -> Option<&Path> { ... }
fn open_async_writer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn AsyncSpillWriter>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Abstraction over a spill file backend. Implementations handle their own quota enforcement and blocking concerns.
Required Methods§
Sourcefn read_stream(
&self,
) -> Result<Pin<Box<dyn Stream<Item = Result<Bytes>> + Send>>>
fn read_stream( &self, ) -> Result<Pin<Box<dyn Stream<Item = Result<Bytes>> + Send>>>
Returns file contents as an async stream of byte chunks.
Sourcefn open_writer(&self) -> Result<Box<dyn SpillWriter>>
fn open_writer(&self) -> Result<Box<dyn SpillWriter>>
Opens a writer for appending data to this file.
Provided Methods§
Sourcefn open_async_writer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn AsyncSpillWriter>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open_async_writer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn AsyncSpillWriter>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Opens an asynchronous writer for appending data to this file.
The default implementation adapts Self::open_writer for backwards
compatibility. Backends with native asynchronous I/O should override
this method to avoid blocking an async executor.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".