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],endthe 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
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
guard: PredicateGuardThe 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
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
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.
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
guard: PredicateGuardThe 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.
Trait Implementations§
Source§impl Clone for PlannerPredicate
impl Clone for PlannerPredicate
Source§fn clone(&self) -> PlannerPredicate
fn clone(&self) -> PlannerPredicate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PlannerPredicate
impl Debug for PlannerPredicate
impl Eq for PlannerPredicate
Source§impl PartialEq for PlannerPredicate
impl PartialEq for PlannerPredicate
impl StructuralPartialEq for PlannerPredicate
Auto Trait Implementations§
impl Freeze for PlannerPredicate
impl RefUnwindSafe for PlannerPredicate
impl Send for PlannerPredicate
impl Sync for PlannerPredicate
impl Unpin for PlannerPredicate
impl UnsafeUnpin for PlannerPredicate
impl UnwindSafe for PlannerPredicate
Blanket Implementations§
impl<T> Allocation for T
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
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§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.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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