GRPC C++  1.13.0-dev
sync_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_IMPL_CODEGEN_SYNC_STREAM_H
20 #define GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H
21 
30 
31 namespace grpc {
32 
33 namespace internal {
36  public:
38 
63  virtual Status Finish() = 0;
64 };
65 
68  public:
70 
77  virtual void SendInitialMetadata() = 0;
78 };
79 
81 template <class R>
83  public:
84  virtual ~ReaderInterface() {}
85 
88  virtual bool NextMessageSize(uint32_t* sz) = 0;
89 
100  virtual bool Read(R* msg) = 0;
101 };
102 
104 template <class W>
106  public:
107  virtual ~WriterInterface() {}
108 
116  virtual bool Write(const W& msg, WriteOptions options) = 0;
117 
124  inline bool Write(const W& msg) { return Write(msg, WriteOptions()); }
125 
140  void WriteLast(const W& msg, WriteOptions options) {
141  Write(msg, options.set_last_message());
142  }
143 };
144 
145 } // namespace internal
146 
148 template <class R>
150  public internal::ReaderInterface<R> {
151  public:
156  virtual void WaitForInitialMetadata() = 0;
157 };
158 
159 namespace internal {
160 template <class R>
162  public:
163  template <class W>
165  const ::grpc::internal::RpcMethod& method,
166  ClientContext* context, const W& request) {
167  return new ClientReader<R>(channel, method, context, request);
168  }
169 };
170 } // namespace internal
171 
175 template <class R>
176 class ClientReader final : public ClientReaderInterface<R> {
177  public:
181  // Side effect:
185  void WaitForInitialMetadata() override {
186  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
187 
189  ops;
190  ops.RecvInitialMetadata(context_);
191  call_.PerformOps(&ops);
192  cq_.Pluck(&ops);
193  }
194 
195  bool NextMessageSize(uint32_t* sz) override {
196  *sz = call_.max_receive_message_size();
197  return true;
198  }
199 
205  bool Read(R* msg) override {
208  ops;
209  if (!context_->initial_metadata_received_) {
210  ops.RecvInitialMetadata(context_);
211  }
212  ops.RecvMessage(msg);
213  call_.PerformOps(&ops);
214  return cq_.Pluck(&ops) && ops.got_message;
215  }
216 
222  Status Finish() override {
224  Status status;
225  ops.ClientRecvStatus(context_, &status);
226  call_.PerformOps(&ops);
227  GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
228  return status;
229  }
230 
231  private:
233  ClientContext* context_;
234  CompletionQueue cq_;
236 
240  template <class W>
242  const ::grpc::internal::RpcMethod& method,
243  ClientContext* context, const W& request)
244  : context_(context),
247  GRPC_CQ_DEFAULT_POLLING}), // Pluckable cq
248  call_(channel->CreateCall(method, context, &cq_)) {
252  ops;
253  ops.SendInitialMetadata(context->send_initial_metadata_,
254  context->initial_metadata_flags());
255  // TODO(ctiller): don't assert
256  GPR_CODEGEN_ASSERT(ops.SendMessage(request).ok());
257  ops.ClientSendClose();
258  call_.PerformOps(&ops);
259  cq_.Pluck(&ops);
260  }
261 };
262 
264 template <class W>
266  public internal::WriterInterface<W> {
267  public:
274  virtual bool WritesDone() = 0;
275 };
276 
277 namespace internal {
278 template <class W>
280  public:
281  template <class R>
283  const ::grpc::internal::RpcMethod& method,
284  ClientContext* context, R* response) {
285  return new ClientWriter<W>(channel, method, context, response);
286  }
287 };
288 } // namespace internal
289 
293 template <class W>
294 class ClientWriter : public ClientWriterInterface<W> {
295  public:
299  // Side effect:
303  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
304 
306  ops;
307  ops.RecvInitialMetadata(context_);
308  call_.PerformOps(&ops);
309  cq_.Pluck(&ops); // status ignored
310  }
311 
318  using ::grpc::internal::WriterInterface<W>::Write;
319  bool Write(const W& msg, WriteOptions options) override {
320  ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
321  ::grpc::internal::CallOpSendMessage,
323  ops;
324 
325  if (options.is_last_message()) {
326  options.set_buffer_hint();
327  ops.ClientSendClose();
328  }
329  if (context_->initial_metadata_corked_) {
330  ops.SendInitialMetadata(context_->send_initial_metadata_,
331  context_->initial_metadata_flags());
332  context_->set_initial_metadata_corked(false);
333  }
334  if (!ops.SendMessage(msg, options).ok()) {
335  return false;
336  }
337 
338  call_.PerformOps(&ops);
339  return cq_.Pluck(&ops);
340  }
341 
342  bool WritesDone() override {
344  ops.ClientSendClose();
345  call_.PerformOps(&ops);
346  return cq_.Pluck(&ops);
347  }
348 
355  Status Finish() override {
356  Status status;
357  if (!context_->initial_metadata_received_) {
358  finish_ops_.RecvInitialMetadata(context_);
359  }
360  finish_ops_.ClientRecvStatus(context_, &status);
361  call_.PerformOps(&finish_ops_);
362  GPR_CODEGEN_ASSERT(cq_.Pluck(&finish_ops_));
363  return status;
364  }
365 
366  private:
368 
374  template <class R>
376  const ::grpc::internal::RpcMethod& method,
377  ClientContext* context, R* response)
378  : context_(context),
381  GRPC_CQ_DEFAULT_POLLING}), // Pluckable cq
382  call_(channel->CreateCall(method, context, &cq_)) {
383  finish_ops_.RecvMessage(response);
384  finish_ops_.AllowNoMessage();
385 
386  if (!context_->initial_metadata_corked_) {
388  ops;
389  ops.SendInitialMetadata(context->send_initial_metadata_,
390  context->initial_metadata_flags());
391  call_.PerformOps(&ops);
392  cq_.Pluck(&ops);
393  }
394  }
395 
396  ClientContext* context_;
400  finish_ops_;
401  CompletionQueue cq_;
403 };
404 
408 template <class W, class R>
410  public internal::WriterInterface<W>,
411  public internal::ReaderInterface<R> {
412  public:
417  virtual void WaitForInitialMetadata() = 0;
418 
425  virtual bool WritesDone() = 0;
426 };
427 
428 namespace internal {
429 template <class W, class R>
431  public:
433  ::grpc::ChannelInterface* channel,
434  const ::grpc::internal::RpcMethod& method, ClientContext* context) {
435  return new ClientReaderWriter<W, R>(channel, method, context);
436  }
437 };
438 } // namespace internal
439 
444 template <class W, class R>
445 class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
446  public:
453  void WaitForInitialMetadata() override {
454  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
455 
457  ops;
458  ops.RecvInitialMetadata(context_);
459  call_.PerformOps(&ops);
460  cq_.Pluck(&ops); // status ignored
461  }
462 
463  bool NextMessageSize(uint32_t* sz) override {
464  *sz = call_.max_receive_message_size();
465  return true;
466  }
467 
472  bool Read(R* msg) override {
475  ops;
476  if (!context_->initial_metadata_received_) {
477  ops.RecvInitialMetadata(context_);
478  }
479  ops.RecvMessage(msg);
480  call_.PerformOps(&ops);
481  return cq_.Pluck(&ops) && ops.got_message;
482  }
483 
489  using ::grpc::internal::WriterInterface<W>::Write;
490  bool Write(const W& msg, WriteOptions options) override {
491  ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
492  ::grpc::internal::CallOpSendMessage,
494  ops;
495 
496  if (options.is_last_message()) {
497  options.set_buffer_hint();
498  ops.ClientSendClose();
499  }
500  if (context_->initial_metadata_corked_) {
501  ops.SendInitialMetadata(context_->send_initial_metadata_,
502  context_->initial_metadata_flags());
503  context_->set_initial_metadata_corked(false);
504  }
505  if (!ops.SendMessage(msg, options).ok()) {
506  return false;
507  }
508 
509  call_.PerformOps(&ops);
510  return cq_.Pluck(&ops);
511  }
512 
513  bool WritesDone() override {
515  ops.ClientSendClose();
516  call_.PerformOps(&ops);
517  return cq_.Pluck(&ops);
518  }
519 
525  Status Finish() override {
528  ops;
529  if (!context_->initial_metadata_received_) {
530  ops.RecvInitialMetadata(context_);
531  }
532  Status status;
533  ops.ClientRecvStatus(context_, &status);
534  call_.PerformOps(&ops);
535  GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
536  return status;
537  }
538 
539  private:
541 
542  ClientContext* context_;
543  CompletionQueue cq_;
545 
550  const ::grpc::internal::RpcMethod& method,
551  ClientContext* context)
552  : context_(context),
555  GRPC_CQ_DEFAULT_POLLING}), // Pluckable cq
556  call_(channel->CreateCall(method, context, &cq_)) {
557  if (!context_->initial_metadata_corked_) {
559  ops;
560  ops.SendInitialMetadata(context->send_initial_metadata_,
561  context->initial_metadata_flags());
562  call_.PerformOps(&ops);
563  cq_.Pluck(&ops);
564  }
565  }
566 };
567 
569 template <class R>
571  public internal::ReaderInterface<R> {};
572 
576 template <class R>
577 class ServerReader final : public ServerReaderInterface<R> {
578  public:
582  void SendInitialMetadata() override {
583  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
584 
586  ops.SendInitialMetadata(ctx_->initial_metadata_,
587  ctx_->initial_metadata_flags());
588  if (ctx_->compression_level_set()) {
589  ops.set_compression_level(ctx_->compression_level());
590  }
591  ctx_->sent_initial_metadata_ = true;
592  call_->PerformOps(&ops);
593  call_->cq()->Pluck(&ops);
594  }
595 
596  bool NextMessageSize(uint32_t* sz) override {
597  *sz = call_->max_receive_message_size();
598  return true;
599  }
600 
601  bool Read(R* msg) override {
603  ops.RecvMessage(msg);
604  call_->PerformOps(&ops);
605  return call_->cq()->Pluck(&ops) && ops.got_message;
606  }
607 
608  private:
609  internal::Call* const call_;
610  ServerContext* const ctx_;
611 
612  template <class ServiceType, class RequestType, class ResponseType>
614 
616  : call_(call), ctx_(ctx) {}
617 };
618 
620 template <class W>
622  public internal::WriterInterface<W> {};
623 
627 template <class W>
628 class ServerWriter final : public ServerWriterInterface<W> {
629  public:
634  void SendInitialMetadata() override {
635  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
636 
638  ops.SendInitialMetadata(ctx_->initial_metadata_,
639  ctx_->initial_metadata_flags());
640  if (ctx_->compression_level_set()) {
641  ops.set_compression_level(ctx_->compression_level());
642  }
643  ctx_->sent_initial_metadata_ = true;
644  call_->PerformOps(&ops);
645  call_->cq()->Pluck(&ops);
646  }
647 
654  bool Write(const W& msg, WriteOptions options) override {
655  if (options.is_last_message()) {
656  options.set_buffer_hint();
657  }
658 
659  if (!ctx_->pending_ops_.SendMessage(msg, options).ok()) {
660  return false;
661  }
662  if (!ctx_->sent_initial_metadata_) {
663  ctx_->pending_ops_.SendInitialMetadata(ctx_->initial_metadata_,
664  ctx_->initial_metadata_flags());
665  if (ctx_->compression_level_set()) {
666  ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
667  }
668  ctx_->sent_initial_metadata_ = true;
669  }
670  call_->PerformOps(&ctx_->pending_ops_);
671  // if this is the last message we defer the pluck until AFTER we start
672  // the trailing md op. This prevents hangs. See
673  // https://github.com/grpc/grpc/issues/11546
674  if (options.is_last_message()) {
675  ctx_->has_pending_ops_ = true;
676  return true;
677  }
678  ctx_->has_pending_ops_ = false;
679  return call_->cq()->Pluck(&ctx_->pending_ops_);
680  }
681 
682  private:
683  internal::Call* const call_;
684  ServerContext* const ctx_;
685 
686  template <class ServiceType, class RequestType, class ResponseType>
688 
690  : call_(call), ctx_(ctx) {}
691 };
692 
694 template <class W, class R>
696  public internal::WriterInterface<W>,
697  public internal::ReaderInterface<R> {};
698 
700 namespace internal {
701 template <class W, class R>
702 class ServerReaderWriterBody final {
703  public:
705  : call_(call), ctx_(ctx) {}
706 
708  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
709 
711  ops.SendInitialMetadata(ctx_->initial_metadata_,
712  ctx_->initial_metadata_flags());
713  if (ctx_->compression_level_set()) {
714  ops.set_compression_level(ctx_->compression_level());
715  }
716  ctx_->sent_initial_metadata_ = true;
717  call_->PerformOps(&ops);
718  call_->cq()->Pluck(&ops);
719  }
720 
721  bool NextMessageSize(uint32_t* sz) {
722  *sz = call_->max_receive_message_size();
723  return true;
724  }
725 
726  bool Read(R* msg) {
728  ops.RecvMessage(msg);
729  call_->PerformOps(&ops);
730  return call_->cq()->Pluck(&ops) && ops.got_message;
731  }
732 
733  bool Write(const W& msg, WriteOptions options) {
734  if (options.is_last_message()) {
735  options.set_buffer_hint();
736  }
737  if (!ctx_->pending_ops_.SendMessage(msg, options).ok()) {
738  return false;
739  }
740  if (!ctx_->sent_initial_metadata_) {
741  ctx_->pending_ops_.SendInitialMetadata(ctx_->initial_metadata_,
742  ctx_->initial_metadata_flags());
743  if (ctx_->compression_level_set()) {
744  ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
745  }
746  ctx_->sent_initial_metadata_ = true;
747  }
748  call_->PerformOps(&ctx_->pending_ops_);
749  // if this is the last message we defer the pluck until AFTER we start
750  // the trailing md op. This prevents hangs. See
751  // https://github.com/grpc/grpc/issues/11546
752  if (options.is_last_message()) {
753  ctx_->has_pending_ops_ = true;
754  return true;
755  }
756  ctx_->has_pending_ops_ = false;
757  return call_->cq()->Pluck(&ctx_->pending_ops_);
758  }
759 
760  private:
761  Call* const call_;
762  ServerContext* const ctx_;
763 };
764 
765 } // namespace internal
766 
771 template <class W, class R>
773  public:
777  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
778 
779  bool NextMessageSize(uint32_t* sz) override {
780  return body_.NextMessageSize(sz);
781  }
782 
783  bool Read(R* msg) override { return body_.Read(msg); }
784 
791  bool Write(const W& msg, WriteOptions options) override {
792  return body_.Write(msg, options);
793  }
794 
795  private:
797 
798  friend class internal::TemplatedBidiStreamingHandler<ServerReaderWriter<W, R>,
799  false>;
800  ServerReaderWriter(internal::Call* call, ServerContext* ctx)
801  : body_(call, ctx) {}
802 };
803 
812 template <class RequestType, class ResponseType>
814  : public ServerReaderWriterInterface<ResponseType, RequestType> {
815  public:
820  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
821 
823  bool NextMessageSize(uint32_t* sz) override {
824  return body_.NextMessageSize(sz);
825  }
826 
837  bool Read(RequestType* request) override {
838  if (read_done_) {
839  return false;
840  }
841  read_done_ = true;
842  return body_.Read(request);
843  }
844 
853  bool Write(const ResponseType& response, WriteOptions options) override {
854  if (write_done_ || !read_done_) {
855  return false;
856  }
857  write_done_ = true;
858  return body_.Write(response, options);
859  }
860 
861  private:
863  bool read_done_;
864  bool write_done_;
865 
867  ServerUnaryStreamer<RequestType, ResponseType>, true>;
869  : body_(call, ctx), read_done_(false), write_done_(false) {}
870 };
871 
877 template <class RequestType, class ResponseType>
879  : public ServerReaderWriterInterface<ResponseType, RequestType> {
880  public:
885  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
886 
888  bool NextMessageSize(uint32_t* sz) override {
889  return body_.NextMessageSize(sz);
890  }
891 
902  bool Read(RequestType* request) override {
903  if (read_done_) {
904  return false;
905  }
906  read_done_ = true;
907  return body_.Read(request);
908  }
909 
918  bool Write(const ResponseType& response, WriteOptions options) override {
919  return read_done_ && body_.Write(response, options);
920  }
921 
922  private:
924  bool read_done_;
925 
927  ServerSplitStreamer<RequestType, ResponseType>, false>;
929  : body_(call, ctx), read_done_(false) {}
930 };
931 
932 } // namespace grpc
933 
934 #endif // GRPCPP_IMPL_CODEGEN_SYNC_STREAM_H
Synchronous (blocking) client-side API for doing server-streaming RPCs, where the stream of messages ...
Definition: channel_interface.h:32
A wrapper class of an application provided server streaming handler.
Definition: byte_buffer.h:47
Client-side interface for streaming writes of message type W.
Definition: sync_stream.h:265
A wrapper class of an application provided bidi-streaming handler.
Definition: completion_queue.h:83
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:123
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:138
bool Read(R *msg) override
Block to read a message and parse to msg.
Definition: sync_stream.h:783
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:140
Definition: sync_stream.h:161
bool Write(const W &msg, WriteOptions options)
Definition: sync_stream.h:733
Server-side interface for bi-directional streaming.
Definition: sync_stream.h:695
A class to represent a flow-controlled server-side streaming call.
Definition: sync_stream.h:878
ServerReaderWriterBody(Call *call, ServerContext *ctx)
Definition: sync_stream.h:704
Common interface for all synchronous client side streaming.
Definition: sync_stream.h:35
bool NextMessageSize(uint32_t *sz)
Definition: sync_stream.h:721
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:463
Client-side interface for streaming reads of message of type R.
Definition: sync_stream.h:149
Definition: completion_queue.h:58
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:162
bool Write(const ResponseType &response, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:853
A class to represent a flow-controlled unary call.
Definition: sync_stream.h:813
Definition: sync_stream.h:430
Primary implementation of CallOpSetInterface.
Definition: call.h:619
bool Read(R *msg) override
See the ReaderInterface.Read method for semantics.
Definition: sync_stream.h:205
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream.h:582
CompletionQueue * cq() const
Definition: call.h:681
virtual ~ClientStreamingInterface()
Definition: sync_stream.h:37
void SendInitialMetadata() override
Block to send initial metadata to client.
Definition: sync_stream.h:885
bool Write(const W &msg)
Block to write msg to the stream with default write options.
Definition: sync_stream.h:124
bool Read(R *msg)
Definition: sync_stream.h:726
static ClientWriter< W > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ClientContext *context, R *response)
Definition: sync_stream.h:282
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:651
virtual Status Finish()=0
Block waiting until the stream finishes and a final status of the call is available.
Server-side interface for streaming reads of message of type R.
Definition: sync_stream.h:570
Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream.h:222
bool Read(R *msg) override
Block to read a message and parse to msg.
Definition: sync_stream.h:601
bool Write(const ResponseType &response, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:918
bool WritesDone() override
Half close writing from the client.
Definition: sync_stream.h:342
bool Read(R *msg) override
See the ReaderInterface.Read method for semantics.
Definition: sync_stream.h:472
Definition: grpc_types.h:652
An interface that can be fed a sequence of messages of type W.
Definition: sync_stream.h:105
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:162
Synchronous (blocking) server-side API for doing client-streaming RPCs, where the incoming message st...
Definition: completion_queue.h:53
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:195
bool Write(const W &msg, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:490
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the request message size from the client.
Definition: sync_stream.h:888
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream.h:777
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:779
void SendInitialMetadata()
Definition: sync_stream.h:707
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream.h:634
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the request message size from the client.
Definition: sync_stream.h:823
bool Read(RequestType *request) override
Read a message of type R into msg.
Definition: sync_stream.h:837
bool Write(const W &msg, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:791
Events are popped out by calling grpc_completion_queue_pluck() API ONLY.
Definition: grpc_types.h:648
Server-side interface for streaming writes of message of type W.
Definition: sync_stream.h:621
Definition: call.h:268
bool Write(const W &msg, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:654
An Alarm posts the user provided tag to its associated completion queue upon expiry or cancellation...
Definition: alarm.h:31
A wrapper class of an application provided client streaming handler.
Definition: completion_queue.h:76
An interface that yields a sequence of messages of type R.
Definition: sync_stream.h:82
Codegen interface for grpc::Channel.
Definition: channel_interface.h:55
The completion queue will have an associated pollset and there is no restriction on the type of file ...
Definition: grpc_types.h:628
Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream.h:355
Definition: byte_buffer.h:41
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:96
Definition: sync_stream.h:279
Per-message write options.
Definition: call.h:83
void SendInitialMetadata() override
Block to send initial metadata to client.
Definition: sync_stream.h:820
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:596
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:55
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:94
bool WritesDone() override
Half close writing from the client.
Definition: sync_stream.h:513
Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream.h:525
void RecvMessage(R *message)
Definition: call.h:328
void WaitForInitialMetadata() override
Block waiting to read initial metadata from the server.
Definition: sync_stream.h:453
int max_receive_message_size() const
Definition: call.h:683
Common interface for all synchronous server side streaming.
Definition: sync_stream.h:67
Synchronous (blocking) server-side API for a bidirectional streaming call, where the incoming message...
Definition: sync_stream.h:772
Client-side interface for bi-directional streaming with client-to-server stream messages of type W an...
Definition: sync_stream.h:409
Did it work? If it didn&#39;t, why?
Definition: status.h:31
static ClientReaderWriter< W, R > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ClientContext *context)
Definition: sync_stream.h:432
void WaitForInitialMetadata() override
See the ClientStreamingInterface.WaitForInitialMetadata method for semantics.
Definition: sync_stream.h:185
virtual ~WriterInterface()
Definition: sync_stream.h:107
bool Read(RequestType *request) override
Read a message of type R into msg.
Definition: sync_stream.h:902
void WaitForInitialMetadata()
See the ClientStreamingInterface.WaitForInitialMetadata method for semantics.
Definition: sync_stream.h:302
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:676
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:187
Synchronous (blocking) client-side API for bi-directional streaming RPCs, where the outgoing message ...
Definition: channel_interface.h:36
virtual ~ServerStreamingInterface()
Definition: sync_stream.h:69
virtual ~ReaderInterface()
Definition: sync_stream.h:84
static ClientReader< R > * Create(ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ClientContext *context, const W &request)
Definition: sync_stream.h:164
Synchronous (blocking) client-side API for doing client-streaming RPCs, where the outgoing message st...
Definition: channel_interface.h:34
Straightforward wrapping of the C call object.
Definition: call.h:660
bool Write(const W &msg, WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream.h:319