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
impl AsyncWriteAllOperation
Sourcepub const fn filesystem(&self) -> &AsyncFileSystem
pub const fn filesystem(&self) -> &AsyncFileSystem
Returns the filesystem retained for execution and recovery inspection.
Sourcepub const fn state(&self) -> AsyncWriteAllOperationState
pub const fn state(&self) -> AsyncWriteAllOperationState
Returns the operation state.
Sourcepub const fn has_recovery(&self) -> bool
pub const fn has_recovery(&self) -> bool
Reports whether an opened writer is retained for recovery.
Sourcepub fn recovery(&mut self) -> Option<&mut AsyncWriterRecovery>
pub fn recovery(&mut self) -> Option<&mut AsyncWriterRecovery>
Returns mutable access to the retained recovery writer.
Sourcepub fn take_recovery(&mut self) -> Option<AsyncWriterRecovery>
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.
Sourcepub const fn written_bytes(&self) -> u64
pub const fn written_bytes(&self) -> u64
Returns the frozen count of bytes confirmed before execution stopped.
Sourcepub async fn execute(
&mut self,
) -> Result<WriteOutcome, AsyncWriteAllOperationFailure>
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.