pub enum StatementEffect {
None,
Attempted,
Applied,
}Expand description
What one statement’s execution did to the store: one of exactly three states, never a pair of flags whose fourth combination has to be explained away.
Both facts are recorded by the statement boundary itself, never inferred from the statement’s surface spelling:
- the attempt fact is the plan walk’s answer — the statement’s plan holds
a mutation operator (a data-write clause, schema DDL, a catalog write, or
a writes-flagged procedure call) — recorded once at statement entry
through the canonical walk, which descends into
NEXTstages and every nested body. It is a fact about the statement, not about rows, so a write whose pipeline feeds it nothing — the zero-effect write’s whole shape — still counts as an attempt; - the applied fact is the write scratch’s own applied-change count, which the statement entry reset zeroes and every applied change — entity, schema or catalog — grows: one redo funnel, so a catalog-only change counts.
The zero state has one spelling, Self::None — there is no constant
alias and no derived default beside it — and the join
(Self::merge) is an explicit three-state table, so no variant order is
semantic. There is no “applied but never attempted” state either: every
state that carries the applied fact (Self::Applied) also answers
Self::attempted.
Variants§
None
The statement’s plan holds no mutation operator, so nothing was
applied: a read (and every pre-execution construction such as an
EXPLAIN result). The policy stays silent however the planner
classified the statement.
Attempted
The statement’s plan holds a mutation operator and the engine applied
nothing: the ADR-0402 “zero-effect write” (the LABS-313 shape, an
idempotent MERGE that matched, a MATCH … SET whose MATCH bound no
rows).
Applied
The statement’s plan holds a mutation operator and at least one change reached the write redo — an entity, schema or catalog change alike.
Implementations§
Source§impl StatementEffect
impl StatementEffect
Sourcepub fn from_facts(attempted: bool, applied: bool) -> Self
pub fn from_facts(attempted: bool, applied: bool) -> Self
The effect of a statement from its two execution facts: attempted —
the statement’s plan holds a mutation operator (the boundary’s one plan
walk) — and applied — at least one change reached the write redo since
the statement’s entry reset.
applied implies attempted for every boundary that takes both facts
from one execution, and the state model has no fourth state to hold the
contrary pair. A caller that passes it anyway still gets
Self::Applied rather than a silently downgraded Self::None:
under-reporting an applied change is the one error the note policy must
never make.
Sourcepub fn from_applied(applied: bool) -> Self
pub fn from_applied(applied: bool) -> Self
The effect of a structural write boundary (the ADR-0209 bulk batch), where the attempt is implied and only the applied fact is observed.
Sourcepub fn applied(self) -> bool
pub fn applied(self) -> bool
Whether the statement applied at least one change (an entity, schema or catalog change — every applied change funnels through the redo).
Sourcepub fn changed_nothing(self) -> bool
pub fn changed_nothing(self) -> bool
The ADR-0402 “zero-effect write” criterion: the statement’s plan holds a mutation operator and the engine applied nothing. A read fails the first half, an effective write (catalog changes included) the second.
Sourcepub fn merge(&mut self, other: Self)
pub fn merge(&mut self, other: Self)
Fold another statement’s effect into this one — the join of the three-state lattice, which is how a transaction’s ledger accumulates its statements: attempted-if-any-attempted, applied-if-any-applied.
The table is spelled out variant by variant, so the declaration order of the enum carries no meaning and a fourth state cannot be added without deciding every join here.
Trait Implementations§
Source§impl Clone for StatementEffect
impl Clone for StatementEffect
impl Copy for StatementEffect
Source§impl Debug for StatementEffect
impl Debug for StatementEffect
impl Eq for StatementEffect
Source§impl PartialEq for StatementEffect
impl PartialEq for StatementEffect
impl StructuralPartialEq for StatementEffect
Auto Trait Implementations§
impl Forget for StatementEffect
impl Freeze for StatementEffect
impl Move for StatementEffect
impl RefUnwindSafe for StatementEffect
impl Send for StatementEffect
impl Sync for StatementEffect
impl Unpin for StatementEffect
impl UnsafeUnpin for StatementEffect
impl UnwindSafe for StatementEffect
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.