[][src]Struct vivaldi::Model

pub struct Model<V> where
    V: Vector + Debug
{ /* fields omitted */ }

A Vivaldi latency model generic over N dimensional vectors.

A single Model should be instantiated for each distinct network of nodes the caller participates in.

Messages exchanged between nodes in the network should include the current model coordinate, and the model should be updated with the measured round-trip time by calling observe.

Methods

impl<V> Model<V> where
    V: Vector + Debug
[src]

pub fn new() -> Model<V>[src]

New initialises a new Vivaldi model.

The model is generic over any implementation of the Vector trait, which should be specified when calling this method:

use vivaldi::{Model, vector::Dimension3};

let model = Model::<Dimension3>::new();

pub fn observe(&mut self, coord: &Coordinate<V>, rtt: Duration)[src]

Observe updates the positional coordinate of the local node.

This method should be called with the coordinate of the remote node and the network round-trip time measured by the caller:


// The remote sends it's current coordinate.
//
// Lets pretend we got this from an RPC response:
let coordinate_from_remote = remote_model.get_coordinate();

// The local application issues a request and measures the response time
let rtt = std::time::Duration::new(0, 42_000);

// And then updates the model with the remote coordinate and rtt
model.observe(&coordinate_from_remote, rtt);

pub fn get_coordinate(&self) -> &Coordinate<V>[src]

Returns the current positional coordinate of the local node.

Trait Implementations

impl<V: Debug> Debug for Model<V> where
    V: Vector + Debug
[src]

Auto Trait Implementations

impl<V> RefUnwindSafe for Model<V> where
    V: RefUnwindSafe

impl<V> Send for Model<V> where
    V: Send

impl<V> Sync for Model<V> where
    V: Sync

impl<V> Unpin for Model<V> where
    V: Unpin

impl<V> UnwindSafe for Model<V> where
    V: UnwindSafe

Blanket Implementations

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

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

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

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

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

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<V, T> VZip<V> for T where
    V: MultiLane<T>,