Go to the documentation of this file.
19 #ifndef GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_IMPL_H
20 #define GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_IMPL_H
81 const ::grpc::internal::RpcMethod& method,
98 static void operator delete(
void* , std::size_t size) {
125 single_buf.set_output_tag(tag);
126 single_buf.RecvInitialMetadata(context_);
128 initial_metadata_read_ =
true;
138 if (initial_metadata_read_) {
139 finish_buf.set_output_tag(tag);
140 finish_buf.RecvMessage(msg);
141 finish_buf.AllowNoMessage();
142 finish_buf.ClientRecvStatus(context_, status);
145 single_buf.set_output_tag(tag);
146 single_buf.RecvInitialMetadata(context_);
147 single_buf.RecvMessage(msg);
148 single_buf.AllowNoMessage();
149 single_buf.ClientRecvStatus(context_, status);
159 bool initial_metadata_read_ =
false;
164 const W& request,
bool start)
165 : context_(context), call_(call), started_(start) {
169 single_buf.ClientSendClose();
170 if (start) StartCallInternal();
173 void StartCallInternal() {
174 single_buf.SendInitialMetadata(&context_->send_initial_metadata_,
175 context_->initial_metadata_flags());
179 static void*
operator new(std::size_t size);
180 static void*
operator new(std::size_t ,
void* p) {
return p; }
201 : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
213 meta_buf_.set_output_tag(tag);
214 meta_buf_.SendInitialMetadata(&ctx_->initial_metadata_,
215 ctx_->initial_metadata_flags());
219 ctx_->sent_initial_metadata_ =
true;
239 finish_buf_.set_output_tag(tag);
240 finish_buf_.set_core_cq_tag(&finish_buf_);
241 if (!ctx_->sent_initial_metadata_) {
242 finish_buf_.SendInitialMetadata(&ctx_->initial_metadata_,
243 ctx_->initial_metadata_flags());
247 ctx_->sent_initial_metadata_ =
true;
251 finish_buf_.ServerSendStatus(&ctx_->trailing_metadata_,
252 finish_buf_.SendMessage(msg));
254 finish_buf_.ServerSendStatus(&ctx_->trailing_metadata_, status);
273 finish_buf_.set_output_tag(tag);
274 if (!ctx_->sent_initial_metadata_) {
275 finish_buf_.SendInitialMetadata(&ctx_->initial_metadata_,
276 ctx_->initial_metadata_flags());
280 ctx_->sent_initial_metadata_ =
true;
282 finish_buf_.ServerSendStatus(&ctx_->trailing_metadata_, status);
314 #endif // GRPCPP_IMPL_CODEGEN_ASYNC_UNARY_CALL_IMPL_H
Definition: service_type.h:41
Definition: call_op_set.h:617
Definition: call_op_set.h:652
Primary implementation of CallOpSetInterface.
Definition: call_op_set.h:849
Definition: call_op_set.h:286
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context_impl.h:215
virtual void * grpc_call_arena_alloc(grpc_call *call, size_t length)=0
Straightforward wrapping of the C call object.
Definition: call.h:38
ServerAsyncResponseWriter(::grpc_impl::ServerContext *ctx)
Definition: async_unary_call_impl.h:200
virtual ~ClientAsyncResponseReaderInterface()
Definition: async_unary_call_impl.h:36
bool compression_level_set() const
Return a bool indicating whether the compression level for this call has been set (either implicitly ...
Definition: server_context_impl.h:230
void Finish(const W &msg, const ::grpc::Status &status, void *tag)
Indicate that the stream is to be finished and request notification when the server has sent the appr...
Definition: async_unary_call_impl.h:238
Async server-side API for handling unary calls, where the single response message sent to the client ...
Definition: async_unary_call_impl.h:197
void FinishWithError(const ::grpc::Status &status, void *tag)
Indicate that the stream is to be finished with a non-OK status, and request notification for when th...
Definition: async_unary_call_impl.h:271
virtual void Finish(R *msg, ::grpc::Status *status, void *tag)=0
Request to receive the server's response msg and final status for the call, and to notify tag on this...
Did it work? If it didn't, why?
Definition: status.h:31
Async API for client-side unary RPCs, where the message response received from the server is of type ...
Definition: async_unary_call_impl.h:94
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context_impl.h:510
void operator()(void *)
Definition: async_unary_call_impl.h:305
Codegen interface for grpc::Channel.
Definition: channel_interface.h:74
virtual void StartCall()=0
Start the call that was set up by the constructor, but only if the constructor was invoked through th...
::google::protobuf::util::Status Status
Definition: config_protobuf.h:90
static ClientAsyncResponseReader< R > * Create(::grpc::ChannelInterface *channel, ::grpc_impl::CompletionQueue *cq, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, const W &request, bool start)
Start a call and write the request out if start is set.
Definition: async_unary_call_impl.h:79
void operator()(void *)
Definition: async_unary_call_impl.h:310
grpc_impl::ClientAsyncResponseReader< R > ClientAsyncResponseReader
Definition: async_unary_call.h:31
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue_impl.h:103
void Finish(R *msg, ::grpc::Status *status, void *tag) override
See ClientAysncResponseReaderInterface::Finish for semantics.
Definition: async_unary_call_impl.h:136
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:68
grpc_call * call() const
Definition: call.h:72
Definition: async_unary_call_impl.h:301
Definition: async_unary_call_impl.h:70
virtual void ReadInitialMetadata(void *tag)=0
Request notification of the reading of initial metadata.
Definition: call_op_set.h:767
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
CoreCodegenInterface * g_core_codegen_interface
Definition: completion_queue_impl.h:93
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:146
void StartCall() override
Start the call that was set up by the constructor, but only if the constructor was invoked through th...
Definition: async_unary_call_impl.h:109
An interface relevant for async client side unary RPCs (which send one request message to a server an...
Definition: async_unary_call_impl.h:34
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_unary_call_impl.h:210
A ClientContext allows the person implementing a service client to:
Definition: client_context_impl.h:184
Definition: byte_buffer.h:58
void ReadInitialMetadata(void *tag) override
See ClientAsyncResponseReaderInterface::ReadInitialMetadata for semantics.
Definition: async_unary_call_impl.h:121