map: moved NodeInfo to own crate

This commit is contained in:
lunar-mining
2022-02-05 10:45:07 +01:00
parent 89371962fe
commit 828535a812

30
bin/map/src/node_info.rs Normal file
View File

@@ -0,0 +1,30 @@
//TODO: made node_id into a HashSet(u32)
// wrap NodeInfo and NodeId in a Mutex
pub type NodeId = u32;
#[derive(Clone)]
pub struct NodeInfo {
pub id: String,
pub connections: usize,
pub is_active: bool,
pub last_message: String,
}
impl NodeInfo {
pub fn new() -> NodeInfo {
let connections = 0;
let is_active = false;
NodeInfo { id: String::new(), connections, is_active, last_message: String::new() }
}
}
impl Default for NodeInfo {
fn default() -> Self {
Self::new()
}
}
//pub async fn add_seen(&self, id: u32) {
// self.privmsg_ids.lock().await.insert(id);
//}