asio-grpc v1.4.0
Asynchronous gRPC with Asio/unified executors
|
Client and server-side function object to finish RPCs. More...
#include <agrpc/rpc.hpp>
Public Member Functions | |
template<class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (grpc::ServerAsyncWriter< Response > &writer, const grpc::Status &status, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Finish a server stream. More... | |
template<class Response , class Request , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (grpc::ServerAsyncReader< Response, Request > &reader, const Response &response, const grpc::Status &status, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Finish a client stream (server-side) More... | |
template<class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (grpc::ServerAsyncResponseWriter< Response > &writer, const Response &response, const grpc::Status &status, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Finish a unary RPC (server-side) More... | |
template<class Response , class Request , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (grpc::ServerAsyncReaderWriter< Response, Request > &reader_writer, const grpc::Status &status, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Finish a bidirectional stream (server-side) More... | |
template<class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (grpc::ClientAsyncReader< Response > &reader, grpc::Status &status, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Finish a server stream (client-side) More... | |
template<class Request , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (grpc::ClientAsyncWriter< Request > &writer, grpc::Status &status, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Finish a client stream (client-side) More... | |
template<class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (grpc::ClientAsyncResponseReader< Response > &reader, Response &response, grpc::Status &status, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Finish a unary RPC (client-side) More... | |
template<class Request , class Response , class CompletionToken = agrpc::DefaultCompletionToken> | |
auto | operator() (grpc::ClientAsyncReaderWriter< Request, Response > &reader_writer, grpc::Status &status, CompletionToken &&token={}) const noexcept(detail::IS_NOTRHOW_GRPC_INITIATE_COMPLETION_TOKEN< CompletionToken >) |
Finish a bidirectional stream (client-side) More... | |
Client and server-side function object to finish RPCs.
The examples below are based on the following .proto file:
|
inlinenoexcept |
Finish a server stream (client-side)
Indicate that the stream is to be finished and request notification for when the call has been ended.
Should not be used concurrently with other operations.
It is appropriate to call this method exactly once when:
false
).The operation will finish when either:
Note that implementations of this method attempt to receive initial metadata from the server if initial metadata has not been received yet.
Side effect:
Example:
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . The bool should always be true . |
|
inlinenoexcept |
Finish a bidirectional stream (client-side)
Indicate that the stream is to be finished and request notification for when the call has been ended.
Should not be used concurrently with other operations.
It is appropriate to call this method exactly once when:
false
). The operation will finish when either:
Note that implementations of this method attempt to receive initial metadata from the server if initial metadata has not been received yet.
Side effect:
Example:
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . The bool should always be true . |
|
inlinenoexcept |
Finish a unary RPC (client-side)
Receive the server's response message and final status for the call.
This operation will finish when either:
Side effect:
Example:
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . The bool should always be true . |
|
inlinenoexcept |
Finish a client stream (client-side)
Indicate that the stream is to be finished and request notification for when the call has been ended.
Should not be used concurrently with other operations.
It is appropriate to call this method exactly once when:
The operation will finish when either:
Note that implementations of this method attempt to receive initial metadata from the server if initial metadata has not been received yet.
Side effect:
request
.Example:
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . The bool should always be true . |
|
inlinenoexcept |
Finish a client stream (server-side)
Side effect:
gRPC does not take ownership or a reference to response and status, so it is safe to deallocate once finish returns.
Example:
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true means that the data/metadata/status/etc is going to go to the wire. If it is false , it is not going to the wire because the call is already dead (i.e., canceled, deadline expired, other side dropped the channel, etc). |
|
inlinenoexcept |
Finish a bidirectional stream (server-side)
Indicate that the stream is to be finished with a certain status code. Should not be used concurrently with other operations.
It is appropriate to call this method when either:
false
). This operation will end when the server has finished sending out initial metadata (if not sent already) and status, or if some failure occurred when trying to do so.
The ServerContext associated with the call is used for sending trailing (and initial if not already sent) metadata to the client. There are no restrictions to the code of status, it may be non-OK. gRPC does not take ownership or a reference to status, so it is safe to to deallocate once finish returns.
Example:
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true means that the data/metadata/status/etc is going to go to the wire. If it is false , it is not going to the wire because the call is already dead (i.e., canceled, deadline expired, other side dropped the channel, etc). |
|
inlinenoexcept |
Finish a unary RPC (server-side)
Indicate that the RPC is to be finished and request notification when the server has sent the appropriate signals to the client to end the call. Should not be used concurrently with other operations.
Side effect:
Example:
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true means that the data/metadata/status/etc is going to go to the wire. If it is false , it is not going to the wire because the call is already dead (i.e., canceled, deadline expired, other side dropped the channel, etc). |
|
inlinenoexcept |
Finish a server stream.
Indicate that the stream is to be finished with a certain status code. Should not be used concurrently with other operations.
It is appropriate to call this method when either:
false
). This operation will end when the server has finished sending out initial metadata (if not sent already) and status, or if some failure occurred when trying to do so.
The ServerContext associated with the call is used for sending trailing (and initial if not already sent) metadata to the client. There are no restrictions to the code of status, it may be non-OK. gRPC does not take ownership or a reference to status, so it is safe to to deallocate once finish returns.
Example:
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true means that the data/metadata/status/etc is going to go to the wire. If it is false , it is not going to the wire because the call is already dead (i.e., canceled, deadline expired, other side dropped the channel, etc). |