From 077af20ceb0869ddff9e08f5db1055138450fe2e Mon Sep 17 00:00:00 2001 From: "Kevin (Kun) \"Kassimo\" Qian" Date: Mon, 18 Feb 2019 15:26:41 -0800 Subject: Add `seek` and implement `Seeker` on `File` (#1797) This patch contains a special hack that circumvents the current tokio seek problem. tokio `seek` is implemented to take ownership of the original File and emit a new one in its future, which conflicts with the design of ResourceTable. To avoid the problem, the current hack makes the FsFile resource an Option which we could `take` the value ownership out of it. We then convert the tokio File into a Rust std File, perform the seek, and then put it back into the resource. This might be able to drop this hack after https://github.com/tokio-rs/tokio/pull/785 lands. --- src/msg.fbs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/msg.fbs') diff --git a/src/msg.fbs b/src/msg.fbs index fcf29ad58..9776bb893 100644 --- a/src/msg.fbs +++ b/src/msg.fbs @@ -65,6 +65,7 @@ union Any { NowRes, IsTTY, IsTTYRes, + Seek, } enum ErrorKind: byte { @@ -117,6 +118,7 @@ enum ErrorKind: byte { // custom errors InvalidUri, + InvalidSeekMode, } table Cwd {} @@ -496,4 +498,10 @@ table IsTTYRes { stderr: bool; } +table Seek { + rid: uint32; + offset: int; + whence: uint; +} + root_type Base; -- cgit v1.2.3