flowd icon indicating copy to clipboard operation
flowd copied to clipboard

Add dynamic loading of components, add thread control handover to component

Open ERnsTL opened this issue 2 years ago • 0 comments

  • https://fasterthanli.me/articles/so-you-want-to-live-reload-rust

  • https://michael-f-bryan.github.io/rust-ffi-guide/dynamic_loading.html#loading-the-contrived-example

  • http://jakegoulding.com/rust-ffi-omnibus/

  • dlopen() a library and start a process() function for handling an IP for this component. DONE.

  • Problem is that:

    • the process has no control over from which inport it wants to read first
    • the process has no control over its own execution lifecycle at all, it cannot poll, it cannot wait for IO, it cannot practically spawn a sub-thread since it does not know when process() would be would be called again in order to send any IPs out
    • generating a possibly large amount of output packets can only be put into an output array of pointers, but this would defeat the concept of bounded connections
    • but allowing only a certain quantity of IPs is difficult - this would mean a need for ability to interrupt processing and generating IPs, leading to the next point:
    • storage of state, which seems difficult without re-implementing some sort of memory reservation and free routines
    • the process would have to know about how the Rust channels, Thread and JoinHandle work.
    • this would exclude certain programming languages and would mean having a C API header of sorts, making the interface complicated
    • should the same interface between componend and library be used as is used between flowd and component (the Component trait and its required parameters)?
  • How to include languages that would be better suited for STDIN/STDOUT communication or a pipe of sorts?

  • NOTE: It is possible to put a join handle and a Thread into an Arc and thus share it across threads. Just clone the Arc reference. https://doc.rust-lang.org/rust-by-example/std/arc.html

ERnsTL avatar Jul 20 '22 09:07 ERnsTL