server_callback_handlers.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2019 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_HANDLERS_H
19 #define GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_HANDLERS_H
20 
21 // IWYU pragma: private
22 
28 
29 namespace grpc {
30 namespace internal {
31 
32 template <class RequestType, class ResponseType>
33 class CallbackUnaryHandler : public grpc::internal::MethodHandler {
34  public:
37  const RequestType*, ResponseType*)>
38  get_reactor)
39  : get_reactor_(std::move(get_reactor)) {}
40 
43  allocator_ = allocator;
44  }
45 
46  void RunHandler(const HandlerParameter& param) final {
47  // Arena allocate a controller structure (that includes request/response)
48  grpc::g_core_codegen_interface->grpc_call_ref(param.call->call());
49  auto* allocator_state =
51  param.internal_data);
52 
54  param.call->call(), sizeof(ServerCallbackUnaryImpl)))
56  static_cast<grpc::CallbackServerContext*>(param.server_context),
57  param.call, allocator_state, param.call_requester);
58  param.server_context->BeginCompletionOp(
59  param.call, [call](bool) { call->MaybeDone(); }, call);
60 
61  ServerUnaryReactor* reactor = nullptr;
62  if (param.status.ok()) {
63  reactor = grpc::internal::CatchingReactorGetter<ServerUnaryReactor>(
65  static_cast<grpc::CallbackServerContext*>(param.server_context),
66  call->request(), call->response());
67  }
68 
69  if (reactor == nullptr) {
70  // if deserialization or reactor creator failed, we need to fail the call
72  param.call->call(), sizeof(UnimplementedUnaryReactor)))
75  }
76 
78  call->SetupReactor(reactor);
79  }
80 
82  grpc::Status* status, void** handler_data) final {
84  buf.set_buffer(req);
85  RequestType* request = nullptr;
87  if (allocator_ != nullptr) {
88  allocator_state = allocator_->AllocateMessages();
89  } else {
90  allocator_state =
94  }
95  *handler_data = allocator_state;
96  request = allocator_state->request();
97  *status =
99  buf.Release();
100  if (status->ok()) {
101  return request;
102  }
103  return nullptr;
104  }
105 
106  private:
108  const RequestType*, ResponseType*)>
111 
113  public:
114  void Finish(grpc::Status s) override {
115  // A callback that only contains a call to MaybeDone can be run as an
116  // inline callback regardless of whether or not OnDone is inlineable
117  // because if the actual OnDone callback needs to be scheduled, MaybeDone
118  // is responsible for dispatching to an executor thread if needed. Thus,
119  // when setting up the finish_tag_, we can set its own callback to
120  // inlineable.
122  call_.call(),
123  [this](bool) {
124  this->MaybeDone(
125  reactor_.load(std::memory_order_relaxed)->InternalInlineable());
126  },
127  &finish_ops_, /*can_inline=*/true);
129 
131  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
133  if (ctx_->compression_level_set()) {
134  finish_ops_.set_compression_level(ctx_->compression_level());
135  }
137  }
138  // The response is dropped if the status is not OK.
139  if (s.ok()) {
140  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_,
141  finish_ops_.SendMessagePtr(response()));
142  } else {
143  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, s);
144  }
147  }
148 
149  void SendInitialMetadata() override {
151  this->Ref();
152  // The callback for this function should not be marked inline because it
153  // is directly invoking a user-controlled reaction
154  // (OnSendInitialMetadataDone). Thus it must be dispatched to an executor
155  // thread. However, any OnDone needed after that can be inlined because it
156  // is already running on an executor thread.
157  meta_tag_.Set(
158  call_.call(),
159  [this](bool ok) {
160  ServerUnaryReactor* reactor =
161  reactor_.load(std::memory_order_relaxed);
162  reactor->OnSendInitialMetadataDone(ok);
163  this->MaybeDone(/*inlineable_ondone=*/true);
164  },
165  &meta_ops_, /*can_inline=*/false);
166  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
168  if (ctx_->compression_level_set()) {
169  meta_ops_.set_compression_level(ctx_->compression_level());
170  }
174  }
175 
176  private:
178 
182  std::function<void()> call_requester)
183  : ctx_(ctx),
184  call_(*call),
185  allocator_state_(allocator_state),
186  call_requester_(std::move(call_requester)) {
187  ctx_->set_message_allocator_state(allocator_state);
188  }
189 
195  reactor_.store(reactor, std::memory_order_relaxed);
196  this->BindReactor(reactor);
197  this->MaybeCallOnCancel(reactor);
198  this->MaybeDone(reactor->InternalInlineable());
199  }
200 
201  const RequestType* request() { return allocator_state_->request(); }
203 
204  void CallOnDone() override {
205  reactor_.load(std::memory_order_relaxed)->OnDone();
206  grpc_call* call = call_.call();
207  auto call_requester = std::move(call_requester_);
209  if (ctx_->context_allocator() != nullptr) {
211  }
212  this->~ServerCallbackUnaryImpl(); // explicitly call destructor
214  call_requester();
215  }
216 
217  ServerReactor* reactor() override {
218  return reactor_.load(std::memory_order_relaxed);
219  }
220 
229 
234  // reactor_ can always be loaded/stored with relaxed memory ordering because
235  // its value is only set once, independently of other data in the object,
236  // and the loads that use it will always actually come provably later even
237  // though they are from different threads since they are triggered by
238  // actions initiated only by the setting up of the reactor_ variable. In
239  // a sense, it's a delayed "const": it gets its value from the SetupReactor
240  // method (not the constructor, so it's not a true const), but it doesn't
241  // change after that and it only gets used by actions caused, directly or
242  // indirectly, by that setup. This comment also applies to the reactor_
243  // variables of the other streaming objects in this file.
244  std::atomic<ServerUnaryReactor*> reactor_;
245  // callbacks_outstanding_ follows a refcount pattern
246  std::atomic<intptr_t> callbacks_outstanding_{
247  3}; // reserve for start, Finish, and CompletionOp
248  };
249 };
250 
251 template <class RequestType, class ResponseType>
252 class CallbackClientStreamingHandler : public grpc::internal::MethodHandler {
253  public:
257  get_reactor)
258  : get_reactor_(std::move(get_reactor)) {}
259  void RunHandler(const HandlerParameter& param) final {
260  // Arena allocate a reader structure (that includes response)
261  grpc::g_core_codegen_interface->grpc_call_ref(param.call->call());
262 
264  param.call->call(), sizeof(ServerCallbackReaderImpl)))
266  static_cast<grpc::CallbackServerContext*>(param.server_context),
267  param.call, param.call_requester);
268  // Inlineable OnDone can be false in the CompletionOp callback because there
269  // is no read reactor that has an inlineable OnDone; this only applies to
270  // the DefaultReactor (which is unary).
271  param.server_context->BeginCompletionOp(
272  param.call,
273  [reader](bool) { reader->MaybeDone(/*inlineable_ondone=*/false); },
274  reader);
275 
276  ServerReadReactor<RequestType>* reactor = nullptr;
277  if (param.status.ok()) {
278  reactor =
279  grpc::internal::CatchingReactorGetter<ServerReadReactor<RequestType>>(
280  get_reactor_,
281  static_cast<grpc::CallbackServerContext*>(param.server_context),
282  reader->response());
283  }
284 
285  if (reactor == nullptr) {
286  // if deserialization or reactor creator failed, we need to fail the call
288  param.call->call(), sizeof(UnimplementedReadReactor<RequestType>)))
291  }
292 
293  reader->SetupReactor(reactor);
294  }
295 
296  private:
297  std::function<ServerReadReactor<RequestType>*(grpc::CallbackServerContext*,
298  ResponseType*)>
300 
301  class ServerCallbackReaderImpl : public ServerCallbackReader<RequestType> {
302  public:
303  void Finish(grpc::Status s) override {
304  // A finish tag with only MaybeDone can have its callback inlined
305  // regardless even if OnDone is not inlineable because this callback just
306  // checks a ref and then decides whether or not to dispatch OnDone.
308  call_.call(),
309  [this](bool) {
310  // Inlineable OnDone can be false here because there is
311  // no read reactor that has an inlineable OnDone; this
312  // only applies to the DefaultReactor (which is unary).
313  this->MaybeDone(/*inlineable_ondone=*/false);
314  },
315  &finish_ops_, /*can_inline=*/true);
317  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
319  if (ctx_->compression_level_set()) {
320  finish_ops_.set_compression_level(ctx_->compression_level());
321  }
323  }
324  // The response is dropped if the status is not OK.
325  if (s.ok()) {
326  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_,
327  finish_ops_.SendMessagePtr(&resp_));
328  } else {
329  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, s);
330  }
333  }
334 
335  void SendInitialMetadata() override {
337  this->Ref();
338  // The callback for this function should not be inlined because it invokes
339  // a user-controlled reaction, but any resulting OnDone can be inlined in
340  // the executor to which this callback is dispatched.
341  meta_tag_.Set(
342  call_.call(),
343  [this](bool ok) {
344  ServerReadReactor<RequestType>* reactor =
345  reactor_.load(std::memory_order_relaxed);
346  reactor->OnSendInitialMetadataDone(ok);
347  this->MaybeDone(/*inlineable_ondone=*/true);
348  },
349  &meta_ops_, /*can_inline=*/false);
350  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
352  if (ctx_->compression_level_set()) {
353  meta_ops_.set_compression_level(ctx_->compression_level());
354  }
358  }
359 
360  void Read(RequestType* req) override {
361  this->Ref();
362  read_ops_.RecvMessage(req);
364  }
365 
366  private:
368 
371  std::function<void()> call_requester)
372  : ctx_(ctx), call_(*call), call_requester_(std::move(call_requester)) {}
373 
375  reactor_.store(reactor, std::memory_order_relaxed);
376  // The callback for this function should not be inlined because it invokes
377  // a user-controlled reaction, but any resulting OnDone can be inlined in
378  // the executor to which this callback is dispatched.
379  read_tag_.Set(
380  call_.call(),
381  [this, reactor](bool ok) {
382  if (GPR_UNLIKELY(!ok)) {
383  ctx_->MaybeMarkCancelledOnRead();
384  }
385  reactor->OnReadDone(ok);
386  this->MaybeDone(/*inlineable_ondone=*/true);
387  },
388  &read_ops_, /*can_inline=*/false);
390  this->BindReactor(reactor);
391  this->MaybeCallOnCancel(reactor);
392  // Inlineable OnDone can be false here because there is no read
393  // reactor that has an inlineable OnDone; this only applies to the
394  // DefaultReactor (which is unary).
395  this->MaybeDone(/*inlineable_ondone=*/false);
396  }
397 
399 
400  ResponseType* response() { return &resp_; }
401 
402  void CallOnDone() override {
403  reactor_.load(std::memory_order_relaxed)->OnDone();
404  grpc_call* call = call_.call();
405  auto call_requester = std::move(call_requester_);
406  if (ctx_->context_allocator() != nullptr) {
407  ctx_->context_allocator()->Release(ctx_);
408  }
409  this->~ServerCallbackReaderImpl(); // explicitly call destructor
411  call_requester();
412  }
413 
414  ServerReactor* reactor() override {
415  return reactor_.load(std::memory_order_relaxed);
416  }
417 
429 
434  // The memory ordering of reactor_ follows ServerCallbackUnaryImpl.
435  std::atomic<ServerReadReactor<RequestType>*> reactor_;
436  // callbacks_outstanding_ follows a refcount pattern
437  std::atomic<intptr_t> callbacks_outstanding_{
438  3}; // reserve for OnStarted, Finish, and CompletionOp
439  };
440 };
441 
442 template <class RequestType, class ResponseType>
443 class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
444  public:
448  get_reactor)
449  : get_reactor_(std::move(get_reactor)) {}
450  void RunHandler(const HandlerParameter& param) final {
451  // Arena allocate a writer structure
452  grpc::g_core_codegen_interface->grpc_call_ref(param.call->call());
453 
455  param.call->call(), sizeof(ServerCallbackWriterImpl)))
457  static_cast<grpc::CallbackServerContext*>(param.server_context),
458  param.call, static_cast<RequestType*>(param.request),
459  param.call_requester);
460  // Inlineable OnDone can be false in the CompletionOp callback because there
461  // is no write reactor that has an inlineable OnDone; this only applies to
462  // the DefaultReactor (which is unary).
463  param.server_context->BeginCompletionOp(
464  param.call,
465  [writer](bool) { writer->MaybeDone(/*inlineable_ondone=*/false); },
466  writer);
467 
468  ServerWriteReactor<ResponseType>* reactor = nullptr;
469  if (param.status.ok()) {
472  get_reactor_,
473  static_cast<grpc::CallbackServerContext*>(param.server_context),
474  writer->request());
475  }
476  if (reactor == nullptr) {
477  // if deserialization or reactor creator failed, we need to fail the call
479  param.call->call(), sizeof(UnimplementedWriteReactor<ResponseType>)))
482  }
483 
484  writer->SetupReactor(reactor);
485  }
486 
488  grpc::Status* status, void** /*handler_data*/) final {
490  buf.set_buffer(req);
492  call, sizeof(RequestType))) RequestType();
493  *status =
495  buf.Release();
496  if (status->ok()) {
497  return request;
498  }
499  request->~RequestType();
500  return nullptr;
501  }
502 
503  private:
504  std::function<ServerWriteReactor<ResponseType>*(grpc::CallbackServerContext*,
505  const RequestType*)>
506  get_reactor_;
507 
508  class ServerCallbackWriterImpl : public ServerCallbackWriter<ResponseType> {
509  public:
510  void Finish(grpc::Status s) override {
511  // A finish tag with only MaybeDone can have its callback inlined
512  // regardless even if OnDone is not inlineable because this callback just
513  // checks a ref and then decides whether or not to dispatch OnDone.
514  finish_tag_.Set(
515  call_.call(),
516  [this](bool) {
517  // Inlineable OnDone can be false here because there is
518  // no write reactor that has an inlineable OnDone; this
519  // only applies to the DefaultReactor (which is unary).
520  this->MaybeDone(/*inlineable_ondone=*/false);
521  },
522  &finish_ops_, /*can_inline=*/true);
523  finish_ops_.set_core_cq_tag(&finish_tag_);
524 
525  if (!ctx_->sent_initial_metadata_) {
526  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
527  ctx_->initial_metadata_flags());
528  if (ctx_->compression_level_set()) {
529  finish_ops_.set_compression_level(ctx_->compression_level());
530  }
531  ctx_->sent_initial_metadata_ = true;
532  }
533  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, s);
534  call_.PerformOps(&finish_ops_);
535  }
536 
537  void SendInitialMetadata() override {
538  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
539  this->Ref();
540  // The callback for this function should not be inlined because it invokes
541  // a user-controlled reaction, but any resulting OnDone can be inlined in
542  // the executor to which this callback is dispatched.
543  meta_tag_.Set(
544  call_.call(),
545  [this](bool ok) {
546  ServerWriteReactor<ResponseType>* reactor =
547  reactor_.load(std::memory_order_relaxed);
548  reactor->OnSendInitialMetadataDone(ok);
549  this->MaybeDone(/*inlineable_ondone=*/true);
550  },
551  &meta_ops_, /*can_inline=*/false);
552  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
553  ctx_->initial_metadata_flags());
554  if (ctx_->compression_level_set()) {
555  meta_ops_.set_compression_level(ctx_->compression_level());
556  }
557  ctx_->sent_initial_metadata_ = true;
558  meta_ops_.set_core_cq_tag(&meta_tag_);
559  call_.PerformOps(&meta_ops_);
560  }
561 
563  this->Ref();
564  if (options.is_last_message()) {
565  options.set_buffer_hint();
566  }
567  if (!ctx_->sent_initial_metadata_) {
568  write_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
569  ctx_->initial_metadata_flags());
570  if (ctx_->compression_level_set()) {
571  write_ops_.set_compression_level(ctx_->compression_level());
572  }
573  ctx_->sent_initial_metadata_ = true;
574  }
575  // TODO(vjpai): don't assert
576  GPR_CODEGEN_ASSERT(write_ops_.SendMessagePtr(resp, options).ok());
577  call_.PerformOps(&write_ops_);
578  }
579 
581  grpc::Status s) override {
582  // This combines the write into the finish callback
583  // TODO(vjpai): don't assert
584  GPR_CODEGEN_ASSERT(finish_ops_.SendMessagePtr(resp, options).ok());
585  Finish(std::move(s));
586  }
587 
588  private:
590 
593  std::function<void()> call_requester)
594  : ctx_(ctx),
595  call_(*call),
596  req_(req),
597  call_requester_(std::move(call_requester)) {}
598 
600  reactor_.store(reactor, std::memory_order_relaxed);
601  // The callback for this function should not be inlined because it invokes
602  // a user-controlled reaction, but any resulting OnDone can be inlined in
603  // the executor to which this callback is dispatched.
604  write_tag_.Set(
605  call_.call(),
606  [this, reactor](bool ok) {
607  reactor->OnWriteDone(ok);
608  this->MaybeDone(/*inlineable_ondone=*/true);
609  },
610  &write_ops_, /*can_inline=*/false);
611  write_ops_.set_core_cq_tag(&write_tag_);
612  this->BindReactor(reactor);
613  this->MaybeCallOnCancel(reactor);
614  // Inlineable OnDone can be false here because there is no write
615  // reactor that has an inlineable OnDone; this only applies to the
616  // DefaultReactor (which is unary).
617  this->MaybeDone(/*inlineable_ondone=*/false);
618  }
620  if (req_ != nullptr) {
621  req_->~RequestType();
622  }
623  }
624 
625  const RequestType* request() { return req_; }
626 
627  void CallOnDone() override {
628  reactor_.load(std::memory_order_relaxed)->OnDone();
629  grpc_call* call = call_.call();
630  auto call_requester = std::move(call_requester_);
631  if (ctx_->context_allocator() != nullptr) {
632  ctx_->context_allocator()->Release(ctx_);
633  }
634  this->~ServerCallbackWriterImpl(); // explicitly call destructor
636  call_requester();
637  }
638 
639  ServerReactor* reactor() override {
640  return reactor_.load(std::memory_order_relaxed);
641  }
642 
655 
660  // The memory ordering of reactor_ follows ServerCallbackUnaryImpl.
661  std::atomic<ServerWriteReactor<ResponseType>*> reactor_;
662  // callbacks_outstanding_ follows a refcount pattern
663  std::atomic<intptr_t> callbacks_outstanding_{
664  3}; // reserve for OnStarted, Finish, and CompletionOp
665  };
666 };
667 
668 template <class RequestType, class ResponseType>
669 class CallbackBidiHandler : public grpc::internal::MethodHandler {
670  public:
674  get_reactor)
675  : get_reactor_(std::move(get_reactor)) {}
676  void RunHandler(const HandlerParameter& param) final {
677  grpc::g_core_codegen_interface->grpc_call_ref(param.call->call());
678 
680  param.call->call(), sizeof(ServerCallbackReaderWriterImpl)))
682  static_cast<grpc::CallbackServerContext*>(param.server_context),
683  param.call, param.call_requester);
684  // Inlineable OnDone can be false in the CompletionOp callback because there
685  // is no bidi reactor that has an inlineable OnDone; this only applies to
686  // the DefaultReactor (which is unary).
687  param.server_context->BeginCompletionOp(
688  param.call,
689  [stream](bool) { stream->MaybeDone(/*inlineable_ondone=*/false); },
690  stream);
691 
693  if (param.status.ok()) {
696  get_reactor_,
697  static_cast<grpc::CallbackServerContext*>(param.server_context));
698  }
699 
700  if (reactor == nullptr) {
701  // if deserialization or reactor creator failed, we need to fail the call
703  param.call->call(),
707  }
708 
709  stream->SetupReactor(reactor);
710  }
711 
712  private:
713  std::function<ServerBidiReactor<RequestType, ResponseType>*(
715  get_reactor_;
716 
718  : public ServerCallbackReaderWriter<RequestType, ResponseType> {
719  public:
720  void Finish(grpc::Status s) override {
721  // A finish tag with only MaybeDone can have its callback inlined
722  // regardless even if OnDone is not inlineable because this callback just
723  // checks a ref and then decides whether or not to dispatch OnDone.
724  finish_tag_.Set(
725  call_.call(),
726  [this](bool) {
727  // Inlineable OnDone can be false here because there is
728  // no bidi reactor that has an inlineable OnDone; this
729  // only applies to the DefaultReactor (which is unary).
730  this->MaybeDone(/*inlineable_ondone=*/false);
731  },
732  &finish_ops_, /*can_inline=*/true);
733  finish_ops_.set_core_cq_tag(&finish_tag_);
734 
735  if (!ctx_->sent_initial_metadata_) {
736  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
737  ctx_->initial_metadata_flags());
738  if (ctx_->compression_level_set()) {
739  finish_ops_.set_compression_level(ctx_->compression_level());
740  }
741  ctx_->sent_initial_metadata_ = true;
742  }
743  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, s);
744  call_.PerformOps(&finish_ops_);
745  }
746 
747  void SendInitialMetadata() override {
748  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
749  this->Ref();
750  // The callback for this function should not be inlined because it invokes
751  // a user-controlled reaction, but any resulting OnDone can be inlined in
752  // the executor to which this callback is dispatched.
753  meta_tag_.Set(
754  call_.call(),
755  [this](bool ok) {
756  ServerBidiReactor<RequestType, ResponseType>* reactor =
757  reactor_.load(std::memory_order_relaxed);
758  reactor->OnSendInitialMetadataDone(ok);
759  this->MaybeDone(/*inlineable_ondone=*/true);
760  },
761  &meta_ops_, /*can_inline=*/false);
762  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
763  ctx_->initial_metadata_flags());
764  if (ctx_->compression_level_set()) {
765  meta_ops_.set_compression_level(ctx_->compression_level());
766  }
767  ctx_->sent_initial_metadata_ = true;
768  meta_ops_.set_core_cq_tag(&meta_tag_);
769  call_.PerformOps(&meta_ops_);
770  }
771 
773  this->Ref();
774  if (options.is_last_message()) {
775  options.set_buffer_hint();
776  }
777  if (!ctx_->sent_initial_metadata_) {
778  write_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
779  ctx_->initial_metadata_flags());
780  if (ctx_->compression_level_set()) {
781  write_ops_.set_compression_level(ctx_->compression_level());
782  }
783  ctx_->sent_initial_metadata_ = true;
784  }
785  // TODO(vjpai): don't assert
786  GPR_CODEGEN_ASSERT(write_ops_.SendMessagePtr(resp, options).ok());
787  call_.PerformOps(&write_ops_);
788  }
789 
791  grpc::Status s) override {
792  // TODO(vjpai): don't assert
793  GPR_CODEGEN_ASSERT(finish_ops_.SendMessagePtr(resp, options).ok());
794  Finish(std::move(s));
795  }
796 
797  void Read(RequestType* req) override {
798  this->Ref();
799  read_ops_.RecvMessage(req);
800  call_.PerformOps(&read_ops_);
801  }
802 
803  private:
805 
808  std::function<void()> call_requester)
809  : ctx_(ctx), call_(*call), call_requester_(std::move(call_requester)) {}
810 
812  reactor_.store(reactor, std::memory_order_relaxed);
813  // The callbacks for these functions should not be inlined because they
814  // invoke user-controlled reactions, but any resulting OnDones can be
815  // inlined in the executor to which a callback is dispatched.
816  write_tag_.Set(
817  call_.call(),
818  [this, reactor](bool ok) {
819  reactor->OnWriteDone(ok);
820  this->MaybeDone(/*inlineable_ondone=*/true);
821  },
822  &write_ops_, /*can_inline=*/false);
823  write_ops_.set_core_cq_tag(&write_tag_);
824  read_tag_.Set(
825  call_.call(),
826  [this, reactor](bool ok) {
827  if (GPR_UNLIKELY(!ok)) {
828  ctx_->MaybeMarkCancelledOnRead();
829  }
830  reactor->OnReadDone(ok);
831  this->MaybeDone(/*inlineable_ondone=*/true);
832  },
833  &read_ops_, /*can_inline=*/false);
834  read_ops_.set_core_cq_tag(&read_tag_);
835  this->BindReactor(reactor);
836  this->MaybeCallOnCancel(reactor);
837  // Inlineable OnDone can be false here because there is no bidi
838  // reactor that has an inlineable OnDone; this only applies to the
839  // DefaultReactor (which is unary).
840  this->MaybeDone(/*inlineable_ondone=*/false);
841  }
842 
843  void CallOnDone() override {
844  reactor_.load(std::memory_order_relaxed)->OnDone();
845  grpc_call* call = call_.call();
846  auto call_requester = std::move(call_requester_);
847  if (ctx_->context_allocator() != nullptr) {
848  ctx_->context_allocator()->Release(ctx_);
849  }
850  this->~ServerCallbackReaderWriterImpl(); // explicitly call destructor
852  call_requester();
853  }
854 
855  ServerReactor* reactor() override {
856  return reactor_.load(std::memory_order_relaxed);
857  }
858 
874 
878  // The memory ordering of reactor_ follows ServerCallbackUnaryImpl.
879  std::atomic<ServerBidiReactor<RequestType, ResponseType>*> reactor_;
880  // callbacks_outstanding_ follows a refcount pattern
881  std::atomic<intptr_t> callbacks_outstanding_{
882  3}; // reserve for OnStarted, Finish, and CompletionOp
883  };
884 };
885 
886 } // namespace internal
887 } // namespace grpc
888 
889 #endif // GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_HANDLERS_H
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::read_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpRecvMessage< RequestType > > read_ops_
Definition: server_callback_handlers.h:427
grpc::internal::CallOpSendMessage
Definition: call_op_set.h:289
grpc::status
auto status
Definition: cpp/client/credentials_test.cc:200
grpc._simple_stubs.RequestType
RequestType
Definition: _simple_stubs.py:27
grpc._simple_stubs.ResponseType
ResponseType
Definition: _simple_stubs.py:28
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::reactor_
std::atomic< ServerReadReactor< RequestType > * > reactor_
Definition: server_callback_handlers.h:435
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::call_requester_
std::function< void()> call_requester_
Definition: server_callback_handlers.h:433
ctx
Definition: benchmark-async.c:30
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::SendInitialMetadata
void SendInitialMetadata() override
Definition: server_callback_handlers.h:335
grpc::internal::ServerCallbackCall::MaybeCallOnCancel
void MaybeCallOnCancel()
Definition: impl/codegen/server_callback.h:119
grpc::internal::FinishOnlyReactor
Definition: impl/codegen/server_callback.h:770
call_
grpc_call * call_
Definition: rls.cc:669
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::SetupReactor
void SetupReactor(ServerBidiReactor< RequestType, ResponseType > *reactor)
Definition: server_callback_handlers.h:811
rpc_service_method.h
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl
Definition: server_callback_handlers.h:717
grpc
Definition: grpcpp/alarm.h:33
grpc::ServerReadReactor
ServerReadReactor is the interface for a client-streaming RPC.
Definition: impl/codegen/server_callback.h:184
req_
EchoRequest req_
Definition: client_interceptors_end2end_test.cc:290
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::meta_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata > meta_ops_
Definition: server_callback_handlers.h:860
grpc::ServerContextBase::trailing_metadata_
std::multimap< std::string, std::string > trailing_metadata_
Definition: grpcpp/impl/codegen/server_context.h:476
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::meta_tag_
grpc::internal::CallbackWithSuccessTag meta_tag_
Definition: server_callback_handlers.h:420
grpc::internal::Call::call
grpc_call * call() const
Definition: include/grpcpp/impl/codegen/call.h:71
grpc::internal::CallbackUnaryHandler::Deserialize
void * Deserialize(grpc_call *call, grpc_byte_buffer *req, grpc::Status *status, void **handler_data) final
Definition: server_callback_handlers.h:81
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::meta_tag_
grpc::internal::CallbackWithSuccessTag meta_tag_
Definition: server_callback_handlers.h:223
grpc::internal::ServerReactor::InternalInlineable
virtual bool InternalInlineable()
Definition: impl/codegen/server_callback.h:61
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::call_
grpc::internal::Call call_
Definition: server_callback_handlers.h:657
grpc::ServerContextBase::set_message_allocator_state
void set_message_allocator_state(RpcAllocatorState *allocator_state)
Definition: grpcpp/impl/codegen/server_context.h:440
grpc::CallbackServerContext::compression_level_set
bool compression_level_set() const
Definition: grpcpp/impl/codegen/server_context.h:251
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::SendInitialMetadata
void SendInitialMetadata() override
Definition: server_callback_handlers.h:747
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::finish_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSendMessage, grpc::internal::CallOpServerSendStatus > finish_ops_
Definition: server_callback_handlers.h:649
options
double_dict options[]
Definition: capstone_test.c:55
benchmark.request
request
Definition: benchmark.py:77
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::call_requester_
std::function< void()> call_requester_
Definition: server_callback_handlers.h:659
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::SendInitialMetadata
void SendInitialMetadata() override
Definition: server_callback_handlers.h:537
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::CallOnDone
void CallOnDone() override
Definition: server_callback_handlers.h:402
grpc::internal::CallbackClientStreamingHandler::CallbackClientStreamingHandler
CallbackClientStreamingHandler(std::function< ServerReadReactor< RequestType > *(grpc::CallbackServerContext *, ResponseType *)> get_reactor)
Definition: server_callback_handlers.h:254
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::SetupReactor
void SetupReactor(ServerWriteReactor< ResponseType > *reactor)
Definition: server_callback_handlers.h:599
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::write_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSendMessage > write_ops_
Definition: server_callback_handlers.h:869
grpc::internal::CallOpSet::set_core_cq_tag
void set_core_cq_tag(void *core_cq_tag)
Definition: call_op_set.h:951
grpc::CoreCodegenInterface::grpc_call_arena_alloc
virtual void * grpc_call_arena_alloc(grpc_call *call, size_t length)=0
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::response
ResponseType * response()
Definition: server_callback_handlers.h:400
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl
Definition: server_callback_handlers.h:112
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl
Definition: server_callback_handlers.h:508
server_callback.h
ctx_
ClientContext ctx_
Definition: client_interceptors_end2end_test.cc:289
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::ctx_
grpc::CallbackServerContext *const ctx_
Definition: server_callback_handlers.h:656
grpc::MessageAllocator::AllocateMessages
virtual MessageHolder< RequestT, ResponseT > * AllocateMessages()=0
grpc::MessageHolder::request
RequestT * request()
Definition: impl/codegen/message_allocator.h:47
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::callbacks_outstanding_
std::atomic< intptr_t > callbacks_outstanding_
Definition: server_callback_handlers.h:246
grpc::ServerBidiReactor
ServerBidiReactor is the interface for a bidirectional streaming RPC.
Definition: impl/codegen/server_callback.h:188
grpc::internal::CallbackServerStreamingHandler::CallbackServerStreamingHandler
CallbackServerStreamingHandler(std::function< ServerWriteReactor< ResponseType > *(grpc::CallbackServerContext *, const RequestType *)> get_reactor)
Definition: server_callback_handlers.h:445
grpc::WriteOptions::is_last_message
bool is_last_message() const
Definition: call_op_set.h:174
grpc::ServerCallbackUnary
Definition: impl/codegen/server_callback.h:193
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::write_tag_
grpc::internal::CallbackWithSuccessTag write_tag_
Definition: server_callback_handlers.h:870
grpc::internal::CallbackBidiHandler::RunHandler
void RunHandler(const HandlerParameter &param) final
Definition: server_callback_handlers.h:676
call
FilterStackCall * call
Definition: call.cc:750
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::CallOnDone
void CallOnDone() override
Definition: server_callback_handlers.h:843
grpc::WriteOptions
Per-message write options.
Definition: call_op_set.h:81
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::request
const RequestType * request()
Definition: server_callback_handlers.h:201
grpc::ServerCallbackReader
Definition: impl/codegen/server_callback.h:209
grpc::SerializationTraits
Definition: grpcpp/impl/codegen/serialization_traits.h:60
grpc::internal::CallOpServerSendStatus
Definition: call_op_set.h:661
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::meta_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata > meta_ops_
Definition: server_callback_handlers.h:644
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::finish_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSendMessage, grpc::internal::CallOpServerSendStatus > finish_ops_
Definition: server_callback_handlers.h:865
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::CallOnDone
void CallOnDone() override
Definition: server_callback_handlers.h:204
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::ServerCallbackReaderImpl
ServerCallbackReaderImpl(grpc::CallbackServerContext *ctx, grpc::internal::Call *call, std::function< void()> call_requester)
Definition: server_callback_handlers.h:369
grpc::g_core_codegen_interface
CoreCodegenInterface * g_core_codegen_interface
Definition: include/grpcpp/impl/codegen/completion_queue.h:98
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::Write
void Write(const ResponseType *resp, grpc::WriteOptions options) override
Definition: server_callback_handlers.h:772
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::WriteAndFinish
void WriteAndFinish(const ResponseType *resp, grpc::WriteOptions options, grpc::Status s) override
Definition: server_callback_handlers.h:580
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::Read
void Read(RequestType *req) override
Definition: server_callback_handlers.h:360
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::read_tag_
grpc::internal::CallbackWithSuccessTag read_tag_
Definition: server_callback_handlers.h:873
grpc::MessageAllocator< RequestType, ResponseType >
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::request
const RequestType * request()
Definition: server_callback_handlers.h:625
grpc::CallbackServerContext::compression_level
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: grpcpp/impl/codegen/server_context.h:236
resp_
EchoResponse resp_
Definition: client_interceptors_end2end_test.cc:291
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::~ServerCallbackWriterImpl
~ServerCallbackWriterImpl()
Definition: server_callback_handlers.h:619
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::SetupReactor
void SetupReactor(ServerReadReactor< RequestType > *reactor)
Definition: server_callback_handlers.h:374
grpc::internal::ServerCallbackCall::Ref
void Ref()
Increases the reference count.
Definition: impl/codegen/server_callback.h:127
grpc::ServerContextBase::initial_metadata_flags
uint32_t initial_metadata_flags() const
Definition: grpcpp/impl/codegen/server_context.h:427
grpc::internal::CallbackBidiHandler
Definition: impl/codegen/server_callback.h:49
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::ServerCallbackUnaryImpl
ServerCallbackUnaryImpl(grpc::CallbackServerContext *ctx, grpc::internal::Call *call, MessageHolder< RequestType, ResponseType > *allocator_state, std::function< void()> call_requester)
Definition: server_callback_handlers.h:179
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::finish_tag_
grpc::internal::CallbackWithSuccessTag finish_tag_
Definition: server_callback_handlers.h:425
grpc::internal::CallbackWithSuccessTag
Definition: callback_common.h:137
req
static uv_connect_t req
Definition: test-connection-fail.c:30
grpc::internal::ServerReactor
Definition: impl/codegen/server_callback.h:51
http2_server_health_check.resp
resp
Definition: http2_server_health_check.py:31
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::meta_tag_
grpc::internal::CallbackWithSuccessTag meta_tag_
Definition: server_callback_handlers.h:645
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::ServerCallbackWriterImpl
ServerCallbackWriterImpl(grpc::CallbackServerContext *ctx, grpc::internal::Call *call, const RequestType *req, std::function< void()> call_requester)
Definition: server_callback_handlers.h:591
grpc::ServerCallbackUnary::BindReactor
void BindReactor(Reactor *reactor)
Definition: impl/codegen/server_callback.h:203
grpc::internal::CallbackClientStreamingHandler::RunHandler
void RunHandler(const HandlerParameter &param) final
Definition: server_callback_handlers.h:259
grpc_call
struct grpc_call grpc_call
Definition: grpc_types.h:70
grpc_byte_buffer
Definition: grpc_types.h:43
grpc::ServerContextBase::initial_metadata_
std::multimap< std::string, std::string > initial_metadata_
Definition: grpcpp/impl/codegen/server_context.h:475
grpc::internal::Call::PerformOps
void PerformOps(CallOpSetInterface *ops)
Definition: include/grpcpp/impl/codegen/call.h:67
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::Finish
void Finish(grpc::Status s) override
Definition: server_callback_handlers.h:720
grpc::internal::CallbackUnaryHandler::RunHandler
void RunHandler(const HandlerParameter &param) final
Definition: server_callback_handlers.h:46
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::finish_tag_
grpc::internal::CallbackWithSuccessTag finish_tag_
Definition: server_callback_handlers.h:866
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::meta_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata > meta_ops_
Definition: server_callback_handlers.h:419
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::reactor
ServerReactor * reactor() override
Definition: server_callback_handlers.h:855
grpc::ByteBuffer
A sequence of bytes.
Definition: include/grpcpp/impl/codegen/byte_buffer.h:61
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::WriteAndFinish
void WriteAndFinish(const ResponseType *resp, grpc::WriteOptions options, grpc::Status s) override
Definition: server_callback_handlers.h:790
grpc::ServerCallbackWriter
Definition: impl/codegen/server_callback.h:223
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::SetupReactor
void SetupReactor(ServerUnaryReactor *reactor)
Definition: server_callback_handlers.h:194
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::meta_tag_
grpc::internal::CallbackWithSuccessTag meta_tag_
Definition: server_callback_handlers.h:861
grpc::ServerCallbackReader< RequestType >::BindReactor
void BindReactor(ServerReadReactor< RequestType > *reactor)
Definition: impl/codegen/server_callback.h:217
grpc::internal::CallbackUnaryHandler::SetMessageAllocator
void SetMessageAllocator(MessageAllocator< RequestType, ResponseType > *allocator)
Definition: server_callback_handlers.h:41
grpc::internal::Call
Straightforward wrapping of the C call object.
Definition: include/grpcpp/impl/codegen/call.h:37
grpc::internal::CallbackClientStreamingHandler
Definition: impl/codegen/server_callback.h:45
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata >
grpc.StatusCode.UNIMPLEMENTED
tuple UNIMPLEMENTED
Definition: src/python/grpcio/grpc/__init__.py:276
grpc::CallbackServerContext
Definition: grpcpp/impl/codegen/server_context.h:606
grpc::internal::CallbackUnaryHandler
Definition: include/grpcpp/impl/codegen/byte_buffer.h:41
writer
void writer(void *n)
Definition: libuv/docs/code/locks/main.c:22
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::call_requester_
std::function< void()> call_requester_
Definition: server_callback_handlers.h:233
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::read_tag_
grpc::internal::CallbackWithSuccessTag read_tag_
Definition: server_callback_handlers.h:428
grpc::internal::CallbackBidiHandler::CallbackBidiHandler
CallbackBidiHandler(std::function< ServerBidiReactor< RequestType, ResponseType > *(grpc::CallbackServerContext *)> get_reactor)
Definition: server_callback_handlers.h:671
grpc::ServerContextBase::sent_initial_metadata_
bool sent_initial_metadata_
Definition: grpcpp/impl/codegen/server_context.h:472
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::ctx_
grpc::CallbackServerContext *const ctx_
Definition: server_callback_handlers.h:875
grpc::internal::DefaultMessageHolder
Definition: impl/codegen/server_callback.h:163
status.h
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::finish_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSendMessage, grpc::internal::CallOpServerSendStatus > finish_ops_
Definition: server_callback_handlers.h:227
grpc::internal::ServerCallbackCall::MaybeDone
void MaybeDone()
Definition: impl/codegen/server_callback.h:95
grpc::internal::UnimplementedUnaryReactor
FinishOnlyReactor< ServerUnaryReactor > UnimplementedUnaryReactor
Definition: impl/codegen/server_callback.h:776
grpc::internal::CallOpSendInitialMetadata
Definition: call_op_set.h:219
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::finish_tag_
grpc::internal::CallbackWithSuccessTag finish_tag_
Definition: server_callback_handlers.h:650
grpc::internal::MethodHandler
Base class for running an RPC handler.
Definition: grpcpp/impl/codegen/rpc_service_method.h:40
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::Read
void Read(RequestType *req) override
Definition: server_callback_handlers.h:797
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::ctx_
grpc::CallbackServerContext *const ctx_
Definition: server_callback_handlers.h:430
grpc::ContextAllocator::Release
virtual void Release(CallbackServerContext *)
Definition: grpcpp/impl/codegen/server_context.h:660
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::write_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSendMessage > write_ops_
Definition: server_callback_handlers.h:653
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::reactor_
std::atomic< ServerWriteReactor< ResponseType > * > reactor_
Definition: server_callback_handlers.h:661
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::allocator_state_
MessageHolder< RequestType, ResponseType > *const allocator_state_
Definition: server_callback_handlers.h:232
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::Finish
void Finish(grpc::Status s) override
Definition: server_callback_handlers.h:114
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::reactor_
std::atomic< ServerUnaryReactor * > reactor_
Definition: server_callback_handlers.h:244
grpc::internal::CallbackWithSuccessTag::Set
void Set(grpc_call *call, std::function< void(bool)> f, CompletionQueueTag *ops, bool can_inline)
Definition: callback_common.h:164
grpc::ServerBidiReactor::OnReadDone
virtual void OnReadDone(bool)
Definition: impl/codegen/server_callback.h:422
benchmark::internal::Finish
double Finish(Counter const &c, IterationCount iterations, double cpu_time, double num_threads)
Definition: benchmark/src/counter.cc:20
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::response
ResponseType * response()
Definition: server_callback_handlers.h:202
grpc::internal::CallbackServerStreamingHandler
Definition: include/grpcpp/impl/codegen/byte_buffer.h:43
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::call_
grpc::internal::Call call_
Definition: server_callback_handlers.h:431
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
grpc::MessageHolder::Release
virtual void Release()=0
grpc::CallbackServerContext::context_allocator
ContextAllocator * context_allocator() const
Definition: grpcpp/impl/codegen/server_context.h:359
server_context.h
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::ctx_
grpc::CallbackServerContext *const ctx_
Definition: server_callback_handlers.h:230
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::call_
grpc::internal::Call call_
Definition: server_callback_handlers.h:876
grpc::Status
Definition: include/grpcpp/impl/codegen/status.h:35
ok
bool ok
Definition: async_end2end_test.cc:197
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::~ServerCallbackReaderImpl
~ServerCallbackReaderImpl()
Definition: server_callback_handlers.h:398
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::reactor
ServerReactor * reactor() override
Definition: server_callback_handlers.h:639
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::Finish
void Finish(grpc::Status s) override
Definition: server_callback_handlers.h:510
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::call_
grpc::internal::Call call_
Definition: server_callback_handlers.h:231
grpc::ServerUnaryReactor
Definition: impl/codegen/server_callback.h:699
grpc::CoreCodegenInterface::grpc_call_ref
virtual void grpc_call_ref(grpc_call *call)=0
GPR_CODEGEN_ASSERT
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: grpcpp/impl/codegen/core_codegen_interface.h:151
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::call_requester_
std::function< void()> call_requester_
Definition: server_callback_handlers.h:877
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::ServerCallbackReaderWriterImpl
ServerCallbackReaderWriterImpl(grpc::CallbackServerContext *ctx, grpc::internal::Call *call, std::function< void()> call_requester)
Definition: server_callback_handlers.h:806
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::reactor
ServerReactor * reactor() override
Definition: server_callback_handlers.h:217
internal
Definition: benchmark/test/output_test_helper.cc:20
grpc::internal::CallbackClientStreamingHandler::get_reactor_
std::function< ServerReadReactor< RequestType > *(grpc::CallbackServerContext *, ResponseType *)> get_reactor_
Definition: server_callback_handlers.h:299
grpc::internal::CallbackUnaryHandler::CallbackUnaryHandler
CallbackUnaryHandler(std::function< ServerUnaryReactor *(grpc::CallbackServerContext *, const RequestType *, ResponseType *)> get_reactor)
Definition: server_callback_handlers.h:35
grpc::internal::CallbackUnaryHandler::allocator_
MessageAllocator< RequestType, ResponseType > * allocator_
Definition: server_callback_handlers.h:110
grpc::MessageHolder< RequestType, ResponseType >
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::write_tag_
grpc::internal::CallbackWithSuccessTag write_tag_
Definition: server_callback_handlers.h:654
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::reactor_
std::atomic< ServerBidiReactor< RequestType, ResponseType > * > reactor_
Definition: server_callback_handlers.h:879
grpc::ServerCallbackReaderWriter
Definition: impl/codegen/server_callback.h:240
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl
Definition: server_callback_handlers.h:301
grpc::internal::CallbackServerStreamingHandler::Deserialize
void * Deserialize(grpc_call *call, grpc_byte_buffer *req, grpc::Status *status, void **) final
Definition: server_callback_handlers.h:487
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition: grpc_tool.cc:250
grpc::MessageHolder::response
ResponseT * response()
Definition: impl/codegen/message_allocator.h:48
grpc::internal::CatchingReactorGetter
Reactor * CatchingReactorGetter(Func &&func, Args &&... args)
Definition: callback_common.h:54
testing::Ref
internal::RefMatcher< T & > Ref(T &x)
Definition: cares/cares/test/gmock-1.8.0/gmock/gmock.h:8628
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::finish_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSendMessage, grpc::internal::CallOpServerSendStatus > finish_ops_
Definition: server_callback_handlers.h:424
grpc::internal::CallbackServerStreamingHandler::RunHandler
void RunHandler(const HandlerParameter &param) final
Definition: server_callback_handlers.h:450
grpc::internal::CallbackBidiHandler::ServerCallbackReaderWriterImpl::read_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpRecvMessage< RequestType > > read_ops_
Definition: server_callback_handlers.h:872
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::meta_ops_
grpc::internal::CallOpSet< grpc::internal::CallOpSendInitialMetadata > meta_ops_
Definition: server_callback_handlers.h:222
message_allocator.h
grpc::ServerWriteReactor
ServerWriteReactor is the interface for a server-streaming RPC.
Definition: impl/codegen/server_callback.h:186
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::req_
const RequestType * req_
Definition: server_callback_handlers.h:658
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::finish_tag_
grpc::internal::CallbackWithSuccessTag finish_tag_
Definition: server_callback_handlers.h:228
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::resp_
ResponseType resp_
Definition: server_callback_handlers.h:432
grpc::CoreCodegenInterface::grpc_call_unref
virtual void grpc_call_unref(grpc_call *call)=0
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::reactor
ServerReactor * reactor() override
Definition: server_callback_handlers.h:414
reader
void reader(void *n)
Definition: libuv/docs/code/locks/main.c:8
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::CallOnDone
void CallOnDone() override
Definition: server_callback_handlers.h:627
grpc::internal::CallbackUnaryHandler::ServerCallbackUnaryImpl::SendInitialMetadata
void SendInitialMetadata() override
Definition: server_callback_handlers.h:149
grpc::internal::CallbackClientStreamingHandler::ServerCallbackReaderImpl::Finish
void Finish(grpc::Status s) override
Definition: server_callback_handlers.h:303
grpc::internal::CallbackUnaryHandler::get_reactor_
std::function< ServerUnaryReactor *(grpc::CallbackServerContext *, const RequestType *, ResponseType *)> get_reactor_
Definition: server_callback_handlers.h:109
grpc::internal::CallbackServerStreamingHandler::ServerCallbackWriterImpl::Write
void Write(const ResponseType *resp, grpc::WriteOptions options) override
Definition: server_callback_handlers.h:562
stream
voidpf stream
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:17