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

Re-focus public API on Address & Mailbox aka short-lived Context #126

Closed
thomaseizinger opened this issue Jul 14, 2022 · 1 comment · Fixed by #133
Closed

Re-focus public API on Address & Mailbox aka short-lived Context #126

thomaseizinger opened this issue Jul 14, 2022 · 1 comment · Fixed by #133
Milestone

Comments

@thomaseizinger
Copy link
Collaborator

As part of doing #122, I started to form the following vision:

  • Chan should be the core channel implementation of the library, Move channel logic into Chan #122 gets us most of the way there
  • Sender and Receiver only really add an opinionated interfaces on top of it, plus reference counting
  • Neither Sender nor Receiver are publicly exposed, meaning I think they don't actually have to exist
  • Sender can be completely inlined into Address, removing an entire layer of indirection
  • Receiver can be promoted to a type called Mailbox that could be publicly exposed
  • Context would be something that is constructed only temporarily for the invocation of a handler (I think we discussed this idea at some point)

Putting all of this together, we could realise an API like this:

let (mailbox, address) = Mailbox::bounded(5);

tokio::spawn(xtra::run(mailbox, MyActor::new()));

With run being implemented more or less like what we have today.

@thomaseizinger thomaseizinger changed the title Vision for 0.6 release Re-focus public API on Address & Mailbox aka short-lived Context Jul 15, 2022
@thomaseizinger thomaseizinger linked a pull request Jul 16, 2022 that will close this issue
2 tasks
@Restioson
Copy link
Owner

I think this makes sense!

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

Successfully merging a pull request may close this issue.

2 participants