diff options
author | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-12 03:58:53 +0000 |
---|---|---|
committer | rlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-12 03:58:53 +0000 |
commit | 6e438962ed8cde2dcaa525feede47a1700e55f30 (patch) | |
tree | b781e35259728b540d5a3d192a9b7b0c89e8045e /sync/protocol | |
parent | e4e44eb805501a71623b2a50e808fa7c454d16aa (diff) | |
download | chromium_src-6e438962ed8cde2dcaa525feede47a1700e55f30.zip chromium_src-6e438962ed8cde2dcaa525feede47a1700e55f30.tar.gz chromium_src-6e438962ed8cde2dcaa525feede47a1700e55f30.tar.bz2 |
sync: Represent UniquePositions as a protobuf
Although this has little practical effect right now, it gives us the
flexibility to convert to more complex protobuf representations in the
future.
The reuse of an existing protobuf field would normally be a very bad
idea, but we're fairly certain that no one has actually made use of the
old definition and that we can clean up all references to it.
BUG=145412
Review URL: https://chromiumcodereview.appspot.com/11825017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176507 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/protocol')
-rw-r--r-- | sync/protocol/sync.proto | 14 | ||||
-rw-r--r-- | sync/protocol/sync_proto.gyp | 1 | ||||
-rw-r--r-- | sync/protocol/unique_position.proto | 28 |
3 files changed, 34 insertions, 9 deletions
diff --git a/sync/protocol/sync.proto b/sync/protocol/sync.proto index 6aea1d0..0dafdc4 100644 --- a/sync/protocol/sync.proto +++ b/sync/protocol/sync.proto @@ -38,6 +38,7 @@ import "sync_enums.proto"; import "synced_notification_specifics.proto"; import "theme_specifics.proto"; import "typed_url_specifics.proto"; +import "unique_position.proto"; // Used for inspecting how long we spent performing operations in different // backends. All times must be in millis. @@ -332,14 +333,6 @@ message SyncEntity { // This is the fourth attempt at positioning. // - // Unique positions are unique per-item, since they are guaranteed to end with - // a fixed-length suffix that is unique per-item. The position string may not - // end with a '\0' byte. - // - // Prior to the suffix is a series of arbitrary bytes of arbitrary length. - // Items under the same parent are positioned relative to each other by a - // lexicographic comparison of their UniquePosition values. - // // This field is present in both GetUpdatesResponse and CommitMessage, if the // item's type requires it and the client that wrote the item supports it (M26 // or higher). Clients must also be prepared to handle updates from clients @@ -349,7 +342,10 @@ message SyncEntity { // This field will not be set for items whose type ignores positioning. // Clients should not attempt to read this field on the receipt of an item of // a type that ignores positioning. - optional bytes unique_position = 25; + // + // Refer to its definition in unique_position.proto for more information about + // its internal representation. + optional UniquePosition unique_position = 25; }; // This message contains diagnostic information used to correlate diff --git a/sync/protocol/sync_proto.gyp b/sync/protocol/sync_proto.gyp index 4745044..31d717f 100644 --- a/sync/protocol/sync_proto.gyp +++ b/sync/protocol/sync_proto.gyp @@ -37,6 +37,7 @@ 'test.proto', 'theme_specifics.proto', 'typed_url_specifics.proto', + 'unique_position.proto', ], 'variables': { 'proto_out_dir': 'sync/protocol', diff --git a/sync/protocol/unique_position.proto b/sync/protocol/unique_position.proto new file mode 100644 index 0000000..c074312 --- /dev/null +++ b/sync/protocol/unique_position.proto @@ -0,0 +1,28 @@ +// 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. +// +// Protobuf representation of the UniquePosition class. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// A UniquePosition is a string of bytes. +// +// Unique positions are unique per-item, since they are guaranteed to end with a +// fixed-length suffix that is unique per-item. The position string may not end +// with a '\0' byte. +// +// Prior to the suffix is a series of arbitrary bytes of arbitrary length. +// Items under the same parent are positioned relative to each other by a +// lexicographic comparison of their UniquePosition values. +message UniquePosition { + optional bytes value = 1; +} |