From d6040e32a610a792d1e5365a7643eb99fbb5a217 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 13 Dec 2022 15:43:22 +0100 Subject: cli: prettier table in garage stats --- src/db/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/db/lib.rs') diff --git a/src/db/lib.rs b/src/db/lib.rs index d96586be..11cae4e3 100644 --- a/src/db/lib.rs +++ b/src/db/lib.rs @@ -181,6 +181,10 @@ impl Tree { pub fn len(&self) -> Result { self.0.len(self.1) } + #[inline] + pub fn fast_len(&self) -> Result> { + self.0.fast_len(self.1) + } #[inline] pub fn first(&self) -> Result> { @@ -323,6 +327,9 @@ pub(crate) trait IDb: Send + Sync { fn get(&self, tree: usize, key: &[u8]) -> Result>; fn len(&self, tree: usize) -> Result; + fn fast_len(&self, _tree: usize) -> Result> { + Ok(None) + } fn insert(&self, tree: usize, key: &[u8], value: &[u8]) -> Result>; fn remove(&self, tree: usize, key: &[u8]) -> Result>; -- cgit v1.2.3