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> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 }; | 90 }; |
91 | 91 |
92 ErrorParsingResult ParseMethodAndError(const leveldb::Status& status, | 92 ErrorParsingResult ParseMethodAndError(const leveldb::Status& status, |
93 MethodID* method, | 93 MethodID* method, |
94 base::File::Error* error); | 94 base::File::Error* error); |
95 int GetCorruptionCode(const leveldb::Status& status); | 95 int GetCorruptionCode(const leveldb::Status& status); |
96 int GetNumCorruptionCodes(); | 96 int GetNumCorruptionCodes(); |
97 std::string GetCorruptionMessage(const leveldb::Status& status); | 97 std::string GetCorruptionMessage(const leveldb::Status& status); |
98 bool IndicatesDiskFull(const leveldb::Status& status); | 98 bool IndicatesDiskFull(const leveldb::Status& status); |
99 | 99 |
| 100 // Determine the appropriate leveldb write buffer size to use. The default size |
| 101 // (4MB) may result in a log file too large to be compacted given the available |
| 102 // storage space. This function will return smaller values for smaller disks, |
| 103 // and the default leveldb value for larger disks. |
| 104 // |
| 105 // |disk_space| is the logical partition size (in bytes), and *not* available |
| 106 // space. A value of -1 will return leveldb's default write buffer size. |
| 107 extern size_t WriteBufferSize(int64_t disk_space); |
| 108 |
100 class UMALogger { | 109 class UMALogger { |
101 public: | 110 public: |
102 virtual void RecordErrorAt(MethodID method) const = 0; | 111 virtual void RecordErrorAt(MethodID method) const = 0; |
103 virtual void RecordOSError(MethodID method, | 112 virtual void RecordOSError(MethodID method, |
104 base::File::Error error) const = 0; | 113 base::File::Error error) const = 0; |
105 }; | 114 }; |
106 | 115 |
107 class RetrierProvider { | 116 class RetrierProvider { |
108 public: | 117 public: |
109 virtual int MaxRetryTimeMillis() const = 0; | 118 virtual int MaxRetryTimeMillis() const = 0; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 void (*function)(void*); | 223 void (*function)(void*); |
215 }; | 224 }; |
216 typedef std::deque<BGItem> BGQueue; | 225 typedef std::deque<BGItem> BGQueue; |
217 BGQueue queue_; | 226 BGQueue queue_; |
218 LockTable locks_; | 227 LockTable locks_; |
219 }; | 228 }; |
220 | 229 |
221 } // namespace leveldb_env | 230 } // namespace leveldb_env |
222 | 231 |
223 #endif // THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ | 232 #endif // THIRD_PARTY_LEVELDATABASE_ENV_CHROMIUM_H_ |
OLD | NEW |