Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: sync/protocol/sync.proto

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

Powered by Google App Engine
This is Rietveld 408576698