Expose Snapshot's SequenceNumber

Summary:
Requested here: https://www.facebook.com/groups/rocksdb.dev/permalink/705524519546065/

It might also help with mongo. I don't see a reason why we shouldn't expose this info.

Test Plan: make check

Reviewers: sdong, yhchiang, rven

Reviewed By: rven

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D32547
main
Igor Canadi 10 years ago
parent 2fd8f750ab
commit 6c6037f60c
  1. 6
      db/db_test.cc
  2. 2
      db/snapshot.h
  3. 4
      include/rocksdb/db.h

@ -7751,6 +7751,12 @@ class ModelDB: public DB {
class ModelSnapshot : public Snapshot { class ModelSnapshot : public Snapshot {
public: public:
KVMap map_; KVMap map_;
virtual SequenceNumber GetSequenceNumber() const {
// no need to call this
assert(false);
return 0;
}
}; };
explicit ModelDB(const Options& options) : options_(options) {} explicit ModelDB(const Options& options) : options_(options) {}

@ -20,6 +20,8 @@ class SnapshotImpl : public Snapshot {
public: public:
SequenceNumber number_; // const after creation SequenceNumber number_; // const after creation
virtual SequenceNumber GetSequenceNumber() const { return number_; }
private: private:
friend class SnapshotList; friend class SnapshotList;

@ -64,6 +64,10 @@ static const int kMinorVersion = __ROCKSDB_MINOR__;
// A Snapshot is an immutable object and can therefore be safely // A Snapshot is an immutable object and can therefore be safely
// accessed from multiple threads without any external synchronization. // accessed from multiple threads without any external synchronization.
class Snapshot { class Snapshot {
public:
// returns Snapshot's sequence number
virtual SequenceNumber GetSequenceNumber() const = 0;
protected: protected:
virtual ~Snapshot(); virtual ~Snapshot();
}; };

Loading…
Cancel
Save