Struct hybrid_clocks::Clock [] [src]

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

The main clock type.

Methods

impl Clock<Wall>
[src]

fn wall() -> Clock<Wall>

Returns a Clock that uses wall-clock time.

impl Clock<ManualClock>
[src]

fn manual(t: u64) -> Clock<ManualClock>

Returns a Clock that uses wall-clock time.

fn set_time(&mut self, t: u64)

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

fn new(src: S) -> Self

Creates a clock with src as the time provider.

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

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

fn set_epoch(&mut self, epoch: u32)

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.

fn now(&mut self) -> Timestamp<S::Time>

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

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

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(&self) -> Clock<S>

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

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

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.