Index: sync/syncable/entry_kernel.h |
diff --git a/sync/syncable/entry_kernel.h b/sync/syncable/entry_kernel.h |
index 6b627a46b8b9a6866182c339eed9d2a40907700d..bb09af62a3e3ced38213d385c09cfea8e98ec71a 100644 |
--- a/sync/syncable/entry_kernel.h |
+++ b/sync/syncable/entry_kernel.h |
@@ -15,6 +15,7 @@ |
#include "sync/internal_api/public/util/immutable.h" |
#include "sync/syncable/metahandle_set.h" |
#include "sync/syncable/proto_value_ptr.h" |
+#include "sync/syncable/syncable_columns.h" |
stanisc
2015/08/07 18:24:04
Instead of including syncable_columns.h in entry_k
Gang Wu
2015/08/07 20:50:57
Done.
|
#include "sync/syncable/syncable_id.h" |
#include "sync/util/time.h" |
@@ -37,162 +38,6 @@ namespace syncable { |
static const int64 kInvalidMetaHandle = 0; |
-enum { |
- BEGIN_FIELDS = 0, |
- INT64_FIELDS_BEGIN = BEGIN_FIELDS |
-}; |
- |
-enum MetahandleField { |
- // Primary key into the table. Keep this as a handle to the meta entry |
- // across transactions. |
- META_HANDLE = INT64_FIELDS_BEGIN |
-}; |
- |
-enum BaseVersion { |
- // After initial upload, the version is controlled by the server, and is |
- // increased whenever the data or metadata changes on the server. |
- BASE_VERSION = META_HANDLE + 1, |
-}; |
- |
-enum Int64Field { |
- SERVER_VERSION = BASE_VERSION + 1, |
- LOCAL_EXTERNAL_ID, // ID of an item in the external local storage that this |
- // entry is associated with. (such as bookmarks.js) |
- TRANSACTION_VERSION, |
- INT64_FIELDS_END |
-}; |
- |
-enum { |
- INT64_FIELDS_COUNT = INT64_FIELDS_END - INT64_FIELDS_BEGIN, |
- TIME_FIELDS_BEGIN = INT64_FIELDS_END, |
-}; |
- |
-enum TimeField { |
- MTIME = TIME_FIELDS_BEGIN, |
- SERVER_MTIME, |
- CTIME, |
- SERVER_CTIME, |
- TIME_FIELDS_END, |
-}; |
- |
-enum { |
- TIME_FIELDS_COUNT = TIME_FIELDS_END - TIME_FIELDS_BEGIN, |
- ID_FIELDS_BEGIN = TIME_FIELDS_END, |
-}; |
- |
-enum IdField { |
- // Code in InitializeTables relies on ID being the first IdField value. |
- ID = ID_FIELDS_BEGIN, |
- PARENT_ID, |
- SERVER_PARENT_ID, |
- ID_FIELDS_END |
-}; |
- |
-enum { |
- ID_FIELDS_COUNT = ID_FIELDS_END - ID_FIELDS_BEGIN, |
- BIT_FIELDS_BEGIN = ID_FIELDS_END |
-}; |
- |
-enum IndexedBitField { |
- IS_UNSYNCED = BIT_FIELDS_BEGIN, |
- IS_UNAPPLIED_UPDATE, |
- INDEXED_BIT_FIELDS_END, |
-}; |
- |
-enum IsDelField { |
- IS_DEL = INDEXED_BIT_FIELDS_END, |
-}; |
- |
-enum BitField { |
- IS_DIR = IS_DEL + 1, |
- SERVER_IS_DIR, |
- SERVER_IS_DEL, |
- BIT_FIELDS_END |
-}; |
- |
-enum { |
- BIT_FIELDS_COUNT = BIT_FIELDS_END - BIT_FIELDS_BEGIN, |
- STRING_FIELDS_BEGIN = BIT_FIELDS_END |
-}; |
- |
-enum StringField { |
- // Name, will be truncated by server. Can be duplicated in a folder. |
- NON_UNIQUE_NAME = STRING_FIELDS_BEGIN, |
- // The server version of |NON_UNIQUE_NAME|. |
- SERVER_NON_UNIQUE_NAME, |
- |
- // A tag string which identifies this node as a particular top-level |
- // permanent object. The tag can be thought of as a unique key that |
- // identifies a singleton instance. |
- UNIQUE_SERVER_TAG, // Tagged by the server |
- UNIQUE_CLIENT_TAG, // Tagged by the client |
- UNIQUE_BOOKMARK_TAG, // Client tags for bookmark items |
- STRING_FIELDS_END, |
-}; |
- |
-enum { |
- STRING_FIELDS_COUNT = STRING_FIELDS_END - STRING_FIELDS_BEGIN, |
- PROTO_FIELDS_BEGIN = STRING_FIELDS_END |
-}; |
- |
-// From looking at the sqlite3 docs, it's not directly stated, but it |
-// seems the overhead for storing a NULL blob is very small. |
-enum ProtoField { |
- SPECIFICS = PROTO_FIELDS_BEGIN, |
- SERVER_SPECIFICS, |
- BASE_SERVER_SPECIFICS, |
- PROTO_FIELDS_END, |
-}; |
- |
-enum { |
- PROTO_FIELDS_COUNT = PROTO_FIELDS_END - PROTO_FIELDS_BEGIN, |
- UNIQUE_POSITION_FIELDS_BEGIN = PROTO_FIELDS_END |
-}; |
- |
-enum UniquePositionField { |
- SERVER_UNIQUE_POSITION = UNIQUE_POSITION_FIELDS_BEGIN, |
- UNIQUE_POSITION, |
- UNIQUE_POSITION_FIELDS_END |
-}; |
- |
-enum { |
- UNIQUE_POSITION_FIELDS_COUNT = |
- UNIQUE_POSITION_FIELDS_END - UNIQUE_POSITION_FIELDS_BEGIN, |
- ATTACHMENT_METADATA_FIELDS_BEGIN = UNIQUE_POSITION_FIELDS_END |
-}; |
- |
-enum AttachmentMetadataField { |
- ATTACHMENT_METADATA = ATTACHMENT_METADATA_FIELDS_BEGIN, |
- SERVER_ATTACHMENT_METADATA, |
- ATTACHMENT_METADATA_FIELDS_END |
-}; |
- |
-enum { |
- ATTACHMENT_METADATA_FIELDS_COUNT = |
- ATTACHMENT_METADATA_FIELDS_END - ATTACHMENT_METADATA_FIELDS_BEGIN, |
- FIELD_COUNT = ATTACHMENT_METADATA_FIELDS_END - BEGIN_FIELDS, |
- // Past this point we have temporaries, stored in memory only. |
- BEGIN_TEMPS = ATTACHMENT_METADATA_FIELDS_END, |
- BIT_TEMPS_BEGIN = BEGIN_TEMPS, |
-}; |
- |
-enum BitTemp { |
- // Whether a server commit operation was started and has not yet completed |
- // for this entity. |
- SYNCING = BIT_TEMPS_BEGIN, |
- // Whether a local change was made to an entity that had SYNCING set to true, |
- // and was therefore in the middle of a commit operation. |
- // Note: must only be set if SYNCING is true. |
- DIRTY_SYNC, |
- BIT_TEMPS_END, |
-}; |
- |
-enum { |
- BIT_TEMPS_COUNT = BIT_TEMPS_END - BIT_TEMPS_BEGIN |
-}; |
- |
- |
- |
struct SYNC_EXPORT_PRIVATE EntryKernel { |
private: |
std::string string_fields[STRING_FIELDS_COUNT]; |
@@ -206,6 +51,8 @@ struct SYNC_EXPORT_PRIVATE EntryKernel { |
std::bitset<BIT_FIELDS_COUNT> bit_fields; |
std::bitset<BIT_TEMPS_COUNT> bit_temps; |
+ friend std::ostream& operator<<(std::ostream& s, const EntryKernel& e); |
+ |
public: |
EntryKernel(); |
~EntryKernel(); |
@@ -393,6 +240,8 @@ base::DictionaryValue* EntryKernelMutationToValue( |
base::ListValue* EntryKernelMutationMapToValue( |
const EntryKernelMutationMap& mutations); |
+std::ostream& operator<<(std::ostream& os, const EntryKernel& entry_kernel); |
+ |
} // namespace syncable |
} // namespace syncer |