pub struct AsyncSpillManager { /* private fields */ }Expand description
Async manager for spill file lifecycle for out-of-core processing.
The async manager handles:
- Creating unique spill files with prefixes using async I/O
- Tracking total bytes spilled to disk
- Automatic cleanup of all spill files on drop
Implementations§
Source§impl AsyncSpillManager
impl AsyncSpillManager
Sourcepub async fn new(spill_dir: impl Into<PathBuf>) -> Result<Self>
pub async fn new(spill_dir: impl Into<PathBuf>) -> Result<Self>
Creates a new async spill manager with the given directory.
Creates the directory if it doesn’t exist.
§Errors
Returns an error if the directory cannot be created.
Sourcepub async fn with_temp_dir() -> Result<Self>
pub async fn with_temp_dir() -> Result<Self>
Creates a new async spill manager using a system temp directory.
§Errors
Returns an error if the temp directory cannot be created.
Sourcepub async fn create_file(&self, prefix: &str) -> Result<AsyncSpillFile>
pub async fn create_file(&self, prefix: &str) -> Result<AsyncSpillFile>
Creates a new async spill file with the given prefix.
The file name format is: {prefix}_{file_id}.spill
§Errors
Returns an error if the file cannot be created.
Sourcepub fn register_spilled_bytes(&self, bytes: u64)
pub fn register_spilled_bytes(&self, bytes: u64)
Registers bytes spilled to disk.
Called by AsyncSpillFile when writing completes.
Sourcepub fn unregister_spilled_bytes(&self, bytes: u64)
pub fn unregister_spilled_bytes(&self, bytes: u64)
Unregisters bytes when a spill file is deleted.
Called by AsyncSpillFile on deletion.
Sourcepub async fn unregister_file(&self, path: &Path)
pub async fn unregister_file(&self, path: &Path)
Removes a file path from tracking (called when file is deleted).
Sourcepub fn spilled_bytes(&self) -> u64
pub fn spilled_bytes(&self) -> u64
Returns total bytes currently spilled to disk.
Sourcepub async fn active_file_count(&self) -> usize
pub async fn active_file_count(&self) -> usize
Returns the number of active spill files.
Trait Implementations§
Source§impl Debug for AsyncSpillManager
impl Debug for AsyncSpillManager
Auto Trait Implementations§
impl !Freeze for AsyncSpillManager
impl !RefUnwindSafe for AsyncSpillManager
impl Send for AsyncSpillManager
impl Sync for AsyncSpillManager
impl Unpin for AsyncSpillManager
impl !UnwindSafe for AsyncSpillManager
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