Struct optra::TimeStamper [] [src]

pub struct TimeStamper {
    // some fields omitted
}

Tracks the relationship between local timestamps and the timestamp on remote machines.

Methods

impl TimeStamper
[src]

fn new() -> TimeStamper

Create a new TimeStamper, with no stamps yet assigned

fn stamp_remote(&mut self, site_id: u32, remote_timestamp: u32) -> u32

Stamp a remote operation corrsponding to the given site_id and remtoe timestamp with a local timestamp. If this remote id has never been stamped before, then assign it a new timestamp, sequentially after the previous one. If it has, the previously assigned timestamp is returned

fn stamp_local(&mut self, site_id: u32) -> u32

Stamp a local operation. This will always create a new timestamp

fn get_local_timestamp_for(&self, remote_site_id: u32, remote_timestamp: u32) -> Option<u32>

Gets the local timestamp corresponding to a given remote site_id and remote timestamp

fn get_timestamps_since(&self, remote: Option<(u32, u32)>) -> Option<BTreeMap<u32(u32, u32)>>

Gets a mapping of timestamps since the given remote site_id and remote timesamp, ordered sequentially, or none if the remote timestamp isn't in the lookup

fn get_last_timestamp(&self) -> Option<(u32, (u32, u32))>

Gets the most recent timestamp this stamper has assigned, or None if it has not yet assigned a timestamp. The timestamp contains both the local and remote timestamps

fn compress_to<W: Write>(&self, writer: &mut W) -> Result<()>

Compresses this TimeStamper to an output source. This can then be expanded again using expand_from

fn expand_from<R: Read>(reader: &mut R) -> Result<TimeStamper>

Expands a TimeStamper from an input source that was previous written to by compress_to()

Trait Implementations

impl Debug for TimeStamper
[src]

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

Formats the value using the given formatter.