asio-grpc v3.4.3
Asynchronous gRPC with Asio/unified executors
|
I/O object for server-side, client-streaming rpcs. More...
#include <agrpc/server_callback.hpp>
Classes | |
struct | rebind_executor |
Rebind the BasicServerReadReactor to another executor. More... | |
Public Types | |
using | executor_type = Executor |
The executor type. | |
Public Member Functions | |
grpc::ServerReadReactor< Request > * | 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_read (Request &request) |
Read message. | |
template<class CompletionToken = detail::DefaultCompletionTokenT<Executor>> | |
auto | wait_for_read (CompletionToken &&token=CompletionToken{}) |
Wait for read. | |
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. | |
I/O object for server-side, client-streaming rpcs.
Create an object of this type using agrpc::make_reactor
/agrpc::allocate_reactor
or server_callback_coroutine.hpp
.
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 |
Read message.
Initiate the read of a message from the client. The argument must remain valid until the read completes (wait_for_read()
).
|
inline |
Wait for read.
Waits for the completion of a read. Only one wait for read 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