| 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 20 matching lines...) Expand all Loading... |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 // LevelDBWrapper class wraps leveldb::DB and leveldb::WriteBatch to provide | 33 // LevelDBWrapper class wraps leveldb::DB and leveldb::WriteBatch to provide |
| 34 // transparent access to pre-commit data. | 34 // transparent access to pre-commit data. |
| 35 // Put() and Delete() update data on memory, and Get() can access to those data | 35 // Put() and Delete() update data on memory, and Get() can access to those data |
| 36 // and also data on disk. Those data on memory are written down on disk when | 36 // and also data on disk. Those data on memory are written down on disk when |
| 37 // Commit() is called. | 37 // Commit() is called. |
| 38 class LevelDBWrapper { | 38 class LevelDBWrapper { |
| 39 private: | 39 private: |
| 40 enum Operation { | 40 enum Operation { |
| 41 DB_PUT, | 41 PUT_OPERATION, |
| 42 DB_DELETE, | 42 DELETE_OPERATION, |
| 43 }; | 43 }; |
| 44 typedef std::pair<Operation, std::string> Transaction; | 44 typedef std::pair<Operation, std::string> Transaction; |
| 45 typedef std::map<std::string, Transaction, SliceComparator> | 45 typedef std::map<std::string, Transaction, SliceComparator> |
| 46 PendingOperationMap; | 46 PendingOperationMap; |
| 47 | 47 |
| 48 public: | 48 public: |
| 49 class Iterator { | 49 class Iterator { |
| 50 public: | 50 public: |
| 51 explicit Iterator(LevelDBWrapper* db); | 51 explicit Iterator(LevelDBWrapper* db); |
| 52 ~Iterator(); | 52 ~Iterator(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 PendingOperationMap pending_; | 96 PendingOperationMap pending_; |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapper); | 98 DISALLOW_COPY_AND_ASSIGN(LevelDBWrapper); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace drive_backend | 101 } // namespace drive_backend |
| 102 } // namespace sync_file_system | 102 } // namespace sync_file_system |
| 103 | 103 |
| 104 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ | 104 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LEVELDB_WRAPPER_H_ |
| OLD | NEW |