Extendex DHT info
This commit is contained in:
@@ -149,8 +149,10 @@ pub struct FedStatus {
|
||||
pub running: bool,
|
||||
pub network: String,
|
||||
pub endpoint_id: String,
|
||||
pub dht_node_id: String,
|
||||
pub connected_peers: Vec<String>,
|
||||
pub known_contacts: usize,
|
||||
pub stored_dht_records: Option<usize>,
|
||||
pub published_items: usize,
|
||||
pub last_sync: Option<String>,
|
||||
pub last_error: Option<String>,
|
||||
@@ -509,12 +511,14 @@ impl Federation {
|
||||
status.running = true;
|
||||
status.network = running.network_name.clone();
|
||||
status.endpoint_id = service.endpoint_id().to_string();
|
||||
status.dht_node_id = service.node_id().to_string();
|
||||
status.connected_peers = service
|
||||
.connected_peers()
|
||||
.iter()
|
||||
.map(|p| p.to_string())
|
||||
.collect();
|
||||
status.known_contacts = service.known_peers().len();
|
||||
status.stored_dht_records = service.dht_record_count().await.ok();
|
||||
status.published_items = service
|
||||
.list_local_items()
|
||||
.await
|
||||
|
||||
@@ -109,6 +109,7 @@ fn draw_status(frame: &mut Frame, area: Rect, state: &AppState) {
|
||||
lines.push(status_line("Node", "running".to_string()));
|
||||
lines.push(status_line("Network", status.network.clone()));
|
||||
lines.push(status_line("Endpoint ID", status.endpoint_id.clone()));
|
||||
lines.push(status_line("DHT node ID", status.dht_node_id.clone()));
|
||||
let peers = if status.connected_peers.is_empty() {
|
||||
"none yet".to_string()
|
||||
} else {
|
||||
@@ -121,6 +122,13 @@ fn draw_status(frame: &mut Frame, area: Rect, state: &AppState) {
|
||||
"Known contacts",
|
||||
status.known_contacts.to_string(),
|
||||
));
|
||||
lines.push(status_line(
|
||||
"Stored DHT records",
|
||||
status
|
||||
.stored_dht_records
|
||||
.map(|count| count.to_string())
|
||||
.unwrap_or_else(|| "unavailable".to_string()),
|
||||
));
|
||||
lines.push(status_line(
|
||||
"Published items",
|
||||
status.published_items.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user