pub struct AsyncSpillFile { /* private fields */ }Expand description
Async handle for a single spill file.
AsyncSpillFile manages a temporary file used for spilling operator state to disk using tokio’s async I/O primitives for non-blocking operations.
Implementations§
Source§impl AsyncSpillFile
impl AsyncSpillFile
Sourcepub async fn new(path: PathBuf) -> Result<Self>
pub async fn new(path: PathBuf) -> Result<Self>
Creates a new async spill file at the given path.
§Errors
Returns an error if the file cannot be created.
Sourcepub fn bytes_written(&self) -> u64
pub fn bytes_written(&self) -> u64
Returns the number of bytes written to this file.
Sourcepub async fn write_u64_le(&mut self, value: u64) -> Result<()>
pub async fn write_u64_le(&mut self, value: u64) -> Result<()>
Sourcepub async fn write_i64_le(&mut self, value: i64) -> Result<()>
pub async fn write_i64_le(&mut self, value: i64) -> Result<()>
Sourcepub async fn write_bytes(&mut self, data: &[u8]) -> Result<()>
pub async fn write_bytes(&mut self, data: &[u8]) -> Result<()>
Writes a length-prefixed byte slice.
Format: [length: u64][data: bytes]
§Errors
Returns an error if the write fails.
Sourcepub async fn finish_write(&mut self) -> Result<()>
pub async fn finish_write(&mut self) -> Result<()>
Finishes writing and flushes buffers.
After this call, the file is ready for reading.
§Errors
Returns an error if the flush fails.
Sourcepub fn is_writable(&self) -> bool
pub fn is_writable(&self) -> bool
Returns whether this file is still in write mode.
Sourcepub async fn reader(&self) -> Result<AsyncSpillFileReader>
pub async fn reader(&self) -> Result<AsyncSpillFileReader>
Creates an async reader for this file.
Can be called multiple times to create multiple readers.
§Errors
Returns an error if the file cannot be opened for reading.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AsyncSpillFile
impl !RefUnwindSafe for AsyncSpillFile
impl Send for AsyncSpillFile
impl Sync for AsyncSpillFile
impl Unpin for AsyncSpillFile
impl !UnwindSafe for AsyncSpillFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more