19 #ifndef GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
20 #define GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
32 class CompletionQueue;
64 virtual void Finish(R* msg,
Status* status,
void* tag) = 0;
84 Call call = channel->CreateCall(method, context, cq);
91 static void operator delete(
void* ptr, std::size_t size) {
104 meta_buf.set_output_tag(tag);
105 meta_buf.RecvInitialMetadata(context_);
115 finish_buf.set_output_tag(tag);
116 if (!context_->initial_metadata_received_) {
117 finish_buf.RecvInitialMetadata(context_);
119 finish_buf.RecvMessage(msg);
120 finish_buf.AllowNoMessage();
121 finish_buf.ClientRecvStatus(context_, status);
131 : context_(context), call_(call) {
132 init_buf.SendInitialMetadata(context->send_initial_metadata_,
133 context->initial_metadata_flags());
136 init_buf.ClientSendClose();
141 static void*
operator new(std::size_t size);
142 static void*
operator new(std::size_t size,
void* p) {
return p; }
144 SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
145 CallOpClientSendClose>
147 CallOpSet<CallOpRecvInitialMetadata> meta_buf;
148 CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>,
149 CallOpClientRecvStatus>
159 : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
171 meta_buf_.set_output_tag(tag);
172 meta_buf_.SendInitialMetadata(ctx_->initial_metadata_,
173 ctx_->initial_metadata_flags());
177 ctx_->sent_initial_metadata_ =
true;
197 finish_buf_.set_output_tag(tag);
198 if (!ctx_->sent_initial_metadata_) {
199 finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
200 ctx_->initial_metadata_flags());
204 ctx_->sent_initial_metadata_ =
true;
208 finish_buf_.ServerSendStatus(ctx_->trailing_metadata_,
209 finish_buf_.SendMessage(msg));
211 finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status);
230 finish_buf_.set_output_tag(tag);
231 if (!ctx_->sent_initial_metadata_) {
232 finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
233 ctx_->initial_metadata_flags());
237 ctx_->sent_initial_metadata_ =
true;
239 finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status);
244 void BindCall(
Call* call)
override { call_ = *call; }
248 CallOpSet<CallOpSendInitialMetadata> meta_buf_;
249 CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
250 CallOpServerSendStatus>
258 class default_delete<grpc::ClientAsyncResponseReader<R>> {
263 class default_delete<grpc::ClientAsyncResponseReaderInterface<R>> {
269 #endif // GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
void FinishWithError(const 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.h:228
virtual ~ClientAsyncResponseReaderInterface()
Definition: async_unary_call.h:40
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context.h:170
virtual void Finish(R *msg, 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...
void Finish(const W &msg, const 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.h:196
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:126
Definition: service_type.h:38
void Finish(R *msg, Status *status, void *tag)
See ClientAysncResponseReaderInterface::Finish for semantics.
Definition: async_unary_call.h:114
virtual void ReadInitialMetadata(void *tag)=0
Request notification of the reading of initial metadata.
static ClientAsyncResponseReader * Create(ChannelInterface *channel, CompletionQueue *cq, const RpcMethod &method, ClientContext *context, const W &request)
Start a call and write the request out.
Definition: async_unary_call.h:79
Async API for client-side unary RPCs, where the message response received from the server is of type ...
Definition: async_unary_call.h:70
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:153
void operator()(void *p)
Definition: async_unary_call.h:260
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_unary_call.h:168
void ReadInitialMetadata(void *tag)
See ClientAsyncResponseReaderInterface::ReadInitialMetadata for semantics.
Definition: async_unary_call.h:101
An interface relevant for async client side unary RPCS (which send one request message to a server an...
Definition: async_unary_call.h:38
void operator()(void *p)
Definition: async_unary_call.h:265
Straightforward wrapping of the C call object.
Definition: call.h:647
Codegen interface for grpc::Channel.
Definition: channel_interface.h:49
CoreCodegenInterface * g_core_codegen_interface
Definition: call.h:49
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:95
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:86
virtual void * grpc_call_arena_alloc(grpc_call *call, size_t length)=0
ServerAsyncResponseWriter(ServerContext *ctx)
Definition: async_unary_call.h:158
Descriptor of an RPC method.
Definition: rpc_method.h:29
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:663
bool ok() const
Is the status OK?
Definition: status.h:64
Did it work? If it didn't, why?
Definition: status.h:30
Async server-side API for handling unary calls, where the single response message sent to the client ...
Definition: async_unary_call.h:156
grpc_call * call() const
Definition: call.h:667
bool compression_level_set() const
Return a bool indicating whether the compression level for this call has been set (either implicitly ...
Definition: server_context.h:185