1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-07-29 11:18:30 +00:00

add file listing to database abstraction.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-03-22 19:37:36 -07:00 committed by June
parent bdf3997de5
commit 6b1933914d
4 changed files with 29 additions and 0 deletions

View file

@ -304,6 +304,30 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
Ok(res)
}
fn file_list(&self) -> Result<String> {
match self.rocks.live_files() {
Err(e) => Ok(String::from(e)),
Ok(files) => {
let mut res = String::new();
for file in files {
let _ = std::fmt::write(
&mut res,
format_args!(
"<code>L{} {:<13} {:7}+ {:4}- {:9}</code> {}<br>",
file.level,
file.name,
file.num_entries,
file.num_deletions,
file.size,
file.column_family_name,
),
);
}
Ok(res)
},
}
}
// TODO: figure out if this is needed for rocksdb
#[allow(dead_code)]
fn clear_caches(&self) {}