blob: bc27539dc481293781fe4fde43d0e2ec6d717a3c [file] [log] [blame]
[email protected]e9b26092012-04-12 18:38:361// 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//
[email protected]09096752013-05-21 11:17:355// Protocol buffer definitions for representing Drive files and directories,
6// and serializing them for the resource metadata database.
[email protected]e9b26092012-04-12 18:38:367
8syntax = "proto2";
9
[email protected]93115b52012-11-12 21:36:2010option optimize_for = LITE_RUNTIME;
11
[email protected]d9d04df2012-10-12 07:06:3512package drive;
[email protected]e9b26092012-04-12 18:38:3613
14// Represents base::PlatformFileInfo.
15message PlatformFileInfoProto {
16 optional int64 size = 1;
17 optional bool is_directory = 2;
18 optional bool is_symbolic_link = 3;
19 optional int64 last_modified = 4;
20 optional int64 last_accessed = 5;
21 optional int64 creation_time = 6;
Stuart Langleyd204c6d2018-06-15 05:35:0322 optional bool is_team_drive_root = 7;
[email protected]e9b26092012-04-12 18:38:3623}
24
mtomasz163271c2015-02-24 10:50:1925// Represents a property for a file.
26message Property {
27 optional string key = 1;
28 optional string value = 2;
29
30 // Visibility of the property. Either restricted to the same client, or
31 // public.
32 enum Visibility {
33 PRIVATE = 0;
34 PUBLIC = 1;
35 }
36
37 optional Visibility visibility = 3;
38}
39
Sasha Morrissey4d997de2018-05-21 05:53:4640// Capabilities (current permissions) info for an entry.
41message CapabilitiesInfo {
42 // Whether the current user can copy this file. For a Team Drive root, whether
43 // the current user can copy files in this Team Drive.
44 optional bool can_copy = 1;
45 // Whether the current user can delete this file. For a Team Drive root,
46 // whether the current user can delete the Team Drive.
47 optional bool can_delete = 2;
48 // Whether the current user can rename this file. For a Team Drive root,
49 // whether the current user can rename the Team Drive.
50 optional bool can_rename = 3;
51 // Whether the current user can add children to this folder. For a Team Drive
52 // root, whether the current user can add children to folders in this Team
53 // Drive. This is always false when the item is not a folder or a Team Drive.
54 optional bool can_add_children = 4;
Sasha Morrisseyacab441f2018-05-23 04:27:4455 // Whether the current user can modify the sharing settings for this file. For
56 // a Team Drive root, whether the current user can share files or folders in
57 // this Team Drive.
58 optional bool can_share = 5;
Sasha Morrissey4d997de2018-05-21 05:53:4659}
60
[email protected]67241b832013-05-02 04:55:5261// File specific info, which is a part of ResourceEntry.
[email protected]164d5012013-05-20 12:47:1662message FileSpecificInfo {
[email protected]6d75edd2013-10-22 03:09:3863 // The argument with ID 1 (thumbnail_url) had been used, but got deleted.
[email protected]8a4c1d1a2012-07-21 05:12:1764
Sasha Morrissey7ae517a2018-05-18 04:14:2265 // The argument with ID 2 (alternate_url) had been used, but got deleted.
[email protected]8a4c1d1a2012-07-21 05:12:1766
67 // Content mime type like "text/plain".
68 optional string content_mime_type = 3;
69
[email protected]09096752013-05-21 11:17:3570 // The MD5 of contents of a regular file. Hosted files don't have MD5.
[email protected]d061c6b2013-06-07 14:46:3371 optional string md5 = 4;
[email protected]8a4c1d1a2012-07-21 05:12:1772
73 // File extension, including the dot, used for hosted documents
[email protected]09096752013-05-21 11:17:3574 // (ex. ".gsheet" for hosted spreadsheets).
[email protected]8a4c1d1a2012-07-21 05:12:1775 optional string document_extension = 5;
76
[email protected]09096752013-05-21 11:17:3577 // True if the file is a hosted document (i.e. document hosted on
78 // drive.google.com such as documents, spreadsheets, and presentations).
[email protected]8a4c1d1a2012-07-21 05:12:1779 optional bool is_hosted_document = 6;
[email protected]1e7b3c12013-06-26 11:56:1080
[email protected]34722302013-10-04 08:33:2581 // The argument with ID 7 had been used, but got deleted.
82
83 // Width of the media if the file is an image.
84 optional int64 image_width = 8;
85
86 // Height of the media if the file is an image.
87 optional int64 image_height = 9;
88
89 // Rotation of the image in clockwise degrees (if an image).
90 optional int64 image_rotation = 10;
[email protected]52525f82014-05-14 04:30:3091
92 // Cache related states.
93 optional FileCacheEntry cache_state = 11;
[email protected]8a4c1d1a2012-07-21 05:12:1794}
95
Stuart Langley22cca242018-05-18 05:59:1296// Represents metadata for a single team drive, store in the root entry.
97message TeamDriveRootSpecificInfo {
98 // The individual start page token for this team drive.
99 optional string start_page_token = 1;
100}
101
[email protected]164d5012013-05-20 12:47:16102// Directory specific info, which is a part of ResourceEntry.
103message DirectorySpecificInfo {
[email protected]73deb662013-03-07 01:07:14104 // The changestamp of this directory. This value can be larger than the
[email protected]09096752013-05-21 11:17:35105 // changestamp of ResourceMetadata, if this directory was
[email protected]73deb662013-03-07 01:07:14106 // "fast-fetched". See crbug.com/178348 for details about the "fast-fetch"
107 // feature.
Stuart Langleyc92ed252018-05-16 08:38:34108 // TODO(slangley): Remove changestamp once migration code can be removed.
109 optional int64 changestamp = 1 [deprecated = true];
Stuart Langley65234c472018-05-09 10:30:24110
111 // The start page token of this directory. This value may not match the
112 // start_page_token of ResourceMetadata if the directory was "fast-fetched".
113 optional string start_page_token = 2;
Stuart Langleyd2c0cb02018-09-27 02:07:00114
115 // The last time we read this directory from the server when fast fetching.
116 // This is used on initial load when we do not have the full list of files
117 // fetched from the server to prevent repeated reading of the directory file
118 // list.
119 optional int64 last_read_time_ms = 3;
[email protected]73deb662013-03-07 01:07:14120}
121
[email protected]09096752013-05-21 11:17:35122// Represents metadata of a resource (file or directory) on Drive.
Stuart Langley22cca242018-05-18 05:59:12123// Next Entry: 24
[email protected]67241b832013-05-02 04:55:52124message ResourceEntry {
[email protected]e9b26092012-04-12 18:38:36125 optional PlatformFileInfoProto file_info = 1;
[email protected]09096752013-05-21 11:17:35126 // Base name of the entry. The base name is used for file paths. Usually
127 // identical to |title|, but some extra number is inserted if multiple
128 // entries with the same title exist in the same directory, to ensure that
129 // file paths are unique. For instance, if two files titled "foo.jpg" exist
130 // in the same directory, which is allowed on drive.google.com, one of them
131 // will have a base name of "foo (2).jpg".
[email protected]fe6be482012-07-19 17:34:02132 optional string base_name = 2;
[email protected]09096752013-05-21 11:17:35133
134 // Title of the entry. See the comment at |base_name|.
[email protected]e9b26092012-04-12 18:38:36135 optional string title = 3;
[email protected]09096752013-05-21 11:17:35136
137 // Resource ID of the entry. Guaranteed to be unique.
[email protected]e9b26092012-04-12 18:38:36138 optional string resource_id = 4;
[email protected]09096752013-05-21 11:17:35139
[email protected]d38aa402013-09-25 09:38:43140 // Local ID of the entry.
141 optional string local_id = 15;
142
[email protected]943cb8b2013-08-21 03:17:08143 // Local ID of the parent entry.
144 optional string parent_local_id = 7;
[email protected]09096752013-05-21 11:17:35145
146 // This field is used for processing the change list from the
147 // server. Deleted entries won't be stored in ResourceMetadata.
[email protected]9eaae802012-09-12 00:12:16148 optional bool deleted = 11;
[email protected]09096752013-05-21 11:17:35149
harukam68666d12016-09-29 12:00:01150 // True if the entry is labeled "starred".
151 optional bool starred = 20;
152
[email protected]0efcc2b02013-12-04 08:38:31153 // True if the entry is labeled with "shared-with-me", i.e., owned by someone
154 // else initially and later shared to the current user.
[email protected]40687c02013-03-27 12:14:58155 optional bool shared_with_me = 14;
[email protected]8a4c1d1a2012-07-21 05:12:17156
[email protected]0efcc2b02013-12-04 08:38:31157 // True if the entry is labeled "shared". Either the entry itself or its
158 // ancestor is shared (to the user from / by the user to) other accounts.
159 optional bool shared = 17;
160
Sasha Morrissey4d997de2018-05-21 05:53:46161 // The capabilities (current permissions) for this file/folder/team drive.
162 optional CapabilitiesInfo capabilities_info = 24;
163
[email protected]8a4c1d1a2012-07-21 05:12:17164 // File specific information, such as MD5.
[email protected]164d5012013-05-20 12:47:16165 optional FileSpecificInfo file_specific_info = 9;
[email protected]73deb662013-03-07 01:07:14166
167 // Directory specific information, such as changestamp.
[email protected]164d5012013-05-20 12:47:16168 optional DirectorySpecificInfo directory_specific_info = 13;
[email protected]4ef22eb2013-11-29 02:38:30169
Stuart Langley22cca242018-05-18 05:59:12170 // Team Drive root specific information, if this entry is a team drive root.
171 optional TeamDriveRootSpecificInfo team_drive_root_specific_info = 23;
172
[email protected]4ef22eb2013-11-29 02:38:30173 // Used to remember whether this entry is edited locally or not.
174 enum EditState {
lukasza01b9d55a2015-07-21 15:19:25175 CLEAN = 0; // No local edit.
176 DIRTY = 1; // Edited locally.
[email protected]4ef22eb2013-11-29 02:38:30177 SYNCING = 2; // Local change is being synced to the server.
178 }
179
180 // Indicates whether this entry's metadata is edited locally or not.
181 optional EditState metadata_edit_state = 16;
[email protected]1aaee64c2014-04-18 10:33:41182
Shuhei Takahashia25ace562017-09-15 09:22:17183 // The time of the last modification. This is a timestamp used for conflict
184 // resolution and can not be modified arbitrarily by users, in contrast to
185 // PlatformFileInfoProto.last_modified and last_modified_by_me.
[email protected]1aaee64c2014-04-18 10:33:41186 optional int64 modification_date = 18;
mtomasz163271c2015-02-24 10:50:19187
188 // List of new properties which are not synced yet via Drive API. Note, that
189 // currently existing properties are never fetched via Drive API, as they are
190 // never used. That would cause growing the proto size for no reason.
191 repeated Property new_properties = 19;
Shuhei Takahashia25ace562017-09-15 09:22:17192
193 // The time of the last modification by the user. When the file is modified
194 // by other users, this timestamp is not updated.
195 // This timestamp is similar to last_modified in PlatformFileInfoProto rather
196 // than modification_date; it will be set to the same value as last_modified
197 // if the operation is done by the user. This field is here, not in
198 // PlatformFileInfoProto, just because this field does not have a
199 // corresponding field in base::File::Info.
200 optional int64 last_modified_by_me = 21;
Sasha Morrissey7ae517a2018-05-18 04:14:22201
202 // This URL is used for opening hosted documents with Google Drive's web
203 // interface.
204 optional string alternate_url = 22;
[email protected]e9b26092012-04-12 18:38:36205}
206
[email protected]5a2e3a2f2013-04-26 08:04:36207// Container for the header part of ResourceMetadata.
208message ResourceMetadataHeader {
[email protected]df3fef22013-03-21 12:20:41209 // Monotonically increasing version number, which is changed when
210 // incompatible change is made to the DB format. kDBVersion in
Sasha Morrissey4d997de2018-05-21 05:53:46211 // resource_metadata_storage.h defines the current version.
[email protected]df3fef22013-03-21 12:20:41212 optional int32 version = 1;
Stuart Langley65234c472018-05-09 10:30:24213
Stuart Langleyc92ed252018-05-16 08:38:34214 // TODO(slangley): Remove changestamp once migration code can be removed.
215 optional int64 largest_changestamp = 2 [deprecated = true];
harukam68666d12016-09-29 12:00:01216
Shuhei Takahashi87ce7f52017-09-05 05:15:41217 // The argument with ID 3 (starred_property_initialized) had been used, but
218 // got deleted.
219 reserved 3;
Stuart Langley65234c472018-05-09 10:30:24220
221 // The start_page_token for the users default corpus changelist.
222 optional string start_page_token = 4;
[email protected]df3fef22013-03-21 12:20:41223}
224
[email protected]12e4c182012-07-12 21:30:04225// Message to store information of an existing cache file.
[email protected]aa7365c2013-05-01 05:50:47226message FileCacheEntry {
[email protected]86981502013-09-10 16:02:02227 // MD5 of the cache file.
[email protected]12e4c182012-07-12 21:30:04228 optional string md5 = 1;
229
230 // True if the file is present locally.
231 optional bool is_present = 2;
232
233 // True if the file is pinned (i.e. available offline).
234 optional bool is_pinned = 3;
235
236 // True if the file is dirty (i.e. modified locally).
237 optional bool is_dirty = 4;
238
[email protected]eca3fc92013-05-01 03:53:40239 // When adding a new state, be sure to update TestFileCacheState and test
[email protected]86981502013-09-10 16:02:02240 // functions defined in test_util.cc.
[email protected]12e4c182012-07-12 21:30:04241}