asio-grpc v3.4.3
Asynchronous gRPC with Asio/unified executors
|
I/O object for client-side, server-streaming rpcs. More...
#include <agrpc/client_callback.hpp>
Classes | |
struct | rebind_executor |
Rebind the BasicClientReadReactor to another executor. More... | |
Public Types | |
using | executor_type = Executor |
The executor type. | |
Public Member Functions | |
template<class StubAsync , class Request > | |
void | start (detail::AsyncServerStreamingReactorFn< StubAsync, Request, Response > fn, StubAsync *stub, const Request &request) |
Start a codegen-ed rpc. | |
template<class CompletionToken = detail::DefaultCompletionTokenT<Executor>> | |
auto | wait_for_initial_metadata (CompletionToken &&token=CompletionToken{}) |
Wait for initial metadata. | |
void | initiate_read (Response &response) |
Read message. | |
template<class CompletionToken = detail::DefaultCompletionTokenT<Executor>> | |
auto | wait_for_read (CompletionToken &&token=CompletionToken{}) |
Wait for write. | |
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. | |
grpc::ClientContext & | context () noexcept |
Get the underlying grpc::ClientContext | |
const grpc::ClientContext & | context () const noexcept |
Get the underlying grpc::ClientContext (const overload) | |
I/O object for client-side, server-streaming rpcs.
Create an object of this type using agrpc::make_reactor
/agrpc::allocate_reactor
.
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.
|
inline |
Start a codegen-ed rpc.
The response object must remain valid until the rpc is finished. May only be called once.
Stub::async::Method
.
|
inline |
Wait for initial metadata.
Only one wait for 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. The argument must remain valid until the write completes (wait_for_read
).
|
inline |
Wait for write.
Waits for the completion of a read. Only one wait for write 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 |
Wait for finish.
Wait until all operations associated with this rpc have completed. No more reads may be initiated on this rpc after this function has been called. Only one wait for finish may be outstanding at any time.
Completion signature is void(error_code, grpc::Status)
. Once this operation completes the response passed to start()
will have been be populated if grpc::Status::ok()
is true.
|
inlinenodiscardnoexceptinherited |
Get the executor.
Thread-safe