34 #ifndef GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
35 #define GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H
47 class CompletionQueue;
79 virtual void Finish(R* msg,
Status* status,
void* tag) = 0;
99 Call call = channel->CreateCall(method, context, cq);
106 static void operator delete(
void* ptr, std::size_t size) {
119 meta_buf_.set_output_tag(tag);
120 meta_buf_.RecvInitialMetadata(context_);
130 finish_buf_.set_output_tag(tag);
131 if (!context_->initial_metadata_received_) {
132 finish_buf_.RecvInitialMetadata(context_);
134 finish_buf_.RecvMessage(msg);
135 finish_buf_.AllowNoMessage();
136 finish_buf_.ClientRecvStatus(context_, status);
146 : context_(context), call_(call) {
147 init_buf_.SendInitialMetadata(context->send_initial_metadata_,
148 context->initial_metadata_flags());
151 init_buf_.ClientSendClose();
156 static void*
operator new(std::size_t size);
157 static void*
operator new(std::size_t size,
void* p) {
return p; };
159 SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
160 CallOpClientSendClose>
162 CallOpSet<CallOpRecvInitialMetadata> meta_buf_;
163 CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>,
164 CallOpClientRecvStatus>
174 : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
186 meta_buf_.set_output_tag(tag);
187 meta_buf_.SendInitialMetadata(ctx_->initial_metadata_,
188 ctx_->initial_metadata_flags());
192 ctx_->sent_initial_metadata_ =
true;
212 finish_buf_.set_output_tag(tag);
213 if (!ctx_->sent_initial_metadata_) {
214 finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
215 ctx_->initial_metadata_flags());
219 ctx_->sent_initial_metadata_ =
true;
223 finish_buf_.ServerSendStatus(ctx_->trailing_metadata_,
224 finish_buf_.SendMessage(msg));
226 finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status);
245 finish_buf_.set_output_tag(tag);
246 if (!ctx_->sent_initial_metadata_) {
247 finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
248 ctx_->initial_metadata_flags());
252 ctx_->sent_initial_metadata_ =
true;
254 finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status);
259 void BindCall(
Call* call)
override { call_ = *call; }
263 CallOpSet<CallOpSendInitialMetadata> meta_buf_;
264 CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
265 CallOpServerSendStatus>
273 class default_delete<grpc::ClientAsyncResponseReader<R>> {
279 #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:243
virtual ~ClientAsyncResponseReaderInterface()
Definition: async_unary_call.h:55
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context.h:184
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:211
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:137
Definition: service_type.h:53
void Finish(R *msg, Status *status, void *tag)
See ClientAysncResponseReaderInterface::Finish for semantics.
Definition: async_unary_call.h:129
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:94
Async API for client-side unary RPCs, where the message response received from the server is of type ...
Definition: async_unary_call.h:85
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:168
void operator()(void *p)
Definition: async_unary_call.h:275
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_unary_call.h:183
void ReadInitialMetadata(void *tag)
See ClientAsyncResponseReaderInterface::ReadInitialMetadata for semantics.
Definition: async_unary_call.h:116
An interface relevant for async client side unary RPCS (which send one request message to a server an...
Definition: async_unary_call.h:53
Straightforward wrapping of the C call object.
Definition: call.h:638
Codegen interface for grpc::Channel.
Definition: channel_interface.h:64
CoreCodegenInterface * g_core_codegen_interface
Definition: call.h:64
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:109
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:101
virtual void * grpc_call_arena_alloc(grpc_call *call, size_t length)=0
ServerAsyncResponseWriter(ServerContext *ctx)
Definition: async_unary_call.h:173
Descriptor of an RPC method.
Definition: rpc_method.h:44
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:654
bool ok() const
Is the status OK?
Definition: status.h:76
Did it work? If it didn't, why?
Definition: status.h:45
Async server-side API for handling unary calls, where the single response message sent to the client ...
Definition: async_unary_call.h:171
grpc_call * call() const
Definition: call.h:658
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:199