mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
port more ops to JSON (#2809)
This commit is contained in:
parent
79f82cf10e
commit
137f33733d
26 changed files with 640 additions and 1147 deletions
127
cli/ops/mod.rs
127
cli/ops/mod.rs
|
@ -45,6 +45,29 @@ pub const OP_OPEN: OpId = 15;
|
|||
pub const OP_CLOSE: OpId = 16;
|
||||
pub const OP_SEEK: OpId = 17;
|
||||
pub const OP_FETCH: OpId = 18;
|
||||
pub const OP_METRICS: OpId = 19;
|
||||
pub const OP_REPL_START: OpId = 20;
|
||||
pub const OP_REPL_READLINE: OpId = 21;
|
||||
pub const OP_ACCEPT: OpId = 22;
|
||||
pub const OP_DIAL: OpId = 23;
|
||||
pub const OP_SHUTDOWN: OpId = 24;
|
||||
pub const OP_LISTEN: OpId = 25;
|
||||
pub const OP_RESOURCES: OpId = 26;
|
||||
pub const OP_GET_RANDOM_VALUES: OpId = 27;
|
||||
pub const OP_GLOBAL_TIMER_STOP: OpId = 28;
|
||||
pub const OP_GLOBAL_TIMER: OpId = 29;
|
||||
pub const OP_NOW: OpId = 30;
|
||||
pub const OP_PERMISSIONS: OpId = 31;
|
||||
pub const OP_REVOKE_PERMISSION: OpId = 32;
|
||||
pub const OP_CREATE_WORKER: OpId = 33;
|
||||
pub const OP_HOST_GET_WORKER_CLOSED: OpId = 34;
|
||||
pub const OP_HOST_POST_MESSAGE: OpId = 35;
|
||||
pub const OP_HOST_GET_MESSAGE: OpId = 36;
|
||||
pub const OP_WORKER_POST_MESSAGE: OpId = 37;
|
||||
pub const OP_WORKER_GET_MESSAGE: OpId = 38;
|
||||
pub const OP_RUN: OpId = 39;
|
||||
pub const OP_RUN_STATUS: OpId = 40;
|
||||
pub const OP_KILL: OpId = 41;
|
||||
|
||||
pub fn dispatch(
|
||||
state: &ThreadSafeState,
|
||||
|
@ -112,9 +135,113 @@ pub fn dispatch(
|
|||
OP_SEEK => {
|
||||
dispatch_json::dispatch(files::op_seek, state, control, zero_copy)
|
||||
}
|
||||
OP_METRICS => {
|
||||
dispatch_json::dispatch(metrics::op_metrics, state, control, zero_copy)
|
||||
}
|
||||
OP_FETCH => {
|
||||
dispatch_json::dispatch(fetch::op_fetch, state, control, zero_copy)
|
||||
}
|
||||
OP_REPL_START => {
|
||||
dispatch_json::dispatch(repl::op_repl_start, state, control, zero_copy)
|
||||
}
|
||||
OP_REPL_READLINE => {
|
||||
dispatch_json::dispatch(repl::op_repl_readline, state, control, zero_copy)
|
||||
}
|
||||
OP_ACCEPT => {
|
||||
dispatch_json::dispatch(net::op_accept, state, control, zero_copy)
|
||||
}
|
||||
OP_DIAL => dispatch_json::dispatch(net::op_dial, state, control, zero_copy),
|
||||
OP_SHUTDOWN => {
|
||||
dispatch_json::dispatch(net::op_shutdown, state, control, zero_copy)
|
||||
}
|
||||
OP_LISTEN => {
|
||||
dispatch_json::dispatch(net::op_listen, state, control, zero_copy)
|
||||
}
|
||||
OP_RESOURCES => dispatch_json::dispatch(
|
||||
resources::op_resources,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_GET_RANDOM_VALUES => dispatch_json::dispatch(
|
||||
random::op_get_random_values,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_GLOBAL_TIMER_STOP => dispatch_json::dispatch(
|
||||
timers::op_global_timer_stop,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_GLOBAL_TIMER => dispatch_json::dispatch(
|
||||
timers::op_global_timer,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_NOW => {
|
||||
dispatch_json::dispatch(performance::op_now, state, control, zero_copy)
|
||||
}
|
||||
OP_PERMISSIONS => dispatch_json::dispatch(
|
||||
permissions::op_permissions,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_REVOKE_PERMISSION => dispatch_json::dispatch(
|
||||
permissions::op_revoke_permission,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_CREATE_WORKER => dispatch_json::dispatch(
|
||||
workers::op_create_worker,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_HOST_GET_WORKER_CLOSED => dispatch_json::dispatch(
|
||||
workers::op_host_get_worker_closed,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_HOST_POST_MESSAGE => dispatch_json::dispatch(
|
||||
workers::op_host_post_message,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_HOST_GET_MESSAGE => dispatch_json::dispatch(
|
||||
workers::op_host_get_message,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
// TODO: make sure these two ops are only accessible to appropriate Workers
|
||||
OP_WORKER_POST_MESSAGE => dispatch_json::dispatch(
|
||||
workers::op_worker_post_message,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_WORKER_GET_MESSAGE => dispatch_json::dispatch(
|
||||
workers::op_worker_get_message,
|
||||
state,
|
||||
control,
|
||||
zero_copy,
|
||||
),
|
||||
OP_RUN => {
|
||||
dispatch_json::dispatch(process::op_run, state, control, zero_copy)
|
||||
}
|
||||
OP_RUN_STATUS => {
|
||||
dispatch_json::dispatch(process::op_run_status, state, control, zero_copy)
|
||||
}
|
||||
OP_KILL => {
|
||||
dispatch_json::dispatch(process::op_kill, state, control, zero_copy)
|
||||
}
|
||||
OP_FLATBUFFER => dispatch_flatbuffers::dispatch(state, control, zero_copy),
|
||||
_ => panic!("bad op_id"),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue