OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium 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. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 leveldb::Status Get(const std::string& key, std::string* value); | 82 leveldb::Status Get(const std::string& key, std::string* value); |
83 scoped_ptr<Iterator> NewIterator(); | 83 scoped_ptr<Iterator> NewIterator(); |
84 | 84 |
85 // Commits pending transactions to |db_| and clears cached transactions. | 85 // Commits pending transactions to |db_| and clears cached transactions. |
86 // Returns true if the commitment succeeds. | 86 // Returns true if the commitment succeeds. |
87 leveldb::Status Commit(); | 87 leveldb::Status Commit(); |
88 | 88 |
89 // Clears pending transactions. | 89 // Clears pending transactions. |
90 void Clear(); | 90 void Clear(); |
91 | 91 |
92 // Return the number of pending PUT/DELETE operations. | |
nhiroki
2014/08/14 08:59:30
nit: s/Return/Returns/
peria
2014/08/14 09:01:53
Done.
| |
93 // Each counter counts operations independently, so operations on a key | |
94 // may be counted more than once. | |
95 int64 num_puts() { return num_puts_; } | |
96 int64 num_deletes() { return num_deletes_; } | |
97 | |
92 // TODO(peria): Rename this method to GetLevelDBForTesting, after removing | 98 // TODO(peria): Rename this method to GetLevelDBForTesting, after removing |
93 // usages of drive_backend::MigrateDatabaseFromVxToVy() under | 99 // usages of drive_backend::MigrateDatabaseFromVxToVy() under |
94 // drive_backend_v1/. | 100 // drive_backend_v1/. |
95 leveldb::DB* GetLevelDB(); | 101 leveldb::DB* GetLevelDB(); |
96 | 102 |
97 private: | 103 private: |
98 scoped_ptr<leveldb::DB> db_; | 104 scoped_ptr<leveldb::DB> db_; |
99 | 105 |
100 PendingOperationMap pending_; | 106 PendingOperationMap pending_; |
107 int64 num_puts_; | |
108 int64 num_deletes_; | |
101 | 109 |
102 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapper); | 110 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapper); |
103 }; | 111 }; |
104 | 112 |
105 } // namespace drive_backend | 113 } // namespace drive_backend |
106 } // namespace sync_file_system | 114 } // namespace sync_file_system |
107 | 115 |
108 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ | 116 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ |
OLD | NEW |