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
StreamResourceenum:pub enum StreamResource { Read(Box<dyn DenoAsyncRead>), Write(Box<dyn DenoAsyncWrite>), ReadWrite(Box<dyn DenoAsyncReadWrite>), }
Managed to get
ioto work (read/write) but can't cast it to concrete type if another operation is needed. Eg.shutdownforTcpStream. Can revert toCliResourceenum 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):fsfile
tlsclient tls streamserver tls stream
nettcp stream
processchild stdinchild stdoutchild stderr
fetchhttp body
- no crate
stdinstdoutstderr
- on
nettlsserver tls stream
processfs- using file as stdout/stderr for process
- on