Skip to content

Commit

Permalink
port cli/ops/fs.rs to json ops, part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Aug 24, 2019
1 parent d32dfd6 commit 6ce3816
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 306 deletions.
48 changes: 0 additions & 48 deletions cli/msg.fbs
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
union Any {
Cwd,
CwdRes,
Link,
MakeTempDir,
MakeTempDirRes,
Read,
ReadRes,
Readlink,
ReadlinkRes,
Rename,
Seek,
Symlink,
Truncate,
Write,
WriteRes,
}
Expand Down Expand Up @@ -117,44 +107,6 @@ table KeyValue {
value: string;
}

table MakeTempDir {
dir: string;
prefix: string;
suffix: string;
}

table MakeTempDirRes {
path: string;
}

table Rename {
oldpath: string;
newpath: string;
}

table Readlink {
name: string;
}

table ReadlinkRes {
path: string;
}

table Symlink {
oldname: string;
newname: string;
}

table Link {
oldname: string;
newname: string;
}

table Truncate {
name: string;
len: uint;
}

table Read {
rid: uint32;
// (ptr, len) is passed as second parameter to Deno.core.send().
Expand Down
15 changes: 2 additions & 13 deletions cli/ops/dispatch_flatbuffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ use deno::*;
use flatbuffers::FlatBufferBuilder;
use hyper::rt::Future;

use super::files::{op_read, op_write};
use super::fs::{
op_cwd, op_link, op_make_temp_dir, op_read_link, op_rename, op_symlink,
op_truncate,
};

type CliDispatchFn = fn(
state: &ThreadSafeState,
base: &msg::Base<'_>,
data: Option<PinnedBuf>,
) -> CliOpResult;

use super::files::{op_read, op_write};

/// Processes raw messages from JavaScript.
/// This functions invoked every time Deno.core.dispatch() is called.
/// control corresponds to the first argument of Deno.core.dispatch().
Expand Down Expand Up @@ -124,14 +120,7 @@ pub fn serialize_response(
/// Standard ops set for most isolates
pub fn op_selector_std(inner_type: msg::Any) -> Option<CliDispatchFn> {
match inner_type {
msg::Any::Cwd => Some(op_cwd),
msg::Any::Link => Some(op_link),
msg::Any::MakeTempDir => Some(op_make_temp_dir),
msg::Any::Read => Some(op_read),
msg::Any::Readlink => Some(op_read_link),
msg::Any::Rename => Some(op_rename),
msg::Any::Symlink => Some(op_symlink),
msg::Any::Truncate => Some(op_truncate),
msg::Any::Write => Some(op_write),

_ => None,
Expand Down
Loading

0 comments on commit 6ce3816

Please sign in to comment.