Struct quilkin::net::cluster::EndpointSet
source · pub struct EndpointSet {
pub endpoints: BTreeSet<Endpoint>,
pub token_map: TokenAddressMap,
/* private fields */
}
Fields§
§endpoints: BTreeSet<Endpoint>
§token_map: TokenAddressMap
Implementations§
source§impl EndpointSet
impl EndpointSet
sourcepub fn new(endpoints: BTreeSet<Endpoint>) -> Self
pub fn new(endpoints: BTreeSet<Endpoint>) -> Self
Creates a new endpoint set, calculating a unique version hash for it
sourcepub fn with_version(
endpoints: BTreeSet<Endpoint>,
hash: EndpointSetVersion
) -> Self
pub fn with_version( endpoints: BTreeSet<Endpoint>, hash: EndpointSetVersion ) -> Self
Creates a new endpoint set with the provided version hash, skipping calculation of it
This hash must be calculated with Self::update
to be consistent
across machines
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn contains(&self, ep: &Endpoint) -> bool
pub fn addresses_for_token( &self, token: Token, addresses: &mut Vec<EndpointAddress> )
sourcepub fn version(&self) -> EndpointSetVersion
pub fn version(&self) -> EndpointSetVersion
Unique version for this endpoint set
sourcepub fn update(&mut self)
pub fn update(&mut self)
Bumps the version, calculating a hash for the entire endpoint set
This is extremely expensive
sourcepub fn build_token_map(&mut self)
pub fn build_token_map(&mut self)
Creates a map of tokens -> address for the current set
pub fn replace(&mut self, replacement: Self) -> BTreeSet<Endpoint>
Trait Implementations§
source§impl Clone for EndpointSet
impl Clone for EndpointSet
source§fn clone(&self) -> EndpointSet
fn clone(&self) -> EndpointSet
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for EndpointSet
impl Send for EndpointSet
impl Sync for EndpointSet
impl Unpin for EndpointSet
impl UnwindSafe for EndpointSet
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