pub struct RestClusterNode { /* private fields */ }
Expand description
An implementation of almost_raft::Node
RestClusterNode
uses REST API to communicate with other cluster nodes. User of the crate
must provide the following endpoints
- /cluster/raft/request-vote/{requester_node_id:string}/{term:uint32}
- /cluster/raft/vote/{term:uint32}/{true|false}
- /cluster/raft/beat/{leader_node_id:string}/{term:uint32}
Implementations§
Source§impl RestClusterNode
impl RestClusterNode
Sourcepub fn new(node_id: String, instance: ServiceInstance) -> Self
pub fn new(node_id: String, instance: ServiceInstance) -> Self
Create new instance
§Arguments
- node_id - Unique identifier, better be UUID
- instance - ServiceInstance of the node
Sourcepub fn service_instance(&self) -> &ServiceInstance
pub fn service_instance(&self) -> &ServiceInstance
Get the instance represented by discovery service
Trait Implementations§
Source§impl Clone for RestClusterNode
impl Clone for RestClusterNode
Source§fn clone(&self) -> RestClusterNode
fn clone(&self) -> RestClusterNode
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 moreSource§impl Debug for RestClusterNode
impl Debug for RestClusterNode
Source§impl Hash for RestClusterNode
impl Hash for RestClusterNode
Source§impl Node for RestClusterNode
impl Node for RestClusterNode
Source§type NodeType = RestClusterNode
type NodeType = RestClusterNode
concrete node type
Source§fn send_message<'life0, 'async_trait>(
&'life0 self,
msg: Message<Self::NodeType>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_message<'life0, 'async_trait>(
&'life0 self,
msg: Message<Self::NodeType>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
send message to the node
Source§fn service_instance_id(&self) -> &String
fn service_instance_id(&self) -> &String
Provide implementation to get id provided by service discovery provider(e.g. Kubernetes).
By default this function is an alias to
Self::node_id
Source§impl PartialEq for RestClusterNode
impl PartialEq for RestClusterNode
impl Eq for RestClusterNode
Auto Trait Implementations§
impl Freeze for RestClusterNode
impl RefUnwindSafe for RestClusterNode
impl Send for RestClusterNode
impl Sync for RestClusterNode
impl Unpin for RestClusterNode
impl UnwindSafe for RestClusterNode
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key
and return true
if they are equal.