]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
11fdf7f2 TL |
2 | // This source code is licensed under both the GPLv2 (found in the |
3 | // COPYING file in the root directory) and Apache 2.0 License | |
4 | // (found in the LICENSE.Apache file in the root directory). | |
7c673cae FG |
5 | // |
6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. | |
7 | // Use of this source code is governed by a BSD-style license that can be | |
8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. | |
9 | #pragma once | |
10 | ||
11 | #include <atomic> | |
12 | #include <map> | |
13 | #include <string> | |
14 | #include <vector> | |
20effc67 TL |
15 | |
16 | #include "env/composite_env_wrapper.h" | |
7c673cae FG |
17 | #include "rocksdb/env.h" |
18 | #include "rocksdb/status.h" | |
7c673cae | 19 | |
f67539c2 | 20 | namespace ROCKSDB_NAMESPACE { |
7c673cae | 21 | |
20effc67 | 22 | class MockEnv : public CompositeEnvWrapper { |
7c673cae FG |
23 | public: |
24 | explicit MockEnv(Env* base_env); | |
25 | ||
7c673cae | 26 | // Results of these can be affected by FakeSleepForMicroseconds() |
20effc67 TL |
27 | Status GetCurrentTime(int64_t* unix_time) override; |
28 | uint64_t NowMicros() override; | |
29 | uint64_t NowNanos() override; | |
7c673cae | 30 | |
7c673cae FG |
31 | Status CorruptBuffer(const std::string& fname); |
32 | ||
33 | // Doesn't really sleep, just affects output of GetCurrentTime(), NowMicros() | |
34 | // and NowNanos() | |
35 | void FakeSleepForMicroseconds(int64_t micros); | |
36 | ||
37 | private: | |
7c673cae FG |
38 | std::atomic<int64_t> fake_sleep_micros_; |
39 | }; | |
40 | ||
f67539c2 | 41 | } // namespace ROCKSDB_NAMESPACE |