pub struct HybridTimestamp(/* private fields */);Expand description
Hybrid UNIX and logical clock timestamp.
This allows for settings where we want the guarantees of a monotonically incrementing lamport timestamp but still “move forwards” with “global time” so we get the best of both worlds during ordering:
- If we lost the state of our logical clock we will still be after previous timestamps, as the global UNIX time advanced (given that no OS clock was faulty).
- If the UNIX timestamp is the same we know which item came after because of the logical clock and don’t need to rely on more “random” tie-breakers, like a hashing digest.
Implementations§
Source§impl HybridTimestamp
impl HybridTimestamp
pub fn from_parts(timestamp: Timestamp, logical: LamportTimestamp) -> Self
pub fn now() -> Self
pub fn increment(self) -> Self
Trait Implementations§
Source§impl Clone for HybridTimestamp
impl Clone for HybridTimestamp
Source§fn clone(&self) -> HybridTimestamp
fn clone(&self) -> HybridTimestamp
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HybridTimestamp
impl Debug for HybridTimestamp
Source§impl<'de> Deserialize<'de> for HybridTimestamp
impl<'de> Deserialize<'de> for HybridTimestamp
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for HybridTimestamp
impl Display for HybridTimestamp
Source§impl FromStr for HybridTimestamp
impl FromStr for HybridTimestamp
Source§impl Hash for HybridTimestamp
impl Hash for HybridTimestamp
Source§impl Ord for HybridTimestamp
impl Ord for HybridTimestamp
Source§fn cmp(&self, other: &HybridTimestamp) -> Ordering
fn cmp(&self, other: &HybridTimestamp) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for HybridTimestamp
impl PartialEq for HybridTimestamp
Source§impl PartialOrd for HybridTimestamp
impl PartialOrd for HybridTimestamp
Source§impl Serialize for HybridTimestamp
impl Serialize for HybridTimestamp
impl Copy for HybridTimestamp
impl Eq for HybridTimestamp
impl StructuralPartialEq for HybridTimestamp
Auto Trait Implementations§
impl Freeze for HybridTimestamp
impl RefUnwindSafe for HybridTimestamp
impl Send for HybridTimestamp
impl Sync for HybridTimestamp
impl Unpin for HybridTimestamp
impl UnwindSafe for HybridTimestamp
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<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
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.