Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide tokio::sync::mpsc-like communication between processes #174

Open
nick1udwig opened this issue Jan 18, 2024 · 0 comments
Open

provide tokio::sync::mpsc-like communication between processes #174

nick1udwig opened this issue Jan 18, 2024 · 0 comments

Comments

@nick1udwig
Copy link
Contributor

Currently, processes use Request and Response builders to message each other.

It would be nice to have an alternative mode of inter-process communication, modeled on tokio::sync::mpsc channels.

Proposed usage is very inspired by mpsc, but a bit different:

  1. Call a function in process A, say, start_handshake_channel(to: Address) -> Channel,
  2. That will send & await to the given to: Address,
  3. to:Address will reply_handshake_channel() -> Channel (or something like that),
  4. As a result, both sides have a channel. That channel has associated methods .send() and .receive(),
  5. When .send(), put the message in a queue that can be accessed by the other side .receive()ing.

Other things that would be cool:

  1. select() over a variety of channels (and perhaps await_message() as well?); this could lead to some very nice & readable logic,
  2. clone_channel(to: Address): give an existing channel to another process; useful for broadcasting and/or multiple speakers to one receiver; would require that the queue not pop off the element upon read, but one queue be maintained per process.

Open questions:

  1. What is scope?
  2. Where does channel queue live?
  3. Is it correct to do the two-way channels above or should they be one-way?
  4. How much of this work should be done in kernel vs at process_lib level?

Proposals at answers:

  1. No cloning, but design queues in a way that they can be extended to cloning, if possible,
  2. Not certain; the answer to this makes it easy/hard to extend to cloning,
  3. I like two-way, but one-way is likely simpler; it'd just lead to more code for devs who want to use two-way,
  4. Not certain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant