diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-03-11 17:26:32 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-03-11 17:26:32 +0100 |
| commit | e1286892e59a6ca2fc44a58473ca45292e623a10 (patch) | |
| tree | 36389b06f5be667e4f13cfb1e62db4d228e75343 /database/src/kv/mod.rs | |
| parent | 578b32c9119692fb049fa56c7d52f2fbb8d485d7 (diff) | |
| download | jellything-e1286892e59a6ca2fc44a58473ca45292e623a10.tar jellything-e1286892e59a6ca2fc44a58473ca45292e623a10.tar.bz2 jellything-e1286892e59a6ca2fc44a58473ca45292e623a10.tar.zst | |
debug info page for db kv and cache kv
Diffstat (limited to 'database/src/kv/mod.rs')
| -rw-r--r-- | database/src/kv/mod.rs | 27 |
1 files changed, 16 insertions, 11 deletions
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<T: jellykv::Store> 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<String> { + 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<String> { - 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<SubtreeNum> { |