| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 // | |
| 5 // Sync protocol for communication between sync client and server. | |
| 6 | |
| 7 // Update proto_value_conversions{.h,.cc,_unittest.cc} if you change | |
| 8 // any fields in this file. | |
| 9 | |
| 10 syntax = "proto2"; | |
| 11 | |
| 12 option optimize_for = LITE_RUNTIME; | |
| 13 option retain_unknown_fields = true; | |
| 14 | |
| 15 package sync_pb; | |
| 16 | |
| 17 import "app_notification_specifics.proto"; | |
| 18 import "app_setting_specifics.proto"; | |
| 19 import "app_specifics.proto"; | |
| 20 import "autofill_specifics.proto"; | |
| 21 import "bookmark_specifics.proto"; | |
| 22 import "extension_setting_specifics.proto"; | |
| 23 import "extension_specifics.proto"; | |
| 24 import "nigori_specifics.proto"; | |
| 25 import "password_specifics.proto"; | |
| 26 import "preference_specifics.proto"; | |
| 27 import "search_engine_specifics.proto"; | |
| 28 import "session_specifics.proto"; | |
| 29 import "theme_specifics.proto"; | |
| 30 import "typed_url_specifics.proto"; | |
| 31 import "encryption.proto"; | |
| 32 import "sync_enums.proto"; | |
| 33 import "client_commands.proto"; | |
| 34 import "client_debug_info.proto"; | |
| 35 | |
| 36 // Used for inspecting how long we spent performing operations in different | |
| 37 // backends. All times must be in millis. | |
| 38 message ProfilingData { | |
| 39 optional int64 meta_data_write_time = 1; | |
| 40 optional int64 file_data_write_time = 2; | |
| 41 optional int64 user_lookup_time = 3; | |
| 42 optional int64 meta_data_read_time = 4; | |
| 43 optional int64 file_data_read_time = 5; | |
| 44 optional int64 total_request_time = 6; | |
| 45 } | |
| 46 | |
| 47 message EntitySpecifics { | |
| 48 // If a datatype is encrypted, this field will contain the encrypted | |
| 49 // original EntitySpecifics. The extension for the datatype will continue | |
| 50 // to exist, but contain only the default values. | |
| 51 // Note that currently passwords employ their own legacy encryption scheme and | |
| 52 // do not use this field. | |
| 53 optional EncryptedData encrypted = 1; | |
| 54 | |
| 55 // To add new datatype-specific fields to the protocol, extend | |
| 56 // EntitySpecifics. First, pick a non-colliding tag number by | |
| 57 // picking a revision number of one of your past commits | |
| 58 // to src.chromium.org. Then, in a different protocol buffer | |
| 59 // definition, define your message type, and add an optional field | |
| 60 // to the list below using the unique tag value you selected. | |
| 61 // | |
| 62 // optional MyDatatypeSpecifics my_datatype = 32222; | |
| 63 // | |
| 64 // where: | |
| 65 // - 32222 is the non-colliding tag number you picked earlier. | |
| 66 // - MyDatatypeSpecifics is the type (probably a message type defined | |
| 67 // in your new .proto file) that you want to associate with each | |
| 68 // object of the new datatype. | |
| 69 // - my_datatype is the field identifier you'll use to access the | |
| 70 // datatype specifics from the code. | |
| 71 // | |
| 72 // Server implementations are obligated to preserve the contents of | |
| 73 // EntitySpecifics when it contains unrecognized fields. In this | |
| 74 // way, it is possible to add new datatype fields without having | |
| 75 // to update the server. | |
| 76 // | |
| 77 // Note: The tag selection process is based on legacy versions of the | |
| 78 // protocol which used protobuf extensions. We have kept the process | |
| 79 // consistent as the old values cannot change. The 5+ digit nature of the | |
| 80 // tags also makes them recognizable (individually and collectively) from | |
| 81 // noise in logs and debugging contexts, and creating a divergent subset of | |
| 82 // tags would only make things a bit more confusing. | |
| 83 | |
| 84 optional AutofillSpecifics autofill = 31729; | |
| 85 optional BookmarkSpecifics bookmark = 32904; | |
| 86 optional PreferenceSpecifics preference = 37702; | |
| 87 optional TypedUrlSpecifics typed_url = 40781; | |
| 88 optional ThemeSpecifics theme = 41210; | |
| 89 optional AppNotification app_notification = 45184; | |
| 90 optional PasswordSpecifics password = 45873; | |
| 91 optional NigoriSpecifics nigori = 47745; | |
| 92 optional ExtensionSpecifics extension = 48119; | |
| 93 optional AppSpecifics app = 48364; | |
| 94 optional SessionSpecifics session = 50119; | |
| 95 optional AutofillProfileSpecifics autofill_profile = 63951; | |
| 96 optional SearchEngineSpecifics search_engine = 88610; | |
| 97 optional ExtensionSettingSpecifics extension_setting = 96159; | |
| 98 optional AppSettingSpecifics app_setting = 103656; | |
| 99 } | |
| 100 | |
| 101 message SyncEntity { | |
| 102 // This item's identifier. In a commit of a new item, this will be a | |
| 103 // client-generated ID. If the commit succeeds, the server will generate | |
| 104 // a globally unique ID and return it to the committing client in the | |
| 105 // CommitResponse.EntryResponse. In the context of a GetUpdatesResponse, | |
| 106 // |id_string| is always the server generated ID. The original | |
| 107 // client-generated ID is preserved in the |originator_client_id| field. | |
| 108 // Present in both GetUpdatesResponse and CommitMessage. | |
| 109 optional string id_string = 1; | |
| 110 | |
| 111 // An id referencing this item's parent in the hierarchy. In a | |
| 112 // CommitMessage, it is accepted for this to be a client-generated temporary | |
| 113 // ID if there was a new created item with that ID appearing earlier | |
| 114 // in the message. In all other situations, it is a server ID. | |
| 115 // Present in both GetUpdatesResponse and CommitMessage. | |
| 116 optional string parent_id_string = 2; | |
| 117 | |
| 118 // old_parent_id is only set in commits and indicates the old server | |
| 119 // parent(s) to remove. When omitted, the old parent is the same as | |
| 120 // the new. | |
| 121 // Present only in CommitMessage. | |
| 122 optional string old_parent_id = 3; | |
| 123 | |
| 124 // The version of this item -- a monotonically increasing value that is | |
| 125 // maintained by for each item. If zero in a CommitMessage, the server | |
| 126 // will interpret this entity as a newly-created item and generate a | |
| 127 // new server ID and an initial version number. If nonzero in a | |
| 128 // CommitMessage, this item is treated as an update to an existing item, and | |
| 129 // the server will use |id_string| to locate the item. Then, if the item's | |
| 130 // current version on the server does not match |version|, the commit will | |
| 131 // fail for that item. The server will not update it, and will return | |
| 132 // a result code of CONFLICT. In a GetUpdatesResponse, |version| is | |
| 133 // always positive and indentifies the revision of the item data being sent | |
| 134 // to the client. | |
| 135 // Present in both GetUpdatesResponse and CommitMessage. | |
| 136 required int64 version = 4; | |
| 137 | |
| 138 // Last modification time (in java time milliseconds) | |
| 139 // Present in both GetUpdatesResponse and CommitMessage. | |
| 140 optional int64 mtime = 5; | |
| 141 | |
| 142 // Creation time. | |
| 143 // Present in both GetUpdatesResponse and CommitMessage. | |
| 144 optional int64 ctime = 6; | |
| 145 | |
| 146 // The name of this item. | |
| 147 // Historical note: | |
| 148 // Since November 2010, this value is no different from non_unique_name. | |
| 149 // Before then, server implementations would maintain a unique-within-parent | |
| 150 // value separate from its base, "non-unique" value. Clients had not | |
| 151 // depended on the uniqueness of the property since November 2009; it was | |
| 152 // removed from Chromium by http://codereview.chromium.org/371029 . | |
| 153 // Present in both GetUpdatesResponse and CommitMessage. | |
| 154 required string name = 7; | |
| 155 | |
| 156 // The name of this item. Same as |name|. | |
| 157 // |non_unique_name| should take precedence over the |name| value if both | |
| 158 // are supplied. For efficiency, clients and servers should avoid setting | |
| 159 // this redundant value. | |
| 160 // Present in both GetUpdatesResponse and CommitMessage. | |
| 161 optional string non_unique_name = 8; | |
| 162 | |
| 163 // A value from a monotonically increasing sequence that indicates when | |
| 164 // this item was last updated on the server. This is now equivalent | |
| 165 // to version. This is now deprecated in favor of version. | |
| 166 // Present only in GetUpdatesResponse. | |
| 167 optional int64 sync_timestamp = 9; | |
| 168 | |
| 169 // If present, this tag identifies this item as being a uniquely | |
| 170 // instanced item. The server ensures that there is never more | |
| 171 // than one entity in a user's store with the same tag value. | |
| 172 // This value is used to identify and find e.g. the "Google Chrome" settings | |
| 173 // folder without relying on it existing at a particular path, or having | |
| 174 // a particular name, in the data store. | |
| 175 // | |
| 176 // This variant of the tag is created by the server, so clients can't create | |
| 177 // an item with a tag using this field. | |
| 178 // | |
| 179 // Use client_defined_unique_tag if you want to create one from the client. | |
| 180 // | |
| 181 // An item can't have both a client_defined_unique_tag and | |
| 182 // a server_defined_unique_tag. | |
| 183 // | |
| 184 // Present only in GetUpdatesResponse. | |
| 185 optional string server_defined_unique_tag = 10; | |
| 186 | |
| 187 // If this group is present, it implies that this SyncEntity corresponds to | |
| 188 // a bookmark or a bookmark folder. | |
| 189 // | |
| 190 // This group is deprecated; clients should use the bookmark EntitySpecifics | |
| 191 // protocol buffer extension instead. | |
| 192 optional group BookmarkData = 11 { | |
| 193 // We use a required field to differentiate between a bookmark and a | |
| 194 // bookmark folder. | |
| 195 // Present in both GetUpdatesMessage and CommitMessage. | |
| 196 required bool bookmark_folder = 12; | |
| 197 | |
| 198 // For bookmark objects, contains the bookmark's URL. | |
| 199 // Present in both GetUpdatesResponse and CommitMessage. | |
| 200 optional string bookmark_url = 13; | |
| 201 | |
| 202 // For bookmark objects, contains the bookmark's favicon. The favicon is | |
| 203 // represented as a 16X16 PNG image. | |
| 204 // Present in both GetUpdatesResponse and CommitMessage. | |
| 205 optional bytes bookmark_favicon = 14; | |
| 206 } | |
| 207 | |
| 208 // Supplies a numeric position for this item, relative to other items with | |
| 209 // the same parent. | |
| 210 // | |
| 211 // Present in both GetUpdatesResponse and CommitMessage. | |
| 212 // | |
| 213 // In a CommitMessage context, server implementations may choose whether | |
| 214 // to compute a position based on this field or based on | |
| 215 // |insert_after_item_id|. Clients should set both values so that they | |
| 216 // result in a consistent ordering regardless of which choice the server | |
| 217 // makes. | |
| 218 optional int64 position_in_parent = 15; | |
| 219 | |
| 220 // Contains the ID of the element (under the same parent) after which this | |
| 221 // element resides. An empty string indicates that the element is the first | |
| 222 // element in the parent. This value is used during commits to specify | |
| 223 // a relative position for a position change. In the context of | |
| 224 // a GetUpdatesMessage, |position_in_parent| is used instead to | |
| 225 // communicate position. | |
| 226 // | |
| 227 // Present only in CommitMessage. | |
| 228 // | |
| 229 // This is being deprecated: clients should now explicitly set | |
| 230 // an absolute |position_in_parent| value at commit time. In the | |
| 231 // interim, clients should supply both values and continue to honor | |
| 232 // the |position_in_parent| value returned in the CommitResponse. | |
| 233 optional string insert_after_item_id = 16; | |
| 234 | |
| 235 // Arbitrary key/value pairs associated with this item. | |
| 236 // Present in both GetUpdatesResponse and CommitMessage. | |
| 237 // Deprecated. | |
| 238 // optional ExtendedAttributes extended_attributes = 17; | |
| 239 | |
| 240 // If true, indicates that this item has been (or should be) deleted. | |
| 241 // Present in both GetUpdatesResponse and CommitMessage. | |
| 242 optional bool deleted = 18 [default = false]; | |
| 243 | |
| 244 // A GUID that identifies the the sync client who initially committed | |
| 245 // this entity. This value corresponds to |cache_guid| in CommitMessage. | |
| 246 // This field, along with |originator_client_item_id|, can be used to | |
| 247 // reunite the original with its official committed version in the case | |
| 248 // where a client does not receive or process the commit response for | |
| 249 // some reason. | |
| 250 // Present only in GetUpdatesResponse. | |
| 251 optional string originator_cache_guid = 19; | |
| 252 | |
| 253 // The local item id of this entry from the client that initially | |
| 254 // committed this entity. Typically a negative integer. | |
| 255 // Present only in GetUpdatesResponse. | |
| 256 optional string originator_client_item_id = 20; | |
| 257 | |
| 258 // Extensible container for datatype-specific data. | |
| 259 // This became available in version 23 of the protocol. | |
| 260 optional EntitySpecifics specifics = 21; | |
| 261 | |
| 262 // Indicate whether this is a folder or not. Available in version 23+. | |
| 263 optional bool folder = 22 [default = false]; | |
| 264 | |
| 265 // A client defined unique hash for this entity. | |
| 266 // Similar to server_defined_unique_tag. | |
| 267 // | |
| 268 // When initially committing an entity, a client can request that the entity | |
| 269 // is unique per that account. To do so, the client should specify a | |
| 270 // client_defined_unique_tag. At most one entity per tag value may exist. | |
| 271 // per account. The server will enforce uniqueness on this tag | |
| 272 // and fail attempts to create duplicates of this tag. | |
| 273 // Will be returned in any updates for this entity. | |
| 274 // | |
| 275 // The difference between server_defined_unique_tag and | |
| 276 // client_defined_unique_tag is the creator of the entity. Server defined | |
| 277 // tags are entities created by the server at account creation, | |
| 278 // while client defined tags are entities created by the client at any time. | |
| 279 // | |
| 280 // During GetUpdates, a sync entity update will come back with ONE of: | |
| 281 // a) Originator and cache id - If client committed the item as non "unique" | |
| 282 // b) Server tag - If server committed the item as unique | |
| 283 // c) Client tag - If client committed the item as unique | |
| 284 // | |
| 285 // May be present in CommitMessages for the initial creation of an entity. | |
| 286 // If present in Commit updates for the entity, it will be ignored. | |
| 287 // | |
| 288 // Available in version 24+. | |
| 289 // | |
| 290 // May be returned in GetUpdatesMessage and sent up in CommitMessage. | |
| 291 // | |
| 292 optional string client_defined_unique_tag = 23; | |
| 293 }; | |
| 294 | |
| 295 // This message contains diagnostic information used to correlate | |
| 296 // commit-related traffic with extensions-related mutations to the | |
| 297 // data models in chromium. It plays no functional role in | |
| 298 // processing this CommitMessage. | |
| 299 message ChromiumExtensionsActivity { | |
| 300 // The human-readable ID identifying the extension responsible | |
| 301 // for the traffic reported in this ChromiumExtensionsActivity. | |
| 302 optional string extension_id = 1; | |
| 303 | |
| 304 // How many times the extension successfully invoked a write | |
| 305 // operation through the bookmarks API since the last CommitMessage. | |
| 306 optional uint32 bookmark_writes_since_last_commit = 2; | |
| 307 }; | |
| 308 | |
| 309 message CommitMessage { | |
| 310 repeated SyncEntity entries = 1; | |
| 311 | |
| 312 // A GUID that identifies the committing sync client. This value will be | |
| 313 // returned as originator_cache_guid for any new items. | |
| 314 optional string cache_guid = 2; | |
| 315 | |
| 316 repeated ChromiumExtensionsActivity extensions_activity = 3; | |
| 317 }; | |
| 318 | |
| 319 message GetUpdatesCallerInfo { | |
| 320 enum GetUpdatesSource { | |
| 321 UNKNOWN = 0; // The source was not set by the caller. | |
| 322 FIRST_UPDATE = 1; // First request after browser restart. Not to | |
| 323 // be confused with "NEW_CLIENT". | |
| 324 LOCAL = 2; // The source of the update was a local change. | |
| 325 NOTIFICATION = 3; // The source of the update was a p2p notification. | |
| 326 PERIODIC = 4; // The source of the update was periodic polling. | |
| 327 SYNC_CYCLE_CONTINUATION = 5; // The source of the update was a | |
| 328 // continuation of a previous update. | |
| 329 CLEAR_PRIVATE_DATA = 6; // Source is a call to remove all private data | |
| 330 NEWLY_SUPPORTED_DATATYPE = 7; // The client is in configuration mode | |
| 331 // because it's syncing all datatypes, and | |
| 332 // support for a new datatype was recently | |
| 333 // released via a software auto-update. | |
| 334 MIGRATION = 8; // The client is in configuration mode because a | |
| 335 // MIGRATION_DONE error previously returned by the | |
| 336 // server necessitated resynchronization. | |
| 337 NEW_CLIENT = 9; // The client is in configuration mode because the | |
| 338 // user enabled sync for the first time. Not to be | |
| 339 // confused with FIRST_UPDATE. | |
| 340 RECONFIGURATION = 10; // The client is in configuration mode because the | |
| 341 // user opted to sync a different set of datatypes. | |
| 342 DATATYPE_REFRESH = 11; // A datatype has requested a refresh. This is | |
| 343 // typically used when datatype's have custom | |
| 344 // sync UI, e.g. sessions. | |
| 345 } | |
| 346 | |
| 347 required GetUpdatesSource source = 1; | |
| 348 | |
| 349 // True only if notifications were enabled for this GetUpdateMessage. | |
| 350 optional bool notifications_enabled = 2; | |
| 351 }; | |
| 352 | |
| 353 message DataTypeProgressMarker { | |
| 354 // An integer identifying the data type whose progress is tracked by this | |
| 355 // marker. The legitimate values of this field correspond to the protobuf | |
| 356 // field numbers of all EntitySpecifics fields supported by the server. | |
| 357 // These values are externally declared in per-datatype .proto files. | |
| 358 optional int32 data_type_id = 1; | |
| 359 | |
| 360 // An opaque-to-the-client sequence of bytes that the server may interpret | |
| 361 // as an indicator of the client's knowledge state. If this is empty or | |
| 362 // omitted by the client, it indicates that the client is initiating a | |
| 363 // a first-time sync of this datatype. Otherwise, clients must supply a | |
| 364 // value previously returned by the server in an earlier GetUpdatesResponse. | |
| 365 // These values are not comparable or generable on the client. | |
| 366 // | |
| 367 // The opaque semantics of this field are to afford server implementations | |
| 368 // some flexibility in implementing progress tracking. For instance, | |
| 369 // a server implementation built on top of a distributed storage service -- | |
| 370 // or multiple heterogenous such services -- might need to supply a vector | |
| 371 // of totally ordered monotonic update timestamps, rather than a single | |
| 372 // monotonically increasing value. Other optimizations may also be | |
| 373 // possible if the server is allowed to embed arbitrary information in | |
| 374 // the progress token. | |
| 375 // | |
| 376 // Server implementations should keep the size of these tokens relatively | |
| 377 // small, on the order of tens of bytes, and they should remain small | |
| 378 // regardless of the number of items synchronized. (A possible bad server | |
| 379 // implementation would be for progress_token to contain a list of all the | |
| 380 // items ever sent to the client. Servers shouldn't do this.) | |
| 381 optional bytes token = 2; | |
| 382 | |
| 383 // Clients that previously downloaded updates synced using the timestamp based | |
| 384 // progress tracking mechanism, but which wish to switch over to the opaque | |
| 385 // token mechanism can set this field in a GetUpdatesMessage. The server | |
| 386 // will perform a get updates operation as normal from the indicated | |
| 387 // timestamp, and return only an opaque progress token. | |
| 388 optional int64 timestamp_token_for_migration = 3; | |
| 389 | |
| 390 // An opaque-to-the-client string of bytes, received through a notification, | |
| 391 // that the server may interpret as a hint about the location of the latest | |
| 392 // version of the data for this type. | |
| 393 optional string notification_hint = 4; | |
| 394 } | |
| 395 | |
| 396 message GetUpdatesMessage { | |
| 397 // Indicates the client's current progress in downloading updates. A | |
| 398 // from_timestamp value of zero means that the client is requesting a first- | |
| 399 // time sync. After that point, clients should fill in this value with the | |
| 400 // value returned in the last-seen GetUpdatesResponse.new_timestamp. | |
| 401 // | |
| 402 // from_timestamp has been deprecated; clients should use | |
| 403 // |from_progress_marker| instead, which allows more flexibility. | |
| 404 optional int64 from_timestamp = 1; | |
| 405 | |
| 406 // Indicates the reason for the GetUpdatesMessage. | |
| 407 optional GetUpdatesCallerInfo caller_info = 2; | |
| 408 | |
| 409 // Indicates whether related folders should be fetched. | |
| 410 optional bool fetch_folders = 3 [default = true]; | |
| 411 | |
| 412 // The presence of an individual EntitySpecifics field indicates that the | |
| 413 // client requests sync object types associated with that field. This | |
| 414 // determination depends only on the presence of the field, not its | |
| 415 // contents -- thus clients should send empty messages as the field value. | |
| 416 // For backwards compatibility only bookmark objects will be sent to the | |
| 417 // client should requested_types not be present. | |
| 418 // | |
| 419 // requested_types may contain multiple EntitySpecifics fields -- in this | |
| 420 // event, the server will return items of all the indicated types. | |
| 421 // | |
| 422 // requested_types has been deprecated; clients should use | |
| 423 // |from_progress_marker| instead, which allows more flexibility. | |
| 424 optional EntitySpecifics requested_types = 4; | |
| 425 | |
| 426 // Client-requested limit on the maximum number of updates to return at once. | |
| 427 // The server may opt to return fewer updates than this amount, but it should | |
| 428 // not return more. | |
| 429 optional int32 batch_size = 5; | |
| 430 | |
| 431 // Per-datatype progress marker. If present, the server will ignore | |
| 432 // the values of requested_types and from_timestamp, using this instead. | |
| 433 repeated DataTypeProgressMarker from_progress_marker = 6; | |
| 434 | |
| 435 // Indicates whether the response should be sent in chunks. This may be | |
| 436 // needed for devices with limited memory resources. If true, the response | |
| 437 // will include one or more ClientToServerResponses, with the frist one | |
| 438 // containing GetUpdatesMetadataResponse, and the remaining ones, if any, | |
| 439 // containing GetUpdatesStreamingResponse. These ClientToServerResponses are | |
| 440 // delimited by a length prefix, which is encoded as a varint. | |
| 441 optional bool streaming = 7 [default = false]; | |
| 442 | |
| 443 // Whether to create the mobile bookmarks folder if it's not | |
| 444 // already created. Should be set to true only by mobile clients. | |
| 445 optional bool create_mobile_bookmarks_folder = 1000 [default = false]; | |
| 446 }; | |
| 447 | |
| 448 message AuthenticateMessage { | |
| 449 required string auth_token = 1; | |
| 450 }; | |
| 451 | |
| 452 // This message is sent to the server to clear data. An asynchronous | |
| 453 // response is returned to the client indicating that the server has received | |
| 454 // the request and has begun to clear data. | |
| 455 message ClearUserDataMessage { | |
| 456 } | |
| 457 | |
| 458 message ClearUserDataResponse { | |
| 459 } | |
| 460 | |
| 461 message ClientToServerMessage { | |
| 462 required string share = 1; | |
| 463 optional int32 protocol_version = 2 [default = 30]; | |
| 464 enum Contents { | |
| 465 COMMIT = 1; | |
| 466 GET_UPDATES = 2; | |
| 467 AUTHENTICATE = 3; | |
| 468 CLEAR_DATA = 4; | |
| 469 } | |
| 470 | |
| 471 required Contents message_contents = 3; | |
| 472 optional CommitMessage commit = 4; | |
| 473 optional GetUpdatesMessage get_updates = 5; | |
| 474 optional AuthenticateMessage authenticate = 6; | |
| 475 // Request to clear all Chromium data from the server | |
| 476 optional ClearUserDataMessage clear_user_data = 9; | |
| 477 | |
| 478 optional string store_birthday = 7; // Opaque store ID; if it changes, duck! | |
| 479 // The client sets this if it detects a sync issue. The server will tell it | |
| 480 // if it should perform a refresh. | |
| 481 optional bool sync_problem_detected = 8 [default = false]; | |
| 482 | |
| 483 // Client side state information for debugging purpose. | |
| 484 // This is only sent on the first getupdates of every sync cycle, | |
| 485 // as an optimization to save bandwidth. | |
| 486 optional DebugInfo debug_info = 10; | |
| 487 }; | |
| 488 | |
| 489 message CommitResponse { | |
| 490 enum ResponseType { | |
| 491 SUCCESS = 1; | |
| 492 CONFLICT = 2; // You're out of date; update and check your data | |
| 493 // TODO(ncarter): What's the difference between RETRY and TRANSIENT_ERROR? | |
| 494 RETRY = 3; // Someone has a conflicting, non-expired session open | |
| 495 INVALID_MESSAGE = 4; // What the client sent was invalid, and trying again | |
| 496 // won't help. | |
| 497 OVER_QUOTA = 5; // This operation would put you, or you are, over quota | |
| 498 TRANSIENT_ERROR = 6; // Something went wrong; try again in a bit | |
| 499 } | |
| 500 repeated group EntryResponse = 1 { | |
| 501 required ResponseType response_type = 2; | |
| 502 | |
| 503 // Sync servers may also return a new ID for an existing item, indicating | |
| 504 // a new entry's been created to hold the data the client's sending up. | |
| 505 optional string id_string = 3; | |
| 506 | |
| 507 // should be filled if our parent was assigned a new ID. | |
| 508 optional string parent_id_string = 4; | |
| 509 | |
| 510 // This value is the same as the position_in_parent value returned within | |
| 511 // the SyncEntity message in GetUpdatesResponse. | |
| 512 optional int64 position_in_parent = 5; | |
| 513 | |
| 514 // The item's current version. | |
| 515 optional int64 version = 6; | |
| 516 | |
| 517 // Allows the server to move-aside an entry as it's being committed. | |
| 518 // This name is the same as the name field returned within the SyncEntity | |
| 519 // message in GetUpdatesResponse. | |
| 520 optional string name = 7; | |
| 521 | |
| 522 // This name is the same as the non_unique_name field returned within the | |
| 523 // SyncEntity message in GetUpdatesResponse. | |
| 524 optional string non_unique_name = 8; | |
| 525 | |
| 526 optional string error_message = 9; | |
| 527 | |
| 528 // Last modification time (in java time milliseconds). Allows the server | |
| 529 // to override the client-supplied mtime during a commit operation. | |
| 530 optional int64 mtime = 10; | |
| 531 } | |
| 532 }; | |
| 533 | |
| 534 message GetUpdatesResponse { | |
| 535 // New sync entries that the client should apply. | |
| 536 repeated SyncEntity entries = 1; | |
| 537 | |
| 538 // If there are more changes on the server that weren't processed during this | |
| 539 // GetUpdates request, the client should send another GetUpdates request and | |
| 540 // use new_timestamp as the from_timestamp value within GetUpdatesMessage. | |
| 541 // | |
| 542 // This field has been deprecated and will be returned only to clients | |
| 543 // that set the also-deprecated |from_timestamp| field in the update request. | |
| 544 // Clients should use |from_progress_marker| and |new_progress_marker| | |
| 545 // instead. | |
| 546 optional int64 new_timestamp = 2; | |
| 547 | |
| 548 // DEPRECATED FIELD - server does not set this anymore. | |
| 549 optional int64 deprecated_newest_timestamp = 3; | |
| 550 | |
| 551 // Approximate count of changes remaining - use this for UI feedback. | |
| 552 // If present and zero, this estimate is firm: the server has no changes | |
| 553 // after the current batch. | |
| 554 optional int64 changes_remaining = 4; | |
| 555 | |
| 556 // Opaque, per-datatype timestamp-like tokens. A client should use this | |
| 557 // field in lieu of new_timestamp, which is deprecated in newer versions | |
| 558 // of the protocol. Clients should retain and persist the values returned | |
| 559 // in this field, and present them back to the server to indicate the | |
| 560 // starting point for future update requests. | |
| 561 // | |
| 562 // This will be sent only if the client provided |from_progress_marker| | |
| 563 // in the update request. | |
| 564 // | |
| 565 // The server may provide a new progress marker even if this is the end of | |
| 566 // the batch, or if there were no new updates on the server; and the client | |
| 567 // must save these. If the server does not provide a |new_progress_marker| | |
| 568 // value for a particular datatype, when the request provided a | |
| 569 // |from_progress_marker| value for that datatype, the client should | |
| 570 // interpret this to mean "no change from the previous state" and retain its | |
| 571 // previous progress-marker value for that datatype. | |
| 572 // | |
| 573 // Progress markers in the context of a response will never have the | |
| 574 // |timestamp_token_for_migration| field set. | |
| 575 repeated DataTypeProgressMarker new_progress_marker = 5; | |
| 576 }; | |
| 577 | |
| 578 // The metadata response for GetUpdatesMessage. This response is sent when | |
| 579 // streaming is set to true in the request. It is prefixed with a length | |
| 580 // delimiter, which is encoded in varint. | |
| 581 message GetUpdatesMetadataResponse { | |
| 582 // Approximate count of changes remaining. Detailed comment is available in | |
| 583 // GetUpdatesResponse. | |
| 584 optional int64 changes_remaining = 1; | |
| 585 | |
| 586 // Opaque, per-datatype timestamp-like tokens. Detailed comment is available | |
| 587 // in GetUpdatesResponse. | |
| 588 repeated DataTypeProgressMarker new_progress_marker = 2; | |
| 589 }; | |
| 590 | |
| 591 // The streaming response message for GetUpdatesMessage. This message is sent | |
| 592 // when streaming is set to true in the request. There may be multiple | |
| 593 // GetUpdatesStreamingResponse messages in a response. This type of messages | |
| 594 // is preceded by GetUpdatesMetadataResponse. It is prefixed with a length | |
| 595 // delimiter, which is encoded in varint. | |
| 596 message GetUpdatesStreamingResponse { | |
| 597 // New sync entries that the client should apply. | |
| 598 repeated SyncEntity entries = 1; | |
| 599 }; | |
| 600 | |
| 601 // A user-identifying struct. For a given Google account the email and display | |
| 602 // name can change, but obfuscated_id should be constant. | |
| 603 // The obfuscated id is optional because at least one planned use of the proto | |
| 604 // (sharing) does not require it. | |
| 605 message UserIdentification { | |
| 606 required string email = 1; // the user's full primary email address. | |
| 607 optional string display_name = 2; // the user's display name. | |
| 608 optional string obfuscated_id = 3; // an obfuscated, opaque user id. | |
| 609 }; | |
| 610 | |
| 611 message AuthenticateResponse { | |
| 612 // Optional only for backward compatibility. | |
| 613 optional UserIdentification user = 1; | |
| 614 }; | |
| 615 | |
| 616 message ThrottleParameters { | |
| 617 // Deprecated. Remove this from the server side. | |
| 618 required int32 min_measure_payload_size = 1; | |
| 619 required double target_utilization = 2; | |
| 620 required double measure_interval_max = 3; | |
| 621 required double measure_interval_min = 4; | |
| 622 required double observation_window = 5; | |
| 623 }; | |
| 624 | |
| 625 message ClientToServerResponse { | |
| 626 optional CommitResponse commit = 1; | |
| 627 optional GetUpdatesResponse get_updates = 2; | |
| 628 optional AuthenticateResponse authenticate = 3; | |
| 629 optional ClearUserDataResponse clear_user_data = 9; | |
| 630 optional GetUpdatesMetadataResponse stream_metadata = 10; | |
| 631 // If GetUpdatesStreamingResponse is contained in the ClientToServerResponse, | |
| 632 // none of the other fields (error_code and etc) will be set. | |
| 633 optional GetUpdatesStreamingResponse stream_data = 11; | |
| 634 | |
| 635 message Error { | |
| 636 optional SyncEnums.ErrorType error_type = 1 [default = UNKNOWN]; | |
| 637 optional string error_description = 2; | |
| 638 optional string url = 3; | |
| 639 enum Action { | |
| 640 UPGRADE_CLIENT = 0; // Upgrade the client to latest version. | |
| 641 CLEAR_USER_DATA_AND_RESYNC = 1; // Clear user data from dashboard and | |
| 642 // setup sync again. | |
| 643 ENABLE_SYNC_ON_ACCOUNT = 2; // The administrator needs to enable sync | |
| 644 // on the account. | |
| 645 STOP_AND_RESTART_SYNC = 3; // Stop sync and set up sync again. | |
| 646 DISABLE_SYNC_ON_CLIENT = 4; // Wipe the client of all sync data and | |
| 647 // stop syncing. | |
| 648 UNKNOWN_ACTION = 5; // This is the default. | |
| 649 } | |
| 650 optional Action action = 4 [default = UNKNOWN_ACTION]; | |
| 651 | |
| 652 // Currently only meaningful if |error_type| is throttled. If this field | |
| 653 // is absent then the whole client (all datatypes) is throttled. | |
| 654 repeated int32 error_data_type_ids = 5; | |
| 655 } | |
| 656 | |
| 657 optional Error error = 13; | |
| 658 | |
| 659 // Up until protocol_version 24, the default was SUCCESS which made it | |
| 660 // impossible to add new enum values since older clients would parse any | |
| 661 // out-of-range value as SUCCESS. Starting with 25, unless explicitly set, | |
| 662 // the error_code will be UNKNOWN so that clients know when they're | |
| 663 // out-of-date. Note also that when using protocol_version < 25, | |
| 664 // TRANSIENT_ERROR is not supported. Instead, the server sends back a HTTP | |
| 665 // 400 error code. This is deprecated now. | |
| 666 optional SyncEnums.ErrorType error_code = 4 [default = UNKNOWN]; | |
| 667 optional string error_message = 5; | |
| 668 | |
| 669 // Opaque store ID; if it changes, the contents of the client's cache | |
| 670 // is meaningless to this server. This happens most typically when | |
| 671 // you switch from one storage backend instance (say, a test instance) | |
| 672 // to another (say, the official instance). | |
| 673 optional string store_birthday = 6; | |
| 674 | |
| 675 optional ClientCommand client_command = 7; | |
| 676 optional ProfilingData profiling_data = 8; | |
| 677 | |
| 678 // The data types whose storage has been migrated. Present when the value of | |
| 679 // error_code is MIGRATION_DONE. | |
| 680 repeated int32 migrated_data_type_id = 12; | |
| 681 }; | |
| 682 | |
| OLD | NEW |