pub enum Node {
Local,
Remote(String, SocketAddr),
}Expand description
Represents a local or remote node of processes.
Variants§
Local
Remote(String, SocketAddr)
Implementations§
Source§impl Node
impl Node
Sourcepub fn address(&self) -> Option<SocketAddr>
pub fn address(&self) -> Option<SocketAddr>
Returns the adddress of the node if it’s a remote node.
Sourcepub fn connect<T: Into<Node>>(node: T)
pub fn connect<T: Into<Node>>(node: T)
Connects to the given node if we’re not already connected.
Sourcepub fn disconnect<T: Into<Node>>(node: T)
pub fn disconnect<T: Into<Node>>(node: T)
Forcefully disconnects from the given node.
Sourcepub fn forget<T: Into<Node>>(node: T)
pub fn forget<T: Into<Node>>(node: T)
Forcefully disconnects, and forgets this node completely.
All existing Pid’s for this node will no longer be reachable.
Sets the node cookie used to secure node connections.
Clears the node cookie.
Sourcepub fn start<T: Into<String>>(name: T, options: NodeOptions) -> Pid
pub fn start<T: Into<String>>(name: T, options: NodeOptions) -> Pid
Turns a non-distributed node into a distributed node.
Sourcepub fn stop()
pub fn stop()
Turns a distributed node into a non-distributed node.
For other nodes in the network, this is the same as the node going down.
Sourcepub fn list() -> Vec<Node>
pub fn list() -> Vec<Node>
Returns a list of all visible nodes in the system, excluding the local node.
Sourcepub fn list_by_state(state: NodeState) -> Vec<Node>
pub fn list_by_state(state: NodeState) -> Vec<Node>
Returns a list of all nodes in the system that match the given state.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<(&str, SocketAddr)> for Node
impl From<(&str, SocketAddr)> for Node
Source§fn from(value: (&str, SocketAddr)) -> Self
fn from(value: (&str, SocketAddr)) -> Self
Converts to this type from the input type.
Source§impl From<(String, SocketAddr)> for Node
impl From<(String, SocketAddr)> for Node
Source§fn from(value: (String, SocketAddr)) -> Self
fn from(value: (String, SocketAddr)) -> Self
Converts to this type from the input type.
Source§impl Ord for Node
impl Ord for Node
Source§impl PartialOrd for Node
impl PartialOrd for Node
impl Eq for Node
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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