GRPC C++  1.46.2
async_stream.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_H
19 #define GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_H
20 
21 // IWYU pragma: private, include <grpcpp/support/async_stream.h>
22 
29 
30 namespace grpc {
31 
32 namespace internal {
35  public:
37 
41  virtual void StartCall(void* tag) = 0;
42 
49  virtual void ReadInitialMetadata(void* tag) = 0;
50 
78  virtual void Finish(grpc::Status* status, void* tag) = 0;
79 };
80 
82 template <class R>
84  public:
85  virtual ~AsyncReaderInterface() {}
86 
100  virtual void Read(R* msg, void* tag) = 0;
101 };
102 
104 template <class W>
106  public:
108 
121  virtual void Write(const W& msg, void* tag) = 0;
122 
138  virtual void Write(const W& msg, grpc::WriteOptions options, void* tag) = 0;
139 
158  void WriteLast(const W& msg, grpc::WriteOptions options, void* tag) {
159  Write(msg, options.set_last_message(), tag);
160  }
161 };
162 
163 } // namespace internal
164 
165 template <class R>
168  public internal::AsyncReaderInterface<R> {};
169 
170 namespace internal {
171 template <class R>
173  public:
181  template <class W>
184  const grpc::internal::RpcMethod& method,
185  grpc::ClientContext* context,
186  const W& request, bool start, void* tag) {
187  grpc::internal::Call call = channel->CreateCall(method, context, cq);
189  call.call(), sizeof(ClientAsyncReader<R>)))
190  ClientAsyncReader<R>(call, context, request, start, tag);
191  }
192 };
193 } // namespace internal
194 
198 template <class R>
200  public:
201  // always allocated against a call arena, no memory free required
202  static void operator delete(void* /*ptr*/, std::size_t size) {
203  GPR_CODEGEN_ASSERT(size == sizeof(ClientAsyncReader));
204  }
205 
206  // This operator should never be called as the memory should be freed as part
207  // of the arena destruction. It only exists to provide a matching operator
208  // delete to the operator new so that some compilers will not complain (see
209  // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
210  // there are no tests catching the compiler warning.
211  static void operator delete(void*, void*) { GPR_CODEGEN_ASSERT(false); }
212 
213  void StartCall(void* tag) override {
214  GPR_CODEGEN_ASSERT(!started_);
215  started_ = true;
216  StartCallInternal(tag);
217  }
218 
227  void ReadInitialMetadata(void* tag) override {
228  GPR_CODEGEN_ASSERT(started_);
229  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
230 
231  meta_ops_.set_output_tag(tag);
232  meta_ops_.RecvInitialMetadata(context_);
233  call_.PerformOps(&meta_ops_);
234  }
235 
236  void Read(R* msg, void* tag) override {
237  GPR_CODEGEN_ASSERT(started_);
238  read_ops_.set_output_tag(tag);
239  if (!context_->initial_metadata_received_) {
240  read_ops_.RecvInitialMetadata(context_);
241  }
242  read_ops_.RecvMessage(msg);
243  call_.PerformOps(&read_ops_);
244  }
245 
251  void Finish(grpc::Status* status, void* tag) override {
252  GPR_CODEGEN_ASSERT(started_);
253  finish_ops_.set_output_tag(tag);
254  if (!context_->initial_metadata_received_) {
255  finish_ops_.RecvInitialMetadata(context_);
256  }
257  finish_ops_.ClientRecvStatus(context_, status);
258  call_.PerformOps(&finish_ops_);
259  }
260 
261  private:
263  template <class W>
265  const W& request, bool start, void* tag)
266  : context_(context), call_(call), started_(start) {
267  // TODO(ctiller): don't assert
268  GPR_CODEGEN_ASSERT(init_ops_.SendMessage(request).ok());
269  init_ops_.ClientSendClose();
270  if (start) {
271  StartCallInternal(tag);
272  } else {
273  GPR_CODEGEN_ASSERT(tag == nullptr);
274  }
275  }
276 
277  void StartCallInternal(void* tag) {
278  init_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
279  context_->initial_metadata_flags());
280  init_ops_.set_output_tag(tag);
281  call_.PerformOps(&init_ops_);
282  }
283 
284  grpc::ClientContext* context_;
285  grpc::internal::Call call_;
286  bool started_;
290  init_ops_;
292  meta_ops_;
295  read_ops_;
298  finish_ops_;
299 };
300 
302 template <class W>
306  public:
311  virtual void WritesDone(void* tag) = 0;
312 };
313 
314 namespace internal {
315 template <class W>
317  public:
329  template <class R>
332  const grpc::internal::RpcMethod& method,
333  grpc::ClientContext* context, R* response,
334  bool start, void* tag) {
335  grpc::internal::Call call = channel->CreateCall(method, context, cq);
337  call.call(), sizeof(ClientAsyncWriter<W>)))
338  ClientAsyncWriter<W>(call, context, response, start, tag);
339  }
340 };
341 } // namespace internal
342 
346 template <class W>
348  public:
349  // always allocated against a call arena, no memory free required
350  static void operator delete(void* /*ptr*/, std::size_t size) {
351  GPR_CODEGEN_ASSERT(size == sizeof(ClientAsyncWriter));
352  }
353 
354  // This operator should never be called as the memory should be freed as part
355  // of the arena destruction. It only exists to provide a matching operator
356  // delete to the operator new so that some compilers will not complain (see
357  // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
358  // there are no tests catching the compiler warning.
359  static void operator delete(void*, void*) { GPR_CODEGEN_ASSERT(false); }
360 
361  void StartCall(void* tag) override {
362  GPR_CODEGEN_ASSERT(!started_);
363  started_ = true;
364  StartCallInternal(tag);
365  }
366 
374  void ReadInitialMetadata(void* tag) override {
375  GPR_CODEGEN_ASSERT(started_);
376  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
377 
378  meta_ops_.set_output_tag(tag);
379  meta_ops_.RecvInitialMetadata(context_);
380  call_.PerformOps(&meta_ops_);
381  }
382 
383  void Write(const W& msg, void* tag) override {
384  GPR_CODEGEN_ASSERT(started_);
385  write_ops_.set_output_tag(tag);
386  // TODO(ctiller): don't assert
387  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
388  call_.PerformOps(&write_ops_);
389  }
390 
391  void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
392  GPR_CODEGEN_ASSERT(started_);
393  write_ops_.set_output_tag(tag);
394  if (options.is_last_message()) {
395  options.set_buffer_hint();
396  write_ops_.ClientSendClose();
397  }
398  // TODO(ctiller): don't assert
399  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
400  call_.PerformOps(&write_ops_);
401  }
402 
403  void WritesDone(void* tag) override {
404  GPR_CODEGEN_ASSERT(started_);
405  write_ops_.set_output_tag(tag);
406  write_ops_.ClientSendClose();
407  call_.PerformOps(&write_ops_);
408  }
409 
417  void Finish(grpc::Status* status, void* tag) override {
418  GPR_CODEGEN_ASSERT(started_);
419  finish_ops_.set_output_tag(tag);
420  if (!context_->initial_metadata_received_) {
421  finish_ops_.RecvInitialMetadata(context_);
422  }
423  finish_ops_.ClientRecvStatus(context_, status);
424  call_.PerformOps(&finish_ops_);
425  }
426 
427  private:
429  template <class R>
431  R* response, 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::ClientContext* context_;
454  grpc::internal::Call call_;
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, grpc::ClientContext* context,
498  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::ClientContext* context, bool start, void* tag)
605  : context_(context), call_(call), started_(start) {
606  if (start) {
607  StartCallInternal(tag);
608  } else {
609  GPR_CODEGEN_ASSERT(tag == nullptr);
610  }
611  }
612 
613  void StartCallInternal(void* tag) {
614  write_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
615  context_->initial_metadata_flags());
616  // if corked bit is set in context, we just keep the initial metadata
617  // buffered up to coalesce with later message send. No op is performed.
618  if (!context_->initial_metadata_corked_) {
619  write_ops_.set_output_tag(tag);
620  call_.PerformOps(&write_ops_);
621  }
622  }
623 
624  grpc::ClientContext* context_;
625  grpc::internal::Call call_;
626  bool started_;
628  meta_ops_;
631  read_ops_;
635  write_ops_;
638  finish_ops_;
639 };
640 
641 template <class W, class R>
645  public:
668  virtual void Finish(const W& msg, const grpc::Status& status, void* tag) = 0;
669 
691  virtual void FinishWithError(const grpc::Status& status, void* tag) = 0;
692 };
693 
697 template <class W, class R>
698 class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
699  public:
701  : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
702 
708  void SendInitialMetadata(void* tag) override {
709  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
710 
711  meta_ops_.set_output_tag(tag);
712  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
713  ctx_->initial_metadata_flags());
714  if (ctx_->compression_level_set()) {
715  meta_ops_.set_compression_level(ctx_->compression_level());
716  }
717  ctx_->sent_initial_metadata_ = true;
718  call_.PerformOps(&meta_ops_);
719  }
720 
721  void Read(R* msg, void* tag) override {
722  read_ops_.set_output_tag(tag);
723  read_ops_.RecvMessage(msg);
724  call_.PerformOps(&read_ops_);
725  }
726 
738  void Finish(const W& msg, const grpc::Status& status, void* tag) override {
739  finish_ops_.set_output_tag(tag);
740  if (!ctx_->sent_initial_metadata_) {
741  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
742  ctx_->initial_metadata_flags());
743  if (ctx_->compression_level_set()) {
744  finish_ops_.set_compression_level(ctx_->compression_level());
745  }
746  ctx_->sent_initial_metadata_ = true;
747  }
748  // The response is dropped if the status is not OK.
749  if (status.ok()) {
750  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_,
751  finish_ops_.SendMessage(msg));
752  } else {
753  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
754  }
755  call_.PerformOps(&finish_ops_);
756  }
757 
767  void FinishWithError(const grpc::Status& status, void* tag) override {
768  GPR_CODEGEN_ASSERT(!status.ok());
769  finish_ops_.set_output_tag(tag);
770  if (!ctx_->sent_initial_metadata_) {
771  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
772  ctx_->initial_metadata_flags());
773  if (ctx_->compression_level_set()) {
774  finish_ops_.set_compression_level(ctx_->compression_level());
775  }
776  ctx_->sent_initial_metadata_ = true;
777  }
778  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
779  call_.PerformOps(&finish_ops_);
780  }
781 
782  private:
783  void BindCall(grpc::internal::Call* call) override { call_ = *call; }
784 
785  grpc::internal::Call call_;
786  grpc::ServerContext* ctx_;
788  meta_ops_;
793  finish_ops_;
794 };
795 
796 template <class W>
800  public:
822  virtual void Finish(const grpc::Status& status, void* tag) = 0;
823 
838  virtual void WriteAndFinish(const W& msg, grpc::WriteOptions options,
839  const grpc::Status& status, void* tag) = 0;
840 };
841 
844 template <class W>
846  public:
848  : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
849 
857  void SendInitialMetadata(void* tag) override {
858  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
859 
860  meta_ops_.set_output_tag(tag);
861  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
862  ctx_->initial_metadata_flags());
863  if (ctx_->compression_level_set()) {
864  meta_ops_.set_compression_level(ctx_->compression_level());
865  }
866  ctx_->sent_initial_metadata_ = true;
867  call_.PerformOps(&meta_ops_);
868  }
869 
870  void Write(const W& msg, void* tag) override {
871  write_ops_.set_output_tag(tag);
872  EnsureInitialMetadataSent(&write_ops_);
873  // TODO(ctiller): don't assert
874  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
875  call_.PerformOps(&write_ops_);
876  }
877 
878  void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
879  write_ops_.set_output_tag(tag);
880  if (options.is_last_message()) {
881  options.set_buffer_hint();
882  }
883 
884  EnsureInitialMetadataSent(&write_ops_);
885  // TODO(ctiller): don't assert
886  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
887  call_.PerformOps(&write_ops_);
888  }
889 
900  void WriteAndFinish(const W& msg, grpc::WriteOptions options,
901  const grpc::Status& status, void* tag) override {
902  write_ops_.set_output_tag(tag);
903  EnsureInitialMetadataSent(&write_ops_);
904  options.set_buffer_hint();
905  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
906  write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
907  call_.PerformOps(&write_ops_);
908  }
909 
921  void Finish(const grpc::Status& status, void* tag) override {
922  finish_ops_.set_output_tag(tag);
923  EnsureInitialMetadataSent(&finish_ops_);
924  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
925  call_.PerformOps(&finish_ops_);
926  }
927 
928  private:
929  void BindCall(grpc::internal::Call* call) override { call_ = *call; }
930 
931  template <class T>
932  void EnsureInitialMetadataSent(T* ops) {
933  if (!ctx_->sent_initial_metadata_) {
934  ops->SendInitialMetadata(&ctx_->initial_metadata_,
935  ctx_->initial_metadata_flags());
936  if (ctx_->compression_level_set()) {
937  ops->set_compression_level(ctx_->compression_level());
938  }
939  ctx_->sent_initial_metadata_ = true;
940  }
941  }
942 
943  grpc::internal::Call call_;
944  grpc::ServerContext* ctx_;
946  meta_ops_;
950  write_ops_;
953  finish_ops_;
954 };
955 
957 template <class W, class R>
962  public:
985  virtual void Finish(const grpc::Status& status, void* tag) = 0;
986 
1001  virtual void WriteAndFinish(const W& msg, grpc::WriteOptions options,
1002  const grpc::Status& status, void* tag) = 0;
1003 };
1004 
1009 template <class W, class R>
1011  : public ServerAsyncReaderWriterInterface<W, R> {
1012  public:
1014  : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
1015 
1023  void SendInitialMetadata(void* tag) override {
1024  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
1025 
1026  meta_ops_.set_output_tag(tag);
1027  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
1028  ctx_->initial_metadata_flags());
1029  if (ctx_->compression_level_set()) {
1030  meta_ops_.set_compression_level(ctx_->compression_level());
1031  }
1032  ctx_->sent_initial_metadata_ = true;
1033  call_.PerformOps(&meta_ops_);
1034  }
1035 
1036  void Read(R* msg, void* tag) override {
1037  read_ops_.set_output_tag(tag);
1038  read_ops_.RecvMessage(msg);
1039  call_.PerformOps(&read_ops_);
1040  }
1041 
1042  void Write(const W& msg, void* tag) override {
1043  write_ops_.set_output_tag(tag);
1044  EnsureInitialMetadataSent(&write_ops_);
1045  // TODO(ctiller): don't assert
1046  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
1047  call_.PerformOps(&write_ops_);
1048  }
1049 
1050  void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
1051  write_ops_.set_output_tag(tag);
1052  if (options.is_last_message()) {
1053  options.set_buffer_hint();
1054  }
1055  EnsureInitialMetadataSent(&write_ops_);
1056  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
1057  call_.PerformOps(&write_ops_);
1058  }
1059 
1068  //
1071  void WriteAndFinish(const W& msg, grpc::WriteOptions options,
1072  const grpc::Status& status, void* tag) override {
1073  write_ops_.set_output_tag(tag);
1074  EnsureInitialMetadataSent(&write_ops_);
1075  options.set_buffer_hint();
1076  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
1077  write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
1078  call_.PerformOps(&write_ops_);
1079  }
1080 
1089  //
1092  void Finish(const grpc::Status& status, void* tag) override {
1093  finish_ops_.set_output_tag(tag);
1094  EnsureInitialMetadataSent(&finish_ops_);
1095 
1096  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
1097  call_.PerformOps(&finish_ops_);
1098  }
1099 
1100  private:
1101  friend class grpc::Server;
1102 
1103  void BindCall(grpc::internal::Call* call) override { call_ = *call; }
1104 
1105  template <class T>
1106  void EnsureInitialMetadataSent(T* ops) {
1107  if (!ctx_->sent_initial_metadata_) {
1108  ops->SendInitialMetadata(&ctx_->initial_metadata_,
1109  ctx_->initial_metadata_flags());
1110  if (ctx_->compression_level_set()) {
1111  ops->set_compression_level(ctx_->compression_level());
1112  }
1113  ctx_->sent_initial_metadata_ = true;
1114  }
1115  }
1116 
1117  grpc::internal::Call call_;
1118  grpc::ServerContext* ctx_;
1120  meta_ops_;
1125  write_ops_;
1128  finish_ops_;
1129 };
1130 
1131 } // namespace grpc
1132 #endif // GRPCPP_IMPL_CODEGEN_ASYNC_STREAM_H
grpc::internal::CallOpRecvInitialMetadata
Definition: call_op_set.h:728
grpc::ClientAsyncReaderWriter::Finish
void Finish(grpc::Status *status, void *tag) override
See the ClientAsyncStreamingInterface.Finish method for semantics.
Definition: async_stream.h:591
grpc::ServerAsyncReaderWriter::Read
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream.h:1036
grpc::ClientAsyncWriter::StartCall
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.h:361
grpc::internal::ServerAsyncStreamingInterface
Definition: service_type.h:39
grpc::internal::CallOpClientSendClose
Definition: call_op_set.h:626
grpc::internal::CallOpGenericRecvMessage
Definition: call_op_set.h:533
grpc::internal::AsyncWriterInterface
An interface that can be fed a sequence of messages of type W.
Definition: async_stream.h:105
grpc::ServerContext
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:544
grpc::internal::CallOpServerSendStatus
Definition: call_op_set.h:661
grpc::Server
Represents a gRPC server.
Definition: server.h:59
grpc::ClientAsyncReaderWriter::ReadInitialMetadata
void ReadInitialMetadata(void *tag) override
See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics of this method.
Definition: async_stream.h:541
grpc
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
grpc::internal::CallOpSet
Primary implementation of CallOpSetInterface.
Definition: call_op_set.h:859
grpc::ClientAsyncReaderWriter::Read
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream.h:550
status.h
grpc::internal::ClientAsyncStreamingInterface::~ClientAsyncStreamingInterface
virtual ~ClientAsyncStreamingInterface()
Definition: async_stream.h:36
grpc::internal::CallOpSendMessage
Definition: call_op_set.h:289
grpc::ServerAsyncReaderWriter::Write
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.h:1050
grpc::ClientAsyncWriter::Write
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream.h:383
grpc::ServerAsyncWriter
Async server-side API for doing server streaming RPCs, where the outgoing message stream from the ser...
Definition: async_stream.h:845
grpc::internal::ClientAsyncReaderWriterFactory
Definition: async_stream.h:486
grpc::WriteOptions::set_last_message
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:158
grpc::ClientAsyncReader::StartCall
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.h:213
grpc::ServerAsyncReader::Finish
void Finish(const W &msg, const grpc::Status &status, void *tag) override
See the ServerAsyncReaderInterface.Read method for semantics.
Definition: async_stream.h:738
grpc::CoreCodegenInterface::grpc_call_arena_alloc
virtual void * grpc_call_arena_alloc(grpc_call *call, size_t length)=0
grpc::ClientAsyncReaderWriterInterface::WritesDone
virtual void WritesDone(void *tag)=0
Signal the client is done with the writes (half-close the client stream).
grpc::ServerAsyncWriter::Write
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream.h:870
service_type.h
grpc::internal::ClientAsyncWriterFactory::Create
static ClientAsyncWriter< W > * Create(grpc::ChannelInterface *channel, grpc::CompletionQueue *cq, const grpc::internal::RpcMethod &method, grpc::ClientContext *context, R *response, bool start, void *tag)
Create a stream object.
Definition: async_stream.h:330
grpc::internal::Call
Straightforward wrapping of the C call object.
Definition: call.h:37
core_codegen_interface.h
grpc::ClientAsyncReaderWriter::WritesDone
void WritesDone(void *tag) override
Signal the client is done with the writes (half-close the client stream).
Definition: async_stream.h:580
grpc::ServerAsyncReader::ServerAsyncReader
ServerAsyncReader(grpc::ServerContext *ctx)
Definition: async_stream.h:700
grpc::ServerAsyncReaderWriter::WriteAndFinish
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.h:1071
grpc::internal::CallOpSendInitialMetadata
Definition: call_op_set.h:219
grpc::ServerAsyncReaderInterface::FinishWithError
virtual void FinishWithError(const grpc::Status &status, void *tag)=0
Indicate that the stream is to be finished with a certain non-OK status code.
grpc::internal::ClientAsyncStreamingInterface::ReadInitialMetadata
virtual void ReadInitialMetadata(void *tag)=0
Request notification of the reading of the initial metadata.
grpc::internal::ClientAsyncReaderWriterFactory::Create
static ClientAsyncReaderWriter< W, R > * Create(grpc::ChannelInterface *channel, grpc::CompletionQueue *cq, const grpc::internal::RpcMethod &method, grpc::ClientContext *context, bool start, void *tag)
Create a stream object.
Definition: async_stream.h:495
grpc::ClientAsyncReader::ReadInitialMetadata
void ReadInitialMetadata(void *tag) override
See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics.
Definition: async_stream.h:227
grpc::ClientAsyncWriter::Write
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.h:391
grpc::Status::ok
bool ok() const
Is the status OK?
Definition: status.h:120
grpc::ServerAsyncReaderWriter::Write
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream.h:1042
grpc::ServerAsyncReader::Read
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream.h:721
grpc::ClientAsyncReaderWriterInterface
Async client-side interface for bi-directional streaming, where the client-to-server message stream h...
Definition: async_stream.h:472
grpc::ClientAsyncWriter::Finish
void Finish(grpc::Status *status, void *tag) override
See the ClientAsyncStreamingInterface.Finish method for semantics.
Definition: async_stream.h:417
grpc::ServerAsyncReaderWriter::ServerAsyncReaderWriter
ServerAsyncReaderWriter(grpc::ServerContext *ctx)
Definition: async_stream.h:1013
grpc::ServerAsyncWriterInterface
Definition: async_stream.h:797
grpc::internal::AsyncWriterInterface::WriteLast
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.h:158
grpc::Status
Did it work? If it didn't, why?
Definition: status.h:33
grpc::internal::ClientAsyncReaderFactory
Definition: async_stream.h:172
grpc::ServerAsyncWriterInterface::WriteAndFinish
virtual void WriteAndFinish(const W &msg, grpc::WriteOptions options, const grpc::Status &status, void *tag)=0
Request the writing of msg and coalesce it with trailing metadata which contains status,...
grpc::internal::ClientAsyncStreamingInterface
Common interface for all client side asynchronous streaming.
Definition: async_stream.h:34
grpc::ServerContext::compression_level
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context.h:231
grpc::ServerAsyncReaderWriterInterface::WriteAndFinish
virtual void WriteAndFinish(const W &msg, grpc::WriteOptions options, const grpc::Status &status, void *tag)=0
Request the writing of msg and coalesce it with trailing metadata which contains status,...
grpc::ClientAsyncWriter::WritesDone
void WritesDone(void *tag) override
Signal the client is done with the writes (half-close the client stream).
Definition: async_stream.h:403
grpc::ClientContext
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:195
grpc::ServerAsyncReaderWriterInterface
Server-side interface for asynchronous bi-directional streaming.
Definition: async_stream.h:958
grpc::ServerAsyncReaderInterface::Finish
virtual void Finish(const W &msg, const grpc::Status &status, void *tag)=0
Indicate that the stream is to be finished with a certain status code and also send out msg response ...
grpc::ServerAsyncWriter::Write
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.h:878
grpc::ClientAsyncReader
Async client-side API for doing server-streaming RPCs, where the incoming message stream coming from ...
Definition: async_stream.h:199
grpc::ServerAsyncReaderWriter::SendInitialMetadata
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_stream.h:1023
grpc::ClientAsyncWriterInterface::WritesDone
virtual void WritesDone(void *tag)=0
Signal the client is done with the writes (half-close the client stream).
grpc::internal::ClientAsyncStreamingInterface::Finish
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.
grpc::ChannelInterface
Codegen interface for grpc::Channel.
Definition: channel_interface.h:73
grpc::ClientAsyncWriter::ReadInitialMetadata
void ReadInitialMetadata(void *tag) override
See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics.
Definition: async_stream.h:374
grpc::ServerAsyncReaderWriter::Finish
void Finish(const grpc::Status &status, void *tag) override
See the ServerAsyncReaderWriterInterface.Finish method for semantics.
Definition: async_stream.h:1092
grpc::internal::ClientAsyncStreamingInterface::StartCall
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...
grpc::internal::ClientAsyncReaderFactory::Create
static ClientAsyncReader< R > * Create(grpc::ChannelInterface *channel, grpc::CompletionQueue *cq, const grpc::internal::RpcMethod &method, grpc::ClientContext *context, const W &request, bool start, void *tag)
Create a stream object.
Definition: async_stream.h:182
grpc::internal::AsyncWriterInterface::Write
virtual void Write(const W &msg, void *tag)=0
Request the writing of msg with identifying tag tag.
grpc::ClientAsyncWriterInterface
Common interface for client side asynchronous writing.
Definition: async_stream.h:303
grpc::ClientAsyncReader::Read
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream.h:236
grpc::internal::AsyncWriterInterface::~AsyncWriterInterface
virtual ~AsyncWriterInterface()
Definition: async_stream.h:107
grpc::internal::AsyncReaderInterface::Read
virtual void Read(R *msg, void *tag)=0
Read a message of type R into msg.
grpc::ServerAsyncReader::FinishWithError
void FinishWithError(const grpc::Status &status, void *tag) override
See the ServerAsyncReaderInterface.Read method for semantics.
Definition: async_stream.h:767
grpc::ServerAsyncWriter::WriteAndFinish
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.h:900
grpc::ClientAsyncWriter
Async API on the client side for doing client-streaming RPCs, where the outgoing message stream going...
Definition: async_stream.h:347
grpc::internal::CallOpSet::set_output_tag
void set_output_tag(void *return_tag)
Definition: call_op_set.h:943
grpc::WriteOptions
Per-message write options.
Definition: call_op_set.h:81
grpc::ServerAsyncWriterInterface::Finish
virtual void Finish(const grpc::Status &status, void *tag)=0
Indicate that the stream is to be finished with a certain status code.
grpc::internal::AsyncReaderInterface
An interface that yields a sequence of messages of type R.
Definition: async_stream.h:83
grpc::ClientAsyncReaderWriter
Async client-side interface for bi-directional streaming, where the outgoing message stream going to ...
Definition: async_stream.h:513
grpc::ServerAsyncReader::SendInitialMetadata
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_stream.h:708
grpc::ClientAsyncReaderWriter::Write
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream.h:560
channel_interface.h
grpc::internal::Call::PerformOps
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:67
grpc::ClientAsyncReaderWriter::Write
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.h:568
grpc::internal::Call::call
grpc_call * call() const
Definition: call.h:71
call.h
grpc::ServerContext::compression_level_set
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:246
server_context.h
grpc::internal::CallOpClientRecvStatus
Definition: call_op_set.h:776
grpc::WriteOptions::set_buffer_hint
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:119
grpc::CompletionQueue
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:104
grpc::internal::ClientAsyncWriterFactory
Definition: async_stream.h:316
grpc::ClientAsyncReader::Finish
void Finish(grpc::Status *status, void *tag) override
See the ClientAsyncStreamingInterface.Finish method for semantics.
Definition: async_stream.h:251
grpc::internal::AsyncReaderInterface::~AsyncReaderInterface
virtual ~AsyncReaderInterface()
Definition: async_stream.h:85
grpc::ClientAsyncReaderWriter::StartCall
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.h:528
grpc::ServerAsyncReaderInterface
Definition: async_stream.h:642
grpc::ServerAsyncWriter::Finish
void Finish(const grpc::Status &status, void *tag) override
See the ServerAsyncWriterInterface.Finish method for semantics.
Definition: async_stream.h:921
grpc::g_core_codegen_interface
CoreCodegenInterface * g_core_codegen_interface
Definition: completion_queue.h:98
GPR_CODEGEN_ASSERT
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:149
grpc::ServerAsyncWriter::SendInitialMetadata
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_stream.h:857
grpc::WriteOptions::is_last_message
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:174
grpc::ServerAsyncReader
Async server-side API for doing client-streaming RPCs, where the incoming message stream from the cli...
Definition: async_stream.h:698
grpc::internal::CallOpRecvMessage
Definition: byte_buffer.h:52
grpc::internal::RpcMethod
Descriptor of an RPC method.
Definition: rpc_method.h:31
grpc::ServerAsyncReaderWriter
Async server-side API for doing bidirectional streaming RPCs, where the incoming message stream comin...
Definition: async_stream.h:1010
grpc::ServerAsyncWriter::ServerAsyncWriter
ServerAsyncWriter(grpc::ServerContext *ctx)
Definition: async_stream.h:847
grpc::ClientAsyncReaderInterface
Definition: async_stream.h:166
grpc::ServerAsyncReaderWriterInterface::Finish
virtual void Finish(const grpc::Status &status, void *tag)=0
Indicate that the stream is to be finished with a certain status code.