[unit test] Complete all providers unit tests #12
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
Blockstorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
2025-09-16 10:36:23 -05:00
parent 66b3a0595d
commit 816d242234
3 changed files with 32 additions and 11 deletions

View File

@@ -174,6 +174,10 @@ public:
calculate_encrypted_size(std::string_view source_path, bool uses_kdf)
-> std::uint64_t;
[[nodiscard]] static auto calculate_encrypted_size(std::uint64_t size,
bool uses_kdf)
-> std::uint64_t;
[[nodiscard]] auto create_iostream() const -> std::shared_ptr<iostream>;
[[nodiscard]] static constexpr auto get_encrypted_chunk_size()

View File

@@ -430,11 +430,16 @@ auto encrypting_reader::calculate_encrypted_size(std::string_view source_path,
source_path,
});
}
auto file_size{opt_size.value()};
return calculate_encrypted_size(opt_size.value(), uses_kdf);
}
auto encrypting_reader::calculate_encrypted_size(std::uint64_t size,
bool uses_kdf)
-> std::uint64_t {
auto total_chunks = utils::divide_with_ceiling(
file_size, static_cast<std::uint64_t>(data_chunk_size_));
return file_size + (total_chunks * encryption_header_size) +
size, static_cast<std::uint64_t>(data_chunk_size_));
return size + (total_chunks * encryption_header_size) +
(uses_kdf ? kdf_config::size() : 0U);
}