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

Unified Diff: components/sync/model_impl/model_type_store_backend.h

Issue 2426613003: [sync] Add store version to model type store backend (Closed)
Patch Set: [sync] Add store version to model type store backend Created 4 years, 2 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
« no previous file with comments | « components/sync/model/model_type_store.h ('k') | components/sync/model_impl/model_type_store_backend.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/model_impl/model_type_store_backend.h
diff --git a/components/sync/model_impl/model_type_store_backend.h b/components/sync/model_impl/model_type_store_backend.h
index e7d375d2ba5b8d688032a5fe21d9e1ac1c047319..4c99ad24bea51e434282809279e14fe4c1eefd83 100644
--- a/components/sync/model_impl/model_type_store_backend.h
+++ b/components/sync/model_impl/model_type_store_backend.h
@@ -67,6 +67,9 @@ class ModelTypeStoreBackend
friend class base::RefCountedThreadSafe<ModelTypeStoreBackend>;
friend class ModelTypeStoreBackendTest;
+ static const int64_t kLatestSchemaVersion;
+ static const char kDBSchemaDescriptorRecordId[];
+
explicit ModelTypeStoreBackend(const std::string& path);
~ModelTypeStoreBackend();
@@ -97,6 +100,20 @@ class ModelTypeStoreBackend
ModelTypeStore::Result Init(const std::string& path,
std::unique_ptr<leveldb::Env> env);
+ // Attempts to read and return the database's version.
+ // If there is not a schema descriptor present, the value returned is 0.
+ // If an error occurs, the value returned is kInvalidSchemaVersion(-1).
+ int64_t GetStoreVersion();
+
+ // Migrate the db schema from |current_version| to |desired_version|,
+ // returning true on success.
+ ModelTypeStore::Result Migrate(int64_t current_version,
+ int64_t desired_version);
+
+ // Migrates from no version record at all (version 0) to version 1 of
+ // the schema, returning true on success.
+ bool Migrate0To1();
+
// Macro wrapped mutex to guard against concurrent calls in debug builds.
DFAKE_MUTEX(push_pop_);
« no previous file with comments | « components/sync/model/model_type_store.h ('k') | components/sync/model_impl/model_type_store_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698