pub struct Phoenix<M> { /* private fields */ }
Expand description
A Phoenix
instance maintains a virtual coordinate space for nodes in a
distributed system to estimate their network latencies. It uses the provided
Measurement
trait to periodically measure and update each node’s
coordinates, allowing for latency estimation between any two nodes.
Implementations§
source§impl<M: Measurement + 'static> Phoenix<M>
impl<M: Measurement + 'static> Phoenix<M>
pub fn new(measurement: M) -> Self
pub fn builder(measurement: M) -> Builder<M>
sourcepub async fn background_update_task(&self)
pub async fn background_update_task(&self)
Starts the background update task to continously sample from nodes and update their coordinates.
pub fn get_coordinates(&self, address: &SocketAddr) -> Option<Coordinates>
pub fn ordered_nodes_by_latency(&self) -> Vec<(IcaoCode, f64)>
pub fn add_node(&self, address: SocketAddr, icao_code: IcaoCode)
pub fn add_node_if_not_exists(&self, address: SocketAddr, icao_code: IcaoCode)
pub fn add_nodes_from_config(&self, config: &Config)
Trait Implementations§
Auto Trait Implementations§
impl<M> !RefUnwindSafe for Phoenix<M>
impl<M> Send for Phoenix<M>
impl<M> Sync for Phoenix<M>
impl<M> Unpin for Phoenix<M>
impl<M> !UnwindSafe for Phoenix<M>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request