asio-grpc v3.5.0
Asynchronous gRPC with Asio/unified executors
|
(experimental) I/O object for server-side, unary rpcs More...
#include <agrpc/server_callback.hpp>
Classes | |
struct | rebind_executor |
Rebind the BasicServerUnaryReactor to another executor. More... | |
Public Types | |
using | executor_type = Executor |
The executor type. | |
Public Member Functions | |
grpc::ServerUnaryReactor * | get () noexcept |
Get underlying gRPC reactor. | |
void | initiate_send_initial_metadata () |
Send initial metadata. | |
template<class CompletionToken = detail::DefaultCompletionTokenT<Executor>> | |
auto | wait_for_send_initial_metadata (CompletionToken &&token=CompletionToken{}) |
Wait for send initial metadata. | |
void | initiate_finish (grpc::Status status) |
Finish rpc. | |
template<class CompletionToken = detail::DefaultCompletionTokenT<Executor>> | |
auto | wait_for_finish (CompletionToken &&token=CompletionToken{}) |
Wait for finish. | |
const Executor & | get_executor () const noexcept |
Get the executor. | |
(experimental) I/O object for server-side, unary rpcs
Create an object of this type using agrpc::make_reactor
/agrpc::allocate_reactor
or server_callback_coroutine.hpp
. Note that grpc::CallbackServerContext::DefaultReactor()
should be use instead of this class whenever possible.
Example:
Based on .proto
file:
Executor | The executor type. |
Per-Operation Cancellation
All. Cancellation will merely interrupt the act of waiting and does not cancel the underlying rpc.
|
inlinenodiscardnoexcept |
Get underlying gRPC reactor.
The returned object should be passed to the gRPC library. Invoking any of its functions may result in undefined behavior.
|
inline |
Send initial metadata.
Send any initial metadata stored in the CallbackServerContext. If not invoked, any initial metadata will be passed along with initiate_finish
.
|
inline |
Wait for send initial metadata.
Waits for the completion of initiate_send_initial_metadata
. Only one wait for send initial metadata may be outstanding at any time.
Completion signature is void(error_code, bool)
. If the bool is false
then the rpc failed (cancelled, disconnected, deadline reached, ...).
|
inline |
Finish rpc.
Indicate that the stream is to be finished and the trailing metadata and rpc status are to be sent. May only be called once. If the status is non-OK, any message will not be sent. Instead, the client will only receive the status and any trailing metadata.
|
inline |
Wait for finish.
Wait until all operations associated with this rpc have completed. Only one wait for finish may be outstanding at any time.
Completion signature is void(error_code, bool)
. If the bool is false
then the rpc failed (cancelled, disconnected, deadline reached, ...).
|
inlinenodiscardnoexceptinherited |
Get the executor.
Thread-safe