blob: e12f9b2be1f60df469f434059fc0c43b9f21db75 [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;
22}
23
mtomasz163271c2015-02-24 10:50:1924// Represents a property for a file.
25message Property {
26 optional string key = 1;
27 optional string value = 2;
28
29 // Visibility of the property. Either restricted to the same client, or
30 // public.
31 enum Visibility {
32 PRIVATE = 0;
33 PUBLIC = 1;
34 }
35
36 optional Visibility visibility = 3;
37}
38
[email protected]67241b832013-05-02 04:55:5239// File specific info, which is a part of ResourceEntry.
[email protected]164d5012013-05-20 12:47:1640message FileSpecificInfo {
[email protected]6d75edd2013-10-22 03:09:3841 // The argument with ID 1 (thumbnail_url) had been used, but got deleted.
[email protected]8a4c1d1a2012-07-21 05:12:1742
[email protected]09096752013-05-21 11:17:3543 // This URL is used for opening hosted documents with Google Drive's web
[email protected]8a4c1d1a2012-07-21 05:12:1744 // interface.
45 optional string alternate_url = 2;
46
47 // Content mime type like "text/plain".
48 optional string content_mime_type = 3;
49
[email protected]09096752013-05-21 11:17:3550 // The MD5 of contents of a regular file. Hosted files don't have MD5.
[email protected]d061c6b2013-06-07 14:46:3351 optional string md5 = 4;
[email protected]8a4c1d1a2012-07-21 05:12:1752
53 // File extension, including the dot, used for hosted documents
[email protected]09096752013-05-21 11:17:3554 // (ex. ".gsheet" for hosted spreadsheets).
[email protected]8a4c1d1a2012-07-21 05:12:1755 optional string document_extension = 5;
56
[email protected]09096752013-05-21 11:17:3557 // True if the file is a hosted document (i.e. document hosted on
58 // drive.google.com such as documents, spreadsheets, and presentations).
[email protected]8a4c1d1a2012-07-21 05:12:1759 optional bool is_hosted_document = 6;
[email protected]1e7b3c12013-06-26 11:56:1060
[email protected]34722302013-10-04 08:33:2561 // The argument with ID 7 had been used, but got deleted.
62
63 // Width of the media if the file is an image.
64 optional int64 image_width = 8;
65
66 // Height of the media if the file is an image.
67 optional int64 image_height = 9;
68
69 // Rotation of the image in clockwise degrees (if an image).
70 optional int64 image_rotation = 10;
[email protected]52525f82014-05-14 04:30:3071
72 // Cache related states.
73 optional FileCacheEntry cache_state = 11;
[email protected]8a4c1d1a2012-07-21 05:12:1774}
75
[email protected]164d5012013-05-20 12:47:1676// Directory specific info, which is a part of ResourceEntry.
77message DirectorySpecificInfo {
[email protected]73deb662013-03-07 01:07:1478 // The changestamp of this directory. This value can be larger than the
[email protected]09096752013-05-21 11:17:3579 // changestamp of ResourceMetadata, if this directory was
[email protected]73deb662013-03-07 01:07:1480 // "fast-fetched". See crbug.com/178348 for details about the "fast-fetch"
81 // feature.
82 optional int64 changestamp = 1;
83}
84
[email protected]09096752013-05-21 11:17:3585// Represents metadata of a resource (file or directory) on Drive.
[email protected]67241b832013-05-02 04:55:5286message ResourceEntry {
[email protected]e9b26092012-04-12 18:38:3687 optional PlatformFileInfoProto file_info = 1;
[email protected]09096752013-05-21 11:17:3588 // Base name of the entry. The base name is used for file paths. Usually
89 // identical to |title|, but some extra number is inserted if multiple
90 // entries with the same title exist in the same directory, to ensure that
91 // file paths are unique. For instance, if two files titled "foo.jpg" exist
92 // in the same directory, which is allowed on drive.google.com, one of them
93 // will have a base name of "foo (2).jpg".
[email protected]fe6be482012-07-19 17:34:0294 optional string base_name = 2;
[email protected]09096752013-05-21 11:17:3595
96 // Title of the entry. See the comment at |base_name|.
[email protected]e9b26092012-04-12 18:38:3697 optional string title = 3;
[email protected]09096752013-05-21 11:17:3598
99 // Resource ID of the entry. Guaranteed to be unique.
[email protected]e9b26092012-04-12 18:38:36100 optional string resource_id = 4;
[email protected]09096752013-05-21 11:17:35101
[email protected]d38aa402013-09-25 09:38:43102 // Local ID of the entry.
103 optional string local_id = 15;
104
[email protected]943cb8b2013-08-21 03:17:08105 // Local ID of the parent entry.
106 optional string parent_local_id = 7;
[email protected]09096752013-05-21 11:17:35107
108 // This field is used for processing the change list from the
109 // server. Deleted entries won't be stored in ResourceMetadata.
[email protected]9eaae802012-09-12 00:12:16110 optional bool deleted = 11;
[email protected]09096752013-05-21 11:17:35111
harukam68666d12016-09-29 12:00:01112 // True if the entry is labeled "starred".
113 optional bool starred = 20;
114
[email protected]0efcc2b02013-12-04 08:38:31115 // True if the entry is labeled with "shared-with-me", i.e., owned by someone
116 // else initially and later shared to the current user.
[email protected]40687c02013-03-27 12:14:58117 optional bool shared_with_me = 14;
[email protected]8a4c1d1a2012-07-21 05:12:17118
[email protected]0efcc2b02013-12-04 08:38:31119 // True if the entry is labeled "shared". Either the entry itself or its
120 // ancestor is shared (to the user from / by the user to) other accounts.
121 optional bool shared = 17;
122
[email protected]8a4c1d1a2012-07-21 05:12:17123 // File specific information, such as MD5.
[email protected]164d5012013-05-20 12:47:16124 optional FileSpecificInfo file_specific_info = 9;
[email protected]73deb662013-03-07 01:07:14125
126 // Directory specific information, such as changestamp.
[email protected]164d5012013-05-20 12:47:16127 optional DirectorySpecificInfo directory_specific_info = 13;
[email protected]4ef22eb2013-11-29 02:38:30128
129 // Used to remember whether this entry is edited locally or not.
130 enum EditState {
lukasza01b9d55a2015-07-21 15:19:25131 CLEAN = 0; // No local edit.
132 DIRTY = 1; // Edited locally.
[email protected]4ef22eb2013-11-29 02:38:30133 SYNCING = 2; // Local change is being synced to the server.
134 }
135
136 // Indicates whether this entry's metadata is edited locally or not.
137 optional EditState metadata_edit_state = 16;
[email protected]1aaee64c2014-04-18 10:33:41138
Shuhei Takahashia25ace562017-09-15 09:22:17139 // The time of the last modification. This is a timestamp used for conflict
140 // resolution and can not be modified arbitrarily by users, in contrast to
141 // PlatformFileInfoProto.last_modified and last_modified_by_me.
[email protected]1aaee64c2014-04-18 10:33:41142 optional int64 modification_date = 18;
mtomasz163271c2015-02-24 10:50:19143
144 // List of new properties which are not synced yet via Drive API. Note, that
145 // currently existing properties are never fetched via Drive API, as they are
146 // never used. That would cause growing the proto size for no reason.
147 repeated Property new_properties = 19;
Shuhei Takahashia25ace562017-09-15 09:22:17148
149 // The time of the last modification by the user. When the file is modified
150 // by other users, this timestamp is not updated.
151 // This timestamp is similar to last_modified in PlatformFileInfoProto rather
152 // than modification_date; it will be set to the same value as last_modified
153 // if the operation is done by the user. This field is here, not in
154 // PlatformFileInfoProto, just because this field does not have a
155 // corresponding field in base::File::Info.
156 optional int64 last_modified_by_me = 21;
[email protected]e9b26092012-04-12 18:38:36157}
158
[email protected]5a2e3a2f2013-04-26 08:04:36159// Container for the header part of ResourceMetadata.
160message ResourceMetadataHeader {
[email protected]df3fef22013-03-21 12:20:41161 // Monotonically increasing version number, which is changed when
162 // incompatible change is made to the DB format. kDBVersion in
163 // drive_resource_metadata_storage.h defines the current version.
164 optional int32 version = 1;
165 optional int64 largest_changestamp = 2;
harukam68666d12016-09-29 12:00:01166
Shuhei Takahashi87ce7f52017-09-05 05:15:41167 // The argument with ID 3 (starred_property_initialized) had been used, but
168 // got deleted.
169 reserved 3;
[email protected]df3fef22013-03-21 12:20:41170}
171
[email protected]12e4c182012-07-12 21:30:04172// Message to store information of an existing cache file.
[email protected]aa7365c2013-05-01 05:50:47173message FileCacheEntry {
[email protected]86981502013-09-10 16:02:02174 // MD5 of the cache file.
[email protected]12e4c182012-07-12 21:30:04175 optional string md5 = 1;
176
177 // True if the file is present locally.
178 optional bool is_present = 2;
179
180 // True if the file is pinned (i.e. available offline).
181 optional bool is_pinned = 3;
182
183 // True if the file is dirty (i.e. modified locally).
184 optional bool is_dirty = 4;
185
[email protected]eca3fc92013-05-01 03:53:40186 // When adding a new state, be sure to update TestFileCacheState and test
[email protected]86981502013-09-10 16:02:02187 // functions defined in test_util.cc.
[email protected]12e4c182012-07-12 21:30:04188}