summaryrefslogtreecommitdiff
path: root/util/file_checksum_helper.h
diff options
context:
space:
mode:
authorZitan Chen <11285749+gg814@users.noreply.github.com>2020-08-12 13:28:43 -0700
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2020-08-12 13:31:09 -0700
commitb578ca2e4dcc027e20b9cec14a8b4ecd8829ae69 (patch)
tree0238e494bd13dfec338413a879a75cb9b2ce17c9 /util/file_checksum_helper.h
parent76609cd38a980d974a4872bba71d9fa820a4d6df (diff)
BackupEngine supports custom file checksums (#7085)
Summary: A new option `std::shared_ptr<FileChecksumGenFactory> backup_checksum_gen_factory` is added to `BackupableDBOptions`. This allows custom checksum functions to be used for creating, verifying, or restoring backups. Tests are added. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7085 Test Plan: Passed make check Reviewed By: pdillinger Differential Revision: D22390756 Pulled By: gg814 fbshipit-source-id: 3b7756ca444c2129844536b91c3ca09f53b6248f
Diffstat (limited to 'util/file_checksum_helper.h')
-rw-r--r--util/file_checksum_helper.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/util/file_checksum_helper.h b/util/file_checksum_helper.h
index d9a3c8e47..ce56f7353 100644
--- a/util/file_checksum_helper.h
+++ b/util/file_checksum_helper.h
@@ -49,8 +49,13 @@ class FileChecksumGenCrc32cFactory : public FileChecksumGenFactory {
public:
std::unique_ptr<FileChecksumGenerator> CreateFileChecksumGenerator(
const FileChecksumGenContext& context) override {
- return std::unique_ptr<FileChecksumGenerator>(
- new FileChecksumGenCrc32c(context));
+ if (context.requested_checksum_func_name.empty() ||
+ context.requested_checksum_func_name == "FileChecksumCrc32c") {
+ return std::unique_ptr<FileChecksumGenerator>(
+ new FileChecksumGenCrc32c(context));
+ } else {
+ return nullptr;
+ }
}
const char* Name() const override { return "FileChecksumGenCrc32cFactory"; }