2019-01-21 14:03:30 -05:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-09-02 17:07:11 -04:00
|
|
|
import * as minimal from "./dispatch_minimal.ts";
|
|
|
|
import * as json from "./dispatch_json.ts";
|
2018-09-05 22:13:36 -04:00
|
|
|
|
2019-08-21 20:42:48 -04:00
|
|
|
// These consts are shared with Rust. Update with care.
|
2019-10-01 18:51:05 -04:00
|
|
|
export let OP_READ: number;
|
|
|
|
export let OP_WRITE: number;
|
|
|
|
export let OP_EXIT: number;
|
|
|
|
export let OP_IS_TTY: number;
|
|
|
|
export let OP_ENV: number;
|
|
|
|
export let OP_EXEC_PATH: number;
|
|
|
|
export let OP_UTIME: number;
|
|
|
|
export let OP_SET_ENV: number;
|
2019-10-02 11:55:28 -04:00
|
|
|
export let OP_GET_ENV: number;
|
2019-10-01 18:51:05 -04:00
|
|
|
export let OP_HOME_DIR: number;
|
|
|
|
export let OP_START: number;
|
|
|
|
export let OP_APPLY_SOURCE_MAP: number;
|
|
|
|
export let OP_FORMAT_ERROR: number;
|
|
|
|
export let OP_CACHE: number;
|
|
|
|
export let OP_FETCH_SOURCE_FILES: number;
|
|
|
|
export let OP_OPEN: number;
|
|
|
|
export let OP_CLOSE: number;
|
|
|
|
export let OP_SEEK: number;
|
|
|
|
export let OP_FETCH: number;
|
|
|
|
export let OP_METRICS: number;
|
|
|
|
export let OP_REPL_START: number;
|
|
|
|
export let OP_REPL_READLINE: number;
|
|
|
|
export let OP_ACCEPT: number;
|
2019-10-21 14:38:28 -04:00
|
|
|
export let OP_ACCEPT_TLS: number;
|
2019-10-01 18:51:05 -04:00
|
|
|
export let OP_DIAL: number;
|
|
|
|
export let OP_SHUTDOWN: number;
|
|
|
|
export let OP_LISTEN: number;
|
2019-10-21 14:38:28 -04:00
|
|
|
export let OP_LISTEN_TLS: number;
|
2019-10-01 18:51:05 -04:00
|
|
|
export let OP_RESOURCES: number;
|
|
|
|
export let OP_GET_RANDOM_VALUES: number;
|
|
|
|
export let OP_GLOBAL_TIMER_STOP: number;
|
|
|
|
export let OP_GLOBAL_TIMER: number;
|
|
|
|
export let OP_NOW: number;
|
2019-10-27 11:22:53 -04:00
|
|
|
export let OP_QUERY_PERMISSION: number;
|
2019-10-01 18:51:05 -04:00
|
|
|
export let OP_REVOKE_PERMISSION: number;
|
2019-11-11 10:33:29 -05:00
|
|
|
export let OP_REQUEST_PERMISSION: number;
|
2019-10-01 18:51:05 -04:00
|
|
|
export let OP_CREATE_WORKER: number;
|
|
|
|
export let OP_HOST_GET_WORKER_CLOSED: number;
|
|
|
|
export let OP_HOST_POST_MESSAGE: number;
|
|
|
|
export let OP_HOST_GET_MESSAGE: number;
|
|
|
|
export let OP_WORKER_POST_MESSAGE: number;
|
|
|
|
export let OP_WORKER_GET_MESSAGE: number;
|
|
|
|
export let OP_RUN: number;
|
|
|
|
export let OP_RUN_STATUS: number;
|
|
|
|
export let OP_KILL: number;
|
|
|
|
export let OP_CHDIR: number;
|
|
|
|
export let OP_MKDIR: number;
|
|
|
|
export let OP_CHMOD: number;
|
|
|
|
export let OP_CHOWN: number;
|
|
|
|
export let OP_REMOVE: number;
|
|
|
|
export let OP_COPY_FILE: number;
|
|
|
|
export let OP_STAT: number;
|
|
|
|
export let OP_READ_DIR: number;
|
|
|
|
export let OP_RENAME: number;
|
|
|
|
export let OP_LINK: number;
|
|
|
|
export let OP_SYMLINK: number;
|
|
|
|
export let OP_READ_LINK: number;
|
|
|
|
export let OP_TRUNCATE: number;
|
|
|
|
export let OP_MAKE_TEMP_DIR: number;
|
|
|
|
export let OP_CWD: number;
|
|
|
|
export let OP_FETCH_ASSET: number;
|
|
|
|
export let OP_DIAL_TLS: number;
|
|
|
|
export let OP_HOSTNAME: number;
|
2019-05-03 00:06:43 -04:00
|
|
|
|
2019-08-23 01:30:14 -04:00
|
|
|
export function asyncMsgFromRust(opId: number, ui8: Uint8Array): void {
|
2019-08-21 20:42:48 -04:00
|
|
|
switch (opId) {
|
|
|
|
case OP_WRITE:
|
|
|
|
case OP_READ:
|
2019-08-23 01:30:14 -04:00
|
|
|
minimal.asyncMsgFromRust(opId, ui8);
|
|
|
|
break;
|
2019-08-26 08:50:21 -04:00
|
|
|
case OP_EXIT:
|
|
|
|
case OP_IS_TTY:
|
|
|
|
case OP_ENV:
|
|
|
|
case OP_EXEC_PATH:
|
2019-08-23 01:30:14 -04:00
|
|
|
case OP_UTIME:
|
2019-08-26 08:50:21 -04:00
|
|
|
case OP_OPEN:
|
|
|
|
case OP_SEEK:
|
|
|
|
case OP_FETCH:
|
|
|
|
case OP_REPL_START:
|
|
|
|
case OP_REPL_READLINE:
|
|
|
|
case OP_ACCEPT:
|
2019-10-21 14:38:28 -04:00
|
|
|
case OP_ACCEPT_TLS:
|
2019-08-26 08:50:21 -04:00
|
|
|
case OP_DIAL:
|
|
|
|
case OP_GLOBAL_TIMER:
|
|
|
|
case OP_HOST_GET_WORKER_CLOSED:
|
|
|
|
case OP_HOST_GET_MESSAGE:
|
|
|
|
case OP_WORKER_GET_MESSAGE:
|
|
|
|
case OP_RUN_STATUS:
|
2019-08-26 10:18:42 -04:00
|
|
|
case OP_MKDIR:
|
|
|
|
case OP_CHMOD:
|
|
|
|
case OP_CHOWN:
|
|
|
|
case OP_REMOVE:
|
|
|
|
case OP_COPY_FILE:
|
|
|
|
case OP_STAT:
|
|
|
|
case OP_READ_DIR:
|
|
|
|
case OP_RENAME:
|
|
|
|
case OP_LINK:
|
|
|
|
case OP_SYMLINK:
|
|
|
|
case OP_READ_LINK:
|
|
|
|
case OP_TRUNCATE:
|
|
|
|
case OP_MAKE_TEMP_DIR:
|
2019-09-23 14:40:38 -04:00
|
|
|
case OP_DIAL_TLS:
|
2019-10-03 07:23:29 -04:00
|
|
|
case OP_FETCH_SOURCE_FILES:
|
2019-08-23 01:30:14 -04:00
|
|
|
json.asyncMsgFromRust(opId, ui8);
|
2019-08-21 20:42:48 -04:00
|
|
|
break;
|
|
|
|
default:
|
2019-08-26 08:50:21 -04:00
|
|
|
throw Error("bad async opId");
|
2018-08-30 15:35:51 -04:00
|
|
|
}
|
|
|
|
}
|