Index: services/file_manager/file.mojom |
diff --git a/services/file_manager/file.mojom b/services/file_manager/file.mojom |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bb2915a7611e5fae99b1941bde72ad55c50e8da1 |
--- /dev/null |
+++ b/services/file_manager/file.mojom |
@@ -0,0 +1,50 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+//FIXME FIXME FIXME: notes to self: |
+// - file offsets, file positions, and file sizes are int64 (though positions |
+// and sizes must always be non-negative) |
+// - buffer size parameters (for read/write) are uint32 |
+// - timestamps are int64, milliseconds since Unix epoch (i.e., dubious) |
+ |
+module mojo.files; |
+ |
+import "services/file_manager/types.mojom"; |
+ |
+interface File { |
+ Close() => (Error err); |
+ |
+ Read(uint32 num_bytes_to_read, int64 offset, Whence whence) |
+ => (Error error, array<uint8>? bytes_read); |
+ Write(array<uint8> bytes_to_write, int64 offset, Whence whence) |
+ => (Error error, uint32 num_bytes_written); |
+ |
+ ReadStream(handle<data_pipe_producer> source, int64 offset, Whence whence) |
darin (slow to review)
2015/02/06 23:36:11
nit: maybe this should be called ReadToStream? sho
vtl
2015/02/06 23:51:50
Maybe?
darin (slow to review)
2015/02/07 00:05:53
OK, yes... I got myself confused. The name ReadStr
|
+ => (Error error); |
+ WriteStream(handle<data_pipe_consumer> sink, int64 offset, Whence whence) |
+ => (Error error); |
+ |
+ Tell() => (Error error, int64 position); |
darin (slow to review)
2015/02/06 23:36:11
is the point of these to enable some read-ahead op
vtl
2015/02/06 23:51:49
If you want to support POSIX-ish/standard C librar
darin (slow to review)
2015/02/07 00:05:53
OK, I see.
|
+ Seek(int64 offset, Whence whence) => (Error error, int64 position); |
+ |
+ Stat() => (Error error, FileInformation? file_information); |
+ Truncate(int64 size) => (Error error); |
+ // TODO(vtl): null |times| means "now" (for both atime and mtime). |
+ Touch(FileTimes? times) => (Error error); |
+ |
+ // TODO(vtl): |Dup()| shares the same file description (i.e., mode and |
+ // position). |
+ Dup(File& file) => (Error error); |
+ // TODO(vtl): What are the rules for reopening (w.r.t. changing mode/flags). |
+ // E.g., obviously can go from "read-write" to "read", but reverse? (probably |
+ // not), can remove "append"? (probably not?). Do we allow "truncate"? |
+ Reopen(File& file, uint32 access_flags, uint32 open_flags) |
+ => (Error error); |
+ |
+ // TODO(vtl): probably should have access flags (but also exec?); how do these |
+ // relate to access mode? |
+ AsBuffer() => (Error error, handle<shared_buffer>? buffer); |
darin (slow to review)
2015/02/06 23:36:11
how about Read/Write variants that take a SHM hand
vtl
2015/02/06 23:51:49
They don't have to map the entire file (buffer han
darin (slow to review)
2015/02/07 00:05:53
I see.
|
+ |
+ // TODO(vtl): Add a "watch"? |
+}; |