Conversation
Non-streaming methods now run as a two-coroutine pipeline: a request coroutine dispatches incoming requests to the handler, and a response coroutine drains completed replies from a toolbelt::SharedPtrPipe and publishes them to the client. Handlers receive reply/error callbacks and may complete their reply later (e.g. after yielding on their coroutine), decoupling request dispatch from response delivery. Existing synchronous RegisterMethod overloads are now thin wrappers over the new RegisterMethodAsync, preserving behavior including error message formatting. Reply writes pass the request coroutine so a momentarily full reply pipe yields instead of blocking the scheduler thread. Adds an async-path test (CallAsyncMethod) that defers its reply via coroutine work.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
co::Coroutine-basedrpcserver so non-streaming methods run as a two-coroutine pipeline: a request coroutine dispatches incoming requests to the handler, and a response coroutine drains completed replies from atoolbelt::SharedPtrPipeand publishes them to the client.reply/errorcallbacks and may complete their reply later (e.g. after yielding/sleeping on their coroutine), decoupling request dispatch from response delivery.RegisterMethodAsync(...)API. Existing synchronousRegisterMethodoverloads are now thin wrappers over it, preserving prior behavior (including the"Error executing method <name>: ..."error formatting).SharedPtrPipe::Write, so a momentarily full reply pipe yields the coroutine (letting the response coroutine drain it) instead of blocking the scheduler thread or silently dropping the reply.Design notes
dups the interrupt fd so it can wait on both the reply pipe and shutdown without violating the epoll "one waiter per fd" restriction.Test plan
bazelisk test //rpc/...— all pass (client_test,server_test,rpc_test)ServerTest.CallAsyncMethodexercises the async reply path (handler defers its reply via coroutine work before completing)