pub struct NodeState<I, A> {
pub id: I,
pub addr: A,
pub meta: Meta,
pub state: State,
pub protocol_version: ProtocolVersion,
pub delegate_version: DelegateVersion,
}Expand description
Represents a node in the cluster
Fields§
§id: IThe id of the node.
addr: AThe address of the node.
meta: MetaMetadata from the delegate for this node.
state: StateState of the node.
protocol_version: ProtocolVersionThe protocol version of the node is speaking.
delegate_version: DelegateVersionThe delegate version of the node is speaking.
Implementations§
Source§impl<I, A> NodeState<I, A>
impl<I, A> NodeState<I, A>
Sourcepub const fn protocol_version(&self) -> ProtocolVersion
pub const fn protocol_version(&self) -> ProtocolVersion
Returns the protocol version of the node is speaking
Sourcepub const fn delegate_version(&self) -> DelegateVersion
pub const fn delegate_version(&self) -> DelegateVersion
Returns the delegate version of the node is speaking
Sourcepub fn with_address(self, val: A) -> NodeState<I, A>
pub fn with_address(self, val: A) -> NodeState<I, A>
Sets the address of the node (Builder pattern)
Sourcepub fn with_meta(self, val: Meta) -> NodeState<I, A>
pub fn with_meta(self, val: Meta) -> NodeState<I, A>
Sets the meta of the node (Builder pattern)
Sourcepub const fn with_state(self, val: State) -> NodeState<I, A>
pub const fn with_state(self, val: State) -> NodeState<I, A>
Sets the state of the node (Builder pattern)
Sourcepub const fn with_protocol_version(
self,
val: ProtocolVersion,
) -> NodeState<I, A>
pub const fn with_protocol_version( self, val: ProtocolVersion, ) -> NodeState<I, A>
Sets the protocol version of the node is speaking (Builder pattern)
Sourcepub const fn with_delegate_version(
self,
val: DelegateVersion,
) -> NodeState<I, A>
pub const fn with_delegate_version( self, val: DelegateVersion, ) -> NodeState<I, A>
Sets the delegate version of the node is speaking (Builder pattern)
Source§impl<I, A> NodeState<I, A>
impl<I, A> NodeState<I, A>
Sourcepub const fn new(id: I, addr: A, state: State) -> NodeState<I, A>
pub const fn new(id: I, addr: A, state: State) -> NodeState<I, A>
Construct a new node with the given name, address and state.
Sourcepub fn set_address(&mut self, addr: A) -> &mut NodeState<I, A>
pub fn set_address(&mut self, addr: A) -> &mut NodeState<I, A>
Sets the address of the node state
Sourcepub fn set_protocol_version(
&mut self,
protocol_version: ProtocolVersion,
) -> &mut NodeState<I, A>
pub fn set_protocol_version( &mut self, protocol_version: ProtocolVersion, ) -> &mut NodeState<I, A>
Set the protocol version of the alive message is speaking.
Sourcepub fn set_delegate_version(
&mut self,
delegate_version: DelegateVersion,
) -> &mut NodeState<I, A>
pub fn set_delegate_version( &mut self, delegate_version: DelegateVersion, ) -> &mut NodeState<I, A>
Set the delegate version of the alive message is speaking.
Source§impl<I, A> NodeState<I, A>where
I: CheapClone,
A: CheapClone,
impl<I, A> NodeState<I, A>where
I: CheapClone,
A: CheapClone,
Trait Implementations§
Source§impl<'arbitrary, I, A> Arbitrary<'arbitrary> for NodeState<I, A>
impl<'arbitrary, I, A> Arbitrary<'arbitrary> for NodeState<I, A>
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<NodeState<I, A>, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<NodeState<I, A>, Error>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(
u: Unstructured<'arbitrary>,
) -> Result<NodeState<I, A>, Error>
fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<NodeState<I, A>, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl<I, A> CheapClone for NodeState<I, A>where
I: CheapClone,
A: CheapClone,
impl<I, A> CheapClone for NodeState<I, A>where
I: CheapClone,
A: CheapClone,
Source§fn cheap_clone(&self) -> NodeState<I, A>
fn cheap_clone(&self) -> NodeState<I, A>
Source§impl<'de, I, A> Deserialize<'de> for NodeState<I, A>where
I: Deserialize<'de>,
A: Deserialize<'de>,
impl<'de, I, A> Deserialize<'de> for NodeState<I, A>where
I: Deserialize<'de>,
A: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NodeState<I, A>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NodeState<I, A>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl<I, A> Eq for NodeState<I, A>
Source§impl<I, A> From<Alive<I, A>> for NodeState<I, A>where
I: CheapClone,
A: CheapClone,
impl<I, A> From<Alive<I, A>> for NodeState<I, A>where
I: CheapClone,
A: CheapClone,
Source§impl<I, A> PartialEq for NodeState<I, A>
impl<I, A> PartialEq for NodeState<I, A>
Source§impl<I, A> Serialize for NodeState<I, A>
impl<I, A> Serialize for NodeState<I, A>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl<I, A> StructuralPartialEq for NodeState<I, A>
Auto Trait Implementations§
impl<I, A> !Freeze for NodeState<I, A>
impl<I, A> RefUnwindSafe for NodeState<I, A>where
I: RefUnwindSafe,
A: RefUnwindSafe,
impl<I, A> Send for NodeState<I, A>
impl<I, A> Sync for NodeState<I, A>
impl<I, A> Unpin for NodeState<I, A>
impl<I, A> UnsafeUnpin for NodeState<I, A>where
I: UnsafeUnpin,
A: UnsafeUnpin,
impl<I, A> UnwindSafe for NodeState<I, A>where
I: UnwindSafe,
A: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> 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 more