mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: format table sizes (#1543)
This commit is contained in:
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -2529,6 +2529,12 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||
|
||||
[[package]]
|
||||
name = "human_bytes"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39b528196c838e8b3da8b665e08c30958a6f2ede91d79f2ffcd0d4664b9c64eb"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
@ -4349,6 +4355,7 @@ dependencies = [
|
||||
"eyre",
|
||||
"fdlimit",
|
||||
"futures",
|
||||
"human_bytes",
|
||||
"jsonrpsee",
|
||||
"metrics",
|
||||
"metrics-exporter-prometheus",
|
||||
|
||||
@ -63,4 +63,5 @@ backon = "0.4"
|
||||
comfy-table = "6.1.4"
|
||||
crossterm = "0.25.0"
|
||||
tui = "0.19.0"
|
||||
jsonrpsee = { version = "0.16", features = ["server"] }
|
||||
jsonrpsee = { version = "0.16", features = ["server"] }
|
||||
human_bytes = "0.4.1"
|
||||
@ -3,6 +3,7 @@ use crate::dirs::{DbPath, PlatformPath};
|
||||
use clap::{Parser, Subcommand};
|
||||
use comfy_table::{Cell, Row, Table as ComfyTable};
|
||||
use eyre::{Result, WrapErr};
|
||||
use human_bytes::human_bytes;
|
||||
use reth_db::{
|
||||
cursor::{DbCursorRO, Walker},
|
||||
database::Database,
|
||||
@ -91,7 +92,7 @@ impl Command {
|
||||
"Branch Pages",
|
||||
"Leaf Pages",
|
||||
"Overflow Pages",
|
||||
"Total Size (KB)",
|
||||
"Total Size",
|
||||
]);
|
||||
|
||||
tool.db.view(|tx| {
|
||||
@ -120,7 +121,7 @@ impl Command {
|
||||
.add_cell(Cell::new(branch_pages))
|
||||
.add_cell(Cell::new(leaf_pages))
|
||||
.add_cell(Cell::new(overflow_pages))
|
||||
.add_cell(Cell::new(table_size / 1024));
|
||||
.add_cell(Cell::new(human_bytes(table_size as f64)));
|
||||
stats_table.add_row(row);
|
||||
}
|
||||
Ok::<(), eyre::Report>(())
|
||||
|
||||
Reference in New Issue
Block a user