pub enum Precondition {
Absent(Key),
Present(Key),
Equals(Key, Value),
NotAfter(u64),
}Expand description
A condition a Batch checks before it writes: raw key/byte checks,
not the ref CAS. A planner decides a ref write with
crate::refs::evaluate_condition on the value it read, then guards
that read here (Absent or Equals on the ref key) so the decision
still holds at commit.
Variants§
Absent(Key)
The key holds no value. observed on failure: the value it holds.
Present(Key)
The key holds a value. observed on failure: None.
Equals(Key, Value)
The key holds exactly this value. observed on failure: the value
it holds, if any.
NotAfter(u64)
Commit deadline (Unix ms): the batch commits only if the backend’s
own clock, read inside the check-and-write step, is <= it. It
names no key, so every store accepts it. Failure is
BatchOutcome::DeadlinePassed, never PreconditionFailed. A
clock reading before the epoch or otherwise invalid fails closed:
it counts as u64::MAX.