asio-grpc v1.6.0
Asynchronous gRPC with Asio/unified executors
|
Client and server-side function object to start RPCs. More...
#include <agrpc/rpc.hpp>
Public Member Functions | |
template<class RPC , class Service , class Request , class Responder , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (detail::ServerMultiArgRequest< RPC, Request, Responder > rpc, Service &service, grpc::ServerContext &server_context, Request &request, Responder &responder, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Wait for a unary or server-streaming RPC request from a client. More... | |
template<class RPC , class Service , class Responder , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (detail::ServerSingleArgRequest< RPC, Responder > rpc, Service &service, grpc::ServerContext &server_context, Responder &responder, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Wait for a client-streaming or bidirectional-streaming RPC request from a client. More... | |
template<class Stub , class Request , class Response , class Executor = asio::any_io_executor> | |
auto | operator() (detail::ClientUnaryRequest< Stub, Request, Response > rpc, Stub &stub, grpc::ClientContext &client_context, const Request &request, asio::use_awaitable_t< Executor > token={}) const -> typename asio::async_result< asio::use_awaitable_t< Executor >, void(std::unique_ptr< grpc::ClientAsyncResponseReader< Response > >)>::return_type |
Convenience function for starting a unary request. More... | |
template<class Stub , class Request , class Response , class Executor = asio::any_io_executor> | |
auto | operator() (detail::ClientUnaryRequest< Stub, Request, Response > rpc, Stub &stub, grpc::ClientContext &client_context, const Request &request, std::unique_ptr< grpc::ClientAsyncResponseReader< Response > > &reader, asio::use_awaitable_t< Executor > token={}) const -> typename asio::async_result< asio::use_awaitable_t< Executor >, void()>::return_type |
Convenience function for starting a unary request. More... | |
template<class Stub , class Request , class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (detail::ClientServerStreamingRequest< Stub, Request, Response > rpc, Stub &stub, grpc::ClientContext &client_context, const Request &request, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Convenience function for starting a server-streaming request. More... | |
template<class Stub , class Request , class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (detail::ClientServerStreamingRequest< Stub, Request, Response > rpc, Stub &stub, grpc::ClientContext &client_context, const Request &request, std::unique_ptr< grpc::ClientAsyncReader< Response > > &reader, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Start a server-streaming request. More... | |
template<class Stub , class Request , class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (detail::ClientClientStreamingRequest< Stub, Request, Response > rpc, Stub &stub, grpc::ClientContext &client_context, Response &response, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Convenience function for starting a client-streaming request. More... | |
template<class Stub , class Request , class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (detail::ClientClientStreamingRequest< Stub, Request, Response > rpc, Stub &stub, grpc::ClientContext &client_context, std::unique_ptr< grpc::ClientAsyncWriter< Request > > &writer, Response &response, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Start a client-streaming request. More... | |
template<class Stub , class Request , class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (detail::ClientBidirectionalStreamingRequest< Stub, Request, Response > rpc, Stub &stub, grpc::ClientContext &client_context, CompletionToken &&token={}) const |
Convenience function for starting a bidirectional-streaming request. More... | |
template<class Stub , class Request , class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (detail::ClientBidirectionalStreamingRequest< Stub, Request, Response > rpc, Stub &stub, grpc::ClientContext &client_context, std::unique_ptr< grpc::ClientAsyncReaderWriter< Request, Response > > &reader_writer, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Start a bidirectional-streaming request. More... | |
Client and server-side function object to start RPCs.
The examples below are based on the following .proto file:
Per-Operation Cancellation
None. gRPC does not support cancellation of requests.
|
inline |
Convenience function for starting a bidirectional-streaming request.
Sends std::unique_ptr<grpc::ClientAsyncWriter<Request>>
through the completion handler, otherwise identical to operator()(ClientClientStreamingRequest, Stub&, ClientContext&, Writer&, Response&,
CompletionToken&&)
Example:
rpc | A pointer to the async version of the RPC method. The async version always starts with Async . |
stub | The Stub that corresponds to the RPC method. In the example above the stub is: example::v1::Example::Stub . |
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(std::pair<std::unique_ptr<grpc::ClientAsyncWriter<Request>>, bool>) . true indicates that the RPC is going to go to the wire. If it is false , it is not going to the wire. This would happen if the channel is either permanently broken or transiently broken but with the fail-fast option. |
|
inlinenoexcept |
Start a bidirectional-streaming request.
Example:
rpc | A pointer to the async version of the RPC method. The async version always starts with Async . |
stub | The Stub that corresponds to the RPC method. In the example above the stub is: example::v1::Example::Stub . |
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true indicates that the RPC is going to go to the wire. If it is false , it is not going to the wire. This would happen if the channel is either permanently broken or transiently broken but with the fail-fast option. |
|
inlinenoexcept |
Convenience function for starting a client-streaming request.
Sends std::unique_ptr<grpc::ClientAsyncWriter<Request>>
through the completion handler, otherwise identical to operator()(ClientClientStreamingRequest, Stub&, ClientContext&, Writer&, Response&,
CompletionToken&&)
Example:
rpc | A pointer to the async version of the RPC method. The async version always starts with Async . |
stub | The Stub that corresponds to the RPC method. In the example above the stub is: example::v1::Example::Stub . |
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(std::pair<std::unique_ptr<grpc::ClientAsyncWriter<Request>>, bool>) . true indicates that the RPC is going to go to the wire. If it is false , it is not going to the wire. This would happen if the channel is either permanently broken or transiently broken but with the fail-fast option. |
|
inlinenoexcept |
Start a client-streaming request.
Example:
rpc | A pointer to the async version of the RPC method. The async version always starts with Async . |
stub | The Stub that corresponds to the RPC method. In the example above the stub is: example::v1::Example::Stub . |
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true indicates that the RPC is going to go to the wire. If it is false , it is not going to the wire. This would happen if the channel is either permanently broken or transiently broken but with the fail-fast option. |
|
inlinenoexcept |
Convenience function for starting a server-streaming request.
Sends std::unique_ptr<grpc::ClientAsyncReader<Response>>
through the completion handler, otherwise identical to operator()(ClientServerStreamingRequest, Stub&, ClientContext&, const Request&, Reader&,
CompletionToken&&)
Example:
rpc | A pointer to the async version of the RPC method. The async version always starts with Async . |
stub | The Stub that corresponds to the RPC method. In the example above the stub is: example::v1::Example::Stub . |
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(std::pair<std::unique_ptr<grpc::ClientAsyncReader<Response>>, bool>) . true indicates that the RPC is going to go to the wire. If it is false , it is not going to the wire. This would happen if the channel is either permanently broken or transiently broken but with the fail-fast option. |
|
inlinenoexcept |
Start a server-streaming request.
Example:
rpc | A pointer to the async version of the RPC method. The async version always starts with Async . |
stub | The Stub that corresponds to the RPC method. In the example above the stub is: example::v1::Example::Stub . |
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true indicates that the RPC is going to go to the wire. If it is false , it is not going to the wire. This would happen if the channel is either permanently broken or transiently broken but with the fail-fast option. |
|
inline |
Convenience function for starting a unary request.
Example:
rpc | A pointer to the async version of the RPC method. The async version always starts with Async . |
stub | The Stub that corresponds to the RPC method. In the example above the stub is: example::v1::Example::Stub . |
|
inline |
Convenience function for starting a unary request.
Takes std::unique_ptr<grpc::ClientAsyncResponseReader<Response>>
as an output parameter, otherwise identical to: operator()(ClientUnaryRequest, Stub&, ClientContext&, const Request&, use_awaitable_t<Executor>)
|
inlinenoexcept |
Wait for a unary or server-streaming RPC request from a client.
Unary RPC:
Server-streaming RPC:
rpc | A pointer to the async version of the RPC method. The async version always starts with Request . |
service | The AsyncService that corresponds to the RPC method. In the examples above the service is: example::v1::Example::AsyncService . |
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true indicates that the RPC has indeed been started. If it is false then the server has been Shutdown before this particular call got matched to an incoming RPC. |
|
inlinenoexcept |
Wait for a client-streaming or bidirectional-streaming RPC request from a client.
Client-streaming RPC:
Bidirectional-streaming RPC:
rpc | A pointer to the async version of the RPC method. The async version always starts with Request . |
service | The AsyncService that corresponds to the RPC method. In the examples above the service is: example::v1::Example::AsyncService . |
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true indicates that the RPC has indeed been started. If it is false then the server has been Shutdown before this particular call got matched to an incoming RPC. |