OLD | NEW |
1 // Copyright (c) 2013 The LevelDB Authors. All rights reserved. | 1 // Copyright (c) 2013 The LevelDB Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. See the AUTHORS file for names of contributors. | 3 // found in the LICENSE file. See the AUTHORS file for names of contributors. |
4 | 4 |
5 #ifndef THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ | 5 #ifndef THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ |
6 #define THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ | 6 #define THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "leveldb/env.h" | 16 #include "leveldb/env.h" |
17 #include "port/port_chromium.h" | 17 #include "port/port_chromium.h" |
18 #include "util/mutexlock.h" | 18 #include "util/mutexlock.h" |
19 | 19 |
20 namespace leveldb_env { | 20 namespace leveldb_env { |
21 | 21 |
| 22 // These entries map to values in tools/metrics/histograms/histograms.xml. New |
| 23 // values should be appended at the end. |
22 enum MethodID { | 24 enum MethodID { |
23 kSequentialFileRead, | 25 kSequentialFileRead, |
24 kSequentialFileSkip, | 26 kSequentialFileSkip, |
25 kRandomAccessFileRead, | 27 kRandomAccessFileRead, |
26 kWritableFileAppend, | 28 kWritableFileAppend, |
27 kWritableFileClose, | 29 kWritableFileClose, |
28 kWritableFileFlush, | 30 kWritableFileFlush, |
29 kWritableFileSync, | 31 kWritableFileSync, |
30 kNewSequentialFile, | 32 kNewSequentialFile, |
31 kNewRandomAccessFile, | 33 kNewRandomAccessFile, |
32 kNewWritableFile, | 34 kNewWritableFile, |
33 kDeleteFile, | 35 kDeleteFile, |
34 kCreateDir, | 36 kCreateDir, |
35 kDeleteDir, | 37 kDeleteDir, |
36 kGetFileSize, | 38 kGetFileSize, |
37 kRenameFile, | 39 kRenameFile, |
38 kLockFile, | 40 kLockFile, |
39 kUnlockFile, | 41 kUnlockFile, |
40 kGetTestDirectory, | 42 kGetTestDirectory, |
41 kNewLogger, | 43 kNewLogger, |
42 kSyncParent, | 44 kSyncParent, |
43 kGetChildren, | 45 kGetChildren, |
| 46 kNewAppendableFile, |
44 kNumEntries | 47 kNumEntries |
45 }; | 48 }; |
46 | 49 |
47 const char* MethodIDToString(MethodID method); | 50 const char* MethodIDToString(MethodID method); |
48 | 51 |
49 leveldb::Status MakeIOError(leveldb::Slice filename, | 52 leveldb::Status MakeIOError(leveldb::Slice filename, |
50 const std::string& message, | 53 const std::string& message, |
51 MethodID method, | 54 MethodID method, |
52 base::File::Error error); | 55 base::File::Error error); |
53 leveldb::Status MakeIOError(leveldb::Slice filename, | 56 leveldb::Status MakeIOError(leveldb::Slice filename, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 virtual leveldb::Status GetTestDirectory(std::string* path); | 125 virtual leveldb::Status GetTestDirectory(std::string* path); |
123 virtual uint64_t NowMicros(); | 126 virtual uint64_t NowMicros(); |
124 virtual void SleepForMicroseconds(int micros); | 127 virtual void SleepForMicroseconds(int micros); |
125 virtual leveldb::Status NewSequentialFile(const std::string& fname, | 128 virtual leveldb::Status NewSequentialFile(const std::string& fname, |
126 leveldb::SequentialFile** result); | 129 leveldb::SequentialFile** result); |
127 virtual leveldb::Status NewRandomAccessFile( | 130 virtual leveldb::Status NewRandomAccessFile( |
128 const std::string& fname, | 131 const std::string& fname, |
129 leveldb::RandomAccessFile** result); | 132 leveldb::RandomAccessFile** result); |
130 virtual leveldb::Status NewWritableFile(const std::string& fname, | 133 virtual leveldb::Status NewWritableFile(const std::string& fname, |
131 leveldb::WritableFile** result); | 134 leveldb::WritableFile** result); |
| 135 virtual leveldb::Status NewAppendableFile(const std::string& fname, |
| 136 leveldb::WritableFile** result); |
132 virtual leveldb::Status NewLogger(const std::string& fname, | 137 virtual leveldb::Status NewLogger(const std::string& fname, |
133 leveldb::Logger** result); | 138 leveldb::Logger** result); |
134 | 139 |
135 protected: | 140 protected: |
136 virtual void DidSyncDir(const std::string& fname); | 141 virtual void DidSyncDir(const std::string& fname); |
137 | 142 |
138 std::string name_; | 143 std::string name_; |
139 bool make_backup_; | 144 bool make_backup_; |
140 | 145 |
141 private: | 146 private: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 void (*function)(void*); | 208 void (*function)(void*); |
204 }; | 209 }; |
205 typedef std::deque<BGItem> BGQueue; | 210 typedef std::deque<BGItem> BGQueue; |
206 BGQueue queue_; | 211 BGQueue queue_; |
207 LockTable locks_; | 212 LockTable locks_; |
208 }; | 213 }; |
209 | 214 |
210 } // namespace leveldb_env | 215 } // namespace leveldb_env |
211 | 216 |
212 #endif // THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ | 217 #endif // THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ |
OLD | NEW |