Skip to content

Commit 2dac7cf

Browse files
Enable checksum verification during reading data from leveldb. (#709)
Pass the user provided CheckCrc open option, to the leveldb::ReadOptions. Resolves: OLPEDGE-1660 Signed-off-by: Mykhailo Kuchma <[email protected]>
1 parent fbe2a1f commit 2dac7cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

olp-cpp-sdk-core/src/cache/DiskCache.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ bool DiskCache::Put(const std::string& key, leveldb::Slice slice) {
258258

259259
boost::optional<std::string> DiskCache::Get(const std::string& key) {
260260
std::string res;
261-
return database_ && database_->Get({}, ToLeveldbSlice(key), &res).ok()
261+
leveldb::ReadOptions options;
262+
options.verify_checksums = check_crc_;
263+
return database_ && database_->Get(options, ToLeveldbSlice(key), &res).ok()
262264
? boost::optional<std::string>(std::move(res))
263265
: boost::none;
264266
}

0 commit comments

Comments
 (0)