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:
Call a function in process A, say, start_handshake_channel(to: Address) -> Channel,
That will send & await to the given to: Address,
to:Address will reply_handshake_channel() -> Channel (or something like that),
As a result, both sides have a channel. That channel has associated methods .send() and .receive(),
When .send(), put the message in a queue that can be accessed by the other side .receive()ing.
Other things that would be cool:
select() over a variety of channels (and perhaps await_message() as well?); this could lead to some very nice & readable logic,
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:
What is scope?
Where does channel queue live?
Is it correct to do the two-way channels above or should they be one-way?
How much of this work should be done in kernel vs at process_lib level?
Proposals at answers:
No cloning, but design queues in a way that they can be extended to cloning, if possible,
Not certain; the answer to this makes it easy/hard to extend to cloning,
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,
Currently, processes use
Request
andResponse
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:start_handshake_channel(to: Address) -> Channel
,to: Address
,to:Address
willreply_handshake_channel() -> Channel
(or something like that),.send()
and.receive()
,.send()
, put the message in a queue that can be accessed by the other side.receive()
ing.Other things that would be cool:
select()
over a variety of channels (and perhapsawait_message()
as well?); this could lead to some very nice & readable logic,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:
Proposals at answers: