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

Unified Diff: chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h

Issue 377413006: [SyncFS] [Refactoring] Make interfaces to handle TrackerIDSet on DB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work for a nit Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h
index ff0ee9bbe8a8ed4587e5e3b84b2c42158666efac..df44df70d3882d0f5eae4942498e3a40edda1f79 100644
--- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h
+++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.h
@@ -99,7 +99,43 @@ class MetadataDatabaseIndexOnDisk : public MetadataDatabaseIndexInterface {
// Returns a TrackerIDSet built from IDs which are found with given key
// and key prefix.
TrackerIDSet GetTrackerIDSetByPrefix(
- const std::string& active_key, const std::string& key_prefix) const;
+ const std::string& active_tracker_key,
+ const std::string& key_prefix) const;
+
+
+ // Simulate behavior of TrackerIDSet class.
+
+ // Adds an entry with |key_prefix| and tracker ID of |tracker|. If |tracker|
+ // is active, an entry for |active_key| is added.
+ void AddToTrackerIDSetWithPrefix(
+ const std::string& active_tracker_key,
+ const std::string& key_prefix,
+ const FileTracker& tracker,
+ leveldb::WriteBatch* batch);
+
+ // Returns true if |tracker_id| is removed successfully. If no other entries
+ // are stored with |key_prefix|, the entry for |active_key| is also removed.
+ bool EraseInTrackerIDSetWithPrefix(
+ const std::string& active_tracker_key,
+ const std::string& key_prefix,
+ int64 tracker_id,
+ leveldb::WriteBatch* batch);
+
+ // Adds an entry for |active_key| on DB, if |tracker_id| has an entry with
+ // |key_prefix|.
+ void ActivateInTrackerIDSetWithPrefix(
+ const std::string& active_tracker_key,
+ const std::string& key_prefix,
+ int64 tracker_id,
+ leveldb::WriteBatch* batch);
+
+ // Removes an entry for |active_key| on DB, if the value of |active_key| key
+ // is |tracker_id|.
+ void DeactivateInTrackerIDSetWithPrefix(
+ const std::string& active_tracker_key,
+ const std::string& key_prefix,
+ int64 tracker_id,
+ leveldb::WriteBatch* batch);
// Checks if |db_| has an entry whose key is |key|.
bool DBHasKey(const std::string& key);

Powered by Google App Engine
This is Rietveld 408576698