blob: dc1ba44f2908e9d9b1c1b953e80b8fdeffd3687c [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]28a64092012-08-21 10:01:125// Protocol buffer definitions for serializing Drive files and directories.
[email protected]e9b26092012-04-12 18:38:366
7syntax = "proto2";
8
[email protected]93115b52012-11-12 21:36:209option optimize_for = LITE_RUNTIME;
10
[email protected]d9d04df2012-10-12 07:06:3511package drive;
[email protected]e9b26092012-04-12 18:38:3612
13// Represents base::PlatformFileInfo.
14message 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]28a64092012-08-21 10:01:1223// File specific info, which is a part of DriveEntryProto.
24message DriveFileSpecificInfo {
[email protected]8a4c1d1a2012-07-21 05:12:1725 // 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]ae618272012-10-24 09:00:2646
47 // This URL points to a page containing Share UI for this document.
48 optional string share_url = 7;
[email protected]8a4c1d1a2012-07-21 05:12:1749}
50
[email protected]28a64092012-08-21 10:01:1251// Represents DriveEntry, DriveFile, and DriveDirectory without children.
52message DriveEntryProto {
[email protected]e9b26092012-04-12 18:38:3653 optional PlatformFileInfoProto file_info = 1;
[email protected]fe6be482012-07-19 17:34:0254 optional string base_name = 2;
[email protected]e9b26092012-04-12 18:38:3655 optional string title = 3;
56 optional string resource_id = 4;
[email protected]71c53fd2012-04-14 00:10:1657 optional string edit_url = 5;
[email protected]e9b26092012-04-12 18:38:3658 optional string content_url = 6;
[email protected]113707f42012-04-28 00:34:1359 optional string parent_resource_id = 7;
[email protected]f8949b72012-07-18 22:16:0860 // 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]d88bcba2012-09-14 06:12:0165 // This stores a DriveEntryKind defined in drive_entry_kinds.h.
66 optional int32 kind = 12;
[email protected]9eaae802012-09-12 00:12:1667 // 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]8a4c1d1a2012-07-21 05:12:1770
71 // File specific information, such as MD5.
[email protected]28a64092012-08-21 10:01:1272 optional DriveFileSpecificInfo file_specific_info = 9;
[email protected]e9b26092012-04-12 18:38:3673}
74
[email protected]28a64092012-08-21 10:01:1275// 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]8a4c1d1a2012-07-21 05:12:1778// 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]28a64092012-08-21 10:01:1283message DriveDirectoryProto {
[email protected]b87fcc32012-09-09 17:02:2984 optional DriveEntryProto drive_entry = 1;
[email protected]28a64092012-08-21 10:01:1285 repeated DriveDirectoryProto child_directories = 7;
86 repeated DriveEntryProto child_files = 9;
[email protected]e9b26092012-04-12 18:38:3687}
[email protected]12e4c182012-07-12 21:30:0488
[email protected]220e35f2012-07-18 17:32:1689// Container for the root directory and the largest changestamp.
90// TODO(satorux): Remove this: crbug.com/137862
[email protected]28a64092012-08-21 10:01:1291message DriveRootDirectoryProto {
[email protected]b87fcc32012-09-09 17:02:2992 optional DriveDirectoryProto drive_directory = 1;
[email protected]6cdb24e2012-08-09 04:00:1793 optional int64 largest_changestamp = 4;
[email protected]8a4c1d1a2012-07-21 05:12:1794 // Monotonically increasing version number, which is changed when
95 // incompatible change is made in the proto file.
[email protected]b87fcc32012-09-09 17:02:2996 // kProtoVersion in drive_files.h defines the current version.
[email protected]8a4c1d1a2012-07-21 05:12:1797 optional int32 version = 3;
[email protected]e9b26092012-04-12 18:38:3698}
[email protected]12e4c182012-07-12 21:30:0499
100// Message to store information of an existing cache file.
101// Cache files are stored in 'tmp' or 'persistent' directory under the
[email protected]28a64092012-08-21 10:01:12102// root cache directory. See DriveCache::GetCacheRootPath().
103message DriveCacheEntry {
[email protected]12e4c182012-07-12 21:30:04104 // 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]28a64092012-08-21 10:01:12122 // When adding a new state, be sure to update TestDriveCacheState and test
[email protected]b87fcc32012-09-09 17:02:29123 // functions defined in drive_test_util.cc.
[email protected]12e4c182012-07-12 21:30:04124}