OLD | NEW |
| (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 // Protocol buffer definitions for representing Drive files and directories, | |
6 // and serializing them for the resource metadata database. | |
7 | |
8 syntax = "proto2"; | |
9 | |
10 option optimize_for = LITE_RUNTIME; | |
11 | |
12 package drive; | |
13 | |
14 // Represents base::PlatformFileInfo. | |
15 message 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 | |
24 // Represents a property for a file. | |
25 message 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 | |
39 // File specific info, which is a part of ResourceEntry. | |
40 message FileSpecificInfo { | |
41 // The argument with ID 1 (thumbnail_url) had been used, but got deleted. | |
42 | |
43 // This URL is used for opening hosted documents with Google Drive's web | |
44 // interface. | |
45 optional string alternate_url = 2; | |
46 | |
47 // Content mime type like "text/plain". | |
48 optional string content_mime_type = 3; | |
49 | |
50 // The MD5 of contents of a regular file. Hosted files don't have MD5. | |
51 optional string md5 = 4; | |
52 | |
53 // File extension, including the dot, used for hosted documents | |
54 // (ex. ".gsheet" for hosted spreadsheets). | |
55 optional string document_extension = 5; | |
56 | |
57 // True if the file is a hosted document (i.e. document hosted on | |
58 // drive.google.com such as documents, spreadsheets, and presentations). | |
59 optional bool is_hosted_document = 6; | |
60 | |
61 // 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; | |
71 | |
72 // Cache related states. | |
73 optional FileCacheEntry cache_state = 11; | |
74 } | |
75 | |
76 // Directory specific info, which is a part of ResourceEntry. | |
77 message DirectorySpecificInfo { | |
78 // The changestamp of this directory. This value can be larger than the | |
79 // changestamp of ResourceMetadata, if this directory was | |
80 // "fast-fetched". See crbug.com/178348 for details about the "fast-fetch" | |
81 // feature. | |
82 optional int64 changestamp = 1; | |
83 } | |
84 | |
85 // Represents metadata of a resource (file or directory) on Drive. | |
86 message ResourceEntry { | |
87 optional PlatformFileInfoProto file_info = 1; | |
88 // 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". | |
94 optional string base_name = 2; | |
95 | |
96 // Title of the entry. See the comment at |base_name|. | |
97 optional string title = 3; | |
98 | |
99 // Resource ID of the entry. Guaranteed to be unique. | |
100 optional string resource_id = 4; | |
101 | |
102 // Local ID of the entry. | |
103 optional string local_id = 15; | |
104 | |
105 // Local ID of the parent entry. | |
106 optional string parent_local_id = 7; | |
107 | |
108 // This field is used for processing the change list from the | |
109 // server. Deleted entries won't be stored in ResourceMetadata. | |
110 optional bool deleted = 11; | |
111 | |
112 // True if the entry is labeled with "shared-with-me", i.e., owned by someone | |
113 // else initially and later shared to the current user. | |
114 optional bool shared_with_me = 14; | |
115 | |
116 // True if the entry is labeled "shared". Either the entry itself or its | |
117 // ancestor is shared (to the user from / by the user to) other accounts. | |
118 optional bool shared = 17; | |
119 | |
120 // File specific information, such as MD5. | |
121 optional FileSpecificInfo file_specific_info = 9; | |
122 | |
123 // Directory specific information, such as changestamp. | |
124 optional DirectorySpecificInfo directory_specific_info = 13; | |
125 | |
126 // Used to remember whether this entry is edited locally or not. | |
127 enum EditState { | |
128 CLEAN = 0; // No local edit. | |
129 DIRTY = 1; // Edited locally. | |
130 SYNCING = 2; // Local change is being synced to the server. | |
131 } | |
132 | |
133 // Indicates whether this entry's metadata is edited locally or not. | |
134 optional EditState metadata_edit_state = 16; | |
135 | |
136 // The time of the last modification. | |
137 optional int64 modification_date = 18; | |
138 | |
139 // List of new properties which are not synced yet via Drive API. Note, that | |
140 // currently existing properties are never fetched via Drive API, as they are | |
141 // never used. That would cause growing the proto size for no reason. | |
142 repeated Property new_properties = 19; | |
143 } | |
144 | |
145 // Container for the header part of ResourceMetadata. | |
146 message ResourceMetadataHeader { | |
147 // Monotonically increasing version number, which is changed when | |
148 // incompatible change is made to the DB format. kDBVersion in | |
149 // drive_resource_metadata_storage.h defines the current version. | |
150 optional int32 version = 1; | |
151 optional int64 largest_changestamp = 2; | |
152 } | |
153 | |
154 // Message to store information of an existing cache file. | |
155 message FileCacheEntry { | |
156 // MD5 of the cache file. | |
157 optional string md5 = 1; | |
158 | |
159 // True if the file is present locally. | |
160 optional bool is_present = 2; | |
161 | |
162 // True if the file is pinned (i.e. available offline). | |
163 optional bool is_pinned = 3; | |
164 | |
165 // True if the file is dirty (i.e. modified locally). | |
166 optional bool is_dirty = 4; | |
167 | |
168 // When adding a new state, be sure to update TestFileCacheState and test | |
169 // functions defined in test_util.cc. | |
170 } | |
OLD | NEW |