pub struct Frontier<T> { /* private fields */ }Expand description
A progress claim: all timestamps strictly less than some element are complete.
A Frontier is a pure value type — no networking, no I/O, no async.
Implementations§
Source§impl<T: PartialOrd + Clone> Frontier<T>
impl<T: PartialOrd + Clone> Frontier<T>
Sourcepub fn bottom() -> Self
pub fn bottom() -> Self
The identity element for meet — an unconstrained frontier
with no elements, where no timestamp is reported in-flight.
Sourcepub fn from_elements(iter: impl IntoIterator<Item = T>) -> Self
pub fn from_elements(iter: impl IntoIterator<Item = T>) -> Self
Creates a frontier from an iterator of elements.
Sourcepub fn less_equal(&self, time: &T) -> bool
pub fn less_equal(&self, time: &T) -> bool
Returns true if time is less than or equal to some element of this frontier,
meaning time is still in-flight.
Sourcepub fn meet(&self, other: &Self) -> Self
pub fn meet(&self, other: &Self) -> Self
Coordinator-free merge: the most conservative frontier dominated by both.
This is the lattice meet (greatest lower bound): the result is the most advanced frontier that is still less than or equal to both inputs.
Properties proven by the Phase 2 property tests:
- Commutative:
meet(a, b) == meet(b, a) - Associative:
meet(a, meet(b, c)) == meet(meet(a, b), c) - Idempotent:
meet(a, a) == a
Convergence guarantee: two nodes that have each seen any subset of the same update set,
in any order, will hold identical Frontier values after calling meet for each update.
Performance: O(n²) in antichain width n. For Frontier<u64> (totally ordered),
the antichain collapses to width 1, making this effectively O(1). For
Frontier<ProductTimestamp<u64, u64>> at worst-case width: 100 ≈ 9 µs, 500 ≈ 204 µs,
1 000 ≈ 825 µs (measured 2026-06-18). Practical production widths are ≤ 50.
use antichain::Frontier;
let f1 = Frontier::from_elem(7u64);
let f2 = Frontier::from_elem(3u64);
// meet returns the more conservative (lower) frontier
let merged = f1.meet(&f2);
assert!(merged.less_equal(&3)); // 3 still in-flight
assert!(!merged.less_equal(&7)); // 7 is past the merged frontier
// order of application does not matter
assert_eq!(f1.meet(&f2), f2.meet(&f1));