CLI things that should be resources:
- global_timer
- start_time
- other timers
- metrics? (it'd be nice if they were resources, but I fear it might be slow because of double lookup for each op)
Problems with refactor:
-
no way for full polymorphism Tried with
StreamResource
enum:pub enum StreamResource { Read(Box<dyn DenoAsyncRead>), Write(Box<dyn DenoAsyncWrite>), ReadWrite(Box<dyn DenoAsyncReadWrite>), }
Managed to get
io
to work (read/write) but can't cast it to concrete type if another operation is needed. Eg.shutdown
forTcpStream
. Can revert toCliResource
enum but that doesn't play nicely with splitting ops to separate crates. -
need to untangle worker resource It's used in numerous places -
cli/state.rs
,cli/worker.rs
,cli/ops/workers.rs
. It might make more sense to do denoland/deno#3116 before resources. -
move as much stuff as possible from
ThreadSafeState
-
dependent op modules
- on
io
(AsyncRead
/AsyncWrite
):fs
file
tls
client tls stream
server tls stream
net
tcp stream
process
child stdin
child stdout
child stderr
fetch
http body
- no crate
stdin
stdout
stderr
- on
net
tls
server tls stream
process
fs
- using file as stdout/stderr for process
- on