GRPC C++  1.4.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sync_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_SYNC_STREAM_H
35 #define GRPCXX_IMPL_CODEGEN_SYNC_STREAM_H
36 
45 
46 namespace grpc {
47 
50  public:
52 
77  virtual Status Finish() = 0;
78 };
79 
82  public:
84 
91  virtual void SendInitialMetadata() = 0;
92 };
93 
95 template <class R>
97  public:
98  virtual ~ReaderInterface() {}
99 
102  virtual bool NextMessageSize(uint32_t* sz) = 0;
103 
114  virtual bool Read(R* msg) = 0;
115 };
116 
118 template <class W>
120  public:
121  virtual ~WriterInterface() {}
122 
130  virtual bool Write(const W& msg, WriteOptions options) = 0;
131 
138  inline bool Write(const W& msg) { return Write(msg, WriteOptions()); }
139 
154  void WriteLast(const W& msg, WriteOptions options) {
155  Write(msg, options.set_last_message());
156  }
157 };
158 
160 template <class R>
162  public ReaderInterface<R> {
163  public:
168  virtual void WaitForInitialMetadata() = 0;
169 };
170 
174 template <class R>
175 class ClientReader final : public ClientReaderInterface<R> {
176  public:
180  template <class W>
181  ClientReader(ChannelInterface* channel, const RpcMethod& method,
182  ClientContext* context, const W& request)
183  : context_(context),
186  GRPC_CQ_DEFAULT_POLLING}), // Pluckable cq
187  call_(channel->CreateCall(method, context, &cq_)) {
190  ops;
191  ops.SendInitialMetadata(context->send_initial_metadata_,
192  context->initial_metadata_flags());
193  // TODO(ctiller): don't assert
194  GPR_CODEGEN_ASSERT(ops.SendMessage(request).ok());
195  ops.ClientSendClose();
196  call_.PerformOps(&ops);
197  cq_.Pluck(&ops);
198  }
199 
203  // Side effect:
207  void WaitForInitialMetadata() override {
208  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
209 
211  ops.RecvInitialMetadata(context_);
212  call_.PerformOps(&ops);
213  cq_.Pluck(&ops);
214  }
215 
216  bool NextMessageSize(uint32_t* sz) override {
217  *sz = call_.max_receive_message_size();
218  return true;
219  }
220 
226  bool Read(R* msg) override {
228  if (!context_->initial_metadata_received_) {
229  ops.RecvInitialMetadata(context_);
230  }
231  ops.RecvMessage(msg);
232  call_.PerformOps(&ops);
233  return cq_.Pluck(&ops) && ops.got_message;
234  }
235 
241  Status Finish() override {
243  Status status;
244  ops.ClientRecvStatus(context_, &status);
245  call_.PerformOps(&ops);
246  GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
247  return status;
248  }
249 
250  private:
251  ClientContext* context_;
252  CompletionQueue cq_;
253  Call call_;
254 };
255 
257 template <class W>
259  public WriterInterface<W> {
260  public:
267  virtual bool WritesDone() = 0;
268 };
269 
273 template <class W>
274 class ClientWriter : public ClientWriterInterface<W> {
275  public:
281  template <class R>
282  ClientWriter(ChannelInterface* channel, const RpcMethod& method,
283  ClientContext* context, R* response)
284  : context_(context),
287  GRPC_CQ_DEFAULT_POLLING}), // Pluckable cq
288  call_(channel->CreateCall(method, context, &cq_)) {
289  finish_ops_.RecvMessage(response);
290  finish_ops_.AllowNoMessage();
291 
292  if (!context_->initial_metadata_corked_) {
294  ops.SendInitialMetadata(context->send_initial_metadata_,
295  context->initial_metadata_flags());
296  call_.PerformOps(&ops);
297  cq_.Pluck(&ops);
298  }
299  }
300 
304  // Side effect:
308  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
309 
311  ops.RecvInitialMetadata(context_);
312  call_.PerformOps(&ops);
313  cq_.Pluck(&ops); // status ignored
314  }
315 
323  bool Write(const W& msg, WriteOptions options) override {
324  CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
326  ops;
327 
328  if (options.is_last_message()) {
329  options.set_buffer_hint();
330  ops.ClientSendClose();
331  }
332  if (context_->initial_metadata_corked_) {
333  ops.SendInitialMetadata(context_->send_initial_metadata_,
334  context_->initial_metadata_flags());
335  context_->set_initial_metadata_corked(false);
336  }
337  if (!ops.SendMessage(msg, options).ok()) {
338  return false;
339  }
340 
341  call_.PerformOps(&ops);
342  return cq_.Pluck(&ops);
343  }
344 
345  bool WritesDone() override {
347  ops.ClientSendClose();
348  call_.PerformOps(&ops);
349  return cq_.Pluck(&ops);
350  }
351 
358  Status Finish() override {
359  Status status;
360  if (!context_->initial_metadata_received_) {
361  finish_ops_.RecvInitialMetadata(context_);
362  }
363  finish_ops_.ClientRecvStatus(context_, &status);
364  call_.PerformOps(&finish_ops_);
365  GPR_CODEGEN_ASSERT(cq_.Pluck(&finish_ops_));
366  return status;
367  }
368 
369  private:
370  ClientContext* context_;
373  finish_ops_;
374  CompletionQueue cq_;
375  Call call_;
376 };
377 
381 template <class W, class R>
383  public WriterInterface<W>,
384  public ReaderInterface<R> {
385  public:
390  virtual void WaitForInitialMetadata() = 0;
391 
398  virtual bool WritesDone() = 0;
399 };
400 
405 template <class W, class R>
406 class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
407  public:
412  ClientContext* context)
413  : context_(context),
416  GRPC_CQ_DEFAULT_POLLING}), // Pluckable cq
417  call_(channel->CreateCall(method, context, &cq_)) {
418  if (!context_->initial_metadata_corked_) {
420  ops.SendInitialMetadata(context->send_initial_metadata_,
421  context->initial_metadata_flags());
422  call_.PerformOps(&ops);
423  cq_.Pluck(&ops);
424  }
425  }
426 
433  void WaitForInitialMetadata() override {
434  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
435 
437  ops.RecvInitialMetadata(context_);
438  call_.PerformOps(&ops);
439  cq_.Pluck(&ops); // status ignored
440  }
441 
442  bool NextMessageSize(uint32_t* sz) override {
443  *sz = call_.max_receive_message_size();
444  return true;
445  }
446 
451  bool Read(R* msg) override {
453  if (!context_->initial_metadata_received_) {
454  ops.RecvInitialMetadata(context_);
455  }
456  ops.RecvMessage(msg);
457  call_.PerformOps(&ops);
458  return cq_.Pluck(&ops) && ops.got_message;
459  }
460 
467  bool Write(const W& msg, WriteOptions options) override {
468  CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
470  ops;
471 
472  if (options.is_last_message()) {
473  options.set_buffer_hint();
474  ops.ClientSendClose();
475  }
476  if (context_->initial_metadata_corked_) {
477  ops.SendInitialMetadata(context_->send_initial_metadata_,
478  context_->initial_metadata_flags());
479  context_->set_initial_metadata_corked(false);
480  }
481  if (!ops.SendMessage(msg, options).ok()) {
482  return false;
483  }
484 
485  call_.PerformOps(&ops);
486  return cq_.Pluck(&ops);
487  }
488 
489  bool WritesDone() override {
491  ops.ClientSendClose();
492  call_.PerformOps(&ops);
493  return cq_.Pluck(&ops);
494  }
495 
501  Status Finish() override {
503  if (!context_->initial_metadata_received_) {
504  ops.RecvInitialMetadata(context_);
505  }
506  Status status;
507  ops.ClientRecvStatus(context_, &status);
508  call_.PerformOps(&ops);
509  GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
510  return status;
511  }
512 
513  private:
514  ClientContext* context_;
515  CompletionQueue cq_;
516  Call call_;
517 };
518 
520 template <class R>
522  public ReaderInterface<R> {};
523 
527 template <class R>
528 class ServerReader final : public ServerReaderInterface<R> {
529  public:
530  ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
531 
535  void SendInitialMetadata() override {
536  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
537 
539  ops.SendInitialMetadata(ctx_->initial_metadata_,
540  ctx_->initial_metadata_flags());
541  if (ctx_->compression_level_set()) {
542  ops.set_compression_level(ctx_->compression_level());
543  }
544  ctx_->sent_initial_metadata_ = true;
545  call_->PerformOps(&ops);
546  call_->cq()->Pluck(&ops);
547  }
548 
549  bool NextMessageSize(uint32_t* sz) override {
550  *sz = call_->max_receive_message_size();
551  return true;
552  }
553 
554  bool Read(R* msg) override {
556  ops.RecvMessage(msg);
557  call_->PerformOps(&ops);
558  return call_->cq()->Pluck(&ops) && ops.got_message;
559  }
560 
561  private:
562  Call* const call_;
563  ServerContext* const ctx_;
564 };
565 
567 template <class W>
569  public WriterInterface<W> {};
570 
574 template <class W>
575 class ServerWriter final : public ServerWriterInterface<W> {
576  public:
577  ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
578 
583  void SendInitialMetadata() override {
584  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
585 
587  ops.SendInitialMetadata(ctx_->initial_metadata_,
588  ctx_->initial_metadata_flags());
589  if (ctx_->compression_level_set()) {
590  ops.set_compression_level(ctx_->compression_level());
591  }
592  ctx_->sent_initial_metadata_ = true;
593  call_->PerformOps(&ops);
594  call_->cq()->Pluck(&ops);
595  }
596 
603  bool Write(const W& msg, WriteOptions options) override {
604  if (options.is_last_message()) {
605  options.set_buffer_hint();
606  }
608  if (!ops.SendMessage(msg, options).ok()) {
609  return false;
610  }
611  if (!ctx_->sent_initial_metadata_) {
612  ops.SendInitialMetadata(ctx_->initial_metadata_,
613  ctx_->initial_metadata_flags());
614  if (ctx_->compression_level_set()) {
615  ops.set_compression_level(ctx_->compression_level());
616  }
617  ctx_->sent_initial_metadata_ = true;
618  }
619  call_->PerformOps(&ops);
620  return call_->cq()->Pluck(&ops);
621  }
622 
623  private:
624  Call* const call_;
625  ServerContext* const ctx_;
626 };
627 
629 template <class W, class R>
631  public WriterInterface<W>,
632  public ReaderInterface<R> {};
633 
635 namespace internal {
636 template <class W, class R>
637 class ServerReaderWriterBody final {
638  public:
640  : call_(call), ctx_(ctx) {}
641 
643  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
644 
646  ops.SendInitialMetadata(ctx_->initial_metadata_,
647  ctx_->initial_metadata_flags());
648  if (ctx_->compression_level_set()) {
649  ops.set_compression_level(ctx_->compression_level());
650  }
651  ctx_->sent_initial_metadata_ = true;
652  call_->PerformOps(&ops);
653  call_->cq()->Pluck(&ops);
654  }
655 
656  bool NextMessageSize(uint32_t* sz) {
657  *sz = call_->max_receive_message_size();
658  return true;
659  }
660 
661  bool Read(R* msg) {
663  ops.RecvMessage(msg);
664  call_->PerformOps(&ops);
665  return call_->cq()->Pluck(&ops) && ops.got_message;
666  }
667 
668  bool Write(const W& msg, WriteOptions options) {
669  if (options.is_last_message()) {
670  options.set_buffer_hint();
671  }
673  if (!ops.SendMessage(msg, options).ok()) {
674  return false;
675  }
676  if (!ctx_->sent_initial_metadata_) {
677  ops.SendInitialMetadata(ctx_->initial_metadata_,
678  ctx_->initial_metadata_flags());
679  if (ctx_->compression_level_set()) {
680  ops.set_compression_level(ctx_->compression_level());
681  }
682  ctx_->sent_initial_metadata_ = true;
683  }
684  call_->PerformOps(&ops);
685  return call_->cq()->Pluck(&ops);
686  }
687 
688  private:
689  Call* const call_;
690  ServerContext* const ctx_;
691 };
692 } // namespace internal
693 
698 template <class W, class R>
700  public:
701  ServerReaderWriter(Call* call, ServerContext* ctx) : body_(call, ctx) {}
702 
706  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
707 
708  bool NextMessageSize(uint32_t* sz) override {
709  return body_.NextMessageSize(sz);
710  }
711 
712  bool Read(R* msg) override { return body_.Read(msg); }
713 
720  bool Write(const W& msg, WriteOptions options) override {
721  return body_.Write(msg, options);
722  }
723 
724  private:
726 };
727 
736 template <class RequestType, class ResponseType>
738  : public ServerReaderWriterInterface<ResponseType, RequestType> {
739  public:
741  : body_(call, ctx), read_done_(false), write_done_(false) {}
742 
747  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
748 
750  bool NextMessageSize(uint32_t* sz) override {
751  return body_.NextMessageSize(sz);
752  }
753 
764  bool Read(RequestType* request) override {
765  if (read_done_) {
766  return false;
767  }
768  read_done_ = true;
769  return body_.Read(request);
770  }
771 
780  bool Write(const ResponseType& response, WriteOptions options) override {
781  if (write_done_ || !read_done_) {
782  return false;
783  }
784  write_done_ = true;
785  return body_.Write(response, options);
786  }
787 
788  private:
790  bool read_done_;
791  bool write_done_;
792 };
793 
799 template <class RequestType, class ResponseType>
801  : public ServerReaderWriterInterface<ResponseType, RequestType> {
802  public:
804  : body_(call, ctx), read_done_(false) {}
805 
810  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
811 
813  bool NextMessageSize(uint32_t* sz) override {
814  return body_.NextMessageSize(sz);
815  }
816 
827  bool Read(RequestType* request) override {
828  if (read_done_) {
829  return false;
830  }
831  read_done_ = true;
832  return body_.Read(request);
833  }
834 
843  bool Write(const ResponseType& response, WriteOptions options) override {
844  return read_done_ && body_.Write(response, options);
845  }
846 
847  private:
849  bool read_done_;
850 };
851 
852 } // namespace grpc
853 
854 #endif // GRPCXX_IMPL_CODEGEN_SYNC_STREAM_H
Synchronous (blocking) client-side API for doing server-streaming RPCs, where the stream of messages ...
Definition: channel_interface.h:49
Client-side interface for streaming writes of message type W.
Definition: sync_stream.h:258
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context.h:184
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:136
bool Read(R *msg) override
Block to read a message and parse to msg.
Definition: sync_stream.h:712
virtual void WaitForInitialMetadata()=0
Block to wait for initial metadata from server.
Common interface for all synchronous server side streaming.
Definition: sync_stream.h:81
bool Write(const W &msg, WriteOptions options)
Definition: sync_stream.h:668
Server-side interface for bi-directional streaming.
Definition: sync_stream.h:630
A class to represent a flow-controlled server-side streaming call.
Definition: sync_stream.h:800
ServerReaderWriterBody(Call *call, ServerContext *ctx)
Definition: sync_stream.h:639
bool NextMessageSize(uint32_t *sz)
Definition: sync_stream.h:656
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the next message size available for reading on this stream. ...
Definition: sync_stream.h:442
Client-side interface for streaming reads of message of type R.
Definition: sync_stream.h:161
Definition: completion_queue.h:73
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:175
virtual ~ServerStreamingInterface()
Definition: sync_stream.h:83
An interface that yields a sequence of messages of type R.
Definition: sync_stream.h:96
bool Write(const ResponseType &response, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:780
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:137
Definition: call.h:516
A class to represent a flow-controlled unary call.
Definition: sync_stream.h:737
bool Read(R *msg) override
See the ReaderInterface.Read method for semantics.
Definition: sync_stream.h:226
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream.h:535
virtual ~ReaderInterface()
Definition: sync_stream.h:98
void set_initial_metadata_corked(bool corked)
Flag whether the initial metadata should be corked.
Definition: client_context.h:315
void SendInitialMetadata() override
Block to send initial metadata to client.
Definition: sync_stream.h:810
bool Read(R *msg)
Definition: sync_stream.h:661
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:601
Server-side interface for streaming reads of message of type R.
Definition: sync_stream.h:521
Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream.h:241
bool Read(R *msg) override
Block to read a message and parse to msg.
Definition: sync_stream.h:554
bool Write(const ResponseType &response, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:843
bool WritesDone() override
Half close writing from the client.
Definition: sync_stream.h:345
bool Read(R *msg) override
See the ReaderInterface.Read method for semantics.
Definition: sync_stream.h:451
Definition: grpc_types.h:602
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:168
Synchronous (blocking) server-side API for doing client-streaming RPCs, where the incoming message st...
Definition: completion_queue.h:68
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the next message size available for reading on this stream. ...
Definition: sync_stream.h:216
bool Write(const W &msg, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:467
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the request message size from the client.
Definition: sync_stream.h:813
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream.h:706
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the next message size available for reading on this stream. ...
Definition: sync_stream.h:708
void SendInitialMetadata()
Definition: sync_stream.h:642
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream.h:583
Definition: call.h:271
ServerReader(Call *call, ServerContext *ctx)
Definition: sync_stream.h:530
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the request message size from the client.
Definition: sync_stream.h:750
bool Read(RequestType *request) override
Read a message of type R into msg.
Definition: sync_stream.h:764
bool Write(const W &msg, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:720
Events are popped out by calling grpc_completion_queue_pluck() API ONLY.
Definition: grpc_types.h:598
Definition: call.h:420
virtual ~ClientStreamingInterface()
Definition: sync_stream.h:51
Server-side interface for streaming writes of message of type W.
Definition: sync_stream.h:568
virtual bool NextMessageSize(uint32_t *sz)=0
Get an upper bound on the next message size available for reading on this stream. ...
ClientReader(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const W &request)
Block to create a stream and write the initial metadata and request out.
Definition: sync_stream.h:181
CompletionQueue * cq() const
Definition: call.h:659
int max_receive_message_size() const
Definition: call.h:661
bool Write(const W &msg, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:603
Straightforward wrapping of the C call object.
Definition: call.h:638
virtual bool WritesDone()=0
Half close writing from the client.
Codegen interface for grpc::Channel.
Definition: channel_interface.h:64
virtual bool Write(const W &msg, WriteOptions options)=0
Block to write msg to the stream with WriteOptions options.
virtual void SendInitialMetadata()=0
Block to send initial metadata to client.
The completion queue will have an associated pollset and there is no restriction on the type of file ...
Definition: grpc_types.h:578
Primary implementaiton of CallOpSetInterface.
Definition: call.h:583
Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream.h:358
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:109
ServerSplitStreamer(Call *call, ServerContext *ctx)
Definition: sync_stream.h:803
Per-message write options.
Definition: call.h:96
void SendInitialMetadata() override
Block to send initial metadata to client.
Definition: sync_stream.h:747
ClientReaderWriter(ChannelInterface *channel, const RpcMethod &method, ClientContext *context)
Block to create a stream and write the initial metadata and request out.
Definition: sync_stream.h:411
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the next message size available for reading on this stream. ...
Definition: sync_stream.h:549
virtual void WaitForInitialMetadata()=0
Block to wait for initial metadata from server.
virtual bool WritesDone()=0
Half close writing from the client.
bool Write(const W &msg)
Block to write msg to the stream with default write options.
Definition: sync_stream.h:138
Synchronous (blocking) server-side API for doing for doing a server-streaming RPCs, where the outgoing message stream coming from the server has messages of type W.
Definition: completion_queue.h:70
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:101
ServerUnaryStreamer(Call *call, ServerContext *ctx)
Definition: sync_stream.h:740
bool WritesDone() override
Half close writing from the client.
Definition: sync_stream.h:489
Descriptor of an RPC method.
Definition: rpc_method.h:44
Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream.h:501
virtual Status Finish()=0
Block waiting until the stream finishes and a final status of the call is available.
void WaitForInitialMetadata() override
Block waiting to read initial metadata from the server.
Definition: sync_stream.h:433
ServerReaderWriter(Call *call, ServerContext *ctx)
Definition: sync_stream.h:701
Synchronous (blocking) server-side API for a bidirectional streaming call, where the incoming message...
Definition: sync_stream.h:699
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:654
An interface that can be fed a sequence of messages of type W.
Definition: sync_stream.h:119
Client-side interface for bi-directional streaming with client-to-server stream messages of type W an...
Definition: sync_stream.h:382
Did it work? If it didn't, why?
Definition: status.h:45
void WaitForInitialMetadata() override
See the ClientStreamingInterface.WaitForInitialMetadata method for semantics.
Definition: sync_stream.h:207
virtual bool Read(R *msg)=0
Block to read a message and parse to msg.
Common interface for all synchronous client side streaming.
Definition: sync_stream.h:49
ServerWriter(Call *call, ServerContext *ctx)
Definition: sync_stream.h:577
Definition: call.h:218
bool Read(RequestType *request) override
Read a message of type R into msg.
Definition: sync_stream.h:827
void WriteLast(const W &msg, WriteOptions options)
Write msg and coalesce it with the writing of trailing metadata, using WriteOptions options...
Definition: sync_stream.h:154
void WaitForInitialMetadata()
See the ClientStreamingInterface.WaitForInitialMetadata method for semantics.
Definition: sync_stream.h:307
Synchronous (blocking) client-side API for bi-directional streaming RPCs, where the outgoing message ...
Definition: channel_interface.h:53
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:199
Synchronous (blocking) client-side API for doing client-streaming RPCs, where the outgoing message st...
Definition: channel_interface.h:51
Definition: call.h:487
ClientWriter(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, R *response)
Block to create a stream (i.e.
Definition: sync_stream.h:282
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:191
virtual ~WriterInterface()
Definition: sync_stream.h:121
Definition: call.h:367
bool Write(const W &msg, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:323