mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 00:11:01 +00:00
Stats for the newest 2 tables
This commit is contained in:
parent
17ea337ef5
commit
10f44b4e5f
@ -1,7 +1,7 @@
|
||||
use super::GossipUi;
|
||||
use eframe::egui;
|
||||
use egui::{Context, Ui};
|
||||
use gossip_lib::{PersonTable, Table, GLOBALS};
|
||||
use gossip_lib::{FollowingsTable, PersonTable, Table, GLOBALS};
|
||||
use humansize::{format_size, DECIMAL};
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
@ -141,5 +141,17 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr
|
||||
GLOBALS.db().get_nip46servers_len().unwrap_or(0)
|
||||
));
|
||||
ui.add_space(6.0);
|
||||
|
||||
ui.label(format!(
|
||||
"Followings: {} records",
|
||||
FollowingsTable::num_records().unwrap_or(0)
|
||||
));
|
||||
ui.add_space(6.0);
|
||||
|
||||
ui.label(format!(
|
||||
"WoT: {} records",
|
||||
GLOBALS.db().get_wot_len().unwrap_or(0)
|
||||
));
|
||||
ui.add_space(6.0);
|
||||
});
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ pub use status::StatusQueue;
|
||||
|
||||
mod storage;
|
||||
pub use storage::types::*;
|
||||
pub use storage::{PersonTable, Storage, Table};
|
||||
pub use storage::{FollowingsTable, PersonTable, Storage, Table};
|
||||
|
||||
mod tasks;
|
||||
|
||||
|
@ -360,6 +360,12 @@ impl Storage {
|
||||
Ok(self.db_person_lists()?.len(&txn)?)
|
||||
}
|
||||
|
||||
/// The number of records in the wot table
|
||||
pub fn get_wot_len(&self) -> Result<u64, Error> {
|
||||
let txn = self.env.read_txn()?;
|
||||
Ok(self.db_wot()?.len(&txn)?)
|
||||
}
|
||||
|
||||
// General key-value functions --------------------------------------------------
|
||||
|
||||
pub fn force_migration_level(&self, level: u32) -> Result<(), Error> {
|
||||
|
Loading…
Reference in New Issue
Block a user