Skip to main content

AsyncSpillFile

Struct AsyncSpillFile 

Source
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

Source

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.

Source

pub fn path(&self) -> &Path

Returns the path to this spill file.

Source

pub fn bytes_written(&self) -> u64

Returns the number of bytes written to this file.

Source

pub async fn write_all(&mut self, data: &[u8]) -> Result<()>

Writes raw bytes to the file asynchronously.

§Errors

Returns an error if the write fails.

Source

pub async fn write_u64_le(&mut self, value: u64) -> Result<()>

Writes a u64 in little-endian format.

§Errors

Returns an error if the write fails.

Source

pub async fn write_i64_le(&mut self, value: i64) -> Result<()>

Writes an i64 in little-endian format.

§Errors

Returns an error if the write fails.

Source

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.

Source

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.

Source

pub fn is_writable(&self) -> bool

Returns whether this file is still in write mode.

Source

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.

Source

pub async fn delete(self) -> Result<()>

Deletes this spill file.

Consumes the AsyncSpillFile handle.

§Errors

Returns an error if the file cannot be deleted.

Trait Implementations§

Source§

impl Debug for AsyncSpillFile

Source§

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

Formats the value using the given formatter. 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.