GRPC C++  1.26.0
async_stream_impl.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_ASYNC_STREAM_IMPL_H
19 #define GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_IMPL_H
20 
27 
28 namespace grpc_impl {
29 
30 namespace internal {
33  public:
35 
39  virtual void StartCall(void* tag) = 0;
40 
47  virtual void ReadInitialMetadata(void* tag) = 0;
48 
76  virtual void Finish(::grpc::Status* status, void* tag) = 0;
77 };
78 
80 template <class R>
82  public:
83  virtual ~AsyncReaderInterface() {}
84 
98  virtual void Read(R* msg, void* tag) = 0;
99 };
100 
102 template <class W>
104  public:
106 
119  virtual void Write(const W& msg, void* tag) = 0;
120 
136  virtual void Write(const W& msg, ::grpc::WriteOptions options, void* tag) = 0;
137 
156  void WriteLast(const W& msg, ::grpc::WriteOptions options, void* tag) {
157  Write(msg, options.set_last_message(), tag);
158  }
159 };
160 
161 } // namespace internal
162 
163 template <class R>
166  public internal::AsyncReaderInterface<R> {};
167 
168 namespace internal {
169 template <class R>
171  public:
179  template <class W>
182  const ::grpc::internal::RpcMethod& method,
183  ::grpc_impl::ClientContext* context,
184  const W& request, bool start, void* tag) {
185  ::grpc::internal::Call call = channel->CreateCall(method, context, cq);
187  call.call(), sizeof(ClientAsyncReader<R>)))
188  ClientAsyncReader<R>(call, context, request, start, tag);
189  }
190 };
191 } // namespace internal
192 
196 template <class R>
198  public:
199  // always allocated against a call arena, no memory free required
200  static void operator delete(void* /*ptr*/, std::size_t size) {
201  GPR_CODEGEN_ASSERT(size == sizeof(ClientAsyncReader));
202  }
203 
204  // This operator should never be called as the memory should be freed as part
205  // of the arena destruction. It only exists to provide a matching operator
206  // delete to the operator new so that some compilers will not complain (see
207  // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
208  // there are no tests catching the compiler warning.
209  static void operator delete(void*, void*) { GPR_CODEGEN_ASSERT(false); }
210 
211  void StartCall(void* tag) override {
212  GPR_CODEGEN_ASSERT(!started_);
213  started_ = true;
214  StartCallInternal(tag);
215  }
216 
225  void ReadInitialMetadata(void* tag) override {
226  GPR_CODEGEN_ASSERT(started_);
227  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
228 
229  meta_ops_.set_output_tag(tag);
230  meta_ops_.RecvInitialMetadata(context_);
231  call_.PerformOps(&meta_ops_);
232  }
233 
234  void Read(R* msg, void* tag) override {
235  GPR_CODEGEN_ASSERT(started_);
236  read_ops_.set_output_tag(tag);
237  if (!context_->initial_metadata_received_) {
238  read_ops_.RecvInitialMetadata(context_);
239  }
240  read_ops_.RecvMessage(msg);
241  call_.PerformOps(&read_ops_);
242  }
243 
249  void Finish(::grpc::Status* status, void* tag) override {
250  GPR_CODEGEN_ASSERT(started_);
251  finish_ops_.set_output_tag(tag);
252  if (!context_->initial_metadata_received_) {
253  finish_ops_.RecvInitialMetadata(context_);
254  }
255  finish_ops_.ClientRecvStatus(context_, status);
256  call_.PerformOps(&finish_ops_);
257  }
258 
259  private:
261  template <class W>
263  ::grpc_impl::ClientContext* context, const W& request,
264  bool start, void* tag)
265  : context_(context), call_(call), started_(start) {
266  // TODO(ctiller): don't assert
267  GPR_CODEGEN_ASSERT(init_ops_.SendMessage(request).ok());
268  init_ops_.ClientSendClose();
269  if (start) {
270  StartCallInternal(tag);
271  } else {
272  GPR_CODEGEN_ASSERT(tag == nullptr);
273  }
274  }
275 
276  void StartCallInternal(void* tag) {
277  init_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
278  context_->initial_metadata_flags());
279  init_ops_.set_output_tag(tag);
280  call_.PerformOps(&init_ops_);
281  }
282 
283  ::grpc_impl::ClientContext* context_;
285  bool started_;
289  init_ops_;
291  meta_ops_;
294  read_ops_;
295  ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
297  finish_ops_;
298 };
299 
301 template <class W>
305  public:
310  virtual void WritesDone(void* tag) = 0;
311 };
312 
313 namespace internal {
314 template <class W>
316  public:
328  template <class R>
331  const ::grpc::internal::RpcMethod& method,
332  ::grpc_impl::ClientContext* context,
333  R* response, bool start, void* tag) {
334  ::grpc::internal::Call call = channel->CreateCall(method, context, cq);
336  call.call(), sizeof(ClientAsyncWriter<W>)))
337  ClientAsyncWriter<W>(call, context, response, start, tag);
338  }
339 };
340 } // namespace internal
341 
345 template <class W>
347  public:
348  // always allocated against a call arena, no memory free required
349  static void operator delete(void* /*ptr*/, std::size_t size) {
350  GPR_CODEGEN_ASSERT(size == sizeof(ClientAsyncWriter));
351  }
352 
353  // This operator should never be called as the memory should be freed as part
354  // of the arena destruction. It only exists to provide a matching operator
355  // delete to the operator new so that some compilers will not complain (see
356  // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
357  // there are no tests catching the compiler warning.
358  static void operator delete(void*, void*) { GPR_CODEGEN_ASSERT(false); }
359 
360  void StartCall(void* tag) override {
361  GPR_CODEGEN_ASSERT(!started_);
362  started_ = true;
363  StartCallInternal(tag);
364  }
365 
373  void ReadInitialMetadata(void* tag) override {
374  GPR_CODEGEN_ASSERT(started_);
375  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
376 
377  meta_ops_.set_output_tag(tag);
378  meta_ops_.RecvInitialMetadata(context_);
379  call_.PerformOps(&meta_ops_);
380  }
381 
382  void Write(const W& msg, void* tag) override {
383  GPR_CODEGEN_ASSERT(started_);
384  write_ops_.set_output_tag(tag);
385  // TODO(ctiller): don't assert
386  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
387  call_.PerformOps(&write_ops_);
388  }
389 
390  void Write(const W& msg, ::grpc::WriteOptions options, void* tag) override {
391  GPR_CODEGEN_ASSERT(started_);
392  write_ops_.set_output_tag(tag);
393  if (options.is_last_message()) {
394  options.set_buffer_hint();
395  write_ops_.ClientSendClose();
396  }
397  // TODO(ctiller): don't assert
398  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
399  call_.PerformOps(&write_ops_);
400  }
401 
402  void WritesDone(void* tag) override {
403  GPR_CODEGEN_ASSERT(started_);
404  write_ops_.set_output_tag(tag);
405  write_ops_.ClientSendClose();
406  call_.PerformOps(&write_ops_);
407  }
408 
416  void Finish(::grpc::Status* status, void* tag) override {
417  GPR_CODEGEN_ASSERT(started_);
418  finish_ops_.set_output_tag(tag);
419  if (!context_->initial_metadata_received_) {
420  finish_ops_.RecvInitialMetadata(context_);
421  }
422  finish_ops_.ClientRecvStatus(context_, status);
423  call_.PerformOps(&finish_ops_);
424  }
425 
426  private:
428  template <class R>
430  ::grpc_impl::ClientContext* context, R* response,
431  bool start, void* tag)
432  : context_(context), call_(call), started_(start) {
433  finish_ops_.RecvMessage(response);
434  finish_ops_.AllowNoMessage();
435  if (start) {
436  StartCallInternal(tag);
437  } else {
438  GPR_CODEGEN_ASSERT(tag == nullptr);
439  }
440  }
441 
442  void StartCallInternal(void* tag) {
443  write_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
444  context_->initial_metadata_flags());
445  // if corked bit is set in context, we just keep the initial metadata
446  // buffered up to coalesce with later message send. No op is performed.
447  if (!context_->initial_metadata_corked_) {
448  write_ops_.set_output_tag(tag);
449  call_.PerformOps(&write_ops_);
450  }
451  }
452 
453  ::grpc_impl::ClientContext* context_;
455  bool started_;
457  meta_ops_;
461  write_ops_;
465  finish_ops_;
466 };
467 
471 template <class W, class R>
476  public:
481  virtual void WritesDone(void* tag) = 0;
482 };
483 
484 namespace internal {
485 template <class W, class R>
487  public:
497  const ::grpc::internal::RpcMethod& method,
498  ::grpc_impl::ClientContext* context, bool start, void* tag) {
499  ::grpc::internal::Call call = channel->CreateCall(method, context, cq);
500 
502  call.call(), sizeof(ClientAsyncReaderWriter<W, R>)))
503  ClientAsyncReaderWriter<W, R>(call, context, start, tag);
504  }
505 };
506 } // namespace internal
507 
512 template <class W, class R>
514  : public ClientAsyncReaderWriterInterface<W, R> {
515  public:
516  // always allocated against a call arena, no memory free required
517  static void operator delete(void* /*ptr*/, std::size_t size) {
519  }
520 
521  // This operator should never be called as the memory should be freed as part
522  // of the arena destruction. It only exists to provide a matching operator
523  // delete to the operator new so that some compilers will not complain (see
524  // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
525  // there are no tests catching the compiler warning.
526  static void operator delete(void*, void*) { GPR_CODEGEN_ASSERT(false); }
527 
528  void StartCall(void* tag) override {
529  GPR_CODEGEN_ASSERT(!started_);
530  started_ = true;
531  StartCallInternal(tag);
532  }
533 
541  void ReadInitialMetadata(void* tag) override {
542  GPR_CODEGEN_ASSERT(started_);
543  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
544 
545  meta_ops_.set_output_tag(tag);
546  meta_ops_.RecvInitialMetadata(context_);
547  call_.PerformOps(&meta_ops_);
548  }
549 
550  void Read(R* msg, void* tag) override {
551  GPR_CODEGEN_ASSERT(started_);
552  read_ops_.set_output_tag(tag);
553  if (!context_->initial_metadata_received_) {
554  read_ops_.RecvInitialMetadata(context_);
555  }
556  read_ops_.RecvMessage(msg);
557  call_.PerformOps(&read_ops_);
558  }
559 
560  void Write(const W& msg, void* tag) override {
561  GPR_CODEGEN_ASSERT(started_);
562  write_ops_.set_output_tag(tag);
563  // TODO(ctiller): don't assert
564  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
565  call_.PerformOps(&write_ops_);
566  }
567 
568  void Write(const W& msg, ::grpc::WriteOptions options, void* tag) override {
569  GPR_CODEGEN_ASSERT(started_);
570  write_ops_.set_output_tag(tag);
571  if (options.is_last_message()) {
572  options.set_buffer_hint();
573  write_ops_.ClientSendClose();
574  }
575  // TODO(ctiller): don't assert
576  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
577  call_.PerformOps(&write_ops_);
578  }
579 
580  void WritesDone(void* tag) override {
581  GPR_CODEGEN_ASSERT(started_);
582  write_ops_.set_output_tag(tag);
583  write_ops_.ClientSendClose();
584  call_.PerformOps(&write_ops_);
585  }
586 
591  void Finish(::grpc::Status* status, void* tag) override {
592  GPR_CODEGEN_ASSERT(started_);
593  finish_ops_.set_output_tag(tag);
594  if (!context_->initial_metadata_received_) {
595  finish_ops_.RecvInitialMetadata(context_);
596  }
597  finish_ops_.ClientRecvStatus(context_, status);
598  call_.PerformOps(&finish_ops_);
599  }
600 
601  private:
604  ::grpc_impl::ClientContext* context, bool start,
605  void* tag)
606  : context_(context), call_(call), started_(start) {
607  if (start) {
608  StartCallInternal(tag);
609  } else {
610  GPR_CODEGEN_ASSERT(tag == nullptr);
611  }
612  }
613 
614  void StartCallInternal(void* tag) {
615  write_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
616  context_->initial_metadata_flags());
617  // if corked bit is set in context, we just keep the initial metadata
618  // buffered up to coalesce with later message send. No op is performed.
619  if (!context_->initial_metadata_corked_) {
620  write_ops_.set_output_tag(tag);
621  call_.PerformOps(&write_ops_);
622  }
623  }
624 
625  ::grpc_impl::ClientContext* context_;
627  bool started_;
629  meta_ops_;
632  read_ops_;
636  write_ops_;
637  ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
639  finish_ops_;
640 };
641 
642 template <class W, class R>
646  public:
669  virtual void Finish(const W& msg, const ::grpc::Status& status,
670  void* tag) = 0;
671 
693  virtual void FinishWithError(const ::grpc::Status& status, void* tag) = 0;
694 };
695 
699 template <class W, class R>
700 class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
701  public:
703  : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
704 
710  void SendInitialMetadata(void* tag) override {
711  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
712 
713  meta_ops_.set_output_tag(tag);
714  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
715  ctx_->initial_metadata_flags());
716  if (ctx_->compression_level_set()) {
717  meta_ops_.set_compression_level(ctx_->compression_level());
718  }
719  ctx_->sent_initial_metadata_ = true;
720  call_.PerformOps(&meta_ops_);
721  }
722 
723  void Read(R* msg, void* tag) override {
724  read_ops_.set_output_tag(tag);
725  read_ops_.RecvMessage(msg);
726  call_.PerformOps(&read_ops_);
727  }
728 
740  void Finish(const W& msg, const ::grpc::Status& status, void* tag) override {
741  finish_ops_.set_output_tag(tag);
742  if (!ctx_->sent_initial_metadata_) {
743  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
744  ctx_->initial_metadata_flags());
745  if (ctx_->compression_level_set()) {
746  finish_ops_.set_compression_level(ctx_->compression_level());
747  }
748  ctx_->sent_initial_metadata_ = true;
749  }
750  // The response is dropped if the status is not OK.
751  if (status.ok()) {
752  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_,
753  finish_ops_.SendMessage(msg));
754  } else {
755  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
756  }
757  call_.PerformOps(&finish_ops_);
758  }
759 
769  void FinishWithError(const ::grpc::Status& status, void* tag) override {
770  GPR_CODEGEN_ASSERT(!status.ok());
771  finish_ops_.set_output_tag(tag);
772  if (!ctx_->sent_initial_metadata_) {
773  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
774  ctx_->initial_metadata_flags());
775  if (ctx_->compression_level_set()) {
776  finish_ops_.set_compression_level(ctx_->compression_level());
777  }
778  ctx_->sent_initial_metadata_ = true;
779  }
780  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
781  call_.PerformOps(&finish_ops_);
782  }
783 
784  private:
785  void BindCall(::grpc::internal::Call* call) override { call_ = *call; }
786 
790  meta_ops_;
795  finish_ops_;
796 };
797 
798 template <class W>
802  public:
824  virtual void Finish(const ::grpc::Status& status, void* tag) = 0;
825 
840  virtual void WriteAndFinish(const W& msg, ::grpc::WriteOptions options,
841  const ::grpc::Status& status, void* tag) = 0;
842 };
843 
846 template <class W>
848  public:
850  : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
851 
859  void SendInitialMetadata(void* tag) override {
860  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
861 
862  meta_ops_.set_output_tag(tag);
863  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
864  ctx_->initial_metadata_flags());
865  if (ctx_->compression_level_set()) {
866  meta_ops_.set_compression_level(ctx_->compression_level());
867  }
868  ctx_->sent_initial_metadata_ = true;
869  call_.PerformOps(&meta_ops_);
870  }
871 
872  void Write(const W& msg, void* tag) override {
873  write_ops_.set_output_tag(tag);
874  EnsureInitialMetadataSent(&write_ops_);
875  // TODO(ctiller): don't assert
876  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
877  call_.PerformOps(&write_ops_);
878  }
879 
880  void Write(const W& msg, ::grpc::WriteOptions options, void* tag) override {
881  write_ops_.set_output_tag(tag);
882  if (options.is_last_message()) {
883  options.set_buffer_hint();
884  }
885 
886  EnsureInitialMetadataSent(&write_ops_);
887  // TODO(ctiller): don't assert
888  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
889  call_.PerformOps(&write_ops_);
890  }
891 
902  void WriteAndFinish(const W& msg, ::grpc::WriteOptions options,
903  const ::grpc::Status& status, void* tag) override {
904  write_ops_.set_output_tag(tag);
905  EnsureInitialMetadataSent(&write_ops_);
906  options.set_buffer_hint();
907  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
908  write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
909  call_.PerformOps(&write_ops_);
910  }
911 
923  void Finish(const ::grpc::Status& status, void* tag) override {
924  finish_ops_.set_output_tag(tag);
925  EnsureInitialMetadataSent(&finish_ops_);
926  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
927  call_.PerformOps(&finish_ops_);
928  }
929 
930  private:
931  void BindCall(::grpc::internal::Call* call) override { call_ = *call; }
932 
933  template <class T>
934  void EnsureInitialMetadataSent(T* ops) {
935  if (!ctx_->sent_initial_metadata_) {
936  ops->SendInitialMetadata(&ctx_->initial_metadata_,
937  ctx_->initial_metadata_flags());
938  if (ctx_->compression_level_set()) {
939  ops->set_compression_level(ctx_->compression_level());
940  }
941  ctx_->sent_initial_metadata_ = true;
942  }
943  }
944 
948  meta_ops_;
952  write_ops_;
953  ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
955  finish_ops_;
956 };
957 
959 template <class W, class R>
964  public:
987  virtual void Finish(const ::grpc::Status& status, void* tag) = 0;
988 
1003  virtual void WriteAndFinish(const W& msg, ::grpc::WriteOptions options,
1004  const ::grpc::Status& status, void* tag) = 0;
1005 };
1006 
1011 template <class W, class R>
1013  : public ServerAsyncReaderWriterInterface<W, R> {
1014  public:
1016  : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
1017 
1025  void SendInitialMetadata(void* tag) override {
1026  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
1027 
1028  meta_ops_.set_output_tag(tag);
1029  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
1030  ctx_->initial_metadata_flags());
1031  if (ctx_->compression_level_set()) {
1032  meta_ops_.set_compression_level(ctx_->compression_level());
1033  }
1034  ctx_->sent_initial_metadata_ = true;
1035  call_.PerformOps(&meta_ops_);
1036  }
1037 
1038  void Read(R* msg, void* tag) override {
1039  read_ops_.set_output_tag(tag);
1040  read_ops_.RecvMessage(msg);
1041  call_.PerformOps(&read_ops_);
1042  }
1043 
1044  void Write(const W& msg, void* tag) override {
1045  write_ops_.set_output_tag(tag);
1046  EnsureInitialMetadataSent(&write_ops_);
1047  // TODO(ctiller): don't assert
1048  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
1049  call_.PerformOps(&write_ops_);
1050  }
1051 
1052  void Write(const W& msg, ::grpc::WriteOptions options, void* tag) override {
1053  write_ops_.set_output_tag(tag);
1054  if (options.is_last_message()) {
1055  options.set_buffer_hint();
1056  }
1057  EnsureInitialMetadataSent(&write_ops_);
1058  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
1059  call_.PerformOps(&write_ops_);
1060  }
1061 
1070  //
1073  void WriteAndFinish(const W& msg, ::grpc::WriteOptions options,
1074  const ::grpc::Status& status, void* tag) override {
1075  write_ops_.set_output_tag(tag);
1076  EnsureInitialMetadataSent(&write_ops_);
1077  options.set_buffer_hint();
1078  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
1079  write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
1080  call_.PerformOps(&write_ops_);
1081  }
1082 
1091  //
1094  void Finish(const ::grpc::Status& status, void* tag) override {
1095  finish_ops_.set_output_tag(tag);
1096  EnsureInitialMetadataSent(&finish_ops_);
1097 
1098  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
1099  call_.PerformOps(&finish_ops_);
1100  }
1101 
1102  private:
1104 
1105  void BindCall(::grpc::internal::Call* call) override { call_ = *call; }
1106 
1107  template <class T>
1108  void EnsureInitialMetadataSent(T* ops) {
1109  if (!ctx_->sent_initial_metadata_) {
1110  ops->SendInitialMetadata(&ctx_->initial_metadata_,
1111  ctx_->initial_metadata_flags());
1112  if (ctx_->compression_level_set()) {
1113  ops->set_compression_level(ctx_->compression_level());
1114  }
1115  ctx_->sent_initial_metadata_ = true;
1116  }
1117  }
1118 
1119  ::grpc::internal::Call call_;
1122  meta_ops_;
1127  write_ops_;
1128  ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
1130  finish_ops_;
1131 };
1132 
1133 } // namespace grpc_impl
1134 #endif // GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_IMPL_H
::grpc_impl::ClientAsyncReader< R > ClientAsyncReader
Definition: async_stream.h:43
An interface that can be fed a sequence of messages of type W.
Definition: async_stream_impl.h:103
void WriteAndFinish(const W &msg, ::grpc::WriteOptions options, const ::grpc::Status &status, void *tag) override
See the ServerAsyncReaderWriterInterface.WriteAndFinish method for semantics.
Definition: async_stream_impl.h:1073
Async server-side API for doing server streaming RPCs, where the outgoing message stream from the ser...
Definition: async_stream_impl.h:847
Definition: async_stream_impl.h:170
WriteOptions & set_buffer_hint()
Sets flag indicating that the write may be buffered and need not go out on the wire immediately...
Definition: call_op_set.h:122
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:146
virtual ~ClientAsyncStreamingInterface()
Definition: async_stream_impl.h:34
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream_impl.h:560
virtual void ReadInitialMetadata(void *tag)=0
Request notification of the reading of the initial metadata.
void WriteAndFinish(const W &msg, ::grpc::WriteOptions options, const ::grpc::Status &status, void *tag) override
See the ServerAsyncWriterInterface.WriteAndFinish method for semantics.
Definition: async_stream_impl.h:902
void WritesDone(void *tag) override
Signal the client is done with the writes (half-close the client stream).
Definition: async_stream_impl.h:580
Definition: async_stream_impl.h:315
WriteOptions & set_last_message()
last-message bit: indicates this is the last message in a stream client-side: makes Write the equival...
Definition: call_op_set.h:161
Common interface for client side asynchronous writing.
Definition: async_stream_impl.h:302
Definition: async_stream_impl.h:486
::grpc_impl::Server Server
Definition: server.h:26
Primary implementation of CallOpSetInterface.
Definition: call_op_set.h:824
void StartCall(void *tag) override
Start the call that was set up by the constructor, but only if the constructor was invoked through th...
Definition: async_stream_impl.h:360
Async client-side interface for bi-directional streaming, where the outgoing message stream going to ...
Definition: async_stream_impl.h:513
::grpc_impl::ClientAsyncReaderWriter< W, R > ClientAsyncReaderWriter
Definition: async_stream.h:56
void Write(const W &msg, ::grpc::WriteOptions options, void *tag) override
Request the writing of msg using WriteOptions options with identifying tag tag.
Definition: async_stream_impl.h:880
static ClientAsyncReader< R > * Create(::grpc::ChannelInterface *channel, ::grpc_impl::CompletionQueue *cq, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, const W &request, bool start, void *tag)
Create a stream object.
Definition: async_stream_impl.h:180
void ReadInitialMetadata(void *tag) override
See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics.
Definition: async_stream_impl.h:373
Definition: async_stream_impl.h:799
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream_impl.h:1044
virtual ~AsyncReaderInterface()
Definition: async_stream_impl.h:83
grpc_call * call() const
Definition: call.h:72
void Write(const W &msg, ::grpc::WriteOptions options, void *tag) override
Request the writing of msg using WriteOptions options with identifying tag tag.
Definition: async_stream_impl.h:390
A ServerContext or CallbackServerContext allows the code implementing a service handler to: ...
Definition: server_context_impl.h:488
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream_impl.h:550
ServerAsyncReader(::grpc_impl::ServerContext *ctx)
Definition: async_stream_impl.h:702
::google::protobuf::util::Status Status
Definition: config_protobuf.h:90
void StartCall(void *tag) override
Start the call that was set up by the constructor, but only if the constructor was invoked through th...
Definition: async_stream_impl.h:528
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream_impl.h:872
Async client-side API for doing server-streaming RPCs, where the incoming message stream coming from ...
Definition: async_stream_impl.h:197
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_stream_impl.h:710
Definition: call_op_set.h:627
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream_impl.h:723
Definition: call_op_set.h:216
ServerAsyncReaderWriter(::grpc_impl::ServerContext *ctx)
Definition: async_stream_impl.h:1015
Server-side interface for asynchronous bi-directional streaming.
Definition: async_stream_impl.h:960
Definition: async_stream_impl.h:643
Definition: call_op_set.h:694
Definition: call_op_set.h:286
Async server-side API for doing client-streaming RPCs, where the incoming message stream from the cli...
Definition: async_stream_impl.h:700
void Finish(const W &msg, const ::grpc::Status &status, void *tag) override
See the ServerAsyncReaderInterface.Read method for semantics.
Definition: async_stream_impl.h:740
virtual ~AsyncWriterInterface()
Definition: async_stream_impl.h:105
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream_impl.h:1038
Codegen interface for grpc::Channel.
Definition: channel_interface.h:74
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream_impl.h:234
CoreCodegenInterface * g_core_codegen_interface
Definition: completion_queue_impl.h:90
Async client-side interface for bi-directional streaming, where the client-to-server message stream h...
Definition: async_stream_impl.h:472
virtual void Finish(::grpc::Status *status, void *tag)=0
Indicate that the stream is to be finished and request notification for when the call has been ended...
Definition: byte_buffer.h:58
Per-message write options.
Definition: call_op_set.h:79
ServerAsyncWriter(::grpc_impl::ServerContext *ctx)
Definition: async_stream_impl.h:849
void Finish(const ::grpc::Status &status, void *tag) override
See the ServerAsyncReaderWriterInterface.Finish method for semantics.
Definition: async_stream_impl.h:1094
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
Definition: call_op_set.h:592
virtual void * grpc_call_arena_alloc(grpc_call *call, size_t length)=0
void Finish(::grpc::Status *status, void *tag) override
See the ClientAsyncStreamingInterface.Finish method for semantics.
Definition: async_stream_impl.h:416
Async server-side API for doing bidirectional streaming RPCs, where the incoming message stream comin...
Definition: async_stream_impl.h:1012
void Write(const W &msg, ::grpc::WriteOptions options, void *tag) override
Request the writing of msg using WriteOptions options with identifying tag tag.
Definition: async_stream_impl.h:1052
An interface that yields a sequence of messages of type R.
Definition: async_stream_impl.h:81
void ReadInitialMetadata(void *tag) override
See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics of this method...
Definition: async_stream_impl.h:541
Async API on the client side for doing client-streaming RPCs, where the outgoing message stream going...
Definition: async_stream_impl.h:346
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue_impl.h:100
void ReadInitialMetadata(void *tag) override
See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics.
Definition: async_stream_impl.h:225
A ClientContext allows the person implementing a service client to:
Definition: client_context_impl.h:184
Did it work? If it didn&#39;t, why?
Definition: status.h:31
::grpc_impl::ClientAsyncWriter< W > ClientAsyncWriter
Definition: async_stream.h:49
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_stream_impl.h:859
virtual void StartCall(void *tag)=0
Start the call that was set up by the constructor, but only if the constructor was invoked through th...
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream_impl.h:382
void WriteLast(const W &msg, ::grpc::WriteOptions options, void *tag)
Request the writing of msg and coalesce it with the writing of trailing metadata, using WriteOptions ...
Definition: async_stream_impl.h:156
Definition: call_op_set.h:514
bool is_last_message() const
Get value for the flag indicating that this is the last message, and should be coalesced with trailin...
Definition: call_op_set.h:186
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_stream_impl.h:1025
Definition: async_stream_impl.h:164
static ClientAsyncWriter< W > * Create(::grpc::ChannelInterface *channel, ::grpc_impl::CompletionQueue *cq, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, R *response, bool start, void *tag)
Create a stream object.
Definition: async_stream_impl.h:329
Definition: call_op_set.h:742
void Finish(::grpc::Status *status, void *tag) override
See the ClientAsyncStreamingInterface.Finish method for semantics.
Definition: async_stream_impl.h:591
Common interface for all client side asynchronous streaming.
Definition: async_stream_impl.h:32
void StartCall(void *tag) override
Start the call that was set up by the constructor, but only if the constructor was invoked through th...
Definition: async_stream_impl.h:211
void Write(const W &msg, ::grpc::WriteOptions options, void *tag) override
Request the writing of msg using WriteOptions options with identifying tag tag.
Definition: async_stream_impl.h:568
void Finish(::grpc::Status *status, void *tag) override
See the ClientAsyncStreamingInterface.Finish method for semantics.
Definition: async_stream_impl.h:249
void Finish(const ::grpc::Status &status, void *tag) override
See the ServerAsyncWriterInterface.Finish method for semantics.
Definition: async_stream_impl.h:923
void WritesDone(void *tag) override
Signal the client is done with the writes (half-close the client stream).
Definition: async_stream_impl.h:402
Straightforward wrapping of the C call object.
Definition: call.h:38
static ClientAsyncReaderWriter< W, R > * Create(::grpc::ChannelInterface *channel, ::grpc_impl::CompletionQueue *cq, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, bool start, void *tag)
Create a stream object.
Definition: async_stream_impl.h:495
void FinishWithError(const ::grpc::Status &status, void *tag) override
See the ServerAsyncReaderInterface.Read method for semantics.
Definition: async_stream_impl.h:769