Skip to content

Commit

Permalink
added option to ZffReader to list decrypted objects only
Browse files Browse the repository at this point in the history
  • Loading branch information
ph0llux committed Dec 15, 2024
1 parent d6bfab1 commit 7eb9221
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/lib/io/zffreader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,20 @@ impl<R: Read + Seek> ZffReader<R> {
Ok(map)
}

/// Same as list_objects, but ignores encrypted objects
pub fn list_decrypted_objects(&self) -> BTreeMap<u64, ObjectType> {
let mut map = BTreeMap::new();
for (k, v) in &self.object_reader {
match v {
ZffObjectReader::Encrypted(_) => (),
ZffObjectReader::Physical(_) => { map.insert(*k, ObjectType::Physical); },
ZffObjectReader::Logical(_) => { map.insert(*k, ObjectType::Logical); },
ZffObjectReader::Virtual(_) => { map.insert(*k, ObjectType::Virtual); },
};
};
map
}

/// Sets an appropriate object as active to read or seek from this object.
/// # Error
/// This method fails, if the appropriate object number not exists in this zff container.
Expand Down
3 changes: 2 additions & 1 deletion src/lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ pub mod io;
pub mod helper;
mod hashing;
mod compression;
mod encryption;
/// Contains various functions, methods and traits to handle encryption in zff.
pub mod encryption;
mod traits;
mod error;
mod signatures;
Expand Down

0 comments on commit 7eb9221

Please sign in to comment.