From e1286892e59a6ca2fc44a58473ca45292e623a10 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 11 Mar 2026 17:26:32 +0100 Subject: debug info page for db kv and cache kv --- database/src/kv/mod.rs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'database/src/kv/mod.rs') diff --git a/database/src/kv/mod.rs b/database/src/kv/mod.rs index 784cbef..f391d31 100644 --- a/database/src/kv/mod.rs +++ b/database/src/kv/mod.rs @@ -41,6 +41,22 @@ impl Database for T { fn transaction(&self, f: &mut dyn FnMut(&mut dyn Transaction) -> Result<()>) -> Result<()> { jellykv::Store::transaction(self, &mut |mut txn| f(&mut txn)) } + fn debug_info(&self) -> Result { + let mut o = String::new(); + self.transaction(&mut |txn| { + o = String::new(); + let rc = read_counter(txn, &T_ROW_COUNTER.to_be_bytes(), 0)?; + writeln!(o, "row ounter: {rc}")?; + writeln!(o, "indices:")?; + for (is, ik) in list_indices(txn)? { + writeln!(o, "\tIS={is} IK={ik}")?; + } + Ok(()) + })?; + writeln!(o)?; + write!(o, "{}", jellykv::Store::debug_info(self)?)?; + Ok(o) + } } impl Transaction for &mut dyn jellykv::Transaction { @@ -125,17 +141,6 @@ impl Transaction for &mut dyn jellykv::Transaction { } Ok(total) } - - fn debug_info(&self) -> Result { - let mut o = String::new(); - let rc = read_counter(*self, &T_ROW_COUNTER.to_be_bytes(), 0)?; - writeln!(o, "Row Counter: {rc}")?; - writeln!(o, "Indices:")?; - for (is, ik) in list_indices(*self)? { - writeln!(o, "\tIS={is} IK={ik}")?; - } - Ok(o) - } } fn get_or_create_index(txn: &mut dyn jellykv::Transaction, ik: &IndexKey) -> Result { -- cgit v1.3