[−][src]Struct vivaldi::Model
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]
V: Vector + Debug,
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
Auto Trait Implementations
impl<V> RefUnwindSafe for Model<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<V> Send for Model<V> where
V: Send,
V: Send,
impl<V> Sync for Model<V> where
V: Sync,
V: Sync,
impl<V> Unpin for Model<V> where
V: Unpin,
V: Unpin,
impl<V> UnwindSafe for Model<V> where
V: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,