Index: chrome/browser/value_store/value_store.h |
diff --git a/chrome/browser/value_store/value_store.h b/chrome/browser/value_store/value_store.h |
index 2b203ea57b779297a647e991b0825b64e64de9ae..3eaa1c91bba457daf601bf2b13cd86ecee102684 100644 |
--- a/chrome/browser/value_store/value_store.h |
+++ b/chrome/browser/value_store/value_store.h |
@@ -191,6 +191,27 @@ class ValueStore { |
// Clears the storage. |
virtual WriteResult Clear() = 0; |
+ |
+ // In the event of corruption, the ValueStore should be able to restore |
+ // itself. This means deleting local corrupted files. If only a few keys are |
+ // corrupted, then some of the database may be saved. If the full database is |
+ // corrupted, this will erase it in its entirety. |
+ // Returns true on success, false on failure. The only way this will fail is |
+ // if we also cannot delete the database file. |
+ // Note: This method needs to read (and possibly delete) the whole database, |
not at google - send to devlin
2014/02/14 19:35:56
why does it need to read the whole database?
Devlin
2014/02/18 23:55:22
Because it relies on Get() to ensure that there's
not at google - send to devlin
2014/02/19 21:25:29
Ok. That's an implementation detail though. It may
Devlin
2014/02/19 23:12:28
Done.
|
+ // so it is slow and should be used sparingly. |
+ // Note: This method (and the following RestoreKey()) are rude, and do not |
+ // make any logs, track changes, or other generally polite things. Please do |
+ // not use these as substitutes for Clear() and Remove(). |
+ virtual bool Restore() = 0; |
+ |
+ // Similar to Restore(), but for only a particular key. If the key is corrupt, |
+ // this will forcefully remove the key. It does not look at the database on |
+ // the whole, which makes it faster, but does not guarantee there is no |
+ // additional corruption. |
+ // Returns true on success, and false on failure. If false, the next step is |
+ // probably to Restore() the whole database. |
+ virtual bool RestoreKey(const std::string& key) = 0; |
}; |
#endif // CHROME_BROWSER_VALUE_STORE_VALUE_STORE_H_ |