Skip to main content

StatementEffect

Enum StatementEffect 

Source
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 NEXT stages 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

Source

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.

Source

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.

Source

pub fn attempted(self) -> bool

Whether the statement’s plan holds a mutation operator.

Source

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).

Source

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.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StatementEffect

Source§

impl Debug for StatementEffect

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for StatementEffect

Source§

impl PartialEq for StatementEffect

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StatementEffect

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V