blob: bab42248be048c173fc773598e92accac9243e41 [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
[email protected]67241b832013-05-02 04:55:5224// File specific info, which is a part of ResourceEntry.
[email protected]164d5012013-05-20 12:47:1625message FileSpecificInfo {
[email protected]8a4c1d1a2012-07-21 05:12:1726 // This URL points to a thumbnail image. The thumbnail URL is not permanent
27 // as it's not protected by authentication. See crbug.com/127697 for how
28 // stale thumbnail URLs are handled.
29 optional string thumbnail_url = 1;
30
[email protected]09096752013-05-21 11:17:3531 // This URL is used for opening hosted documents with Google Drive's web
[email protected]8a4c1d1a2012-07-21 05:12:1732 // interface.
33 optional string alternate_url = 2;
34
35 // Content mime type like "text/plain".
36 optional string content_mime_type = 3;
37
[email protected]09096752013-05-21 11:17:3538 // The MD5 of contents of a regular file. Hosted files don't have MD5.
[email protected]d061c6b2013-06-07 14:46:3339 optional string md5 = 4;
[email protected]8a4c1d1a2012-07-21 05:12:1740
41 // File extension, including the dot, used for hosted documents
[email protected]09096752013-05-21 11:17:3542 // (ex. ".gsheet" for hosted spreadsheets).
[email protected]8a4c1d1a2012-07-21 05:12:1743 optional string document_extension = 5;
44
[email protected]09096752013-05-21 11:17:3545 // True if the file is a hosted document (i.e. document hosted on
46 // drive.google.com such as documents, spreadsheets, and presentations).
[email protected]8a4c1d1a2012-07-21 05:12:1747 optional bool is_hosted_document = 6;
[email protected]1e7b3c12013-06-26 11:56:1048
[email protected]b2b71db2013-07-26 08:28:0049 // The argument with ID 7 had been used, but got deleted. Next ID to use: 8.
[email protected]8a4c1d1a2012-07-21 05:12:1750}
51
[email protected]164d5012013-05-20 12:47:1652// Directory specific info, which is a part of ResourceEntry.
53message DirectorySpecificInfo {
[email protected]73deb662013-03-07 01:07:1454 // The changestamp of this directory. This value can be larger than the
[email protected]09096752013-05-21 11:17:3555 // changestamp of ResourceMetadata, if this directory was
[email protected]73deb662013-03-07 01:07:1456 // "fast-fetched". See crbug.com/178348 for details about the "fast-fetch"
57 // feature.
58 optional int64 changestamp = 1;
59}
60
[email protected]09096752013-05-21 11:17:3561// Represents metadata of a resource (file or directory) on Drive.
[email protected]67241b832013-05-02 04:55:5262message ResourceEntry {
[email protected]e9b26092012-04-12 18:38:3663 optional PlatformFileInfoProto file_info = 1;
[email protected]09096752013-05-21 11:17:3564 // Base name of the entry. The base name is used for file paths. Usually
65 // identical to |title|, but some extra number is inserted if multiple
66 // entries with the same title exist in the same directory, to ensure that
67 // file paths are unique. For instance, if two files titled "foo.jpg" exist
68 // in the same directory, which is allowed on drive.google.com, one of them
69 // will have a base name of "foo (2).jpg".
[email protected]fe6be482012-07-19 17:34:0270 optional string base_name = 2;
[email protected]09096752013-05-21 11:17:3571
72 // Title of the entry. See the comment at |base_name|.
[email protected]e9b26092012-04-12 18:38:3673 optional string title = 3;
[email protected]09096752013-05-21 11:17:3574
75 // Resource ID of the entry. Guaranteed to be unique.
[email protected]e9b26092012-04-12 18:38:3676 optional string resource_id = 4;
[email protected]09096752013-05-21 11:17:3577
[email protected]d38aa402013-09-25 09:38:4378 // Local ID of the entry.
79 optional string local_id = 15;
80
[email protected]943cb8b2013-08-21 03:17:0881 // Local ID of the parent entry.
82 optional string parent_local_id = 7;
[email protected]09096752013-05-21 11:17:3583
84 // This field is used for processing the change list from the
85 // server. Deleted entries won't be stored in ResourceMetadata.
[email protected]9eaae802012-09-12 00:12:1686 optional bool deleted = 11;
[email protected]09096752013-05-21 11:17:3587
[email protected]40687c02013-03-27 12:14:5888 // True if the entry is labeled with "shared-with-me".
89 optional bool shared_with_me = 14;
[email protected]8a4c1d1a2012-07-21 05:12:1790
91 // File specific information, such as MD5.
[email protected]164d5012013-05-20 12:47:1692 optional FileSpecificInfo file_specific_info = 9;
[email protected]73deb662013-03-07 01:07:1493
94 // Directory specific information, such as changestamp.
[email protected]164d5012013-05-20 12:47:1695 optional DirectorySpecificInfo directory_specific_info = 13;
[email protected]e9b26092012-04-12 18:38:3696}
97
[email protected]5a2e3a2f2013-04-26 08:04:3698// Container for the header part of ResourceMetadata.
99message ResourceMetadataHeader {
[email protected]df3fef22013-03-21 12:20:41100 // Monotonically increasing version number, which is changed when
101 // incompatible change is made to the DB format. kDBVersion in
102 // drive_resource_metadata_storage.h defines the current version.
103 optional int32 version = 1;
104 optional int64 largest_changestamp = 2;
105}
106
[email protected]12e4c182012-07-12 21:30:04107// Message to store information of an existing cache file.
[email protected]aa7365c2013-05-01 05:50:47108message FileCacheEntry {
[email protected]86981502013-09-10 16:02:02109 // MD5 of the cache file.
[email protected]12e4c182012-07-12 21:30:04110 optional string md5 = 1;
111
112 // True if the file is present locally.
113 optional bool is_present = 2;
114
115 // True if the file is pinned (i.e. available offline).
116 optional bool is_pinned = 3;
117
118 // True if the file is dirty (i.e. modified locally).
119 optional bool is_dirty = 4;
120
[email protected]eca3fc92013-05-01 03:53:40121 // When adding a new state, be sure to update TestFileCacheState and test
[email protected]86981502013-09-10 16:02:02122 // functions defined in test_util.cc.
[email protected]12e4c182012-07-12 21:30:04123}