[email protected] | e9b2609 | 2012-04-12 18:38:36 | [diff] [blame] | 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 | // |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 5 | // Protocol buffer definitions for serializing Drive files and directories. |
[email protected] | e9b2609 | 2012-04-12 18:38:36 | [diff] [blame] | 6 | |
| 7 | syntax = "proto2"; |
| 8 | |
[email protected] | 93115b5 | 2012-11-12 21:36:20 | [diff] [blame^] | 9 | option optimize_for = LITE_RUNTIME; |
| 10 | |
[email protected] | d9d04df | 2012-10-12 07:06:35 | [diff] [blame] | 11 | package drive; |
[email protected] | e9b2609 | 2012-04-12 18:38:36 | [diff] [blame] | 12 | |
| 13 | // Represents base::PlatformFileInfo. |
| 14 | message PlatformFileInfoProto { |
| 15 | optional int64 size = 1; |
| 16 | optional bool is_directory = 2; |
| 17 | optional bool is_symbolic_link = 3; |
| 18 | optional int64 last_modified = 4; |
| 19 | optional int64 last_accessed = 5; |
| 20 | optional int64 creation_time = 6; |
| 21 | } |
| 22 | |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 23 | // File specific info, which is a part of DriveEntryProto. |
| 24 | message DriveFileSpecificInfo { |
[email protected] | 8a4c1d1a | 2012-07-21 05:12:17 | [diff] [blame] | 25 | // This URL points to a thumbnail image. The thumbnail URL is not permanent |
| 26 | // as it's not protected by authentication. See crbug.com/127697 for how |
| 27 | // stale thumbnail URLs are handled. |
| 28 | optional string thumbnail_url = 1; |
| 29 | |
| 30 | // This URL is used for opening hosted documents with Google Docs's web |
| 31 | // interface. |
| 32 | optional string alternate_url = 2; |
| 33 | |
| 34 | // Content mime type like "text/plain". |
| 35 | optional string content_mime_type = 3; |
| 36 | |
| 37 | // The MD5 of contents of a regular file. |
| 38 | optional string file_md5 = 4; |
| 39 | |
| 40 | // File extension, including the dot, used for hosted documents |
| 41 | // (ex. ".gsheet" for hosted spreadsheet documents). |
| 42 | optional string document_extension = 5; |
| 43 | |
| 44 | // True if the file is a hosted document. |
| 45 | optional bool is_hosted_document = 6; |
[email protected] | ae61827 | 2012-10-24 09:00:26 | [diff] [blame] | 46 | |
| 47 | // This URL points to a page containing Share UI for this document. |
| 48 | optional string share_url = 7; |
[email protected] | 8a4c1d1a | 2012-07-21 05:12:17 | [diff] [blame] | 49 | } |
| 50 | |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 51 | // Represents DriveEntry, DriveFile, and DriveDirectory without children. |
| 52 | message DriveEntryProto { |
[email protected] | e9b2609 | 2012-04-12 18:38:36 | [diff] [blame] | 53 | optional PlatformFileInfoProto file_info = 1; |
[email protected] | fe6be48 | 2012-07-19 17:34:02 | [diff] [blame] | 54 | optional string base_name = 2; |
[email protected] | e9b2609 | 2012-04-12 18:38:36 | [diff] [blame] | 55 | optional string title = 3; |
| 56 | optional string resource_id = 4; |
[email protected] | 71c53fd | 2012-04-14 00:10:16 | [diff] [blame] | 57 | optional string edit_url = 5; |
[email protected] | e9b2609 | 2012-04-12 18:38:36 | [diff] [blame] | 58 | optional string content_url = 6; |
[email protected] | 113707f4 | 2012-04-28 00:34:13 | [diff] [blame] | 59 | optional string parent_resource_id = 7; |
[email protected] | f8949b7 | 2012-07-18 22:16:08 | [diff] [blame] | 60 | // For a file, this is "resumable-edit-media" URL, used to update an |
| 61 | // existing file. For a directory, this is "resumable-create-media" URL, |
| 62 | // used to upload a new file to that directory. See |
| 63 | // https://developers.google.com/google-apps/documents-list/ |
| 64 | optional string upload_url = 8; |
[email protected] | d88bcba | 2012-09-14 06:12:01 | [diff] [blame] | 65 | // This stores a DriveEntryKind defined in drive_entry_kinds.h. |
| 66 | optional int32 kind = 12; |
[email protected] | 9eaae80 | 2012-09-12 00:12:16 | [diff] [blame] | 67 | // This field is used for processing the feeds from the server. Deleted |
| 68 | // entries won't be stored in the metadata storage. |
| 69 | optional bool deleted = 11; |
[email protected] | 8a4c1d1a | 2012-07-21 05:12:17 | [diff] [blame] | 70 | |
| 71 | // File specific information, such as MD5. |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 72 | optional DriveFileSpecificInfo file_specific_info = 9; |
[email protected] | e9b2609 | 2012-04-12 18:38:36 | [diff] [blame] | 73 | } |
| 74 | |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 75 | // Represents DriveDirectory. This message type is defined to keep children |
| 76 | // separate from DriveEntryProto. This design allows us to get the metadata |
| 77 | // of a directory efficiently as DriveEntryProto, without carrying the |
[email protected] | 8a4c1d1a | 2012-07-21 05:12:17 | [diff] [blame] | 78 | // metadata of children. |
| 79 | // |
| 80 | // TODO(satorux): With the new metadata storage system, we plan to store |
| 81 | // children as pairs of base name and resource ID. We should remove this |
| 82 | // message type once we get there. |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 83 | message DriveDirectoryProto { |
[email protected] | b87fcc3 | 2012-09-09 17:02:29 | [diff] [blame] | 84 | optional DriveEntryProto drive_entry = 1; |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 85 | repeated DriveDirectoryProto child_directories = 7; |
| 86 | repeated DriveEntryProto child_files = 9; |
[email protected] | e9b2609 | 2012-04-12 18:38:36 | [diff] [blame] | 87 | } |
[email protected] | 12e4c18 | 2012-07-12 21:30:04 | [diff] [blame] | 88 | |
[email protected] | 220e35f | 2012-07-18 17:32:16 | [diff] [blame] | 89 | // Container for the root directory and the largest changestamp. |
| 90 | // TODO(satorux): Remove this: crbug.com/137862 |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 91 | message DriveRootDirectoryProto { |
[email protected] | b87fcc3 | 2012-09-09 17:02:29 | [diff] [blame] | 92 | optional DriveDirectoryProto drive_directory = 1; |
[email protected] | 6cdb24e | 2012-08-09 04:00:17 | [diff] [blame] | 93 | optional int64 largest_changestamp = 4; |
[email protected] | 8a4c1d1a | 2012-07-21 05:12:17 | [diff] [blame] | 94 | // Monotonically increasing version number, which is changed when |
| 95 | // incompatible change is made in the proto file. |
[email protected] | b87fcc3 | 2012-09-09 17:02:29 | [diff] [blame] | 96 | // kProtoVersion in drive_files.h defines the current version. |
[email protected] | 8a4c1d1a | 2012-07-21 05:12:17 | [diff] [blame] | 97 | optional int32 version = 3; |
[email protected] | e9b2609 | 2012-04-12 18:38:36 | [diff] [blame] | 98 | } |
[email protected] | 12e4c18 | 2012-07-12 21:30:04 | [diff] [blame] | 99 | |
| 100 | // Message to store information of an existing cache file. |
| 101 | // Cache files are stored in 'tmp' or 'persistent' directory under the |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 102 | // root cache directory. See DriveCache::GetCacheRootPath(). |
| 103 | message DriveCacheEntry { |
[email protected] | 12e4c18 | 2012-07-12 21:30:04 | [diff] [blame] | 104 | // MD5 of the cache file. "local" if the file is locally modified. |
| 105 | optional string md5 = 1; |
| 106 | |
| 107 | // True if the file is present locally. |
| 108 | optional bool is_present = 2; |
| 109 | |
| 110 | // True if the file is pinned (i.e. available offline). |
| 111 | optional bool is_pinned = 3; |
| 112 | |
| 113 | // True if the file is dirty (i.e. modified locally). |
| 114 | optional bool is_dirty = 4; |
| 115 | |
| 116 | // True if the file is a mounted archive file. |
| 117 | optional bool is_mounted = 5; |
| 118 | |
| 119 | // True if the file is in the persistent directory. |
| 120 | optional bool is_persistent = 6; |
| 121 | |
[email protected] | 28a6409 | 2012-08-21 10:01:12 | [diff] [blame] | 122 | // When adding a new state, be sure to update TestDriveCacheState and test |
[email protected] | b87fcc3 | 2012-09-09 17:02:29 | [diff] [blame] | 123 | // functions defined in drive_test_util.cc. |
[email protected] | 12e4c18 | 2012-07-12 21:30:04 | [diff] [blame] | 124 | } |