Struct rabble::Node
[−]
[src]
pub struct Node<T: Encodable + Decodable + Debug + Clone> { pub id: NodeId, pub logger: Logger, // some fields omitted }
A Node represents a way for services to interact with rabble internals.
The Node api is used by services and their handlers to send messages, get status, join nodes into a cluster, etc...
Fields
id: NodeId
logger: Logger
Methods
impl<T: Encodable + Decodable + Debug + Clone> Node<T>
[src]
fn new(id: NodeId,
executor_tx: Sender<ExecutorMsg<T>>,
cluster_tx: Sender<ClusterMsg<T>>,
logger: Logger)
-> Node<T>
executor_tx: Sender<ExecutorMsg<T>>,
cluster_tx: Sender<ClusterMsg<T>>,
logger: Logger)
-> Node<T>
Create a new node. This function should not be called by the user directly. It is called by
by the user call to rabble::rouse(..)
that initializes a rabble system for a single node.
fn join(&self, node_id: &NodeId) -> Result<()>
Join 1 node to another to form a cluster.
Node joins are transitive such that if Node A
joins Node B
which is already joined with
Node C
, then Node A
will become connected to both Node B
and Node C
.
Join's are not immediate. The local member state is updated and the joining node will continuously try to connect to the remote node so that they can exchange membership information and participate in peer operations.
fn leave(&self, node_id: &NodeId) -> Result<()>
fn spawn(&self, pid: &Pid, process: Box<Process<Msg=T>>) -> Result<()>
Add a process to the executor that can be sent Envelopes addressed to its pid
fn stop(&self, pid: &Pid) -> Result<()>
Remove a process from the executor
fn register_service(&self, pid: &Pid, tx: &Sender<Envelope<T>>) -> Result<()>
Register a Service's sender with the executor so that it can be sent messages addressed to its pid
fn send(&self, envelope: Envelope<T>) -> Result<()>
Send an envelope to the executor so it gets routed to the appropriate process or service
fn executor_status(&self, correlation_id: CorrelationId) -> Result<()>
Get the status of the executor
fn cluster_status(&self, correlation_id: CorrelationId) -> Result<()>
Get the status of the cluster server
fn shutdown(&self)
Shutdown the node
Trait Implementations
impl<T: Clone + Encodable + Decodable + Debug + Clone> Clone for Node<T>
[src]
fn clone(&self) -> Node<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more