diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-04-21 18:32:48 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-04-21 18:32:48 +0300 |
commit | d2cc05cd7a0997c16687642d9a6814a506711e41 (patch) | |
tree | 261d99f921fd5198b836ad220df49a8c07cd0497 /src/cmd/show_gen.rs | |
parent | f5783321e102ade9a60a8a95eac226f0e52d0f11 (diff) | |
download | obnam2-d2cc05cd7a0997c16687642d9a6814a506711e41.tar.gz |
feat: show-generation shows size of the generation's SQLite db
Sponsored-by: author
Diffstat (limited to 'src/cmd/show_gen.rs')
-rw-r--r-- | src/cmd/show_gen.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cmd/show_gen.rs b/src/cmd/show_gen.rs index 6641d3c..98c57fc 100644 --- a/src/cmd/show_gen.rs +++ b/src/cmd/show_gen.rs @@ -54,6 +54,7 @@ impl ShowGeneration { let total_bytes = total_bytes?; let output = Output::new(gen_id) + .db_bytes(temp.path().metadata()?.len()) .file_count(gen.file_count()?) .file_bytes(total_bytes); serde_json::to_writer_pretty(std::io::stdout(), &output)?; @@ -68,6 +69,8 @@ struct Output { file_count: u64, file_bytes: String, file_bytes_raw: u64, + db_bytes: String, + db_bytes_raw: u64, } impl Output { @@ -88,4 +91,10 @@ impl Output { self.file_bytes = HumanBytes(n).to_string(); self } + + fn db_bytes(mut self, n: u64) -> Self { + self.db_bytes_raw = n; + self.db_bytes = HumanBytes(n).to_string(); + self + } } |