Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.h

Issue 466373004: [SyncFS] Introduce counters in LevelDBWrapper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work for nits Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Returns the number of pending PUT/DELETE operations.
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698