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

Unified Diff: sync/internal_api/public/model_type_store_impl.h

Issue 2018623002: [USS] Store supports hosting multiple datatypes per database (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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: sync/internal_api/public/model_type_store_impl.h
diff --git a/sync/internal_api/public/model_type_store_impl.h b/sync/internal_api/public/model_type_store_impl.h
index 88bd8fa9703e1d1bf408b06cebc3f5a51820addc..63ff1378ee51a4badf6cc7a71e31db52ac959c47 100644
--- a/sync/internal_api/public/model_type_store_impl.h
+++ b/sync/internal_api/public/model_type_store_impl.h
@@ -12,6 +12,7 @@
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "sync/api/model_type_store.h"
+#include "sync/internal_api/public/base/model_type.h"
namespace leveldb {
class WriteBatch;
@@ -29,6 +30,7 @@ class ModelTypeStoreImpl : public ModelTypeStore, public base::NonThreadSafe {
~ModelTypeStoreImpl() override;
static void CreateStore(
+ const syncer::ModelType type,
const std::string& path,
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner,
const InitCallback& callback);
@@ -66,13 +68,18 @@ class ModelTypeStoreImpl : public ModelTypeStore, public base::NonThreadSafe {
std::unique_ptr<ModelTypeStoreImpl> store,
Result result);
- // Format key for data/metadata records with given id.
- static std::string FormatDataKey(const std::string& id);
- static std::string FormatMetadataKey(const std::string& id);
+ // Format prefix key for data/metadata records with |type|.
+ static std::string FormatDataPrefix(const syncer::ModelType type);
+ static std::string FormatMetaPrefix(const syncer::ModelType type);
static leveldb::WriteBatch* GetLeveldbWriteBatch(WriteBatch* write_batch);
+ // Format key for data/metadata records with given id.
+ std::string FormatDataKey(const std::string& id);
+ std::string FormatMetadataKey(const std::string& id);
+
ModelTypeStoreImpl(
+ const syncer::ModelType type,
std::unique_ptr<ModelTypeStoreBackend> backend,
scoped_refptr<base::SequencedTaskRunner> backend_task_runner);
@@ -101,6 +108,9 @@ class ModelTypeStoreImpl : public ModelTypeStore, public base::NonThreadSafe {
std::unique_ptr<ModelTypeStoreBackend> backend_;
scoped_refptr<base::SequencedTaskRunner> backend_task_runner_;
+ const std::string dataPrefix_;
maxbogue 2016/06/07 23:35:09 Comment above these?
pavely 2016/06/08 01:18:07 Also follow naming conventions: data_prefix_
Gang Wu 2016/06/08 01:29:28 Done.
Gang Wu 2016/06/20 21:39:21 Done.
+ const std::string metadataPrefix_;
+
base::WeakPtrFactory<ModelTypeStoreImpl> weak_ptr_factory_;
};

Powered by Google App Engine
This is Rietveld 408576698