Skip to main content

AsyncSpillManager

Struct AsyncSpillManager 

Source
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

Source

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.

Source

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.

Source

pub fn spill_dir(&self) -> &Path

Returns the spill directory path.

Source

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.

Source

pub fn register_spilled_bytes(&self, bytes: u64)

Registers bytes spilled to disk.

Called by AsyncSpillFile when writing completes.

Source

pub fn unregister_spilled_bytes(&self, bytes: u64)

Unregisters bytes when a spill file is deleted.

Called by AsyncSpillFile on deletion.

Source

pub async fn unregister_file(&self, path: &Path)

Removes a file path from tracking (called when file is deleted).

Source

pub fn spilled_bytes(&self) -> u64

Returns total bytes currently spilled to disk.

Source

pub async fn active_file_count(&self) -> usize

Returns the number of active spill files.

Source

pub async fn cleanup(&self) -> Result<()>

Cleans up all spill files asynchronously.

This can be called manually for async cleanup.

§Errors

Returns an error if any file cannot be deleted (continues trying others).

Trait Implementations§

Source§

impl Debug for AsyncSpillManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for AsyncSpillManager

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.