Skip to main content

PlannerPredicate

Enum PlannerPredicate 

Source
pub enum PlannerPredicate {
    Equation {
        start: String,
        end: String,
        duration: String,
        duration_unit_nanos: i128,
        end_inclusive: bool,
        guard: Option<PredicateGuard>,
    },
    NullWhen {
        column: String,
        guard: PredicateGuard,
    },
    InRange {
        column: String,
        min_nanos: i128,
        max_nanos: i128,
    },
    CounterSum {
        addends: Vec<String>,
        sum: String,
        guard: Option<PredicateGuard>,
    },
    NonNegative {
        columns: Vec<String>,
    },
    NotNullWhen {
        column: String,
        guard: PredicateGuard,
    },
    Ordering {
        earlier: String,
        later: String,
        guard: Option<PredicateGuard>,
    },
}
Expand description

A machine-checkable invariant a planner guarantees over the columns it owns.

Predicates are stated over column names and integer units so the verifier can evaluate them directly against generated rows without re-deriving the planner’s logic. Timestamp columns are compared as nanoseconds since the Unix epoch; a duration column is an integer count of duration_unit_nanos-sized units.

Variants§

§

Equation

On every row the guard selects (or every row when guard is None), the end timestamp is a checked-integer function of start and duration. The exact relation depends on end_inclusive:

  • end_inclusive == false (half-open [start, end)): end_ns == start_ns + duration * duration_unit_nanos.
  • end_inclusive == true (closed [start, end], end the last covered instant): end_ns == start_ns + duration * duration_unit_nanos - 1 (one nanosecond, the smallest internal unit).

The two modes are therefore not the same predicate: a verifier must branch on end_inclusive and check the exact produced value.

Fields

§start: String

The start timestamp column.

§end: String

The end timestamp column.

§duration: String

The duration column, an integer count of duration_unit_nanos units.

§duration_unit_nanos: i128

Nanoseconds per duration unit (e.g. 1_000_000_000 for seconds).

§end_inclusive: bool

Whether end denotes the inclusive last instant of the interval.

§guard: Option<PredicateGuard>

The rows the equation applies to; None means every row.

§

NullWhen

On every row the guard selects, column is SQL NULL.

Fields

§column: String

The column asserted to be NULL.

§guard: PredicateGuard

The rows the assertion applies to.

§

InRange

column, compared as epoch nanoseconds, lies within the inclusive bounds [min_nanos, max_nanos] on every non-null row.

Fields

§column: String

The timestamp column bounded.

§min_nanos: i128

Inclusive lower bound, epoch nanoseconds.

§max_nanos: i128

Inclusive upper bound, epoch nanoseconds.

§

CounterSum

On every row the guard selects (or every row when guard is None), the integer values of addends sum exactly to the integer value of sum. Counter planners state their partition equations this way, e.g. succeeded + failed == processed and processed + pending == total. A single-element addends therefore asserts a plain equality between two counter columns (e.g. processed == total on completed rows).

Fields

§addends: Vec<String>

The integer columns summed on the left-hand side.

§sum: String

The integer column the addends must sum to.

§guard: Option<PredicateGuard>

The rows the equation applies to; None means every row.

§

NonNegative

Every listed integer columns value is >= 0 on every row. Counter planners assert their counters never go negative.

Fields

§columns: Vec<String>

The integer columns constrained to be non-negative.

§

NotNullWhen

On every row the guard selects, column is non-NULL (the dual of NullWhen). Counter planners assert a completed row carries a completion timestamp.

Fields

§column: String

The column asserted to be non-NULL.

§guard: PredicateGuard

The rows the assertion applies to.

§

Ordering

On every row the guard selects (or every row when guard is None) where both endpoints are non-NULL, earlier (compared as epoch nanoseconds) is at most later. A NULL endpoint never violates the predicate — the temporal.lifecycle planner uses NULL to mean “state not yet reached”, so an unreached column’s absence does not participate in the ordering.

Fields

§earlier: String

The timestamp column expected to occur first.

§later: String

The timestamp column expected to occur at or after earlier.

§guard: Option<PredicateGuard>

The rows the ordering applies to; None means every row.

Trait Implementations§

Source§

impl Clone for PlannerPredicate

Source§

fn clone(&self) -> PlannerPredicate

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 Debug for PlannerPredicate

Source§

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

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

impl Eq for PlannerPredicate

Source§

impl PartialEq for PlannerPredicate

Source§

fn eq(&self, other: &PlannerPredicate) -> 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 PlannerPredicate

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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

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<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: RngExt + ?Sized, Self: FakeBase<U>,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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