Struct erl_dist::epmd::EpmdClient
source · pub struct EpmdClient<T> { /* private fields */ }
Expand description
EPMD client.
Implementations§
source§impl<T> EpmdClient<T>where
T: AsyncRead + AsyncWrite + Unpin,
impl<T> EpmdClient<T>where T: AsyncRead + AsyncWrite + Unpin,
sourcepub fn new(connection: T) -> Self
pub fn new(connection: T) -> Self
Makes a new EpmdClient
instance.
connection
is a connection to communicate with the target EPMD server.
sourcepub async fn register(self, node: NodeEntry) -> Result<(T, Creation), EpmdError>
pub async fn register(self, node: NodeEntry) -> Result<(T, Creation), EpmdError>
Registers a node in EPMD.
The connection created to the EPMD must be kept as long as the node is a distributed node. When the connection is closed, the node is automatically unregistered from the EPMD.
sourcepub async fn get_names(self) -> Result<Vec<(String, u16)>, EpmdError>
pub async fn get_names(self) -> Result<Vec<(String, u16)>, EpmdError>
Gets all registered nodes (name and port pairs) from EPMD.
sourcepub async fn get_node(
self,
node_name: &str
) -> Result<Option<NodeEntry>, EpmdError>
pub async fn get_node( self, node_name: &str ) -> Result<Option<NodeEntry>, EpmdError>
Queries the node which has the given name to EPMD.
If the node has not been registered in the connected EPMD, this method will return None
.
sourcepub async fn kill(self) -> Result<String, EpmdError>
pub async fn kill(self) -> Result<String, EpmdError>
Kills EPMD.
This request kills the running EPMD. It is almost never used.
If EPMD is killed, this method returns "OK"
.
sourcepub async fn dump(self) -> Result<String, EpmdError>
pub async fn dump(self) -> Result<String, EpmdError>
Dumps all data from EPMD.
This request is not really used, it is to be regarded as a debug feature.
The result value is a string written for each node kept in the connected EPMD.
The format of each entry is
"active name ${NODE_NAME} at port ${PORT}, fd = ${FD}\n"
or
"old/unused name ${NODE_NAME} at port ${PORT}, fd = ${FD}\n"