pub struct GossipProtocol { /* private fields */ }Expand description
Gossip protocol instance
Implementations§
Source§impl GossipProtocol
impl GossipProtocol
Sourcepub fn new(
config: GossipConfig,
local_member: GossipMember,
event_tx: Sender<GossipEvent>,
) -> Self
pub fn new( config: GossipConfig, local_member: GossipMember, event_tx: Sender<GossipEvent>, ) -> Self
Create a new gossip protocol instance
Sourcepub async fn start(&self) -> Result<(), GossipError>
pub async fn start(&self) -> Result<(), GossipError>
Start the gossip protocol
Sourcepub async fn get_members(&self) -> Vec<GossipMember>
pub async fn get_members(&self) -> Vec<GossipMember>
Get all known members
Sourcepub async fn get_alive_members(&self) -> Vec<GossipMember>
pub async fn get_alive_members(&self) -> Vec<GossipMember>
Get alive members only
Sourcepub async fn get_member(&self, node_id: &str) -> Option<GossipMember>
pub async fn get_member(&self, node_id: &str) -> Option<GossipMember>
Get member by ID
Sourcepub async fn update_metadata(&self, key: String, value: String)
pub async fn update_metadata(&self, key: String, value: String)
Update local member metadata
Sourcepub async fn leave(&self) -> Result<(), GossipError>
pub async fn leave(&self) -> Result<(), GossipError>
Gracefully leave the cluster
Auto Trait Implementations§
impl !Freeze for GossipProtocol
impl !RefUnwindSafe for GossipProtocol
impl Send for GossipProtocol
impl Sync for GossipProtocol
impl Unpin for GossipProtocol
impl UnsafeUnpin for GossipProtocol
impl !UnwindSafe for GossipProtocol
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
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 more