GRPC C++  1.3.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
async_stream.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015, Google Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following disclaimer
14  * in the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of Google Inc. nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 #ifndef GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
35 #define GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
36 
43 
44 namespace grpc {
45 
46 class CompletionQueue;
47 
50  public:
52 
59  virtual void ReadInitialMetadata(void* tag) = 0;
60 
66  virtual void Finish(Status* status, void* tag) = 0;
67 };
68 
70 template <class R>
72  public:
73  virtual ~AsyncReaderInterface() {}
74 
85  virtual void Read(R* msg, void* tag) = 0;
86 };
87 
89 template <class W>
91  public:
92  virtual ~AsyncWriterInterface() {}
93 
103  virtual void Write(const W& msg, void* tag) = 0;
104 
117  virtual void Write(const W& msg, WriteOptions options, void* tag) = 0;
118 
134  void WriteLast(const W& msg, WriteOptions options, void* tag) {
135  Write(msg, options.set_last_message(), tag);
136  }
137 };
138 
139 template <class R>
141  public AsyncReaderInterface<R> {};
142 
143 template <class R>
145  public:
147  template <class W>
149  const RpcMethod& method, ClientContext* context,
150  const W& request, void* tag)
151  : context_(context), call_(channel->CreateCall(method, context, cq)) {
152  init_ops_.set_output_tag(tag);
153  init_ops_.SendInitialMetadata(context->send_initial_metadata_,
154  context->initial_metadata_flags());
155  // TODO(ctiller): don't assert
156  GPR_CODEGEN_ASSERT(init_ops_.SendMessage(request).ok());
157  init_ops_.ClientSendClose();
158  call_.PerformOps(&init_ops_);
159  }
160 
161  void ReadInitialMetadata(void* tag) override {
162  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
163 
164  meta_ops_.set_output_tag(tag);
165  meta_ops_.RecvInitialMetadata(context_);
166  call_.PerformOps(&meta_ops_);
167  }
168 
169  void Read(R* msg, void* tag) override {
170  read_ops_.set_output_tag(tag);
171  if (!context_->initial_metadata_received_) {
172  read_ops_.RecvInitialMetadata(context_);
173  }
174  read_ops_.RecvMessage(msg);
175  call_.PerformOps(&read_ops_);
176  }
177 
178  void Finish(Status* status, void* tag) override {
179  finish_ops_.set_output_tag(tag);
180  if (!context_->initial_metadata_received_) {
181  finish_ops_.RecvInitialMetadata(context_);
182  }
183  finish_ops_.ClientRecvStatus(context_, status);
184  call_.PerformOps(&finish_ops_);
185  }
186 
187  private:
188  ClientContext* context_;
189  Call call_;
191  init_ops_;
195 };
196 
198 template <class W>
200  public AsyncWriterInterface<W> {
201  public:
206  virtual void WritesDone(void* tag) = 0;
207 };
208 
209 template <class W>
211  public:
212  template <class R>
214  const RpcMethod& method, ClientContext* context,
215  R* response, void* tag)
216  : context_(context), call_(channel->CreateCall(method, context, cq)) {
217  finish_ops_.RecvMessage(response);
218  finish_ops_.AllowNoMessage();
219  // if corked bit is set in context, we buffer up the initial metadata to
220  // coalesce with later message to be sent. No op is performed.
221  if (context_->initial_metadata_corked_) {
222  write_ops_.SendInitialMetadata(context->send_initial_metadata_,
223  context->initial_metadata_flags());
224  } else {
225  write_ops_.set_output_tag(tag);
226  write_ops_.SendInitialMetadata(context->send_initial_metadata_,
227  context->initial_metadata_flags());
228  call_.PerformOps(&write_ops_);
229  }
230  }
231 
232  void ReadInitialMetadata(void* tag) override {
233  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
234 
235  meta_ops_.set_output_tag(tag);
236  meta_ops_.RecvInitialMetadata(context_);
237  call_.PerformOps(&meta_ops_);
238  }
239 
240  void Write(const W& msg, void* tag) override {
241  write_ops_.set_output_tag(tag);
242  // TODO(ctiller): don't assert
243  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
244  call_.PerformOps(&write_ops_);
245  }
246 
247  void Write(const W& msg, WriteOptions options, void* tag) override {
248  write_ops_.set_output_tag(tag);
249  if (options.is_last_message()) {
250  options.set_buffer_hint();
251  write_ops_.ClientSendClose();
252  }
253  // TODO(ctiller): don't assert
254  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
255  call_.PerformOps(&write_ops_);
256  }
257 
258  void WritesDone(void* tag) override {
259  write_ops_.set_output_tag(tag);
260  write_ops_.ClientSendClose();
261  call_.PerformOps(&write_ops_);
262  }
263 
264  void Finish(Status* status, void* tag) override {
265  finish_ops_.set_output_tag(tag);
266  if (!context_->initial_metadata_received_) {
267  finish_ops_.RecvInitialMetadata(context_);
268  }
269  finish_ops_.ClientRecvStatus(context_, status);
270  call_.PerformOps(&finish_ops_);
271  }
272 
273  private:
274  ClientContext* context_;
275  Call call_;
278  write_ops_;
281  finish_ops_;
282 };
283 
285 template <class W, class R>
287  public AsyncWriterInterface<W>,
288  public AsyncReaderInterface<R> {
289  public:
294  virtual void WritesDone(void* tag) = 0;
295 };
296 
297 template <class W, class R>
299  : public ClientAsyncReaderWriterInterface<W, R> {
300  public:
302  const RpcMethod& method, ClientContext* context,
303  void* tag)
304  : context_(context), call_(channel->CreateCall(method, context, cq)) {
305  if (context_->initial_metadata_corked_) {
306  // if corked bit is set in context, we buffer up the initial metadata to
307  // coalesce with later message to be sent. No op is performed.
308  write_ops_.SendInitialMetadata(context->send_initial_metadata_,
309  context->initial_metadata_flags());
310  } else {
311  write_ops_.set_output_tag(tag);
312  write_ops_.SendInitialMetadata(context->send_initial_metadata_,
313  context->initial_metadata_flags());
314  call_.PerformOps(&write_ops_);
315  }
316  }
317 
318  void ReadInitialMetadata(void* tag) override {
319  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
320 
321  meta_ops_.set_output_tag(tag);
322  meta_ops_.RecvInitialMetadata(context_);
323  call_.PerformOps(&meta_ops_);
324  }
325 
326  void Read(R* msg, void* tag) override {
327  read_ops_.set_output_tag(tag);
328  if (!context_->initial_metadata_received_) {
329  read_ops_.RecvInitialMetadata(context_);
330  }
331  read_ops_.RecvMessage(msg);
332  call_.PerformOps(&read_ops_);
333  }
334 
335  void Write(const W& msg, void* tag) override {
336  write_ops_.set_output_tag(tag);
337  // TODO(ctiller): don't assert
338  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
339  call_.PerformOps(&write_ops_);
340  }
341 
342  void Write(const W& msg, WriteOptions options, void* tag) override {
343  write_ops_.set_output_tag(tag);
344  if (options.is_last_message()) {
345  options.set_buffer_hint();
346  write_ops_.ClientSendClose();
347  }
348  // TODO(ctiller): don't assert
349  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
350  call_.PerformOps(&write_ops_);
351  }
352 
353  void WritesDone(void* tag) override {
354  write_ops_.set_output_tag(tag);
355  write_ops_.ClientSendClose();
356  call_.PerformOps(&write_ops_);
357  }
358 
359  void Finish(Status* status, void* tag) override {
360  finish_ops_.set_output_tag(tag);
361  if (!context_->initial_metadata_received_) {
362  finish_ops_.RecvInitialMetadata(context_);
363  }
364  finish_ops_.ClientRecvStatus(context_, status);
365  call_.PerformOps(&finish_ops_);
366  }
367 
368  private:
369  ClientContext* context_;
370  Call call_;
374  write_ops_;
376 };
377 
378 template <class W, class R>
380  public AsyncReaderInterface<R> {
381  public:
382  virtual void Finish(const W& msg, const Status& status, void* tag) = 0;
383 
384  virtual void FinishWithError(const Status& status, void* tag) = 0;
385 };
386 
387 template <class W, class R>
388 class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
389  public:
391  : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
392 
393  void SendInitialMetadata(void* tag) override {
394  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
395 
396  meta_ops_.set_output_tag(tag);
397  meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
398  ctx_->initial_metadata_flags());
399  if (ctx_->compression_level_set()) {
400  meta_ops_.set_compression_level(ctx_->compression_level());
401  }
402  ctx_->sent_initial_metadata_ = true;
403  call_.PerformOps(&meta_ops_);
404  }
405 
406  void Read(R* msg, void* tag) override {
407  read_ops_.set_output_tag(tag);
408  read_ops_.RecvMessage(msg);
409  call_.PerformOps(&read_ops_);
410  }
411 
412  void Finish(const W& msg, const Status& status, void* tag) override {
413  finish_ops_.set_output_tag(tag);
414  if (!ctx_->sent_initial_metadata_) {
415  finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
416  ctx_->initial_metadata_flags());
417  if (ctx_->compression_level_set()) {
418  finish_ops_.set_compression_level(ctx_->compression_level());
419  }
420  ctx_->sent_initial_metadata_ = true;
421  }
422  // The response is dropped if the status is not OK.
423  if (status.ok()) {
424  finish_ops_.ServerSendStatus(ctx_->trailing_metadata_,
425  finish_ops_.SendMessage(msg));
426  } else {
427  finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
428  }
429  call_.PerformOps(&finish_ops_);
430  }
431 
432  void FinishWithError(const Status& status, void* tag) override {
433  GPR_CODEGEN_ASSERT(!status.ok());
434  finish_ops_.set_output_tag(tag);
435  if (!ctx_->sent_initial_metadata_) {
436  finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
437  ctx_->initial_metadata_flags());
438  if (ctx_->compression_level_set()) {
439  finish_ops_.set_compression_level(ctx_->compression_level());
440  }
441  ctx_->sent_initial_metadata_ = true;
442  }
443  finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
444  call_.PerformOps(&finish_ops_);
445  }
446 
447  private:
448  void BindCall(Call* call) override { call_ = *call; }
449 
450  Call call_;
451  ServerContext* ctx_;
452  CallOpSet<CallOpSendInitialMetadata> meta_ops_;
453  CallOpSet<CallOpRecvMessage<R>> read_ops_;
454  CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
455  CallOpServerSendStatus>
456  finish_ops_;
457 };
458 
459 template <class W>
461  public AsyncWriterInterface<W> {
462  public:
463  virtual void Finish(const Status& status, void* tag) = 0;
464 
476  virtual void WriteAndFinish(const W& msg, WriteOptions options,
477  const Status& status, void* tag) = 0;
478 };
479 
480 template <class W>
482  public:
484  : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
485 
486  void SendInitialMetadata(void* tag) override {
487  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
488 
489  meta_ops_.set_output_tag(tag);
490  meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
491  ctx_->initial_metadata_flags());
492  if (ctx_->compression_level_set()) {
493  meta_ops_.set_compression_level(ctx_->compression_level());
494  }
495  ctx_->sent_initial_metadata_ = true;
496  call_.PerformOps(&meta_ops_);
497  }
498 
499  void Write(const W& msg, void* tag) override {
500  write_ops_.set_output_tag(tag);
501  EnsureInitialMetadataSent(&write_ops_);
502  // TODO(ctiller): don't assert
503  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
504  call_.PerformOps(&write_ops_);
505  }
506 
507  void Write(const W& msg, WriteOptions options, void* tag) override {
508  write_ops_.set_output_tag(tag);
509  if (options.is_last_message()) {
510  options.set_buffer_hint();
511  }
512 
513  EnsureInitialMetadataSent(&write_ops_);
514  // TODO(ctiller): don't assert
515  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
516  call_.PerformOps(&write_ops_);
517  }
518 
519  void WriteAndFinish(const W& msg, WriteOptions options, const Status& status,
520  void* tag) override {
521  write_ops_.set_output_tag(tag);
522  EnsureInitialMetadataSent(&write_ops_);
523  options.set_buffer_hint();
524  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
525  write_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
526  call_.PerformOps(&write_ops_);
527  }
528 
529  void Finish(const Status& status, void* tag) override {
530  finish_ops_.set_output_tag(tag);
531  EnsureInitialMetadataSent(&finish_ops_);
532  finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
533  call_.PerformOps(&finish_ops_);
534  }
535 
536  private:
537  void BindCall(Call* call) override { call_ = *call; }
538 
539  template <class T>
540  void EnsureInitialMetadataSent(T* ops) {
541  if (!ctx_->sent_initial_metadata_) {
542  ops->SendInitialMetadata(ctx_->initial_metadata_,
543  ctx_->initial_metadata_flags());
544  if (ctx_->compression_level_set()) {
545  ops->set_compression_level(ctx_->compression_level());
546  }
547  ctx_->sent_initial_metadata_ = true;
548  }
549  }
550 
551  Call call_;
552  ServerContext* ctx_;
553  CallOpSet<CallOpSendInitialMetadata> meta_ops_;
554  CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
555  CallOpServerSendStatus>
556  write_ops_;
557  CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> finish_ops_;
558 };
559 
561 template <class W, class R>
563  public AsyncWriterInterface<W>,
564  public AsyncReaderInterface<R> {
565  public:
566  virtual void Finish(const Status& status, void* tag) = 0;
567 
579  virtual void WriteAndFinish(const W& msg, WriteOptions options,
580  const Status& status, void* tag) = 0;
581 };
582 
583 template <class W, class R>
585  : public ServerAsyncReaderWriterInterface<W, R> {
586  public:
588  : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
589 
590  void SendInitialMetadata(void* tag) override {
591  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
592 
593  meta_ops_.set_output_tag(tag);
594  meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
595  ctx_->initial_metadata_flags());
596  if (ctx_->compression_level_set()) {
597  meta_ops_.set_compression_level(ctx_->compression_level());
598  }
599  ctx_->sent_initial_metadata_ = true;
600  call_.PerformOps(&meta_ops_);
601  }
602 
603  void Read(R* msg, void* tag) override {
604  read_ops_.set_output_tag(tag);
605  read_ops_.RecvMessage(msg);
606  call_.PerformOps(&read_ops_);
607  }
608 
609  void Write(const W& msg, void* tag) override {
610  write_ops_.set_output_tag(tag);
611  EnsureInitialMetadataSent(&write_ops_);
612  // TODO(ctiller): don't assert
613  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
614  call_.PerformOps(&write_ops_);
615  }
616 
617  void Write(const W& msg, WriteOptions options, void* tag) override {
618  write_ops_.set_output_tag(tag);
619  if (options.is_last_message()) {
620  options.set_buffer_hint();
621  }
622  EnsureInitialMetadataSent(&write_ops_);
623  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
624  call_.PerformOps(&write_ops_);
625  }
626 
627  void WriteAndFinish(const W& msg, WriteOptions options, const Status& status,
628  void* tag) override {
629  write_ops_.set_output_tag(tag);
630  EnsureInitialMetadataSent(&write_ops_);
631  options.set_buffer_hint();
632  GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg, options).ok());
633  write_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
634  call_.PerformOps(&write_ops_);
635  }
636 
637  void Finish(const Status& status, void* tag) override {
638  finish_ops_.set_output_tag(tag);
639  EnsureInitialMetadataSent(&finish_ops_);
640 
641  finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
642  call_.PerformOps(&finish_ops_);
643  }
644 
645  private:
646  friend class ::grpc::Server;
647 
648  void BindCall(Call* call) override { call_ = *call; }
649 
650  template <class T>
651  void EnsureInitialMetadataSent(T* ops) {
652  if (!ctx_->sent_initial_metadata_) {
653  ops->SendInitialMetadata(ctx_->initial_metadata_,
654  ctx_->initial_metadata_flags());
655  if (ctx_->compression_level_set()) {
656  ops->set_compression_level(ctx_->compression_level());
657  }
658  ctx_->sent_initial_metadata_ = true;
659  }
660  }
661 
662  Call call_;
663  ServerContext* ctx_;
664  CallOpSet<CallOpSendInitialMetadata> meta_ops_;
665  CallOpSet<CallOpRecvMessage<R>> read_ops_;
666  CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
667  CallOpServerSendStatus>
668  write_ops_;
669  CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> finish_ops_;
670 };
671 
672 } // namespace grpc
673 
674 #endif // GRPCXX_IMPL_CODEGEN_ASYNC_STREAM_H
Common interface for all client side asynchronous streaming.
Definition: async_stream.h:49
Definition: async_stream.h:298
grpc_compression_level compression_level() const
Definition: server_context.h:131
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream.h:406
WriteOptions & set_buffer_hint()
Sets flag indicating that the write may be buffered and need not go out on the wire immediately...
Definition: call.h:135
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream.h:169
virtual void WriteAndFinish(const W &msg, WriteOptions options, const Status &status, void *tag)=0
Request the writing of msg and coalesce it with trailing metadata which contains status, using WriteOptions options with identifying tag tag.
WriteOptions & set_last_message()
last-message bit: indicates this is the last message in a stream client-side: makes Write the equival...
Definition: call.h:174
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:122
virtual void WritesDone(void *tag)=0
Signal the client is done with the writes.
Definition: call.h:536
virtual void Write(const W &msg, void *tag)=0
Request the writing of msg with identifying tag tag.
Definition: async_stream.h:584
void FinishWithError(const Status &status, void *tag) override
Definition: async_stream.h:432
void Write(const W &msg, WriteOptions options, void *tag) override
Request the writing of msg using WriteOptions options with identifying tag tag.
Definition: async_stream.h:617
Definition: service_type.h:53
void Finish(Status *status, void *tag) override
Indicate that the stream is to be finished and request notification Should not be used concurrently w...
Definition: async_stream.h:359
Definition: async_stream.h:379
void WriteLast(const W &msg, WriteOptions options, void *tag)
Request the writing of msg and coalesce it with the writing of trailing metadata, using WriteOptions ...
Definition: async_stream.h:134
void Finish(Status *status, void *tag) override
Indicate that the stream is to be finished and request notification Should not be used concurrently w...
Definition: async_stream.h:178
virtual void WritesDone(void *tag)=0
Signal the client is done with the writes.
Definition: client_context.h:154
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream.h:499
Definition: async_stream.h:481
ClientAsyncWriter(ChannelInterface *channel, CompletionQueue *cq, const RpcMethod &method, ClientContext *context, R *response, void *tag)
Definition: async_stream.h:213
void Finish(const W &msg, const Status &status, void *tag) override
Definition: async_stream.h:412
void Finish(const Status &status, void *tag) override
Definition: async_stream.h:637
virtual ~AsyncReaderInterface()
Definition: async_stream.h:73
void Write(const W &msg, WriteOptions options, void *tag) override
Request the writing of msg using WriteOptions options with identifying tag tag.
Definition: async_stream.h:342
ServerAsyncReaderWriter(ServerContext *ctx)
Definition: async_stream.h:587
ClientAsyncReaderWriter(ChannelInterface *channel, CompletionQueue *cq, const RpcMethod &method, ClientContext *context, void *tag)
Definition: async_stream.h:301
Definition: async_stream.h:140
void SendInitialMetadata(void *tag) override
Definition: async_stream.h:590
Definition: call.h:675
Client-side interface for asynchronous bi-directional streaming.
Definition: async_stream.h:286
virtual void Finish(const Status &status, void *tag)=0
Codegen interface for grpc::Channel.
Definition: channel_interface.h:64
ServerAsyncWriter(ServerContext *ctx)
Definition: async_stream.h:483
An interface that can be fed a sequence of messages of type W.
Definition: async_stream.h:90
void SendInitialMetadata(void *tag) override
Definition: async_stream.h:486
Definition: async_stream.h:210
Primary implementaiton of CallOpSetInterface.
Definition: call.h:623
virtual void FinishWithError(const Status &status, void *tag)=0
Server-side interface for asynchronous bi-directional streaming.
Definition: async_stream.h:562
void WritesDone(void *tag) override
Signal the client is done with the writes.
Definition: async_stream.h:353
Definition: server_context.h:94
void SendInitialMetadata(void *tag) override
Definition: async_stream.h:393
Per-message write options.
Definition: call.h:95
void Write(const W &msg, WriteOptions options, void *tag) override
Request the writing of msg using WriteOptions options with identifying tag tag.
Definition: async_stream.h:507
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream.h:240
void WriteAndFinish(const W &msg, WriteOptions options, const Status &status, void *tag) override
Request the writing of msg and coalesce it with trailing metadata which contains status, using WriteOptions options with identifying tag tag.
Definition: async_stream.h:627
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:101
virtual ~ClientAsyncStreamingInterface()
Definition: async_stream.h:51
virtual void ReadInitialMetadata(void *tag)=0
Request notification of the reading of the initial metadata.
Definition: rpc_method.h:43
void ReadInitialMetadata(void *tag) override
Request notification of the reading of the initial metadata.
Definition: async_stream.h:161
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:691
bool ok() const
Is the status OK?
Definition: status.h:76
void Write(const W &msg, WriteOptions options, void *tag) override
Request the writing of msg using WriteOptions options with identifying tag tag.
Definition: async_stream.h:247
Did it work? If it didn't, why?
Definition: status.h:45
void Finish(const Status &status, void *tag) override
Definition: async_stream.h:529
void ReadInitialMetadata(void *tag) override
Request notification of the reading of the initial metadata.
Definition: async_stream.h:318
virtual void Finish(Status *status, void *tag)=0
Indicate that the stream is to be finished and request notification Should not be used concurrently w...
Definition: async_stream.h:460
void Finish(Status *status, void *tag) override
Indicate that the stream is to be finished and request notification Should not be used concurrently w...
Definition: async_stream.h:264
void WritesDone(void *tag) override
Signal the client is done with the writes.
Definition: async_stream.h:258
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream.h:335
Definition: async_stream.h:144
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream.h:603
virtual ~AsyncWriterInterface()
Definition: async_stream.h:92
bool compression_level_set() const
Definition: server_context.h:140
void Write(const W &msg, void *tag) override
Request the writing of msg with identifying tag tag.
Definition: async_stream.h:609
void Read(R *msg, void *tag) override
Read a message of type R into msg.
Definition: async_stream.h:326
virtual void WriteAndFinish(const W &msg, WriteOptions options, const Status &status, void *tag)=0
Request the writing of msg and coalesce it with trailing metadata which contains status, using WriteOptions options with identifying tag tag.
void WriteAndFinish(const W &msg, WriteOptions options, const Status &status, void *tag) override
Request the writing of msg and coalesce it with trailing metadata which contains status, using WriteOptions options with identifying tag tag.
Definition: async_stream.h:519
Definition: async_stream.h:388
Definition: call.h:507
ClientAsyncReader(ChannelInterface *channel, CompletionQueue *cq, const RpcMethod &method, ClientContext *context, const W &request, void *tag)
Create a stream and write the first request out.
Definition: async_stream.h:148
virtual void Finish(const Status &status, void *tag)=0
virtual void Read(R *msg, void *tag)=0
Read a message of type R into msg.
void ReadInitialMetadata(void *tag) override
Request notification of the reading of the initial metadata.
Definition: async_stream.h:232
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.h:190
Definition: call.h:386
ServerAsyncReader(ServerContext *ctx)
Definition: async_stream.h:390
An interface that yields a sequence of messages of type R.
Definition: async_stream.h:71
virtual void Finish(const W &msg, const Status &status, void *tag)=0
Common interface for client side asynchronous writing.
Definition: async_stream.h:199