Skip to main content

AtomicUnitOp

Type Alias AtomicUnitOp 

Source
pub type AtomicUnitOp = Box<dyn for<'w> FnOnce(&'w mut dyn SqlWriter) -> BoxFuture<'w, StorageResult<Box<dyn Any + Send>>> + Send>;
Expand description

A caller-supplied unit of work to run as ONE atomic operation via SqlAccess::atomic_unit (ADR-067 Component A, Fork C slice 2).

op receives a live &mut dyn SqlWriter already inside an open write transaction โ€” it must issue DML only (no bare BEGIN/COMMIT/ ROLLBACK; the caller-visible transaction boundary is owned entirely by atomic_unit, exactly like the existing execute_batch contract) โ€” and returns its result type-erased via Box<dyn Any + Send> so this trait method stays object-safe (no method-level generics on a trait used as dyn SqlAccess). Callers downcast the returned box back to their own concrete outcome type.

Aliased Typeยง

pub struct AtomicUnitOp(/* private fields */);