GRPC C++  1.80.0
async_stream.h
Go to the documentation of this file.
1 //
2 //
3 // Copyright 2015 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 
19 #ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H
20 #define GRPCPP_SUPPORT_ASYNC_STREAM_H
21 
22 #include <grpc/grpc.h>
23 #include <grpcpp/impl/call.h>
26 #include <grpcpp/server_context.h>
27 #include <grpcpp/support/status.h>
28 
29 #include "absl/log/absl_check.h"
30 
31 namespace grpc {
32 
33 namespace internal {
36  public:
38 
46  virtual void StartCall(void* tag) = 0;
47 
54  virtual void ReadInitialMetadata(void* tag) = 0;
55 
83  virtual void Finish(grpc::Status* status, void* tag) = 0;
84 };
85 
87 template <class R>
89  public:
90  virtual ~AsyncReaderInterface() {}
91 
105  virtual void Read(R* msg, void* tag) = 0;
106 };
107 
109 template <class W>
111  public:
113 
126  virtual void Write(const W& msg, void* tag) = 0;
127 
143  virtual void Write(const W& msg, grpc::WriteOptions options, void* tag) = 0;
144 
163  void WriteLast(const W& msg, grpc::WriteOptions options, void* tag) {
164  Write(msg, options.set_last_message(), tag);
165  }
166 };
167 
168 } // namespace internal
169 
170 template <class R>
173  public internal::AsyncReaderInterface<R> {};
174 
175 namespace internal {
176 template <class R>
177 class ClientAsyncReaderFactory {
178  public:
186  template <class W>
189  const grpc::internal::RpcMethod& method,
190  grpc::ClientContext* context,
191  const W& request, bool start, void* tag) {
192  grpc::internal::Call call = channel->CreateCall(method, context, cq);
193  return new (
195  ClientAsyncReader<R>(channel, call, context, request, start, tag);
196  }
197 };
198 } // namespace internal
199 
203 template <class R>
204 class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
205  public:
206  // always allocated against a call arena, no memory free required
207  static void operator delete(void* /*ptr*/, std::size_t size) {
208  ABSL_CHECK_EQ(size, sizeof(ClientAsyncReader));
209  }
210 
211  // This operator should never be called as the memory should be freed as part
212  // of the arena destruction. It only exists to provide a matching operator
213  // delete to the operator new so that some compilers will not complain (see
214  // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
215  // there are no tests catching the compiler warning.
216  static void operator delete(void*, void*) { ABSL_CHECK(false); }
217 
218  void StartCall(void* tag) override {
219  ABSL_CHECK(!started_);
220  started_ = true;
221  StartCallInternal(tag);
222  }
223 
232  void ReadInitialMetadata(void* tag) override {
233  ABSL_CHECK(started_);
234  ABSL_CHECK(!context_->initial_metadata_received_);
235 
236  meta_ops_.set_output_tag(tag);
237  meta_ops_.RecvInitialMetadata(context_);
238  meta_ops_.FillOps(&call_);
239  }
240 
241  void Read(R* msg, void* tag) override {
242  ABSL_CHECK(started_);
243  read_ops_.set_output_tag(tag);
244  if (!context_->initial_metadata_received_) {
245  read_ops_.RecvInitialMetadata(context_);
246  }
247  read_ops_.RecvMessage(msg);
248  read_ops_.FillOps(&call_);
249  }
250 
256  void Finish(grpc::Status* status, void* tag) override {
257  ABSL_CHECK(started_);
258  finish_ops_.set_output_tag(tag);
259  if (!context_->initial_metadata_received_) {
260  finish_ops_.RecvInitialMetadata(context_);
261  }
262  finish_ops_.ClientRecvStatus(context_, status);
263  finish_ops_.FillOps(&call_);
264  }
265 
266  private:
268  template <class W>
270  grpc::ClientContext* context, const W& request, bool start,
271  void* tag)
272  : channel_(channel), context_(context), call_(call), started_(start) {
273  // TODO(ctiller): don't assert
274  ABSL_CHECK(
275  init_ops_.SendMessage(request, channel_->memory_allocator()).ok());
276  init_ops_.ClientSendClose();
277  if (start) {
278  StartCallInternal(tag);
279  } else {
280  ABSL_CHECK(tag == nullptr);
281  }
282  }
283 
284  void StartCallInternal(void* tag) {
285  init_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
286  context_->initial_metadata_flags());
287  init_ops_.set_output_tag(tag);
288  init_ops_.FillOps(&call_);
289  }
290 
291  grpc::ChannelInterface* channel_;
292  grpc::ClientContext* context_;
293  grpc::internal::Call call_;
294  bool started_;
298  init_ops_;
300  meta_ops_;
303  read_ops_;
306  finish_ops_;
307 };
308 
310 template <class W>
314  public:
319  virtual void WritesDone(void* tag) = 0;
320 };
321 
322 namespace internal {
323 template <class W>
324 class ClientAsyncWriterFactory {
325  public:
337  template <class R>
340  const grpc::internal::RpcMethod& method,
341  grpc::ClientContext* context, R* response,
342  bool start, void* tag) {
343  grpc::internal::Call call = channel->CreateCall(method, context, cq);
344  return new (
346  ClientAsyncWriter<W>(channel, call, context, response, start, tag);
347  }
348 };
349 } // namespace internal
350 
354 template <class W>
355 class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
356  public:
357  // always allocated against a call arena, no memory free required
358  static void operator delete(void* /*ptr*/, std::size_t size) {
359  ABSL_CHECK_EQ(size, sizeof(ClientAsyncWriter));
360  }
361 
362  // This operator should never be called as the memory should be freed as part
363  // of the arena destruction. It only exists to provide a matching operator
364  // delete to the operator new so that some compilers will not complain (see
365  // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
366  // there are no tests catching the compiler warning.
367  static void operator delete(void*, void*) { ABSL_CHECK(false); }
368 
369  void StartCall(void* tag) override {
370  ABSL_CHECK(!started_);
371  started_ = true;
372  StartCallInternal(tag);
373  }
374 
382  void ReadInitialMetadata(void* tag) override {
383  ABSL_CHECK(started_);
384  ABSL_CHECK(!context_->initial_metadata_received_);
385 
386  meta_ops_.set_output_tag(tag);
387  meta_ops_.RecvInitialMetadata(context_);
388  meta_ops_.FillOps(&call_);
389  }
390 
391  void Write(const W& msg, void* tag) override {
392  ABSL_CHECK(started_);
393  write_ops_.set_output_tag(tag);
394  // TODO(ctiller): don't assert
395  ABSL_CHECK(write_ops_.SendMessage(msg, channel_->memory_allocator()).ok());
396  write_ops_.FillOps(&call_);
397  }
398 
399  void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
400  ABSL_CHECK(started_);
401  write_ops_.set_output_tag(tag);
402  if (options.is_last_message()) {
403  options.set_buffer_hint();
404  write_ops_.ClientSendClose();
405  }
406 
407  // TODO(ctiller): don't assert
408  ABSL_CHECK(
409  write_ops_.SendMessage(msg, options, channel_->memory_allocator())
410  .ok());
411  write_ops_.FillOps(&call_);
412  }
413 
414  void WritesDone(void* tag) override {
415  ABSL_CHECK(started_);
416  write_ops_.set_output_tag(tag);
417  write_ops_.ClientSendClose();
418  write_ops_.FillOps(&call_);
419  }
420 
428  void Finish(grpc::Status* status, void* tag) override {
429  ABSL_CHECK(started_);
430  finish_ops_.set_output_tag(tag);
431  if (!context_->initial_metadata_received_) {
432  finish_ops_.RecvInitialMetadata(context_);
433  }
434  finish_ops_.ClientRecvStatus(context_, status);
435  finish_ops_.FillOps(&call_);
436  }
437 
438  private:
440  template <class R>
442  grpc::ClientContext* context, R* response, bool start,
443  void* tag)
444  : channel_(channel), context_(context), call_(call), started_(start) {
445  finish_ops_.RecvMessage(response);
446  finish_ops_.AllowNoMessage();
447  if (start) {
448  StartCallInternal(tag);
449  } else {
450  ABSL_CHECK(tag == nullptr);
451  }
452  }
453 
454  void StartCallInternal(void* tag) {
455  write_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
456  context_->initial_metadata_flags());
457  // if corked bit is set in context, we just keep the initial metadata
458  // buffered up to coalesce with later message send. No op is performed.
459  if (!context_->initial_metadata_corked_) {
460  write_ops_.set_output_tag(tag);
461  write_ops_.FillOps(&call_);
462  }
463  }
464 
465  grpc::ChannelInterface* channel_;
466  grpc::ClientContext* context_;
467  grpc::internal::Call call_;
468  bool started_;
470  meta_ops_;
474  write_ops_;
478  finish_ops_;
479 };
480 
484 template <class W, class R>
489  public:
494  virtual void WritesDone(void* tag) = 0;
495 };
496 
497 namespace internal {
498 template <class W, class R>
499 class ClientAsyncReaderWriterFactory {
500  public:
510  const grpc::internal::RpcMethod& method, grpc::ClientContext* context,
511  bool start, void* tag) {
512  grpc::internal::Call call = channel->CreateCall(method, context, cq);
513 
514  return new (grpc_call_arena_alloc(call.call(),
516  ClientAsyncReaderWriter<W, R>(channel, call, context, start, tag);
517  }
518 };
519 } // namespace internal
520 
525 template <class W, class R>
526 class ClientAsyncReaderWriter final
527  : public ClientAsyncReaderWriterInterface<W, R> {
528  public:
529  // always allocated against a call arena, no memory free required
530  static void operator delete(void* /*ptr*/, std::size_t size) {
531  ABSL_CHECK_EQ(size, sizeof(ClientAsyncReaderWriter));
532  }
533 
534  // This operator should never be called as the memory should be freed as part
535  // of the arena destruction. It only exists to provide a matching operator
536  // delete to the operator new so that some compilers will not complain (see
537  // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
538  // there are no tests catching the compiler warning.
539  static void operator delete(void*, void*) { ABSL_CHECK(false); }
540 
541  void StartCall(void* tag) override {
542  ABSL_CHECK(!started_);
543  started_ = true;
544  StartCallInternal(tag);
545  }
546 
554  void ReadInitialMetadata(void* tag) override {
555  ABSL_CHECK(started_);
556  ABSL_CHECK(!context_->initial_metadata_received_);
557 
558  meta_ops_.set_output_tag(tag);
559  meta_ops_.RecvInitialMetadata(context_);
560  meta_ops_.FillOps(&call_);
561  }
562 
563  void Read(R* msg, void* tag) override {
564  ABSL_CHECK(started_);
565  read_ops_.set_output_tag(tag);
566  if (!context_->initial_metadata_received_) {
567  read_ops_.RecvInitialMetadata(context_);
568  }
569  read_ops_.RecvMessage(msg);
570  read_ops_.FillOps(&call_);
571  }
572 
573  void Write(const W& msg, void* tag) override {
574  ABSL_CHECK(started_);
575  write_ops_.set_output_tag(tag);
576  // TODO(ctiller): don't assert
577  ABSL_CHECK(write_ops_.SendMessage(msg, channel_->memory_allocator()).ok());
578  write_ops_.FillOps(&call_);
579  }
580 
581  void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
582  ABSL_CHECK(started_);
583  write_ops_.set_output_tag(tag);
584  if (options.is_last_message()) {
585  options.set_buffer_hint();
586  write_ops_.ClientSendClose();
587  }
588  // TODO(ctiller): don't assert
589  ABSL_CHECK(
590  write_ops_.SendMessage(msg, options, channel_->memory_allocator())
591  .ok());
592  write_ops_.FillOps(&call_);
593  }
594 
595  void WritesDone(void* tag) override {
596  ABSL_CHECK(started_);
597  write_ops_.set_output_tag(tag);
598  write_ops_.ClientSendClose();
599  write_ops_.FillOps(&call_);
600  }
601 
606  void Finish(grpc::Status* status, void* tag) override {
607  ABSL_CHECK(started_);
608  finish_ops_.set_output_tag(tag);
609  if (!context_->initial_metadata_received_) {
610  finish_ops_.RecvInitialMetadata(context_);
611  }
612  finish_ops_.ClientRecvStatus(context_, status);
613  finish_ops_.FillOps(&call_);
614  }
615 
616  private:
620  grpc::ClientContext* context, bool start, void* tag)
621  : channel_(channel), context_(context), call_(call), started_(start) {
622  if (start) {
623  StartCallInternal(tag);
624  } else {
625  ABSL_CHECK(tag == nullptr);
626  }
627  }
628 
629  void StartCallInternal(void* tag) {
630  write_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
631  context_->initial_metadata_flags());
632  // if corked bit is set in context, we just keep the initial metadata
633  // buffered up to coalesce with later message send. No op is performed.
634  if (!context_->initial_metadata_corked_) {
635  write_ops_.set_output_tag(tag);
636  write_ops_.FillOps(&call_);
637  }
638  }
639 
640  grpc::ChannelInterface* channel_;
641  grpc::ClientContext* context_;
642  grpc::internal::Call call_;
643  bool started_;
645  meta_ops_;
648  read_ops_;
652  write_ops_;
655  finish_ops_;
656 };
657 
658 template <class W, class R>
662  public:
685  virtual void Finish(const W& msg, const grpc::Status& status, void* tag) = 0;
686 
708  virtual void FinishWithError(const grpc::Status& status, void* tag) = 0;
709 };
710 
714 template <class W, class R>
715 class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
716  public:
717  explicit ServerAsyncReader(grpc::ServerContext* ctx) : call_(), ctx_(ctx) {}
718 
724  void SendInitialMetadata(void* tag) override {
725  ABSL_CHECK(!ctx_->sent_initial_metadata_);
726 
727  meta_ops_.set_output_tag(tag);
728  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
729  ctx_->initial_metadata_flags());
730  if (ctx_->compression_level_set()) {
731  meta_ops_.set_compression_level(ctx_->compression_level());
732  }
733  ctx_->sent_initial_metadata_ = true;
734  meta_ops_.FillOps(&call_);
735  }
736 
737  void Read(R* msg, void* tag) override {
738  read_ops_.set_output_tag(tag);
739  read_ops_.RecvMessage(msg);
740  read_ops_.FillOps(&call_);
741  }
742 
754  void Finish(const W& msg, const grpc::Status& status, void* tag) override {
755  finish_ops_.set_output_tag(tag);
756  if (!ctx_->sent_initial_metadata_) {
757  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
758  ctx_->initial_metadata_flags());
759  if (ctx_->compression_level_set()) {
760  finish_ops_.set_compression_level(ctx_->compression_level());
761  }
762  ctx_->sent_initial_metadata_ = true;
763  }
764  // The response is dropped if the status is not OK.
765  if (status.ok()) {
766  finish_ops_.ServerSendStatus(
767  &ctx_->trailing_metadata_,
768  finish_ops_.SendMessage(msg, ctx_->memory_allocator()));
769  } else {
770  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
771  }
772  finish_ops_.FillOps(&call_);
773  }
774 
784  void FinishWithError(const grpc::Status& status, void* tag) override {
785  ABSL_CHECK(!status.ok());
786  finish_ops_.set_output_tag(tag);
787  if (!ctx_->sent_initial_metadata_) {
788  finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
789  ctx_->initial_metadata_flags());
790  if (ctx_->compression_level_set()) {
791  finish_ops_.set_compression_level(ctx_->compression_level());
792  }
793  ctx_->sent_initial_metadata_ = true;
794  }
795  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
796  finish_ops_.FillOps(&call_);
797  }
798 
799  private:
800  void BindCall(grpc::internal::Call* call) override { call_ = *call; }
801 
802  grpc::internal::Call call_;
803  grpc::ServerContext* ctx_;
805  meta_ops_;
810  finish_ops_;
811 };
812 
813 template <class W>
817  public:
839  virtual void Finish(const grpc::Status& status, void* tag) = 0;
840 
855  virtual void WriteAndFinish(const W& msg, grpc::WriteOptions options,
856  const grpc::Status& status, void* tag) = 0;
857 };
858 
861 template <class W>
862 class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
863  public:
864  explicit ServerAsyncWriter(grpc::ServerContext* ctx) : call_(), ctx_(ctx) {}
865 
873  void SendInitialMetadata(void* tag) override {
874  ABSL_CHECK(!ctx_->sent_initial_metadata_);
875 
876  meta_ops_.set_output_tag(tag);
877  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
878  ctx_->initial_metadata_flags());
879  if (ctx_->compression_level_set()) {
880  meta_ops_.set_compression_level(ctx_->compression_level());
881  }
882  ctx_->sent_initial_metadata_ = true;
883  meta_ops_.FillOps(&call_);
884  }
885 
886  void Write(const W& msg, void* tag) override {
887  write_ops_.set_output_tag(tag);
888  EnsureInitialMetadataSent(&write_ops_);
889  // TODO(ctiller): don't assert
890  ABSL_CHECK(write_ops_.SendMessage(msg, ctx_->memory_allocator()).ok());
891  write_ops_.FillOps(&call_);
892  }
893 
894  void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
895  write_ops_.set_output_tag(tag);
896  if (options.is_last_message()) {
897  options.set_buffer_hint();
898  }
899 
900  EnsureInitialMetadataSent(&write_ops_);
901  // TODO(ctiller): don't assert
902  ABSL_CHECK(
903  write_ops_.SendMessage(msg, options, ctx_->memory_allocator()).ok());
904  write_ops_.FillOps(&call_);
905  }
906 
917  void WriteAndFinish(const W& msg, grpc::WriteOptions options,
918  const grpc::Status& status, void* tag) override {
919  write_ops_.set_output_tag(tag);
920  EnsureInitialMetadataSent(&write_ops_);
921  options.set_buffer_hint();
922  ABSL_CHECK(
923  write_ops_.SendMessage(msg, options, ctx_->memory_allocator()).ok());
924  write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
925  write_ops_.FillOps(&call_);
926  }
927 
939  void Finish(const grpc::Status& status, void* tag) override {
940  finish_ops_.set_output_tag(tag);
941  EnsureInitialMetadataSent(&finish_ops_);
942  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
943  finish_ops_.FillOps(&call_);
944  }
945 
946  private:
947  void BindCall(grpc::internal::Call* call) override { call_ = *call; }
948 
949  template <class T>
950  void EnsureInitialMetadataSent(T* ops) {
951  if (!ctx_->sent_initial_metadata_) {
952  ops->SendInitialMetadata(&ctx_->initial_metadata_,
953  ctx_->initial_metadata_flags());
954  if (ctx_->compression_level_set()) {
955  ops->set_compression_level(ctx_->compression_level());
956  }
957  ctx_->sent_initial_metadata_ = true;
958  }
959  }
960 
961  grpc::internal::Call call_;
962  grpc::ServerContext* ctx_;
964  meta_ops_;
968  write_ops_;
971  finish_ops_;
972 };
973 
975 template <class W, class R>
980  public:
1003  virtual void Finish(const grpc::Status& status, void* tag) = 0;
1004 
1019  virtual void WriteAndFinish(const W& msg, grpc::WriteOptions options,
1020  const grpc::Status& status, void* tag) = 0;
1021 };
1022 
1027 template <class W, class R>
1028 class ServerAsyncReaderWriter final
1029  : public ServerAsyncReaderWriterInterface<W, R> {
1030  public:
1032  : call_(), ctx_(ctx) {}
1033 
1041  void SendInitialMetadata(void* tag) override {
1042  ABSL_CHECK(!ctx_->sent_initial_metadata_);
1043 
1044  meta_ops_.set_output_tag(tag);
1045  meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
1046  ctx_->initial_metadata_flags());
1047  if (ctx_->compression_level_set()) {
1048  meta_ops_.set_compression_level(ctx_->compression_level());
1049  }
1050  ctx_->sent_initial_metadata_ = true;
1051  meta_ops_.FillOps(&call_);
1052  }
1053 
1054  void Read(R* msg, void* tag) override {
1055  read_ops_.set_output_tag(tag);
1056  read_ops_.RecvMessage(msg);
1057  read_ops_.FillOps(&call_);
1058  }
1059 
1060  void Write(const W& msg, void* tag) override {
1061  write_ops_.set_output_tag(tag);
1062  EnsureInitialMetadataSent(&write_ops_);
1063  // TODO(ctiller): don't assert
1064  ABSL_CHECK(write_ops_.SendMessage(msg, ctx_->memory_allocator()).ok());
1065  write_ops_.FillOps(&call_);
1066  }
1067 
1068  void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
1069  write_ops_.set_output_tag(tag);
1070  if (options.is_last_message()) {
1071  options.set_buffer_hint();
1072  }
1073  EnsureInitialMetadataSent(&write_ops_);
1074  ABSL_CHECK(
1075  write_ops_.SendMessage(msg, options, ctx_->memory_allocator()).ok());
1076  write_ops_.FillOps(&call_);
1077  }
1078 
1087  //
1090  void WriteAndFinish(const W& msg, grpc::WriteOptions options,
1091  const grpc::Status& status, void* tag) override {
1092  write_ops_.set_output_tag(tag);
1093  EnsureInitialMetadataSent(&write_ops_);
1094  options.set_buffer_hint();
1095  ABSL_CHECK(
1096  write_ops_.SendMessage(msg, options, ctx_->memory_allocator()).ok());
1097  write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
1098  write_ops_.FillOps(&call_);
1099  }
1100 
1109  //
1112  void Finish(const grpc::Status& status, void* tag) override {
1113  finish_ops_.set_output_tag(tag);
1114  EnsureInitialMetadataSent(&finish_ops_);
1115 
1116  finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
1117  finish_ops_.FillOps(&call_);
1118  }
1119 
1120  private:
1121  friend class grpc::Server;
1122 
1123  void BindCall(grpc::internal::Call* call) override { call_ = *call; }
1124 
1125  template <class T>
1126  void EnsureInitialMetadataSent(T* ops) {
1127  if (!ctx_->sent_initial_metadata_) {
1128  ops->SendInitialMetadata(&ctx_->initial_metadata_,
1129  ctx_->initial_metadata_flags());
1130  if (ctx_->compression_level_set()) {
1131  ops->set_compression_level(ctx_->compression_level());
1132  }
1133  ctx_->sent_initial_metadata_ = true;
1134  }
1135  }
1136 
1137  grpc::internal::Call call_;
1138  grpc::ServerContext* ctx_;
1140  meta_ops_;
1145  write_ops_;
1148  finish_ops_;
1149 };
1150 
1151 } // namespace grpc
1152 
1153 #endif // GRPCPP_SUPPORT_ASYNC_STREAM_H
grpc::internal::CallOpRecvInitialMetadata
Definition: call_op_set.h:723
grpc::ClientAsyncReaderWriter::Finish
void Finish(grpc::Status *status, void *tag) override
See the ClientAsyncStreamingInterface.Finish method for semantics.
Definition: async_stream.h:606
grpc::ServerAsyncReaderWriter::Read
void Read(R *msg, void *tag) override
Definition: async_stream.h:1054
grpc::ClientAsyncWriter::StartCall
void StartCall(void *tag) override
Definition: async_stream.h:369
grpc::internal::ServerAsyncStreamingInterface
Definition: service_type.h:38
grpc::internal::CallOpClientSendClose
Definition: call_op_set.h:621
grpc_call_arena_alloc
GRPCAPI void * grpc_call_arena_alloc(grpc_call *call, size_t size)
Allocate memory in the grpc_call arena: this memory is automatically discarded at call completion.
grpc::internal::CallOpGenericRecvMessage
Definition: call_op_set.h:528
grpc::internal::AsyncWriterInterface
An interface that can be fed a sequence of messages of type W.
Definition: async_stream.h:110
grpc::ServerContext
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:586
grpc::internal::CallOpServerSendStatus
Definition: call_op_set.h:656
grpc::Server
Represents a gRPC server.
Definition: server.h:58
grpc::ClientAsyncReaderWriter::ReadInitialMetadata
void ReadInitialMetadata(void *tag) override
See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics of this method.
Definition: async_stream.h:554
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: completion_queue.h:97
grpc::ClientAsyncReaderWriter::Read
void Read(R *msg, void *tag) override
Definition: async_stream.h:563
grpc::internal::ClientAsyncStreamingInterface::~ClientAsyncStreamingInterface
virtual ~ClientAsyncStreamingInterface()
Definition: async_stream.h:37
grpc::internal::CallOpSendMessage
Definition: call_op_set.h:287
grpc::ServerAsyncReaderWriter::Write
void Write(const W &msg, grpc::WriteOptions options, void *tag) override
Definition: async_stream.h:1068
grpc::ClientAsyncWriter::Write
void Write(const W &msg, void *tag) override
Definition: async_stream.h:391
grpc::ServerAsyncWriter
Async server-side API for doing server streaming RPCs, where the outgoing message stream from the ser...
Definition: server_context.h:58
grpc::internal::ClientAsyncReaderWriterFactory
Definition: channel_interface.h:43
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:156
grpc::ClientAsyncReader::StartCall
void StartCall(void *tag) override
Definition: async_stream.h:218
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:754
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
Definition: async_stream.h:886
grpc::internal::CallOpSet::FillOps
void FillOps(Call *call) override
Definition: call_op_set.h:895
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:338
grpc::internal::Call
Straightforward wrapping of the C call object.
Definition: call.h:34
grpc::ServerContextBase::memory_allocator
grpc_event_engine::experimental::MemoryAllocator * memory_allocator()
Definition: server_context.h:300
grpc::ClientAsyncReaderWriter::WritesDone
void WritesDone(void *tag) override
Definition: async_stream.h:595
grpc::ServerAsyncReader::ServerAsyncReader
ServerAsyncReader(grpc::ServerContext *ctx)
Definition: async_stream.h:717
status.h
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:1090
grpc::internal::CallOpSendInitialMetadata
Definition: call_op_set.h:217
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:508
grpc::ClientAsyncReader::ReadInitialMetadata
void ReadInitialMetadata(void *tag) override
See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics.
Definition: async_stream.h:232
grpc::ClientAsyncWriter::Write
void Write(const W &msg, grpc::WriteOptions options, void *tag) override
Definition: async_stream.h:399
grpc::Status::ok
bool ok() const
Is the status OK?
Definition: status.h:124
grpc::ServerAsyncReaderWriter::Write
void Write(const W &msg, void *tag) override
Definition: async_stream.h:1060
grpc::ServerAsyncReader::Read
void Read(R *msg, void *tag) override
Definition: async_stream.h:737
grpc::ClientAsyncReaderWriterInterface
Async client-side interface for bi-directional streaming, where the client-to-server message stream h...
Definition: async_stream.h:485
grpc::ClientAsyncWriter::Finish
void Finish(grpc::Status *status, void *tag) override
See the ClientAsyncStreamingInterface.Finish method for semantics.
Definition: async_stream.h:428
grpc::ServerAsyncReaderWriter::ServerAsyncReaderWriter
ServerAsyncReaderWriter(grpc::ServerContext *ctx)
Definition: async_stream.h:1031
grpc::ServerAsyncWriterInterface
Definition: async_stream.h:814
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:163
grpc::Status
Did it work? If it didn't, why?
Definition: status.h:34
grpc::internal::ClientAsyncReaderFactory
Definition: channel_interface.h:39
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:35
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:236
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
Definition: async_stream.h:414
grpc::ClientContext
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:194
grpc.h
grpc::ServerAsyncReaderWriterInterface
Server-side interface for asynchronous bi-directional streaming.
Definition: async_stream.h:976
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
Definition: async_stream.h:894
grpc::ClientAsyncReader
Async client-side API for doing server-streaming RPCs, where the incoming message stream coming from ...
Definition: client_context.h:86
grpc::ServerAsyncReaderWriter::SendInitialMetadata
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_stream.h:1041
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.
channel_interface.h
grpc::ChannelInterface
Codegen interface for grpc::Channel.
Definition: channel_interface.h:72
grpc::ClientAsyncWriter::ReadInitialMetadata
void ReadInitialMetadata(void *tag) override
See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics.
Definition: async_stream.h:382
grpc::ServerAsyncReaderWriter::Finish
void Finish(const grpc::Status &status, void *tag) override
See the ServerAsyncReaderWriterInterface.Finish method for semantics.
Definition: async_stream.h:1112
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:187
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:311
grpc::ClientAsyncReader::Read
void Read(R *msg, void *tag) override
Definition: async_stream.h:241
grpc::internal::AsyncWriterInterface::~AsyncWriterInterface
virtual ~AsyncWriterInterface()
Definition: async_stream.h:112
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:784
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:917
grpc::ClientAsyncWriter
Async API on the client side for doing client-streaming RPCs, where the outgoing message stream going...
Definition: client_context.h:88
grpc::internal::CallOpSet::set_output_tag
void set_output_tag(void *return_tag)
Definition: call_op_set.h:939
grpc::WriteOptions
Per-message write options.
Definition: call_op_set.h:79
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:88
grpc::ClientAsyncReaderWriter
Async client-side interface for bi-directional streaming, where the outgoing message stream going to ...
Definition: client_context.h:90
grpc::ServerAsyncReader::SendInitialMetadata
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_stream.h:724
grpc::ClientAsyncReaderWriter::Write
void Write(const W &msg, void *tag) override
Definition: async_stream.h:573
grpc::ClientAsyncReaderWriter::Write
void Write(const W &msg, grpc::WriteOptions options, void *tag) override
Definition: async_stream.h:581
grpc::internal::Call::call
grpc_call * call() const
Definition: call.h:55
server_context.h
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:251
grpc::internal::CallOpClientRecvStatus
Definition: call_op_set.h:771
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:117
service_type.h
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: channel_interface.h:41
grpc::ClientAsyncReader::Finish
void Finish(grpc::Status *status, void *tag) override
See the ClientAsyncStreamingInterface.Finish method for semantics.
Definition: async_stream.h:256
grpc::internal::AsyncReaderInterface::~AsyncReaderInterface
virtual ~AsyncReaderInterface()
Definition: async_stream.h:90
grpc::ClientAsyncReaderWriter::StartCall
void StartCall(void *tag) override
Definition: async_stream.h:541
grpc::ServerAsyncReaderInterface
Definition: async_stream.h:659
grpc::ServerAsyncWriter::Finish
void Finish(const grpc::Status &status, void *tag) override
See the ServerAsyncWriterInterface.Finish method for semantics.
Definition: async_stream.h:939
grpc::ServerAsyncWriter::SendInitialMetadata
void SendInitialMetadata(void *tag) override
See ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
Definition: async_stream.h:873
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:172
grpc::ServerAsyncReader
Async server-side API for doing client-streaming RPCs, where the incoming message stream from the cli...
Definition: server_context.h:56
grpc::internal::CallOpRecvMessage
Definition: call_op_set.h:427
grpc::internal::RpcMethod
Descriptor of an RPC method.
Definition: rpc_method.h:29
grpc::ServerAsyncReaderWriter
Async server-side API for doing bidirectional streaming RPCs, where the incoming message stream comin...
Definition: server_context.h:62
grpc::ServerAsyncWriter::ServerAsyncWriter
ServerAsyncWriter(grpc::ServerContext *ctx)
Definition: async_stream.h:864
grpc::ChannelInterface::memory_allocator
virtual grpc_event_engine::experimental::MemoryAllocator * memory_allocator() const
Definition: channel_interface.h:106
grpc::ClientAsyncReaderInterface
Definition: async_stream.h:171
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.