summaryrefslogtreecommitdiffstats
path: root/sync/syncable/syncable_columns.h
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 09:35:42 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 09:35:42 +0000
commitc1c32c85357f14756247b04b8b5ae41b05bf2e16 (patch)
tree58f25f64e1fa592e8daf276ef69901cd2218f929 /sync/syncable/syncable_columns.h
parent63ee33bde2ec8471a70f0f0ec6a1962dd07fc8ab (diff)
downloadchromium_src-c1c32c85357f14756247b04b8b5ae41b05bf2e16.zip
chromium_src-c1c32c85357f14756247b04b8b5ae41b05bf2e16.tar.gz
chromium_src-c1c32c85357f14756247b04b8b5ae41b05bf2e16.tar.bz2
[Sync] Move 'sync' target to sync/
Also move related test files. Move WriteNode::UpdateEntryWithEncryption to nigori_util.h. Clean up defines and dependencies. In particular, get rid of SYNC_ENGINE_VERSION_STRING and hard-code the string in the single place it's used. Rename data_encryption.* to data_encryption_win.* and add a pragma for crypt32.lib. Clean up exit-time constructor warnings in sync{able,er}_unittest.cc. Remove some unused files. BUG=117585 TEST= TBR=jhawkins@chromium.org Review URL: https://chromiumcodereview.appspot.com/9699057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/syncable/syncable_columns.h')
-rw-r--r--sync/syncable/syncable_columns.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/sync/syncable/syncable_columns.h b/sync/syncable/syncable_columns.h
new file mode 100644
index 0000000..18a0215
--- /dev/null
+++ b/sync/syncable/syncable_columns.h
@@ -0,0 +1,74 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_SYNCABLE_SYNCABLE_COLUMNS_H_
+#define SYNC_SYNCABLE_SYNCABLE_COLUMNS_H_
+#pragma once
+
+#include "sync/syncable/syncable.h"
+#include "sync/syncable/syncable_changes_version.h"
+
+namespace syncable {
+
+struct ColumnSpec {
+ const char* name;
+ const char* spec;
+};
+
+// Must be in exact same order as fields in syncable.
+static const ColumnSpec g_metas_columns[] = {
+ //////////////////////////////////////
+ // int64s
+ {"metahandle", "bigint primary key ON CONFLICT FAIL"},
+ {"base_version", "bigint default " CHANGES_VERSION_STRING},
+ {"server_version", "bigint default 0"},
+ {"server_position_in_parent", "bigint default 0"},
+ // This is the item ID that we store for the embedding application.
+ {"local_external_id", "bigint default 0"},
+ // These timestamps are kept in the same format as that of the
+ // protocol (ms since Unix epoch).
+ {"mtime", "bigint default 0"},
+ {"server_mtime", "bigint default 0"},
+ {"ctime", "bigint default 0"},
+ {"server_ctime", "bigint default 0"},
+ //////////////////////////////////////
+ // Ids
+ {"id", "varchar(255) default \"r\""},
+ {"parent_id", "varchar(255) default \"r\""},
+ {"server_parent_id", "varchar(255) default \"r\""},
+ {"prev_id", "varchar(255) default \"r\""},
+ {"next_id", "varchar(255) default \"r\""},
+ //////////////////////////////////////
+ // bits
+ {"is_unsynced", "bit default 0"},
+ {"is_unapplied_update", "bit default 0"},
+ {"is_del", "bit default 0"},
+ {"is_dir", "bit default 0"},
+ {"server_is_dir", "bit default 0"},
+ {"server_is_del", "bit default 0"},
+ //////////////////////////////////////
+ // Strings
+ {"non_unique_name", "varchar"},
+ {"server_non_unique_name", "varchar(255)"},
+ {"unique_server_tag", "varchar"},
+ {"unique_client_tag", "varchar"},
+ //////////////////////////////////////
+ // Blobs.
+ {"specifics", "blob"},
+ {"server_specifics", "blob"},
+ {"base_server_specifics", "blob"}
+};
+
+// At least enforce that there are equal number of column names and fields.
+COMPILE_ASSERT(arraysize(g_metas_columns) >= FIELD_COUNT, missing_column_name);
+COMPILE_ASSERT(arraysize(g_metas_columns) <= FIELD_COUNT, extra_column_names);
+
+static inline const char* ColumnName(int field) {
+ DCHECK(field < BEGIN_TEMPS);
+ return g_metas_columns[field].name;
+}
+
+} // namespace syncable
+
+#endif // SYNC_SYNCABLE_SYNCABLE_COLUMNS_H_