Skip to main content

AsyncWriteAllOperation

Struct AsyncWriteAllOperation 

Source
pub struct AsyncWriteAllOperation { /* private fields */ }
Expand description

Owning asynchronous whole-file write that survives cancellation.

§Examples

The example runs against an isolated in-memory fixture. Applications obtain their configured facade from a provider or registry integration.

use qubit_fs::Path;
use qubit_fs::write::WriteOptions;
use qubit_fs::write::AsyncWriteAllOperationState;

let mut operation = filesystem.begin_write_all(
    Path::parse("/report")?, b"bytes".to_vec(), WriteOptions::default(),
)?;
operation.execute().await?;
assert_eq!(AsyncWriteAllOperationState::Completed, operation.state());
assert_eq!(5, operation.written_bytes());
assert!(!operation.has_recovery());

Implementations§

Source§

impl AsyncWriteAllOperation

Source

pub const fn filesystem(&self) -> &AsyncFileSystem

Returns the filesystem retained for execution and recovery inspection.

Source

pub const fn path(&self) -> &Path

Returns the requested target path.

Source

pub const fn state(&self) -> AsyncWriteAllOperationState

Returns the operation state.

Source

pub const fn has_recovery(&self) -> bool

Reports whether an opened writer is retained for recovery.

Source

pub fn recovery(&mut self) -> Option<&mut AsyncWriterRecovery>

Returns mutable access to the retained recovery writer.

Source

pub fn take_recovery(&mut self) -> Option<AsyncWriterRecovery>

Transfers recovery responsibility to the caller.

Subsequent writer recovery does not change this operation’s historical publication state or byte count.

Source

pub const fn written_bytes(&self) -> u64

Returns the frozen count of bytes confirmed before execution stopped.

Source

pub async fn execute( &mut self, ) -> Result<WriteOutcome, AsyncWriteAllOperationFailure>

Executes the operation once, retaining recovery state on failure.

§Cancellation

Keep this operation outside the cancellation scope and cancel only this future. Dropping an unpolled future leaves the operation ready. After execution starts, cancellation records indeterminate publication and retains any opened writer. A missing writer does not prove no effects. The payload is released when this future finishes or is dropped.

§Returns

The confirmed write outcome. Success freezes the acknowledged byte count and releases the committed writer.

§Errors

Returns the provider failure with confirmed progress, or InvalidState if execution has already started. Repeated execution preserves the historical state and does not invoke the provider again.

Trait Implementations§

Source§

impl Debug for AsyncWriteAllOperation

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult

Formats lifecycle facts without payload or provider session contents.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.