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.
5 // Sync protocol for communication between sync client and server.
7 // Update proto_value_conversions{.h,.cc,_unittest.cc} if you change
8 // any fields in this file.
12 option optimize_for = LITE_RUNTIME;
13 option retain_unknown_fields = true;
17 import "app_list_specifics.proto";
18 import "app_notification_specifics.proto";
19 import "app_setting_specifics.proto";
20 import "app_specifics.proto";
21 import "article_specifics.proto";
22 import "attachments.proto";
23 import "autofill_specifics.proto";
24 import "bookmark_specifics.proto";
25 import "client_commands.proto";
26 import "client_debug_info.proto";
27 import "device_info_specifics.proto";
28 import "dictionary_specifics.proto";
29 import "encryption.proto";
30 import "experiments_specifics.proto";
31 import "extension_setting_specifics.proto";
32 import "extension_specifics.proto";
33 import "favicon_image_specifics.proto";
34 import "favicon_tracking_specifics.proto";
35 import "get_updates_caller_info.proto";
36 import "history_delete_directive_specifics.proto";
37 import "nigori_specifics.proto";
38 import "managed_user_setting_specifics.proto";
39 import "managed_user_shared_setting_specifics.proto";
40 import "managed_user_specifics.proto";
41 import "managed_user_whitelist_specifics.proto";
42 import "password_specifics.proto";
43 import "preference_specifics.proto";
44 import "priority_preference_specifics.proto";
45 import "search_engine_specifics.proto";
46 import "session_specifics.proto";
47 import "sync_enums.proto";
48 import "synced_notification_app_info_specifics.proto";
49 import "synced_notification_specifics.proto";
50 import "theme_specifics.proto";
51 import "typed_url_specifics.proto";
52 import "unique_position.proto";
53 import "wifi_credential_specifics.proto";
55 // Used for inspecting how long we spent performing operations in different
56 // backends. All times must be in millis.
57 message ProfilingData {
58 optional int64 meta_data_write_time = 1;
59 optional int64 file_data_write_time = 2;
60 optional int64 user_lookup_time = 3;
61 optional int64 meta_data_read_time = 4;
62 optional int64 file_data_read_time = 5;
63 optional int64 total_request_time = 6;
66 message EntitySpecifics {
67 // If a datatype is encrypted, this field will contain the encrypted
68 // original EntitySpecifics. The extension for the datatype will continue
69 // to exist, but contain only the default values.
70 // Note that currently passwords employ their own legacy encryption scheme and
71 // do not use this field.
72 optional EncryptedData encrypted = 1;
74 // To add new datatype-specific fields to the protocol, extend
75 // EntitySpecifics. First, pick a non-colliding tag number by
76 // picking a Cr-Commit-Position of one of your past commits
77 // to src.chromium.org. Then, in a different protocol buffer
78 // definition, define your message type, and add an optional field
79 // to the list below using the unique tag value you selected.
81 // optional MyDatatypeSpecifics my_datatype = 32222;
84 // - 32222 is the non-colliding tag number you picked earlier.
85 // - MyDatatypeSpecifics is the type (probably a message type defined
86 // in your new .proto file) that you want to associate with each
87 // object of the new datatype.
88 // - my_datatype is the field identifier you'll use to access the
89 // datatype specifics from the code.
91 // Server implementations are obligated to preserve the contents of
92 // EntitySpecifics when it contains unrecognized fields. In this
93 // way, it is possible to add new datatype fields without having
94 // to update the server.
96 // Note: The tag selection process is based on legacy versions of the
97 // protocol which used protobuf extensions. We have kept the process
98 // consistent as the old values cannot change. The 5+ digit nature of the
99 // tags also makes them recognizable (individually and collectively) from
100 // noise in logs and debugging contexts, and creating a divergent subset of
101 // tags would only make things a bit more confusing.
103 optional AutofillSpecifics autofill = 31729;
104 optional BookmarkSpecifics bookmark = 32904;
105 optional PreferenceSpecifics preference = 37702;
106 optional TypedUrlSpecifics typed_url = 40781;
107 optional ThemeSpecifics theme = 41210;
108 optional AppNotification app_notification = 45184;
109 optional PasswordSpecifics password = 45873;
110 optional NigoriSpecifics nigori = 47745;
111 optional ExtensionSpecifics extension = 48119;
112 optional AppSpecifics app = 48364;
113 optional SessionSpecifics session = 50119;
114 optional AutofillProfileSpecifics autofill_profile = 63951;
115 optional SearchEngineSpecifics search_engine = 88610;
116 optional ExtensionSettingSpecifics extension_setting = 96159;
117 optional AppSettingSpecifics app_setting = 103656;
118 optional HistoryDeleteDirectiveSpecifics history_delete_directive = 150251;
119 optional SyncedNotificationSpecifics synced_notification = 153108;
120 optional SyncedNotificationAppInfoSpecifics synced_notification_app_info = 235816;
121 optional DeviceInfoSpecifics device_info = 154522;
122 optional ExperimentsSpecifics experiments = 161496;
123 optional PriorityPreferenceSpecifics priority_preference = 163425;
124 optional DictionarySpecifics dictionary = 170540;
125 optional FaviconTrackingSpecifics favicon_tracking = 181534;
126 optional FaviconImageSpecifics favicon_image = 182019;
127 optional ManagedUserSettingSpecifics managed_user_setting = 186662;
128 optional ManagedUserSpecifics managed_user = 194582;
129 optional ManagedUserSharedSettingSpecifics managed_user_shared_setting =
131 optional ManagedUserWhitelistSpecifics managed_user_whitelist = 306060;
132 optional ArticleSpecifics article = 223759;
133 optional AppListSpecifics app_list = 229170;
134 optional WifiCredentialSpecifics wifi_credential = 218175;
135 optional AutofillWalletSpecifics autofill_wallet = 306270;
136 optional WalletMetadataSpecifics wallet_metadata = 330441;
140 // This item's identifier. In a commit of a new item, this will be a
141 // client-generated ID. If the commit succeeds, the server will generate
142 // a globally unique ID and return it to the committing client in the
143 // CommitResponse.EntryResponse. In the context of a GetUpdatesResponse,
144 // |id_string| is always the server generated ID. The original
145 // client-generated ID is preserved in the |originator_client_id| field.
146 // Present in both GetUpdatesResponse and CommitMessage.
147 optional string id_string = 1;
149 // An id referencing this item's parent in the hierarchy. In a
150 // CommitMessage, it is accepted for this to be a client-generated temporary
151 // ID if there was a new created item with that ID appearing earlier
152 // in the message. In all other situations, it is a server ID.
153 // Present in both GetUpdatesResponse and CommitMessage.
154 optional string parent_id_string = 2;
156 // old_parent_id is only set in commits and indicates the old server
157 // parent(s) to remove. When omitted, the old parent is the same as
159 // Present only in CommitMessage.
160 optional string old_parent_id = 3;
162 // The version of this item -- a monotonically increasing value that is
163 // maintained by for each item. If zero in a CommitMessage, the server
164 // will interpret this entity as a newly-created item and generate a
165 // new server ID and an initial version number. If nonzero in a
166 // CommitMessage, this item is treated as an update to an existing item, and
167 // the server will use |id_string| to locate the item. Then, if the item's
168 // current version on the server does not match |version|, the commit will
169 // fail for that item. The server will not update it, and will return
170 // a result code of CONFLICT. In a GetUpdatesResponse, |version| is
171 // always positive and indentifies the revision of the item data being sent
173 // Present in both GetUpdatesResponse and CommitMessage.
174 required int64 version = 4;
176 // Last modification time (in java time milliseconds)
177 // Present in both GetUpdatesResponse and CommitMessage.
178 optional int64 mtime = 5;
181 // Present in both GetUpdatesResponse and CommitMessage.
182 optional int64 ctime = 6;
184 // The name of this item.
186 // Since November 2010, this value is no different from non_unique_name.
187 // Before then, server implementations would maintain a unique-within-parent
188 // value separate from its base, "non-unique" value. Clients had not
189 // depended on the uniqueness of the property since November 2009; it was
190 // removed from Chromium by http://codereview.chromium.org/371029 .
191 // Present in both GetUpdatesResponse and CommitMessage.
192 required string name = 7;
194 // The name of this item. Same as |name|.
195 // |non_unique_name| should take precedence over the |name| value if both
196 // are supplied. For efficiency, clients and servers should avoid setting
197 // this redundant value.
198 // Present in both GetUpdatesResponse and CommitMessage.
199 optional string non_unique_name = 8;
201 // A value from a monotonically increasing sequence that indicates when
202 // this item was last updated on the server. This is now equivalent
203 // to version. This is now deprecated in favor of version.
204 // Present only in GetUpdatesResponse.
205 optional int64 sync_timestamp = 9;
207 // If present, this tag identifies this item as being a uniquely
208 // instanced item. The server ensures that there is never more
209 // than one entity in a user's store with the same tag value.
210 // This value is used to identify and find e.g. the "Google Chrome" settings
211 // folder without relying on it existing at a particular path, or having
212 // a particular name, in the data store.
214 // This variant of the tag is created by the server, so clients can't create
215 // an item with a tag using this field.
217 // Use client_defined_unique_tag if you want to create one from the client.
219 // An item can't have both a client_defined_unique_tag and
220 // a server_defined_unique_tag.
222 // Present only in GetUpdatesResponse.
223 optional string server_defined_unique_tag = 10;
225 // If this group is present, it implies that this SyncEntity corresponds to
226 // a bookmark or a bookmark folder.
228 // This group is deprecated; clients should use the bookmark EntitySpecifics
229 // protocol buffer extension instead.
230 optional group BookmarkData = 11 {
231 // We use a required field to differentiate between a bookmark and a
233 // Present in both GetUpdatesMessage and CommitMessage.
234 required bool bookmark_folder = 12;
236 // For bookmark objects, contains the bookmark's URL.
237 // Present in both GetUpdatesResponse and CommitMessage.
238 optional string bookmark_url = 13;
240 // For bookmark objects, contains the bookmark's favicon. The favicon is
241 // represented as a 16X16 PNG image.
242 // Present in both GetUpdatesResponse and CommitMessage.
243 optional bytes bookmark_favicon = 14;
246 // Supplies a numeric position for this item, relative to other items with the
247 // same parent. Deprecated in M26, though clients are still required to set
250 // Present in both GetUpdatesResponse and CommitMessage.
252 // At one point this was used as an alternative / supplement to
253 // the deprecated |insert_after_item_id|, but now it, too, has been
256 // In order to maintain compatibility with older clients, newer clients should
257 // still set this field. Its value should be based on the first 8 bytes of
258 // this item's |unique_position|.
260 // Nerwer clients must also support the receipt of items that contain
261 // |position_in_parent| but no |unique_position|. They should locally convert
262 // the given int64 position to a UniquePosition.
264 // The conversion from int64 to UniquePosition is as follows:
265 // The int64 value will have its sign bit flipped then placed in big endian
266 // order as the first 8 bytes of the UniquePosition. The subsequent bytes of
267 // the UniquePosition will consist of the item's unique suffix.
269 // Conversion from UniquePosition to int64 reverses this process: the first 8
270 // bytes of the position are to be interpreted as a big endian int64 value
271 // with its sign bit flipped.
272 optional int64 position_in_parent = 15;
274 // Contains the ID of the element (under the same parent) after which this
275 // element resides. An empty string indicates that the element is the first
276 // element in the parent. This value is used during commits to specify
277 // a relative position for a position change. In the context of
278 // a GetUpdatesMessage, |position_in_parent| is used instead to
279 // communicate position.
281 // Present only in CommitMessage.
283 // This is deprecated. Clients are allowed to omit this as long as they
284 // include |position_in_parent| instead.
285 optional string insert_after_item_id = 16;
287 // Arbitrary key/value pairs associated with this item.
288 // Present in both GetUpdatesResponse and CommitMessage.
290 // optional ExtendedAttributes extended_attributes = 17;
292 // If true, indicates that this item has been (or should be) deleted.
293 // Present in both GetUpdatesResponse and CommitMessage.
294 optional bool deleted = 18 [default = false];
296 // A GUID that identifies the the sync client who initially committed
297 // this entity. This value corresponds to |cache_guid| in CommitMessage.
298 // This field, along with |originator_client_item_id|, can be used to
299 // reunite the original with its official committed version in the case
300 // where a client does not receive or process the commit response for
303 // Present only in GetUpdatesResponse.
305 // This field is also used in determining the unique identifier used in
306 // bookmarks' unique_position field.
307 optional string originator_cache_guid = 19;
309 // The local item id of this entry from the client that initially
310 // committed this entity. Typically a negative integer.
311 // Present only in GetUpdatesResponse.
313 // This field is also used in determinging the unique identifier used in
314 // bookmarks' unique_position field.
315 optional string originator_client_item_id = 20;
317 // Extensible container for datatype-specific data.
318 // This became available in version 23 of the protocol.
319 optional EntitySpecifics specifics = 21;
321 // Indicate whether this is a folder or not. Available in version 23+.
322 optional bool folder = 22 [default = false];
324 // A client defined unique hash for this entity.
325 // Similar to server_defined_unique_tag.
327 // When initially committing an entity, a client can request that the entity
328 // is unique per that account. To do so, the client should specify a
329 // client_defined_unique_tag. At most one entity per tag value may exist.
330 // per account. The server will enforce uniqueness on this tag
331 // and fail attempts to create duplicates of this tag.
332 // Will be returned in any updates for this entity.
334 // The difference between server_defined_unique_tag and
335 // client_defined_unique_tag is the creator of the entity. Server defined
336 // tags are entities created by the server at account creation,
337 // while client defined tags are entities created by the client at any time.
339 // During GetUpdates, a sync entity update will come back with ONE of:
340 // a) Originator and cache id - If client committed the item as non "unique"
341 // b) Server tag - If server committed the item as unique
342 // c) Client tag - If client committed the item as unique
344 // May be present in CommitMessages for the initial creation of an entity.
345 // If present in Commit updates for the entity, it will be ignored.
347 // Available in version 24+.
349 // May be returned in GetUpdatesMessage and sent up in CommitMessage.
351 optional string client_defined_unique_tag = 23;
353 // This positioning system had a relatively short life. It was made obsolete
354 // by |unique_position| before either the client or server made much of an
355 // attempt to support it. In fact, no client ever read or set this field.
357 // Deprecated in M26.
358 optional bytes ordinal_in_parent = 24;
360 // This is the fourth attempt at positioning.
362 // This field is present in both GetUpdatesResponse and CommitMessage, if the
363 // item's type requires it and the client that wrote the item supports it (M26
364 // or higher). Clients must also be prepared to handle updates from clients
365 // that do not set this field. See the comments on
366 // |server_position_in_parent| for more information on how this is handled.
368 // This field will not be set for items whose type ignores positioning.
369 // Clients should not attempt to read this field on the receipt of an item of
370 // a type that ignores positioning.
372 // Refer to its definition in unique_position.proto for more information about
373 // its internal representation.
374 optional UniquePosition unique_position = 25;
376 // Attachment ids of attachments associated with this SyncEntity.
377 repeated AttachmentIdProto attachment_id = 26;
380 // This message contains diagnostic information used to correlate
381 // commit-related traffic with extensions-related mutations to the
382 // data models in chromium. It plays no functional role in
383 // processing this CommitMessage.
384 message ChromiumExtensionsActivity {
385 // The human-readable ID identifying the extension responsible
386 // for the traffic reported in this ChromiumExtensionsActivity.
387 optional string extension_id = 1;
389 // How many times the extension successfully invoked a write
390 // operation through the bookmarks API since the last CommitMessage.
391 optional uint32 bookmark_writes_since_last_commit = 2;
394 // Client specific configuration information.
395 message ClientConfigParams {
396 // The set of data types this client has enabled. Note that this does not
397 // include proxy types, as they do not have protocol field numbers and are
398 // placeholder types that implicitly enable protocol types.
399 repeated int32 enabled_type_ids = 1;
401 // Whether the PROXY_TABS proxy datatype is enabled on this client.
402 optional bool tabs_datatype_enabled = 2;
405 message CommitMessage {
406 repeated SyncEntity entries = 1;
408 // A GUID that identifies the committing sync client. This value will be
409 // returned as originator_cache_guid for any new items.
410 optional string cache_guid = 2;
412 repeated ChromiumExtensionsActivity extensions_activity = 3;
414 // The configuration of this client at commit time. Used by the server to
415 // make commit-time decisions about how to process datatypes that might
416 // involve server-side interaction, and e.g require explicit user intent for
417 // syncing a particular data type regardless of whether a commit for that
418 // datatype is currently being sent up.
419 optional ClientConfigParams config_params = 4;
421 // Set of optional per-client datatype contexts.
422 repeated DataTypeContext client_contexts = 5;
425 // This message communicates additional per-type information related to
426 // requests with origin GU_TRIGGER. This message is not relevant when any
427 // other origin value is used.
428 // Introduced in M29.
429 message GetUpdateTriggers {
430 // An opaque-to-the-client string of bytes, received through a notification,
431 // that the server may interpret as a hint about the location of the latest
432 // version of the data for this type.
434 // Note that this will eventually replace the 'optional' field of the same
435 // name defined in the progress marker, but the client and server should
436 // support both until it's safe to deprecate the old one.
438 // This field was introduced in M29.
439 repeated string notification_hint = 1;
441 // This flag is set if the client was forced to drop hints because the number
442 // of queued hints exceeded its limit. The oldest hints will be discarded
443 // first. Introduced in M29.
444 optional bool client_dropped_hints = 2;
446 // This flag is set when the client suspects that its list of invalidation
447 // hints may be incomplete. This may be the case if:
448 // - The client is syncing for the first time.
449 // - The client has just restarted and it was unable to keep track of
450 // invalidations that were received prior to the restart.
451 // - The client's connection to the invalidation server is currently or
452 // was recently broken.
454 // It's difficult to provide more details here. This is implemented by
455 // setting the flag to false whenever anything that might adversely affect
456 // notifications happens (eg. a crash, restart on a platform that doesn't
457 // support invalidation ack-tracking, transient invalidation error) and is
458 // unset only after we've experienced one successful sync cycle while
459 // notifications were enabled.
461 // This flag was introduced in M29.
462 optional bool invalidations_out_of_sync = 3;
464 // This counts the number of times the syncer has been asked to commit
465 // changes for this type since the last successful sync cycle. The number of
466 // nudges may not be related to the actual number of items modified. It
467 // often correlates with the number of user actions, but that's not always
469 // Introduced in M29.
470 optional int64 local_modification_nudges = 4;
472 // This counts the number of times the syncer has been explicitly asked to
473 // fetch updates for this type since the last successful sync cycle. These
474 // explicit refresh requests should be relatively rare on most platforms, and
475 // associated with user actions. For example, at the time of this writing
476 // the most common (only?) source of refresh requests is when a user opens
477 // the new tab page on a platform that does not support sessions
479 // Introduced in M29.
480 optional int64 datatype_refresh_nudges = 5;
482 // This flag is set if the invalidation server reports that it may have
483 // dropped some invalidations at some point. Introduced in M33.
484 optional bool server_dropped_hints = 6;
486 // This flag is set if this GetUpdate request is due at least in part due
487 // to the fact that this type has not finished initial sync yet, and the
488 // client would like to initialize itself with the server data.
490 // Only some types support performing an initial sync as part of a normal
491 // GetUpdate request. Many types must be in configure mode when fetching
492 // initial sync data.
494 // Introduced in M38.
495 optional bool initial_sync_in_progress = 7;
497 // This flag is set if this GetUpdate request is due to client receiving
498 // conflict response from server, so client needs to sync and then resolve
499 // conflict locally, and then commit again.
501 // Introduced in M42.
502 optional bool sync_for_resolve_conflict_in_progress = 8;
505 message GarbageCollectionDirective {
508 VERSION_WATERMARK = 1;
513 optional Type type = 1 [default = UNKNOWN];
515 // This field specifies the watermark for the versions which should get
516 // garbage collected. The client should purge all sync entities with a
517 // version smaller than version_watermark locally.
518 optional int64 version_watermark = 2;
520 // This field specifies the watermark in terms of age in days. The client
521 // should purge all sync entities which are older than this specific value
522 // based on last modified time.
523 optional int32 age_watermark_in_days = 3;
525 // This field specifies the max number of items that the client should keep
526 // for a specific datatype. If the number of items exceeds this limit, the
527 // client should purge the extra sync entities based on the LRU rule.
528 optional int32 max_number_of_items = 4;
531 message DataTypeProgressMarker {
532 // An integer identifying the data type whose progress is tracked by this
533 // marker. The legitimate values of this field correspond to the protobuf
534 // field numbers of all EntitySpecifics fields supported by the server.
535 // These values are externally declared in per-datatype .proto files.
536 optional int32 data_type_id = 1;
538 // An opaque-to-the-client sequence of bytes that the server may interpret
539 // as an indicator of the client's knowledge state. If this is empty or
540 // omitted by the client, it indicates that the client is initiating a
541 // a first-time sync of this datatype. Otherwise, clients must supply a
542 // value previously returned by the server in an earlier GetUpdatesResponse.
543 // These values are not comparable or generable on the client.
545 // The opaque semantics of this field are to afford server implementations
546 // some flexibility in implementing progress tracking. For instance,
547 // a server implementation built on top of a distributed storage service --
548 // or multiple heterogenous such services -- might need to supply a vector
549 // of totally ordered monotonic update timestamps, rather than a single
550 // monotonically increasing value. Other optimizations may also be
551 // possible if the server is allowed to embed arbitrary information in
552 // the progress token.
554 // Server implementations should keep the size of these tokens relatively
555 // small, on the order of tens of bytes, and they should remain small
556 // regardless of the number of items synchronized. (A possible bad server
557 // implementation would be for progress_token to contain a list of all the
558 // items ever sent to the client. Servers shouldn't do this.)
559 optional bytes token = 2;
561 // Clients that previously downloaded updates synced using the timestamp based
562 // progress tracking mechanism, but which wish to switch over to the opaque
563 // token mechanism can set this field in a GetUpdatesMessage. The server
564 // will perform a get updates operation as normal from the indicated
565 // timestamp, and return only an opaque progress token.
566 optional int64 timestamp_token_for_migration = 3;
568 // An opaque-to-the-client string of bytes, received through a notification,
569 // that the server may interpret as a hint about the location of the latest
570 // version of the data for this type.
572 // Deprecated in M29. We should use the repeated field version in the
573 // PerClientTypeState instead.
574 optional string notification_hint = 4;
576 // This field will be included only in GetUpdates with origin GU_TRIGGER.
577 optional GetUpdateTriggers get_update_triggers = 5;
579 // The garbage collection directive for this data type. The client should
580 // purge items locally based on this directive. Since this directive is
581 // designed to be sent from server only, the client should persist it locally
582 // as needed and avoid sending it to the server.
583 optional GarbageCollectionDirective gc_directive = 6;
586 message GetUpdatesMessage {
587 // Indicates the client's current progress in downloading updates. A
588 // from_timestamp value of zero means that the client is requesting a first-
589 // time sync. After that point, clients should fill in this value with the
590 // value returned in the last-seen GetUpdatesResponse.new_timestamp.
592 // from_timestamp has been deprecated; clients should use
593 // |from_progress_marker| instead, which allows more flexibility.
594 optional int64 from_timestamp = 1;
596 // Indicates the reason for the GetUpdatesMessage.
597 // Deprecated in M29. We should eventually rely on GetUpdatesOrigin instead.
598 // Newer clients will support both systems during the transition period.
599 optional GetUpdatesCallerInfo caller_info = 2;
601 // Indicates whether related folders should be fetched.
602 optional bool fetch_folders = 3 [default = true];
604 // The presence of an individual EntitySpecifics field indicates that the
605 // client requests sync object types associated with that field. This
606 // determination depends only on the presence of the field, not its
607 // contents -- thus clients should send empty messages as the field value.
608 // For backwards compatibility only bookmark objects will be sent to the
609 // client should requested_types not be present.
611 // requested_types may contain multiple EntitySpecifics fields -- in this
612 // event, the server will return items of all the indicated types.
614 // requested_types has been deprecated; clients should use
615 // |from_progress_marker| instead, which allows more flexibility.
616 optional EntitySpecifics requested_types = 4;
618 // Client-requested limit on the maximum number of updates to return at once.
619 // The server may opt to return fewer updates than this amount, but it should
621 optional int32 batch_size = 5;
623 // Per-datatype progress marker. If present, the server will ignore
624 // the values of requested_types and from_timestamp, using this instead.
626 // With the exception of certain configuration or initial sync requests, the
627 // client should include one instance of this field for each enabled data
629 repeated DataTypeProgressMarker from_progress_marker = 6;
631 // Indicates whether the response should be sent in chunks. This may be
632 // needed for devices with limited memory resources. If true, the response
633 // will include one or more ClientToServerResponses, with the frist one
634 // containing GetUpdatesMetadataResponse, and the remaining ones, if any,
635 // containing GetUpdatesStreamingResponse. These ClientToServerResponses are
636 // delimited by a length prefix, which is encoded as a varint.
637 optional bool streaming = 7 [default = false];
639 // Whether the client needs the server to provide an encryption key for this
641 // Note: this should typically only be set on the first GetUpdates a client
642 // requests. Clients are expected to persist the encryption key from then on.
643 // The allowed frequency for requesting encryption keys is much lower than
644 // other datatypes, so repeated usage will likely result in throttling.
645 optional bool need_encryption_key = 8 [default = false];
647 // Whether to create the mobile bookmarks folder if it's not
648 // already created. Should be set to true only by mobile clients.
649 optional bool create_mobile_bookmarks_folder = 1000 [default = false];
651 // This value is an updated version of the GetUpdatesCallerInfo's
652 // GetUpdatesSource. It describes the reason for the GetUpdate request.
653 // Introduced in M29.
654 optional SyncEnums.GetUpdatesOrigin get_updates_origin = 9;
656 // Whether this GU also serves as a retry GU. Any GU that happens after
657 // retry timer timeout is a retry GU effectively.
658 optional bool is_retry = 10 [default = false];
660 // Set of optional per-client datatype contexts.
661 repeated DataTypeContext client_contexts = 11;
664 message AuthenticateMessage {
665 required string auth_token = 1;
668 message ClearUserDataMessage {
671 message ClearUserDataResponse {
674 // The client must preserve, store, and resend the chip bag with
675 // every request. The server depends on the chip bag in order
676 // to precisely choreograph a client-server state machines.
678 // Because the client stores and sends this data on every request,
679 // the contents of the chip bag should be kept relatively small.
681 // If the server does not return a chip bag, the client must assume
682 // that there has been no change to the chip bag. The client must
683 // resend the bag of chips it had prior on the next request.
685 // The client must make the chip bag durable if and only if it
686 // processes the response from the server.
688 // Server chips are deliberately oqaque, allowing the server
689 // to encapsulate its state machine logic.
690 optional bytes server_chips = 1;
693 // Information about the syncer's state.
694 message ClientStatus {
695 // Flag to indicate if the client has detected hierarchy conflcits. The flag
696 // is left unset if update application has not been attempted yet.
698 // The server should attempt to resolve any hierarchy conflicts when this flag
699 // is set. The client may not assume that any particular action will be
700 // taken. There is no guarantee the problem will be addressed in a reasonable
702 optional bool hierarchy_conflict_detected = 1;
705 // A single datatype's sync context. Allows the datatype to pass along
706 // datatype specific information with its own server backend.
707 message DataTypeContext {
708 // The type this context is associated with.
709 optional int32 data_type_id = 1;
710 // The context for the datatype.
711 optional bytes context = 2;
712 // The version of the context.
713 optional int64 version = 3;
716 message ClientToServerMessage {
717 required string share = 1;
718 optional int32 protocol_version = 2 [default = 45];
726 required Contents message_contents = 3;
727 optional CommitMessage commit = 4;
728 optional GetUpdatesMessage get_updates = 5;
729 optional AuthenticateMessage authenticate = 6;
731 // Request to clear all Chromium data from the server.
732 optional ClearUserDataMessage clear_user_data = 9;
734 optional string store_birthday = 7; // Opaque store ID; if it changes, duck!
735 // The client sets this if it detects a sync issue. The server will tell it
736 // if it should perform a refresh.
737 optional bool sync_problem_detected = 8 [default = false];
739 // Client side state information for debugging purpose.
740 // This is only sent on the first getupdates of every sync cycle,
741 // as an optimization to save bandwidth.
742 optional DebugInfo debug_info = 10;
744 // Per-client state for use by the server. Sent with every message sent to the
746 optional ChipBag bag_of_chips = 11;
749 optional string api_key = 12;
751 // Client's self-reported state.
752 // The client should set this on every message sent to the server, though its
753 // member fields may often be unset.
754 optional ClientStatus client_status = 13;
756 // The ID that our invalidation client used to identify itself to the server.
757 // Sending the ID here allows the server to not send notifications of our own
758 // changes to our invalidator.
759 optional string invalidator_client_id = 14;
762 // This request allows the client to convert a specific crash identifier
763 // into more general information (e.g. hash of the crashing call stack)
764 // suitable for upload in an (authenticated) DebugInfo event.
765 message GetCrashInfoRequest {
766 // Id of the uploaded crash.
767 optional string crash_id = 1;
769 // Time that the crash occurred.
770 optional int64 crash_time_millis = 2;
773 // Proto to be written in its entirety to the debug info log.
774 message GetCrashInfoResponse {
775 // Hash of the crashing call stack.
776 optional string stack_id = 1;
778 // Time of the crash, potentially rounded to remove
780 optional int64 crash_time_millis = 2;
783 message CommitResponse {
786 CONFLICT = 2; // You're out of date; update and check your data
787 // TODO(ncarter): What's the difference between RETRY and TRANSIENT_ERROR?
788 RETRY = 3; // Someone has a conflicting, non-expired session open
789 INVALID_MESSAGE = 4; // What the client sent was invalid, and trying again
791 OVER_QUOTA = 5; // This operation would put you, or you are, over quota
792 TRANSIENT_ERROR = 6; // Something went wrong; try again in a bit
794 repeated group EntryResponse = 1 {
795 required ResponseType response_type = 2;
797 // Sync servers may also return a new ID for an existing item, indicating
798 // a new entry's been created to hold the data the client's sending up.
799 optional string id_string = 3;
801 // should be filled if our parent was assigned a new ID.
802 optional string parent_id_string = 4;
804 // This value is the same as the position_in_parent value returned within
805 // the SyncEntity message in GetUpdatesResponse. There was a time when the
806 // client would attempt to honor this position, but nowadays the server
807 // should ensure it is no different from the position_in_parent sent up in
808 // the commit request and the client should not read it.
809 optional int64 position_in_parent = 5;
811 // The item's current version.
812 optional int64 version = 6;
814 // Allows the server to move-aside an entry as it's being committed.
815 // This name is the same as the name field returned within the SyncEntity
816 // message in GetUpdatesResponse.
817 optional string name = 7;
819 // This name is the same as the non_unique_name field returned within the
820 // SyncEntity message in GetUpdatesResponse.
821 optional string non_unique_name = 8;
823 optional string error_message = 9;
825 // Last modification time (in java time milliseconds). Allows the server
826 // to override the client-supplied mtime during a commit operation.
827 optional int64 mtime = 10;
831 message GetUpdatesResponse {
832 // New sync entries that the client should apply.
833 repeated SyncEntity entries = 1;
835 // If there are more changes on the server that weren't processed during this
836 // GetUpdates request, the client should send another GetUpdates request and
837 // use new_timestamp as the from_timestamp value within GetUpdatesMessage.
839 // This field has been deprecated and will be returned only to clients
840 // that set the also-deprecated |from_timestamp| field in the update request.
841 // Clients should use |from_progress_marker| and |new_progress_marker|
843 optional int64 new_timestamp = 2;
845 // DEPRECATED FIELD - server does not set this anymore.
846 optional int64 deprecated_newest_timestamp = 3;
848 // Approximate count of changes remaining - use this for UI feedback.
849 // If present and zero, this estimate is firm: the server has no changes
850 // after the current batch.
851 optional int64 changes_remaining = 4;
853 // Opaque, per-datatype timestamp-like tokens. A client should use this
854 // field in lieu of new_timestamp, which is deprecated in newer versions
855 // of the protocol. Clients should retain and persist the values returned
856 // in this field, and present them back to the server to indicate the
857 // starting point for future update requests.
859 // This will be sent only if the client provided |from_progress_marker|
860 // in the update request.
862 // The server may provide a new progress marker even if this is the end of
863 // the batch, or if there were no new updates on the server; and the client
864 // must save these. If the server does not provide a |new_progress_marker|
865 // value for a particular datatype, when the request provided a
866 // |from_progress_marker| value for that datatype, the client should
867 // interpret this to mean "no change from the previous state" and retain its
868 // previous progress-marker value for that datatype.
870 // Progress markers in the context of a response will never have the
871 // |timestamp_token_for_migration| field set.
872 repeated DataTypeProgressMarker new_progress_marker = 5;
874 // The current encryption keys associated with this account. Will be set if
875 // the GetUpdatesMessage in the request had need_encryption_key == true or
876 // the server has updated the set of encryption keys (e.g. due to a key
878 repeated bytes encryption_keys = 6;
880 // Set of optional datatype contexts server mutations.
881 repeated DataTypeContext context_mutations = 7;
884 // The metadata response for GetUpdatesMessage. This response is sent when
885 // streaming is set to true in the request. It is prefixed with a length
886 // delimiter, which is encoded in varint.
887 message GetUpdatesMetadataResponse {
888 // Approximate count of changes remaining. Detailed comment is available in
889 // GetUpdatesResponse.
890 optional int64 changes_remaining = 1;
892 // Opaque, per-datatype timestamp-like tokens. Detailed comment is available
893 // in GetUpdatesResponse.
894 repeated DataTypeProgressMarker new_progress_marker = 2;
897 // The streaming response message for GetUpdatesMessage. This message is sent
898 // when streaming is set to true in the request. There may be multiple
899 // GetUpdatesStreamingResponse messages in a response. This type of messages
900 // is preceded by GetUpdatesMetadataResponse. It is prefixed with a length
901 // delimiter, which is encoded in varint.
902 message GetUpdatesStreamingResponse {
903 // New sync entries that the client should apply.
904 repeated SyncEntity entries = 1;
907 // A user-identifying struct. For a given Google account the email and display
908 // name can change, but obfuscated_id should be constant.
909 // The obfuscated id is optional because at least one planned use of the proto
910 // (sharing) does not require it.
911 message UserIdentification {
912 required string email = 1; // the user's full primary email address.
913 optional string display_name = 2; // the user's display name.
914 optional string obfuscated_id = 3; // an obfuscated, opaque user id.
917 message AuthenticateResponse {
918 // Optional only for backward compatibility.
919 optional UserIdentification user = 1;
922 message ThrottleParameters {
923 // Deprecated. Remove this from the server side.
924 required int32 min_measure_payload_size = 1;
925 required double target_utilization = 2;
926 required double measure_interval_max = 3;
927 required double measure_interval_min = 4;
928 required double observation_window = 5;
931 message ClientToServerResponse {
932 optional CommitResponse commit = 1;
933 optional GetUpdatesResponse get_updates = 2;
934 optional AuthenticateResponse authenticate = 3;
936 // Up until protocol_version 24, the default was SUCCESS which made it
937 // impossible to add new enum values since older clients would parse any
938 // out-of-range value as SUCCESS. Starting with 25, unless explicitly set,
939 // the error_code will be UNKNOWN so that clients know when they're
940 // out-of-date. Note also that when using protocol_version < 25,
941 // TRANSIENT_ERROR is not supported. Instead, the server sends back a HTTP
942 // 400 error code. This is deprecated now.
943 optional SyncEnums.ErrorType error_code = 4 [default = UNKNOWN];
944 optional string error_message = 5;
946 // Opaque store ID; if it changes, the contents of the client's cache
947 // is meaningless to this server. This happens most typically when
948 // you switch from one storage backend instance (say, a test instance)
949 // to another (say, the official instance).
950 optional string store_birthday = 6;
952 optional ClientCommand client_command = 7;
953 optional ProfilingData profiling_data = 8;
954 optional ClearUserDataResponse clear_user_data = 9;
955 optional GetUpdatesMetadataResponse stream_metadata = 10;
956 // If GetUpdatesStreamingResponse is contained in the ClientToServerResponse,
957 // none of the other fields (error_code and etc) will be set.
958 optional GetUpdatesStreamingResponse stream_data = 11;
960 // The data types whose storage has been migrated. Present when the value of
961 // error_code is MIGRATION_DONE.
962 repeated int32 migrated_data_type_id = 12;
965 optional SyncEnums.ErrorType error_type = 1 [default = UNKNOWN];
966 optional string error_description = 2;
967 optional string url = 3;
968 optional SyncEnums.Action action = 4 [default = UNKNOWN_ACTION];
970 // Currently meaningful if |error_type| is throttled or partial_failure.
971 // In the throttled case, if this field is absent then the whole client
972 // (all datatypes) is throttled.
973 // In the partial_failure case, this field denotes partial failures. The
974 // client should retry those datatypes with exponential backoff.
975 repeated int32 error_data_type_ids = 5;
977 optional Error error = 13;
979 // The new per-client state for this client. If set, should be persisted and
980 // sent with any subsequent ClientToServerMessages.
981 optional ChipBag new_bag_of_chips = 14;
984 // A message to notify the server of certain sync events. Idempotent. Send these
985 // to the /event endpoint.
986 message EventRequest {
987 optional SyncDisabledEvent sync_disabled = 1;
990 message EventResponse {
993 // A message indicating that the sync engine has been disabled on a client.
994 message SyncDisabledEvent {
995 // The GUID that identifies the sync client.
996 optional string cache_guid = 1;
998 // The store birthday that the client was using before disabling sync.
999 optional string store_birthday = 2;