Chromium Code Reviews| Index: sync/syncable/syncable_columns.h |
| diff --git a/sync/syncable/syncable_columns.h b/sync/syncable/syncable_columns.h |
| index 8b3bd9ee10a00e18cd1c077816338db6bd6b8294..1c144a8e0a4088cc4be22e4c45a7d6d9b1f50f0c 100644 |
| --- a/sync/syncable/syncable_columns.h |
| +++ b/sync/syncable/syncable_columns.h |
| @@ -5,12 +5,165 @@ |
| #ifndef SYNC_SYNCABLE_SYNCABLE_COLUMNS_H_ |
| #define SYNC_SYNCABLE_SYNCABLE_COLUMNS_H_ |
| -#include "sync/syncable/entry_kernel.h" |
| #include "sync/syncable/syncable_changes_version.h" |
| namespace syncer { |
| namespace syncable { |
| +enum { |
|
stanisc
2015/08/07 18:24:04
This is an unnecessary change. I'd prefer to keep
Gang Wu
2015/08/07 20:50:57
Done.
|
| + 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 ColumnSpec { |
| const char* name; |
| const char* spec; |