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
This commit is contained in:
Igor Canadi 2015-01-29 18:22:43 -08:00
parent 2fd8f750ab
commit 6c6037f60c
3 changed files with 12 additions and 0 deletions

View File

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

View File

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

View File

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