Expand description
Erlang node connectivity and RPC communication.
This module provides functionality to connect to Erlang nodes using the distributed Erlang protocol and make RPC calls for messaging operations, including persistent message history loading.
§Architecture
The module uses erl_dist for the distributed Erlang protocol and erl_rpc
for making RPC calls. The connection is established asynchronously and the
RPC client runs in a background task.
§Message History
The module provides three methods for loading message history:
load_recent_messages()- Load the most recent N messagesload_messages_before()- Load older messages before a timestamp (for scrolling up)load_messages_range()- Load messages within a time range
Messages are retrieved from the Erlang backend’s SQLite database via RPC calls
to cryptic_rpc module, which decrypts and returns them as structured data.
§Examples
use cryptic_tui::erlang::ErlangConnection;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Create connection
let conn = ErlangConnection::new(
"admin@localhost".to_string(),
"mycookie".to_string()
);
// Connect to remote node
conn.connect().await?;
// Load recent message history
let messages = conn.load_recent_messages("alice", 50).await?;
println!("Loaded {} messages", messages.len());
Ok(())
}Structs§
- Erlang
Connection - Manages a connection to a remote Erlang node.
Enums§
- Connection
Status - Connection status to an Erlang node.
Functions§
- extract_
binary 🔒 - Extract a string from a binary term
- extract_
integer 🔒 - Extract an integer from a term
- parse_
message_ 🔒history - Parse message history from Erlang RPC response.