forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrive.proto
241 lines (190 loc) · 8.92 KB
/
drive.proto
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
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Protocol buffer definitions for representing Drive files and directories,
// and serializing them for the resource metadata database.
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package drive;
// Represents base::PlatformFileInfo.
message PlatformFileInfoProto {
optional int64 size = 1;
optional bool is_directory = 2;
optional bool is_symbolic_link = 3;
optional int64 last_modified = 4;
optional int64 last_accessed = 5;
optional int64 creation_time = 6;
optional bool is_team_drive_root = 7;
}
// Represents a property for a file.
message Property {
optional string key = 1;
optional string value = 2;
// Visibility of the property. Either restricted to the same client, or
// public.
enum Visibility {
PRIVATE = 0;
PUBLIC = 1;
}
optional Visibility visibility = 3;
}
// Capabilities (current permissions) info for an entry.
message CapabilitiesInfo {
// Whether the current user can copy this file. For a Team Drive root, whether
// the current user can copy files in this Team Drive.
optional bool can_copy = 1;
// Whether the current user can delete this file. For a Team Drive root,
// whether the current user can delete the Team Drive.
optional bool can_delete = 2;
// Whether the current user can rename this file. For a Team Drive root,
// whether the current user can rename the Team Drive.
optional bool can_rename = 3;
// Whether the current user can add children to this folder. For a Team Drive
// root, whether the current user can add children to folders in this Team
// Drive. This is always false when the item is not a folder or a Team Drive.
optional bool can_add_children = 4;
// Whether the current user can modify the sharing settings for this file. For
// a Team Drive root, whether the current user can share files or folders in
// this Team Drive.
optional bool can_share = 5;
}
// File specific info, which is a part of ResourceEntry.
message FileSpecificInfo {
// The argument with ID 1 (thumbnail_url) had been used, but got deleted.
// The argument with ID 2 (alternate_url) had been used, but got deleted.
// Content mime type like "text/plain".
optional string content_mime_type = 3;
// The MD5 of contents of a regular file. Hosted files don't have MD5.
optional string md5 = 4;
// File extension, including the dot, used for hosted documents
// (ex. ".gsheet" for hosted spreadsheets).
optional string document_extension = 5;
// True if the file is a hosted document (i.e. document hosted on
// drive.google.com such as documents, spreadsheets, and presentations).
optional bool is_hosted_document = 6;
// The argument with ID 7 had been used, but got deleted.
// Width of the media if the file is an image.
optional int64 image_width = 8;
// Height of the media if the file is an image.
optional int64 image_height = 9;
// Rotation of the image in clockwise degrees (if an image).
optional int64 image_rotation = 10;
// Cache related states.
optional FileCacheEntry cache_state = 11;
}
// Represents metadata for a single team drive, store in the root entry.
message TeamDriveRootSpecificInfo {
// The individual start page token for this team drive.
optional string start_page_token = 1;
}
// Directory specific info, which is a part of ResourceEntry.
message DirectorySpecificInfo {
// The changestamp of this directory. This value can be larger than the
// changestamp of ResourceMetadata, if this directory was
// "fast-fetched". See crbug.com/178348 for details about the "fast-fetch"
// feature.
// TODO(slangley): Remove changestamp once migration code can be removed.
optional int64 changestamp = 1 [deprecated = true];
// The start page token of this directory. This value may not match the
// start_page_token of ResourceMetadata if the directory was "fast-fetched".
optional string start_page_token = 2;
// The last time we read this directory from the server when fast fetching.
// This is used on initial load when we do not have the full list of files
// fetched from the server to prevent repeated reading of the directory file
// list.
optional int64 last_read_time_ms = 3;
}
// Represents metadata of a resource (file or directory) on Drive.
// Next Entry: 24
message ResourceEntry {
optional PlatformFileInfoProto file_info = 1;
// Base name of the entry. The base name is used for file paths. Usually
// identical to |title|, but some extra number is inserted if multiple
// entries with the same title exist in the same directory, to ensure that
// file paths are unique. For instance, if two files titled "foo.jpg" exist
// in the same directory, which is allowed on drive.google.com, one of them
// will have a base name of "foo (2).jpg".
optional string base_name = 2;
// Title of the entry. See the comment at |base_name|.
optional string title = 3;
// Resource ID of the entry. Guaranteed to be unique.
optional string resource_id = 4;
// Local ID of the entry.
optional string local_id = 15;
// Local ID of the parent entry.
optional string parent_local_id = 7;
// This field is used for processing the change list from the
// server. Deleted entries won't be stored in ResourceMetadata.
optional bool deleted = 11;
// True if the entry is labeled "starred".
optional bool starred = 20;
// True if the entry is labeled with "shared-with-me", i.e., owned by someone
// else initially and later shared to the current user.
optional bool shared_with_me = 14;
// True if the entry is labeled "shared". Either the entry itself or its
// ancestor is shared (to the user from / by the user to) other accounts.
optional bool shared = 17;
// The capabilities (current permissions) for this file/folder/team drive.
optional CapabilitiesInfo capabilities_info = 24;
// File specific information, such as MD5.
optional FileSpecificInfo file_specific_info = 9;
// Directory specific information, such as changestamp.
optional DirectorySpecificInfo directory_specific_info = 13;
// Team Drive root specific information, if this entry is a team drive root.
optional TeamDriveRootSpecificInfo team_drive_root_specific_info = 23;
// Used to remember whether this entry is edited locally or not.
enum EditState {
CLEAN = 0; // No local edit.
DIRTY = 1; // Edited locally.
SYNCING = 2; // Local change is being synced to the server.
}
// Indicates whether this entry's metadata is edited locally or not.
optional EditState metadata_edit_state = 16;
// The time of the last modification. This is a timestamp used for conflict
// resolution and can not be modified arbitrarily by users, in contrast to
// PlatformFileInfoProto.last_modified and last_modified_by_me.
optional int64 modification_date = 18;
// List of new properties which are not synced yet via Drive API. Note, that
// currently existing properties are never fetched via Drive API, as they are
// never used. That would cause growing the proto size for no reason.
repeated Property new_properties = 19;
// The time of the last modification by the user. When the file is modified
// by other users, this timestamp is not updated.
// This timestamp is similar to last_modified in PlatformFileInfoProto rather
// than modification_date; it will be set to the same value as last_modified
// if the operation is done by the user. This field is here, not in
// PlatformFileInfoProto, just because this field does not have a
// corresponding field in base::File::Info.
optional int64 last_modified_by_me = 21;
// This URL is used for opening hosted documents with Google Drive's web
// interface.
optional string alternate_url = 22;
}
// Container for the header part of ResourceMetadata.
message ResourceMetadataHeader {
// Monotonically increasing version number, which is changed when
// incompatible change is made to the DB format. kDBVersion in
// resource_metadata_storage.h defines the current version.
optional int32 version = 1;
// TODO(slangley): Remove changestamp once migration code can be removed.
optional int64 largest_changestamp = 2 [deprecated = true];
// The argument with ID 3 (starred_property_initialized) had been used, but
// got deleted.
reserved 3;
// The start_page_token for the users default corpus changelist.
optional string start_page_token = 4;
}
// Message to store information of an existing cache file.
message FileCacheEntry {
// MD5 of the cache file.
optional string md5 = 1;
// True if the file is present locally.
optional bool is_present = 2;
// True if the file is pinned (i.e. available offline).
optional bool is_pinned = 3;
// True if the file is dirty (i.e. modified locally).
optional bool is_dirty = 4;
// When adding a new state, be sure to update TestFileCacheState and test
// functions defined in test_util.cc.
}