Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Design discussion #2

Closed
zeenix opened this issue Apr 5, 2021 · 1 comment
Closed

Design discussion #2

zeenix opened this issue Apr 5, 2021 · 1 comment

Comments

@zeenix
Copy link
Owner

zeenix commented Apr 5, 2021

This would be a follow-up from the discussion that started here. I'd like to discuss the basic approach taken here and how we can make the API work nicely before I finish the implementation, move this under smol-rs and release.

One problem with the simple async_channel aggregation approach is how one of the receiver in the chain might have a channel that's full or closed and Sender::{try_send, send} failing because of that, and even worse, some of the receivers getting the message while other don't. The latter is easy to fix as we can just not immediately error out on sending but rather send to everyone we possibly can and throw the error at the end. However, how do we combine errors from multiple channels and how useful is this to the user?

3 options come to mind:

  1. We make this an explicit async_channel::Sender aggregator, where user explicitly add and remove Sender instances (that they create themselves). While this is simple, it also means this crate basically just provides a send loop and hence not useful.

  2. Add API in async_channel to create leaky channels (that is, when channel is full, the last message is popped to make room) and use that here. However, what to do about a closed channel?

  3. Don't use async_channel at all and just try to create an API similar to that of tokio's broadcast channel.

@zeenix
Copy link
Owner Author

zeenix commented Apr 28, 2021

Ok, seems there already was a WIP project for this so I'll archive this project.

@zeenix zeenix closed this as completed Apr 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant