pub struct SpillManager { /* private fields */ }Expand description
Manages spill file lifecycle for out-of-core processing.
The manager handles:
- Creating unique spill files with prefixes
- Tracking total bytes spilled to disk
- Automatic cleanup of all spill files on drop
Implementations§
Source§impl SpillManager
impl SpillManager
Sourcepub fn new(spill_dir: impl Into<PathBuf>) -> Result<Self>
pub fn new(spill_dir: impl Into<PathBuf>) -> Result<Self>
Creates a new 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 fn with_temp_dir() -> Result<Self>
pub fn with_temp_dir() -> Result<Self>
Creates a new spill manager using a system temp directory.
§Errors
Returns an error if the temp directory cannot be created.
Sourcepub fn create_file(&self, prefix: &str) -> Result<SpillFile>
pub fn create_file(&self, prefix: &str) -> Result<SpillFile>
Creates a new 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 SpillFile 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 SpillFile on deletion.
Sourcepub fn unregister_file(&self, path: &Path)
pub 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 fn active_file_count(&self) -> usize
pub fn active_file_count(&self) -> usize
Returns the number of active spill files.
Trait Implementations§
Source§impl Debug for SpillManager
impl Debug for SpillManager
Auto Trait Implementations§
impl !Freeze for SpillManager
impl !RefUnwindSafe for SpillManager
impl Send for SpillManager
impl Sync for SpillManager
impl Unpin for SpillManager
impl UnsafeUnpin for SpillManager
impl UnwindSafe for SpillManager
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