pub enum GossipMessage {
Ping {
seq: u64,
sender: NodeId,
updates: Vec<NodeUpdate>,
},
PingReq {
seq: u64,
sender: NodeId,
target: NodeId,
target_addr: SocketAddr,
},
Ack {
seq: u64,
sender: NodeId,
updates: Vec<NodeUpdate>,
},
Join {
sender: NodeId,
sender_addr: SocketAddr,
},
Welcome {
sender: NodeId,
members: Vec<MemberInfo>,
},
SlotsAnnounce {
sender: NodeId,
incarnation: u64,
slots: Vec<SlotRange>,
},
}Expand description
Message types for the SWIM gossip protocol.
Variants§
Ping
Direct probe to check if a node is alive.
PingReq
Request another node to probe a target on our behalf.
Ack
Response to a Ping or forwarded PingReq.
Join
Join request from a new node.
Welcome
Welcome response with current cluster state.
SlotsAnnounce
Direct slot announcement: the sender is telling peers its current slot
ownership without going through the normal piggybacking mechanism.
Used by broadcast_local_slots to eagerly push slot state to all peers.
Implementations§
Source§impl GossipMessage
impl GossipMessage
Sourcepub fn encode_into(&self, buf: &mut BytesMut)
pub fn encode_into(&self, buf: &mut BytesMut)
Serializes the message into the given buffer.
Sourcepub fn encode_authenticated(&self, secret: &ClusterSecret) -> Bytes
pub fn encode_authenticated(&self, secret: &ClusterSecret) -> Bytes
Encodes the message with a trailing HMAC-SHA256 tag.
Sourcepub fn decode_authenticated(buf: &[u8], secret: &ClusterSecret) -> Result<Self>
pub fn decode_authenticated(buf: &[u8], secret: &ClusterSecret) -> Result<Self>
Decodes a message, verifying the trailing HMAC-SHA256 tag first.
Returns an error if the buffer is too short or the tag doesn’t match.
Trait Implementations§
Source§impl Clone for GossipMessage
impl Clone for GossipMessage
Source§fn clone(&self) -> GossipMessage
fn clone(&self) -> GossipMessage
Returns a duplicate 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 moreSource§impl Debug for GossipMessage
impl Debug for GossipMessage
Source§impl PartialEq for GossipMessage
impl PartialEq for GossipMessage
impl StructuralPartialEq for GossipMessage
Auto Trait Implementations§
impl Freeze for GossipMessage
impl RefUnwindSafe for GossipMessage
impl Send for GossipMessage
impl Sync for GossipMessage
impl Unpin for GossipMessage
impl UnsafeUnpin for GossipMessage
impl UnwindSafe for GossipMessage
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