Skip to content

Commit

Permalink
Remove duplicate MockTimeEnv
Browse files Browse the repository at this point in the history
  • Loading branch information
igorcanadi committed Mar 27, 2018
1 parent c568e6e commit 627eb27
Showing 1 changed file with 2 additions and 33 deletions.
35 changes: 2 additions & 33 deletions db/db_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -610,37 +610,6 @@ class MockTimeEnv : public EnvWrapper {
uint64_t current_time_ = 0;
};

class MockTimeEnv : public EnvWrapper {
public:
explicit MockTimeEnv(Env* base) : EnvWrapper(base) {}

virtual Status GetCurrentTime(int64_t* time) override {
assert(time != nullptr);
assert(current_time_ <=
static_cast<uint64_t>(std::numeric_limits<int64_t>::max()));
*time = static_cast<int64_t>(current_time_);
return Status::OK();
}

virtual uint64_t NowMicros() override {
assert(current_time_ <= std::numeric_limits<uint64_t>::max() / 1000000);
return current_time_ * 1000000;
}

virtual uint64_t NowNanos() override {
assert(current_time_ <= std::numeric_limits<uint64_t>::max() / 1000000000);
return current_time_ * 1000000000;
}

void set_current_time(uint64_t time) {
assert(time >= current_time_);
current_time_ = time;
}

private:
uint64_t current_time_ = 0;
};

#ifndef ROCKSDB_LITE
class OnFileDeletionListener : public EventListener {
public:
Expand Down Expand Up @@ -737,8 +706,8 @@ class DBTestBase : public testing::Test {

// The types of envs that we want to test with
enum OptionConfigEnv {
kDefaultEnv = 0, // posix env
kAwsEnv = 1, // aws env
kDefaultEnv = 0, // posix env
kAwsEnv = 1, // aws env
kEndEnv = 2,
};
int option_env_;
Expand Down

0 comments on commit 627eb27

Please sign in to comment.