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

Add rpc::all function #554

Open
Thomasdezeeuw opened this issue Apr 16, 2022 · 0 comments
Open

Add rpc::all function #554

Thomasdezeeuw opened this issue Apr 16, 2022 · 0 comments
Labels
enhancement An improvement of the API. idea An idea, open to discussion. performance Performance related issue. priority:low Low priority issue.

Comments

@Thomasdezeeuw
Copy link
Owner

Goals:

  • Minimal number of wakeups of the caller (ideally only 1 when all calls have return or errored).
  • Minimal amount of allocations.

API idea

/// Run multple RPCs concurrently.
fn all<I, Res>(rpc: I) -> Res
where
    I: ExactSizeIterator<RPC<T>>,
    Res: FromIterator<Result<T, SendError>>,
{
    // ...
}

Specially design task::Waker implementation that only wakes if all responses are ready, or if one errored (?).
Waker called:

  • If message not yet send -> wake to send message.
  • If message is already send -> don't wake, mark the message as ready to receive.
@Thomasdezeeuw Thomasdezeeuw added enhancement An improvement of the API. priority:low Low priority issue. idea An idea, open to discussion. performance Performance related issue. labels Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of the API. idea An idea, open to discussion. performance Performance related issue. priority:low Low priority issue.
Projects
None yet
Development

No branches or pull requests

1 participant