pub struct BitemporalCoord {
pub valid_from: u64,
pub valid_to: u64,
pub system_time: u64,
}Expand description
Bitemporal versioning coordinate for a Knowledge Object.
Supports two independent time dimensions:
- Valid time (
valid_from,valid_to): When the fact was/is true in the real world. Example: an employee’s tenure at a company. - System time (
system_time): When the system recorded this version. Assigned automatically by the HLC on write. Monotonically increasing.
This enables queries like:
as_of(system_time=T₁)— “What did the system know at time T₁?”valid_at(valid_time=T₂)— “What was true at time T₂?”as_of(T₁).valid_at(T₂)— “What did the system believe at T₁ about T₂?”
Timestamps are HLC-encoded microseconds (see hlc.rs): upper 48 bits are
physical microseconds since Unix epoch, lower 16 bits are logical counter.
Fields§
§valid_from: u64Start of valid time interval (inclusive). HLC-encoded microseconds.
valid_to: u64End of valid time interval (exclusive). u64::MAX means “still valid”.
HLC-encoded microseconds.
system_time: u64System time when this version was recorded. Assigned by HLC on write. HLC-encoded microseconds.
Implementations§
Source§impl BitemporalCoord
impl BitemporalCoord
Sourcepub fn new(valid_from: u64, system_time: u64) -> Self
pub fn new(valid_from: u64, system_time: u64) -> Self
Create a new bitemporal coordinate with an open-ended valid interval.
Sourcepub fn with_valid_range(
valid_from: u64,
valid_to: u64,
system_time: u64,
) -> Self
pub fn with_valid_range( valid_from: u64, valid_to: u64, system_time: u64, ) -> Self
Create a coordinate with a closed valid interval.
Sourcepub fn valid_at(&self, valid_time: u64) -> bool
pub fn valid_at(&self, valid_time: u64) -> bool
Check if this coordinate is valid at a given valid time.
Sourcepub fn known_at(&self, system_time: u64) -> bool
pub fn known_at(&self, system_time: u64) -> bool
Check if this coordinate was known to the system by a given system time.
Sourcepub fn visible_at(&self, system_time: u64, valid_time: u64) -> bool
pub fn visible_at(&self, system_time: u64, valid_time: u64) -> bool
Combined bitemporal query: was this fact known at sys_time and valid at valid_time?
Sourcepub fn close_valid_time(&mut self, valid_to: u64)
pub fn close_valid_time(&mut self, valid_to: u64)
Close the valid time interval (the fact is no longer true).
Sourcepub fn is_current(&self) -> bool
pub fn is_current(&self) -> bool
Check if this coordinate represents a currently-valid fact (valid_to == MAX).
Trait Implementations§
Source§impl Clone for BitemporalCoord
impl Clone for BitemporalCoord
Source§fn clone(&self) -> BitemporalCoord
fn clone(&self) -> BitemporalCoord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BitemporalCoord
Source§impl Debug for BitemporalCoord
impl Debug for BitemporalCoord
Source§impl Default for BitemporalCoord
impl Default for BitemporalCoord
Source§impl<'de> Deserialize<'de> for BitemporalCoord
impl<'de> Deserialize<'de> for BitemporalCoord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for BitemporalCoord
Source§impl Hash for BitemporalCoord
impl Hash for BitemporalCoord
Source§impl PartialEq for BitemporalCoord
impl PartialEq for BitemporalCoord
Source§fn eq(&self, other: &BitemporalCoord) -> bool
fn eq(&self, other: &BitemporalCoord) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for BitemporalCoord
impl Serialize for BitemporalCoord
impl StructuralPartialEq for BitemporalCoord
Auto Trait Implementations§
impl Freeze for BitemporalCoord
impl RefUnwindSafe for BitemporalCoord
impl Send for BitemporalCoord
impl Sync for BitemporalCoord
impl Unpin for BitemporalCoord
impl UnsafeUnpin for BitemporalCoord
impl UnwindSafe for BitemporalCoord
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.