From dea0a0e5bd270d2b53063cda8a96ed8fe6274d78 Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Tue, 14 May 2024 20:53:16 +0530 Subject: [PATCH] fix: update deserialize utility (#345) --- tools/deserialize-backup/src/main.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/deserialize-backup/src/main.rs b/tools/deserialize-backup/src/main.rs index 2f129709..2b37f755 100644 --- a/tools/deserialize-backup/src/main.rs +++ b/tools/deserialize-backup/src/main.rs @@ -115,14 +115,18 @@ fn main() -> Result<(), Error> { let dirs = std::fs::read_dir(commandline.directory)?; for dir in dirs { let dir = dir?; + if dir.metadata()?.is_file() { + continue; + } + + let path = dir.path(); + let stream_name = dir.path().into_iter().last().unwrap().to_string_lossy().to_string(); // NOTE: max_file_size and max_file_count should not matter when reading non-destructively - let mut storage = storage::Storage::new(1048576); - storage.set_persistence(dir.path(), 3)?; + let mut storage = storage::Storage::new(&stream, 1048576); + storage.set_persistence(path, 3)?; storage.set_non_destructive_read(true); - let stream = streams - .entry(dir.path().into_iter().last().unwrap().to_string_lossy().to_string()) - .or_default(); + let stream = streams.entry(stream_name).or_default(); 'outer: loop { loop { match storage.reload_on_eof() {