[][src]Struct hybrid_clocks::Clock

pub struct Clock<S: ClockSource> { /* fields omitted */ }

The main clock type.

Methods

impl Clock<WallNS>[src]

pub fn wall_ns() -> Clock<WallNS>[src]

Returns a Clock that uses WallNS-clock time.

impl Clock<WallMS>[src]

pub fn wall_ms() -> Clock<WallMS>[src]

Returns a Clock that uses WallNS-clock time.

impl Clock<ManualClock>[src]

pub fn manual(t: u64) -> Clock<ManualClock>[src]

Returns a Clock that uses WallNS-clock time.

pub fn set_time(&mut self, t: u64)[src]

impl<S: ClockSource> Clock<S>[src]

pub fn new(src: S) -> Self[src]

Creates a clock with src as the time provider.

pub fn new_with_max_diff(src: S, diff: S::Delta) -> Self[src]

Creates a clock with src as the time provider, and diff as how far in the future we don't mind seeing updates from.

pub fn set_epoch(&mut self, epoch: u32)[src]

Used to create a new "epoch" of clock times, mostly useful as a manual override when a cluster member has skewed the clock time far into the future.

pub fn now(&mut self) -> Timestamp<S::Time>[src]

Creates a unique monotonic timestamp suitable for annotating messages we send.

pub fn observe(&mut self, msg: &Timestamp<S::Time>) -> Result<(), Error>[src]

Accepts a timestamp from an incoming message, and updates the clock so that further calls to now will always return a timestamp that happens-after either locally generated timestamps or that of the input message. Returns an Error iff the delta from our local lock to the observed timestamp is greater than our configured limit.

Trait Implementations

impl<S: Clone + ClockSource> Clone for Clock<S> where
    S::Time: Clone,
    S::Delta: Clone
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<S: Debug + ClockSource> Debug for Clock<S> where
    S::Time: Debug,
    S::Delta: Debug
[src]

Auto Trait Implementations

impl<S> Send for Clock<S> where
    S: Send,
    <S as ClockSource>::Delta: Send,
    <S as ClockSource>::Time: Send

impl<S> Sync for Clock<S> where
    S: Sync,
    <S as ClockSource>::Delta: Sync,
    <S as ClockSource>::Time: Sync

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]