Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: services/files/directory.mojom

Issue 875643004: Prototype of Files service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: moar comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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 module mojo.files;
6
7 import "services/files/file.mojom";
8 import "services/files/types.mojom";
9
10 // TODO(vtl): paths may be relative; should they allowed to be absolute?
11 // (currently not)
qsr 2015/03/03 11:56:44 Can you specify somewhere that all |path| in the d
viettrungluu 2015/03/03 18:50:35 Done.
12
13 // TODO(vtl): Write comments.
14 interface Directory {
15 // Operations about "this" |Directory|:
16
17 // TODO(vtl): Should we have a "close" method?
18
19 // Reads the contents of this directory.
20 // TODO(vtl): Clarify error codes versus |directory_contents|.
21 Read() => (Error error, array<DirectoryEntry>? directory_contents);
22
23 // Gets information about this directory. On success, |file_information| is
24 // non-null and will contain this information.
25 Stat() => (Error error, FileInformation? file_information);
26
27 // Updates this directory's atime and/or mtime to the time specified by
28 // |atime| (or |mtime|, respectively), which may also indicate "now". If
29 // |atime| or |mtime| is null, then the corresponding time is not modified.
30 Touch(TimespecOrNow? atime, TimespecOrNow? mtime) => (Error error);
31
32 // Operations *in* "this" |Directory|:
33
34 // Opens the file specified by |path| with the given |open_flags|. |file| is
35 // optional, mainly for consistency with |OpenDirectory()| (but may be useful,
36 // together with |kOpenFlagCreate|, for "touching" a file).
37 OpenFile(string path, File&? file, uint32 open_flags)
38 => (Error error);
39
40 // Opens the directory specified by |path|. |directory| is optional, so that
41 // this may be used as a simple "mkdir()" with |kOpenFlagCreate|.
qsr 2015/03/03 11:56:44 I guess "." is a valid path? Is this the way to du
viettrungluu 2015/03/03 18:50:35 That's a good point. Possibly Directory should hav
42 OpenDirectory(string path,
43 Directory&? directory,
44 uint32 open_flags) => (Error error);
45
46 // Renames/moves the file/directory given by |path| to |new_path|.
47 Rename(string path, string new_path) => (Error error);
48
49 // Deletes the given path, which may be a file or a directory (see
50 // |kDeleteFlag...| for details).
51 Delete(string path, uint32 delete_flags) => (Error error);
52
53 // TODO(vtl): directory "streaming"?
54 // TODO(vtl): "make root" (i.e., prevent cd-ing, etc., to parent); note that
55 // this would require a much more complicated implementation (e.g., it needs
56 // to be "inherited" by OpenDirectory(), and the enforcement needs to be valid
57 // even if the opened directory is subsequently moved -- e.g., closer to the
58 // "root")
qsr 2015/03/03 11:56:44 Agreed on letting this as a TODO, but shouldn't th
viettrungluu 2015/03/03 18:50:35 Being unable to chdir() out would make it difficul
qsr 2015/03/04 15:10:19 I see. But then, do you have any idea how to corre
59 // TODO(vtl): Add a "watch"?
60 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698