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

Interloop (trio <-> asyncio) memory channel design #273

Open
goodboy opened this issue Dec 12, 2021 · 0 comments
Open

Interloop (trio <-> asyncio) memory channel design #273

goodboy opened this issue Dec 12, 2021 · 0 comments
Labels
api discussion experiment Exploratory design and testing help wanted Extra attention is needed

Comments

@goodboy
Copy link
Owner

goodboy commented Dec 12, 2021

With the completion of #121 we now have a way to wrangle asyncio code
from SC-actor-land.

One of the obvious ugly parts of the current api is the delivery of an
asyncio.Queue to the target asyncio task. In keeping with trio
style it would be much better to offer a small abstraction much like
trio.abc.Channel to make asyncio-side streaming semantics more
elegant.

We already introduced a LinkedTaskChannel as part of #121
for the trio side and it would be handy to have something equivalent
for asyncio tasks.


Some design options:

  • make two types of LinkedTaskChannels, one for each task in each loop
    • probably allows the most flexibility for the apis allowed from either task and is most explicit type-wise?
  • universal queue ideas from the trio peeps:
  • adopt either directly or by inspiration some stream apis from anyio?
    • we could adopt a stapeled stream style where we dynamically figure out which loop the channel object is being used in and then runtime-define the methods implementations? This might allow for a more symmetric channel api/object at the expense of some magical method definitions?
  • consider adding a .started() method to whatever the asyncio-side channel type ends up being much like the anyio.from_thread.BlockingPortal.start_task()/trio.Nursery.start() target function mechanisms. This would allow us to avoid the current manual first-sent-value-ublocks-the-trio side to_asyncio.open_channel_from() entry.

Very open to and interested in other ideas (and further discussion) from the lurkerz.

@goodboy goodboy added help wanted Extra attention is needed discussion api labels Dec 12, 2021
@goodboy goodboy mentioned this issue Dec 17, 2021
16 tasks
@goodboy goodboy added the experiment Exploratory design and testing label Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api discussion experiment Exploratory design and testing help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant