pub struct Coordinate {
pub portion: SmallVec<[f64; 8]>,
pub error: f64,
pub adjustment: f64,
pub height: f64,
}Expand description
A specialized structure for holding network coordinates for the Vivaldi-based coordinate mapping algorithm. All of the fields should be public to enable this to be serialized. All values in here are in units of seconds.
Fields§
§portion: SmallVec<[f64; 8]>The Euclidean portion of the coordinate. This is used along with the other fields to provide an overall distance estimate. The units here are seconds.
error: f64Reflects the confidence in the given coordinate and is updated dynamically by the Vivaldi Client. This is dimensionless.
adjustment: f64A distance offset computed based on a calculation over observations from all other nodes over a fixed window and is updated dynamically by the Vivaldi Client. The units here are seconds.
height: f64A distance offset that accounts for non-Euclidean effects which model the access links from nodes to the core Internet. The access links are usually set by bandwidth and congestion, and the core links usually follow distance based on geography.
Implementations§
Source§impl Coordinate
impl Coordinate
Sourcepub const fn portion(&self) -> &SmallVec<[f64; 8]> ⓘ
pub const fn portion(&self) -> &SmallVec<[f64; 8]> ⓘ
Returns the Euclidean portion of the coordinate.
Sourcepub const fn adjustment(&self) -> f64
pub const fn adjustment(&self) -> f64
Returns the distance offset.
Sourcepub const fn height(&self) -> f64
pub const fn height(&self) -> f64
Returns the distance offset that accounts for non-Euclidean effects.
Sourcepub fn with_portion(self, val: SmallVec<[f64; 8]>) -> Self
pub fn with_portion(self, val: SmallVec<[f64; 8]>) -> Self
Sets the Euclidean portion of the coordinate.
Sourcepub fn with_error(self, val: f64) -> Self
pub fn with_error(self, val: f64) -> Self
Sets the confidence in the given coordinate.
Sourcepub fn with_adjustment(self, val: f64) -> Self
pub fn with_adjustment(self, val: f64) -> Self
Sets the distance offset.
Sourcepub fn with_height(self, val: f64) -> Self
pub fn with_height(self, val: f64) -> Self
Sets the distance offset that accounts for non-Euclidean effects.
Source§impl Coordinate
impl Coordinate
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new coordinate at the origin, using the default options to supply key initial values.
Sourcepub fn with_options(opts: CoordinateOptions) -> Self
pub fn with_options(opts: CoordinateOptions) -> Self
Creates a new coordinate at the origin, using the given options to supply key initial values.
Sourcepub fn is_compatible_with(&self, other: &Self) -> bool
pub fn is_compatible_with(&self, other: &Self) -> bool
Returns true if the dimensions of the coordinates are compatible.
Sourcepub fn apply_force(&self, height_min: f64, force: f64, other: &Self) -> Self
pub fn apply_force(&self, height_min: f64, force: f64, other: &Self) -> Self
Returns the result of applying the force from the direction of the other coordinate.
Sourcepub fn apply_force_in_place(
&mut self,
height_min: f64,
force: f64,
other: &Self,
)
pub fn apply_force_in_place( &mut self, height_min: f64, force: f64, other: &Self, )
Apply the result of applying the force from the direction of the other coordinate to self.
Sourcepub fn distance_to(&self, other: &Self) -> Duration
pub fn distance_to(&self, other: &Self) -> Duration
Returns the distance between this coordinate and the other coordinate, including adjustments.
Trait Implementations§
Source§impl Clone for Coordinate
impl Clone for Coordinate
Source§fn clone(&self) -> Coordinate
fn clone(&self) -> Coordinate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Coordinate
impl Debug for Coordinate
Source§impl Default for Coordinate
impl Default for Coordinate
Source§impl<'de> Deserialize<'de> for Coordinate
impl<'de> Deserialize<'de> for Coordinate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for Coordinate
impl PartialEq for Coordinate
Source§impl Serialize for Coordinate
impl Serialize for Coordinate
Source§impl Transformable for Coordinate
impl Transformable for Coordinate
Source§type Error = CoordinateTransformError
type Error = CoordinateTransformError
Source§fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
fn encode(&self, dst: &mut [u8]) -> Result<usize, Self::Error>
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
fn decode(src: &[u8]) -> Result<(usize, Self), Self::Error>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Result<Vec<u8>, Self::Error>
fn encode_to_vec(&self) -> Result<Vec<u8>, Self::Error>
Source§fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
fn encode_to_writer<W>(&self, writer: &mut W) -> Result<usize, Error>where
W: Write,
Source§fn encode_to_async_writer<W>(
&self,
writer: &mut W,
) -> impl Future<Output = Result<usize, Error>> + Send
fn encode_to_async_writer<W>( &self, writer: &mut W, ) -> impl Future<Output = Result<usize, Error>> + Send
impl StructuralPartialEq for Coordinate
Auto Trait Implementations§
impl Freeze for Coordinate
impl RefUnwindSafe for Coordinate
impl Send for Coordinate
impl Sync for Coordinate
impl Unpin for Coordinate
impl UnwindSafe for Coordinate
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
Source§impl<T> Decodable for Twhere
T: Transformable,
impl<T> Decodable for Twhere
T: Transformable,
Source§type Error = <T as Transformable>::Error
type Error = <T as Transformable>::Error
Source§fn decode(src: &[u8]) -> Result<(usize, T), <T as Decodable>::Error>
fn decode(src: &[u8]) -> Result<(usize, T), <T as Decodable>::Error>
Source§impl<T> Encodable for Twhere
T: Transformable,
impl<T> Encodable for Twhere
T: Transformable,
Source§type Error = <T as Transformable>::Error
type Error = <T as Transformable>::Error
Source§fn encode(&self, dst: &mut [u8]) -> Result<usize, <T as Encodable>::Error>
fn encode(&self, dst: &mut [u8]) -> Result<usize, <T as Encodable>::Error>
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode_to_vec(&self) -> Result<Vec<u8>, <T as Encodable>::Error>
fn encode_to_vec(&self) -> Result<Vec<u8>, <T as Encodable>::Error>
Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.