Make GetDbIdentity pure virtual and also implement it for StackableDB, DBWithTTL

Summary: As title

Test Plan: make clean and make

Reviewers: igor

Reviewed By: igor

CC: leveldb

Differential Revision: https://reviews.facebook.net/D14469
main
Mayank Agarwal 11 years ago
parent 18802689b8
commit 92e8316118
  1. 4
      db/db_test.cc
  2. 5
      include/rocksdb/db.h
  3. 4
      include/utilities/stackable_db.h
  4. 4
      utilities/ttl/db_ttl.cc
  5. 2
      utilities/ttl/db_ttl.h

@ -4476,6 +4476,10 @@ class ModelDB: public DB {
return Status::OK(); return Status::OK();
} }
virtual Status GetDbIdentity(std::string& identity) {
return Status::OK();
}
virtual SequenceNumber GetLatestSequenceNumber() const { virtual SequenceNumber GetLatestSequenceNumber() const {
return 0; return 0;
} }

@ -295,10 +295,7 @@ class DB {
// Sets the globally unique ID created at database creation time by invoking // Sets the globally unique ID created at database creation time by invoking
// Env::GenerateUniqueId(), in identity. Returns Status::OK if identity could // Env::GenerateUniqueId(), in identity. Returns Status::OK if identity could
// be set properly // be set properly
virtual Status GetDbIdentity(std::string& identity) { virtual Status GetDbIdentity(std::string& identity) = 0;
identity.clear();
return Status::OK();
}
private: private:
// No copying allowed // No copying allowed

@ -140,6 +140,10 @@ class StackableDB : public DB {
return db_->DeleteFile(name); return db_->DeleteFile(name);
} }
virtual Status GetDbIdentity(std::string& identity) {
return db_->GetDbIdentity(identity);
}
virtual Status GetUpdatesSince(SequenceNumber seq_number, virtual Status GetUpdatesSince(SequenceNumber seq_number,
unique_ptr<TransactionLogIterator>* iter) unique_ptr<TransactionLogIterator>* iter)
override { override {

@ -291,6 +291,10 @@ Status DBWithTTL::DeleteFile(std::string name) {
return db_->DeleteFile(name); return db_->DeleteFile(name);
} }
Status DBWithTTL::GetDbIdentity(std::string& identity) {
return db_->GetDbIdentity(identity);
}
Status DBWithTTL::GetUpdatesSince( Status DBWithTTL::GetUpdatesSince(
SequenceNumber seq_number, SequenceNumber seq_number,
unique_ptr<TransactionLogIterator>* iter) { unique_ptr<TransactionLogIterator>* iter) {

@ -84,6 +84,8 @@ class DBWithTTL : public StackableDB {
virtual Status DeleteFile(std::string name); virtual Status DeleteFile(std::string name);
virtual Status GetDbIdentity(std::string& identity);
virtual SequenceNumber GetLatestSequenceNumber() const; virtual SequenceNumber GetLatestSequenceNumber() const;
virtual Status GetUpdatesSince(SequenceNumber seq_number, virtual Status GetUpdatesSince(SequenceNumber seq_number,

Loading…
Cancel
Save