pub struct AtomicWriter<S: ContextStore> { /* private fields */ }Expand description
Encapsulates the atomic write-before-complete discipline.
The protocol:
- Write output to ContextStore
- If write succeeds → call the completion callback
- If write fails → do NOT call completion; the Step will be retried
- If write succeeds but completion fails → on retry, write returns
AlreadyExists→ the Step knows the output is already durable and can safely re-attempt completion
Implementations§
Source§impl<S: ContextStore> AtomicWriter<S>
impl<S: ContextStore> AtomicWriter<S>
pub fn new(store: Arc<S>) -> Self
Sourcepub fn write_and_complete<F, T>(
&self,
flow_run_id: FlowRunId,
node_id: NodeId,
value: &Value,
complete_fn: F,
) -> Result<T, AtomicWriteError>
pub fn write_and_complete<F, T>( &self, flow_run_id: FlowRunId, node_id: NodeId, value: &Value, complete_fn: F, ) -> Result<T, AtomicWriteError>
Execute the write-before-complete protocol.
complete_fn is called only after the write succeeds. If the write
returns AlreadyExists, this is treated as success (idempotent retry)
and complete_fn is still called.
Returns the result of complete_fn, or the write error if the write
failed for a non-idempotent reason.
Auto Trait Implementations§
impl<S> Freeze for AtomicWriter<S>
impl<S> RefUnwindSafe for AtomicWriter<S>where
S: RefUnwindSafe,
impl<S> Send for AtomicWriter<S>
impl<S> Sync for AtomicWriter<S>
impl<S> Unpin for AtomicWriter<S>
impl<S> UnsafeUnpin for AtomicWriter<S>
impl<S> UnwindSafe for AtomicWriter<S>where
S: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more