File: sync_entity.proto

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (254 lines) | stat: -rw-r--r-- 11,513 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option java_multiple_files = true;
option java_package = "org.chromium.components.sync.protocol";

option optimize_for = LITE_RUNTIME;

package sync_pb;

import "components/sync/protocol/deletion_origin.proto";
import "components/sync/protocol/entity_specifics.proto";
import "components/sync/protocol/unique_position.proto";

message SyncEntity {
  // This item's identifier.  In a commit of a new item, this will be a
  // client-generated ID.  If the commit succeeds, the server will generate
  // a globally unique ID and return it to the committing client in the
  // CommitResponse.EntryResponse.  In the context of a GetUpdatesResponse,
  // `id_string` is always the server generated ID.  The original
  // client-generated ID is preserved in the `originator_client_id` field.
  // Present in both GetUpdatesResponse and CommitMessage.
  // Prior to M123, this field was empty for commit-only types.
  optional string id_string = 1;

  // An id referencing this item's parent in the hierarchy.  In a
  // CommitMessage, it is accepted for this to be a client-generated temporary
  // ID if there was a new created item with that ID appearing earlier
  // in the message.  In all other situations, it is a server ID.
  // Present in both GetUpdatesResponse and CommitMessage.
  //
  // Starting with M99, this field is optional and used for legacy bookmarks
  // only:
  // 1. When processing GetUpdatesResponse, it is unused for modern data created
  //    or reuploaded by M94 or above, which populates the parent's GUID in
  //    BookmarkSpecifics (which is sufficient).
  // 2. When issuing CommitMessage, the field is populated for compatibility
  //    with clients before M99.
  optional string parent_id_string = 2;

  reserved 3;
  reserved "old_parent_id";

  // The version of this item -- a monotonically increasing value that is
  // maintained by for each item.  If zero in a CommitMessage, the server
  // will interpret this entity as a newly-created item and generate a
  // new server ID and an initial version number.  If nonzero in a
  // CommitMessage, this item is treated as an update to an existing item, and
  // the server will use `id_string` to locate the item.  Then, if the item's
  // current version on the server does not match `version`, the commit will
  // fail for that item.  The server will not update it, and will return
  // a result code of CONFLICT.  In a GetUpdatesResponse, `version` is always
  // positive and identifies the revision of the item data being sent to the
  // client.
  // Present in both GetUpdatesResponse and CommitMessage.
  // WARNING: This field used to be required before M60. Any client before this
  // will fail to deserialize if this field is missing.
  optional int64 version = 4;

  // Last modification time, in milliseconds since Unix epoch.
  // Present in both GetUpdatesResponse and CommitMessage.
  optional int64 mtime = 5;

  // Creation time, in milliseconds since Unix epoch.
  // Present in both GetUpdatesResponse and CommitMessage.
  optional int64 ctime = 6;

  // The name of this item.
  // Historical note:
  //   Since November 2010, this value is no different from non_unique_name.
  //   Before then, server implementations would maintain a unique-within-parent
  //   value separate from its base, "non-unique" value.  Clients had not
  //   depended on the uniqueness of the property since November 2009; it was
  //   removed from Chromium by http://codereview.chromium.org/371029 .
  // Present in both GetUpdatesResponse and CommitMessage.
  // WARNING: This field used to be required before M60. Any client before this
  // will fail to deserialize if this field is missing.
  optional string name = 7;

  // The name of this item.  Same as `name`.
  // `non_unique_name` should take precedence over the `name` value if both
  // are supplied.  For efficiency, clients and servers should avoid setting
  // this redundant value.
  // Present in both GetUpdatesResponse and CommitMessage.
  optional string non_unique_name = 8;

  reserved 9;
  reserved "sync_timestamp";

  // If present, this tag identifies this item as being a uniquely
  // instanced item.  The server ensures that there is never more
  // than one entity in a user's store with the same tag value.
  // This value is used to identify and find e.g. the "Bookmark Bar" folder
  // without relying on a particular ID or name.
  //
  // This variant of the tag is created by the server, so clients can't create
  // an item with a tag using this field.
  //
  // Use client_tag_hash if you want to create one from the client.
  //
  // An item can't have both a client_tag_hash and
  // a server_defined_unique_tag.
  //
  // Present only in GetUpdatesResponse.
  optional string server_defined_unique_tag = 10;

  reserved 11;
  reserved "BookmarkData";
  reserved 12;
  reserved "bookmark_folder";
  reserved 13;
  reserved "bookmark_url";
  reserved 14;
  reserved "bookmark_favicon";

  // Ancient fields, predecessors for `unique_position`, deprecated with M26 and
  // still supported to deal with old incoming data. See field `unique_position`
  // for details as well as the data-upgrading implementation in
  // GetUniquePositionFromSyncEntity().
  optional int64 position_in_parent = 15 [deprecated = true];
  optional string insert_after_item_id = 16 [deprecated = true];

  reserved 17;
  reserved "extended_attributes";

  // If true, indicates that this item has been (or should be) deleted.
  // Present in both GetUpdatesResponse and CommitMessage.
  optional bool deleted = 18 [default = false];

  // A unique ID that identifies the the sync client who initially committed
  // this entity.  This value corresponds to `cache_guid` in CommitMessage.
  // This field, along with `originator_client_item_id`, can be used to
  // reunite the original with its official committed version in the case
  // where a client does not receive or process the commit response for
  // some reason.
  //
  // Present only in GetUpdatesResponse.
  //
  // This field is also used in determining the unique identifier used in
  // bookmarks' unique_position field.
  optional string originator_cache_guid = 19;

  // Item ID as generated by the client that initially created this entity. Used
  // exclusively for bookmarks (other datatypes use client_tag_hash).
  // There are three generation of bookmarks that have populated this field
  // differently, depending on which version of the browser created the
  // bookmark:
  // 1. For bookmarks created before M44 (2015), the field got populated with an
  //    ID that is locally unique, but not globally unique (usually a negative
  //    number).
  // 2. For bookmarks created between M45 and M51, both inclusive, the field got
  //    populated with a globally unique GUID in uppercase form.
  // 3. For bookmarks created with M52 or above, the field gets populated with
  //    a globally unique GUID in lowercase form.
  //
  // Present only in GetUpdatesResponse.
  optional string originator_client_item_id = 20;

  // Extensible container for datatype-specific data.
  // This became available in version 23 of the protocol.
  optional EntitySpecifics specifics = 21;

  // Indicate whether this is a folder or not. Available in version 23+.
  optional bool folder = 22 [default = false];

  // A client defined unique hash for this entity.
  // Analogous to server_defined_unique_tag, but allows the client to determine
  // an immutable attribute of the entity in hashed form that makes it unique
  // per user (i.e. at most one entity may exist per client tag hash).
  //
  // This value must be of the form base64(SHA1(client_tag)) where the
  // client_tag is a value derived from the contents of an entity in a
  // type-specific way. Since the hashed contents of the client_tag are exposed
  // to the server via this field, take care when defining it that there is
  // enough entropy to mask any secrets that the server shouldn't learn.
  //
  // The difference between server_defined_unique_tag and
  // client_tag_hash is the creator of the entity. Server defined
  // tags are entities created by the server at account creation,
  // while client defined tags are entities created by the client at any time.
  //
  // During GetUpdates, a sync entity update will come back with ONE of:
  // a) Originator item and cache id - for bookmarks created using old versions
  //    of the browser (latest M93, before https://crrev.com/c/2945119).
  // b) Server tag - If server committed the item as unique
  // c) Client tag - If client committed the item as unique
  //
  // May be present in CommitMessages for the initial creation of an entity.
  // If present in Commit updates for the entity, it will be ignored.
  //
  // May be returned in GetUpdatesMessage and sent up in CommitMessage.
  optional string client_tag_hash = 23;

  // Field 23 was previously named client_defined_unique_tag, avoid reuse.
  reserved "client_defined_unique_tag";

  reserved 24;
  reserved "ordinal_in_parent";

  // Introduced in M26, represents ordering among entities, in practice used for
  // bookmarks only. Clients should not assume it is always populated in
  // GetUpdatesMessage due to the following caveats:
  // 1. Tombstones and permanent folders do not populate it (ordering is
  //    irrelevant).
  // 2. It may remain unset by future versions of the client, as long as the
  //    field with the same name is populated inside BookmarkSpecifics. M94 and
  //    above populate both for backward compatibility reasons, but when support
  //    for M93 is retired, modern clients at the time may stop populating this
  //    field.
  // 3. Very old data (last committed by M25 or below, before the field was
  //    introduced) does not include this field, and in that case the legacy
  //    fields `position_in_parent` or `insert_after_item_id` must be honored
  //    instead.
  //
  // May be returned in GetUpdatesMessage and sent up in CommitMessage.
  optional UniquePosition unique_position = 25;

  // This used to be a list of sync attachment IDs, but it was never launched
  // and the code has been removed as of M66.
  reserved 26;
  reserved "attachment_id";

  // Metadata used for shared data types. Must not be present for regular data
  // types.
  // Introduced in M124.
  message CollaborationMetadata {
    message Attribution {
      // Obfuscated Gaia ID of the user.
      optional string obfuscated_gaia_id = 1;
    }

    // Collaboration ID which the current entity belongs to.
    optional string collaboration_id = 1;

    // Information about when the specifics was created.
    optional Attribution creation_attribution = 2;

    // Information about when the specifics was last updated.
    optional Attribution last_update_attribution = 3;
  }

  optional CollaborationMetadata collaboration = 27;

  // Optionally present in CommitMessage for committed deletions (but may remain
  // unset if the origin is unspecified), it represents which piece of code
  // triggered a deletion. It is a debug-only field with no compatibility
  // guarantees, subject to change over time. The main purpose is to help with
  // investigating and mitigating user reports or incidents that cause data
  // deletion. Introduced in M126.
  optional DeletionOrigin deletion_origin = 28;
}