From 3ce36584111e236e6d7170f0c0dc9adc4b1f949e Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Mon, 25 Nov 2013 15:51:50 -0800 Subject: [PATCH] DB::GetOptions() Summary: We need access to options for BackupableDB Test Plan: make check Reviewers: dhruba Reviewed By: dhruba CC: leveldb, reconnect.grayhat Differential Revision: https://reviews.facebook.net/D14331 --- db/db_impl.cc | 4 ++++ db/db_impl.h | 1 + db/db_test.cc | 4 ++++ include/rocksdb/db.h | 3 +++ include/utilities/stackable_db.h | 4 ++++ utilities/ttl/db_ttl.cc | 4 ++++ utilities/ttl/db_ttl.h | 2 ++ 7 files changed, 22 insertions(+) diff --git a/db/db_impl.cc b/db/db_impl.cc index 1f28af324..2d85d7014 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -3135,6 +3135,10 @@ Env* DBImpl::GetEnv() const { return env_; } +const Options& DBImpl::GetOptions() const { + return options_; +} + bool DBImpl::GetProperty(const Slice& property, std::string* value) { value->clear(); diff --git a/db/db_impl.h b/db/db_impl.h index fdd0a2520..8a57b92f5 100644 --- a/db/db_impl.h +++ b/db/db_impl.h @@ -68,6 +68,7 @@ class DBImpl : public DB { virtual int MaxMemCompactionLevel(); virtual int Level0StopWriteTrigger(); virtual Env* GetEnv() const; + virtual const Options& GetOptions() const; virtual Status Flush(const FlushOptions& options); virtual Status DisableFileDeletions(); virtual Status EnableFileDeletions(); diff --git a/db/db_test.cc b/db/db_test.cc index 5e257483e..1e85ab1fa 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -4466,6 +4466,10 @@ class ModelDB: public DB { return nullptr; } + virtual const Options& GetOptions() const { + return options_; + } + virtual Status Flush(const rocksdb::FlushOptions& options) { Status ret; return ret; diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index 0ec7ffba7..73f9ac4da 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -231,6 +231,9 @@ class DB { // Get Env object from the DB virtual Env* GetEnv() const = 0; + // Get DB Options that we use + virtual const Options& GetOptions() const = 0; + // Flush all mem-table data. virtual Status Flush(const FlushOptions& options) = 0; diff --git a/include/utilities/stackable_db.h b/include/utilities/stackable_db.h index b1e308b20..dc26ed852 100644 --- a/include/utilities/stackable_db.h +++ b/include/utilities/stackable_db.h @@ -107,6 +107,10 @@ class StackableDB : public DB { return db_->GetEnv(); } + virtual const Options& GetOptions() const override { + return db_->GetOptions(); + } + virtual Status Flush(const FlushOptions& fopts) override { return db_->Flush(fopts); } diff --git a/utilities/ttl/db_ttl.cc b/utilities/ttl/db_ttl.cc index 127a2e566..abe7408a6 100644 --- a/utilities/ttl/db_ttl.cc +++ b/utilities/ttl/db_ttl.cc @@ -258,6 +258,10 @@ Env* DBWithTTL::GetEnv() const { return db_->GetEnv(); } +const Options& DBWithTTL::GetOptions() const { + return db_->GetOptions(); +} + Status DBWithTTL::Flush(const FlushOptions& fopts) { return db_->Flush(fopts); } diff --git a/utilities/ttl/db_ttl.h b/utilities/ttl/db_ttl.h index d5c51dd3f..d09bae966 100644 --- a/utilities/ttl/db_ttl.h +++ b/utilities/ttl/db_ttl.h @@ -69,6 +69,8 @@ class DBWithTTL : public StackableDB { virtual Env* GetEnv() const; + virtual const Options& GetOptions() const; + virtual Status Flush(const FlushOptions& fopts); virtual Status DisableFileDeletions();