GRPC C++  1.30.0
sync_stream_impl.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2019 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef GRPCPP_IMPL_CODEGEN_SYNC_STREAM_IMPL_H
19 #define GRPCPP_IMPL_CODEGEN_SYNC_STREAM_IMPL_H
20 
29 
30 namespace grpc_impl {
31 
32 namespace internal {
35  public:
37 
63 };
64 
67  public:
69 
76  virtual void SendInitialMetadata() = 0;
77 };
78 
80 template <class R>
82  public:
83  virtual ~ReaderInterface() {}
84 
87  virtual bool NextMessageSize(uint32_t* sz) = 0;
88 
99  virtual bool Read(R* msg) = 0;
100 };
101 
103 template <class W>
105  public:
106  virtual ~WriterInterface() {}
107 
115  virtual bool Write(const W& msg, ::grpc::WriteOptions options) = 0;
116 
123  inline bool Write(const W& msg) { return Write(msg, ::grpc::WriteOptions()); }
124 
139  void WriteLast(const W& msg, ::grpc::WriteOptions options) {
140  Write(msg, options.set_last_message());
141  }
142 };
143 
144 } // namespace internal
145 
147 template <class R>
149  public internal::ReaderInterface<R> {
150  public:
155  virtual void WaitForInitialMetadata() = 0;
156 };
157 
158 namespace internal {
159 template <class R>
161  public:
162  template <class W>
164  const ::grpc::internal::RpcMethod& method,
165  ::grpc_impl::ClientContext* context,
166  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  int result = call_.max_receive_message_size();
197  *sz = (result > 0) ? result : UINT32_MAX;
198  return true;
199  }
200 
206  bool Read(R* msg) override {
209  ops;
210  if (!context_->initial_metadata_received_) {
211  ops.RecvInitialMetadata(context_);
212  }
213  ops.RecvMessage(msg);
214  call_.PerformOps(&ops);
215  return cq_.Pluck(&ops) && ops.got_message;
216  }
217 
223  ::grpc::Status Finish() override {
225  ::grpc::Status status;
226  ops.ClientRecvStatus(context_, &status);
227  call_.PerformOps(&ops);
228  GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
229  return status;
230  }
231 
232  private:
234  ::grpc_impl::ClientContext* context_;
237 
241  template <class W>
243  const ::grpc::internal::RpcMethod& method,
244  ::grpc_impl::ClientContext* context, const W& request)
245  : context_(context),
248  nullptr}), // Pluckable cq
249  call_(channel->CreateCall(method, context, &cq_)) {
253  ops;
254  ops.SendInitialMetadata(&context->send_initial_metadata_,
255  context->initial_metadata_flags());
256  // TODO(ctiller): don't assert
257  GPR_CODEGEN_ASSERT(ops.SendMessagePtr(&request).ok());
258  ops.ClientSendClose();
259  call_.PerformOps(&ops);
260  cq_.Pluck(&ops);
261  }
262 };
263 
265 template <class W>
267  public internal::WriterInterface<W> {
268  public:
275  virtual bool WritesDone() = 0;
276 };
277 
278 namespace internal {
279 template <class W>
281  public:
282  template <class R>
284  const ::grpc::internal::RpcMethod& method,
285  ::grpc_impl::ClientContext* context,
286  R* response) {
287  return new ClientWriter<W>(channel, method, context, response);
288  }
289 };
290 } // namespace internal
291 
295 template <class W>
296 class ClientWriter : public ClientWriterInterface<W> {
297  public:
301  // Side effect:
305  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
306 
308  ops;
309  ops.RecvInitialMetadata(context_);
310  call_.PerformOps(&ops);
311  cq_.Pluck(&ops); // status ignored
312  }
313 
321  bool Write(const W& msg, ::grpc::WriteOptions options) override {
325  ops;
326 
327  if (options.is_last_message()) {
328  options.set_buffer_hint();
329  ops.ClientSendClose();
330  }
331  if (context_->initial_metadata_corked_) {
332  ops.SendInitialMetadata(&context_->send_initial_metadata_,
333  context_->initial_metadata_flags());
334  context_->set_initial_metadata_corked(false);
335  }
336  if (!ops.SendMessagePtr(&msg, options).ok()) {
337  return false;
338  }
339 
340  call_.PerformOps(&ops);
341  return cq_.Pluck(&ops);
342  }
343 
344  bool WritesDone() override {
346  ops.ClientSendClose();
347  call_.PerformOps(&ops);
348  return cq_.Pluck(&ops);
349  }
350 
357  ::grpc::Status Finish() override {
358  ::grpc::Status status;
359  if (!context_->initial_metadata_received_) {
360  finish_ops_.RecvInitialMetadata(context_);
361  }
362  finish_ops_.ClientRecvStatus(context_, &status);
363  call_.PerformOps(&finish_ops_);
364  GPR_CODEGEN_ASSERT(cq_.Pluck(&finish_ops_));
365  return status;
366  }
367 
368  private:
370 
376  template <class R>
378  const ::grpc::internal::RpcMethod& method,
379  ::grpc_impl::ClientContext* context, R* response)
380  : context_(context),
383  nullptr}), // Pluckable cq
384  call_(channel->CreateCall(method, context, &cq_)) {
385  finish_ops_.RecvMessage(response);
386  finish_ops_.AllowNoMessage();
387 
388  if (!context_->initial_metadata_corked_) {
390  ops;
391  ops.SendInitialMetadata(&context->send_initial_metadata_,
392  context->initial_metadata_flags());
393  call_.PerformOps(&ops);
394  cq_.Pluck(&ops);
395  }
396  }
397 
398  ::grpc_impl::ClientContext* context_;
402  finish_ops_;
405 };
406 
410 template <class W, class R>
412  public internal::WriterInterface<W>,
413  public internal::ReaderInterface<R> {
414  public:
419  virtual void WaitForInitialMetadata() = 0;
420 
427  virtual bool WritesDone() = 0;
428 };
429 
430 namespace internal {
431 template <class W, class R>
433  public:
435  ::grpc::ChannelInterface* channel,
436  const ::grpc::internal::RpcMethod& method,
437  ::grpc_impl::ClientContext* context) {
438  return new ClientReaderWriter<W, R>(channel, method, context);
439  }
440 };
441 } // namespace internal
442 
447 template <class W, class R>
448 class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
449  public:
456  void WaitForInitialMetadata() override {
457  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
458 
460  ops;
461  ops.RecvInitialMetadata(context_);
462  call_.PerformOps(&ops);
463  cq_.Pluck(&ops); // status ignored
464  }
465 
466  bool NextMessageSize(uint32_t* sz) override {
467  int result = call_.max_receive_message_size();
468  *sz = (result > 0) ? result : UINT32_MAX;
469  return true;
470  }
471 
476  bool Read(R* msg) override {
479  ops;
480  if (!context_->initial_metadata_received_) {
481  ops.RecvInitialMetadata(context_);
482  }
483  ops.RecvMessage(msg);
484  call_.PerformOps(&ops);
485  return cq_.Pluck(&ops) && ops.got_message;
486  }
487 
494  bool Write(const W& msg, ::grpc::WriteOptions options) override {
498  ops;
499 
500  if (options.is_last_message()) {
501  options.set_buffer_hint();
502  ops.ClientSendClose();
503  }
504  if (context_->initial_metadata_corked_) {
505  ops.SendInitialMetadata(&context_->send_initial_metadata_,
506  context_->initial_metadata_flags());
507  context_->set_initial_metadata_corked(false);
508  }
509  if (!ops.SendMessagePtr(&msg, options).ok()) {
510  return false;
511  }
512 
513  call_.PerformOps(&ops);
514  return cq_.Pluck(&ops);
515  }
516 
517  bool WritesDone() override {
519  ops.ClientSendClose();
520  call_.PerformOps(&ops);
521  return cq_.Pluck(&ops);
522  }
523 
529  ::grpc::Status Finish() override {
532  ops;
533  if (!context_->initial_metadata_received_) {
534  ops.RecvInitialMetadata(context_);
535  }
536  ::grpc::Status status;
537  ops.ClientRecvStatus(context_, &status);
538  call_.PerformOps(&ops);
539  GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
540  return status;
541  }
542 
543  private:
545 
546  ::grpc_impl::ClientContext* context_;
549 
554  const ::grpc::internal::RpcMethod& method,
555  ::grpc_impl::ClientContext* context)
556  : context_(context),
559  nullptr}), // Pluckable cq
560  call_(channel->CreateCall(method, context, &cq_)) {
561  if (!context_->initial_metadata_corked_) {
563  ops;
564  ops.SendInitialMetadata(&context->send_initial_metadata_,
565  context->initial_metadata_flags());
566  call_.PerformOps(&ops);
567  cq_.Pluck(&ops);
568  }
569  }
570 };
571 
573 template <class R>
575  public internal::ReaderInterface<R> {};
576 
580 template <class R>
581 class ServerReader final : public ServerReaderInterface<R> {
582  public:
586  void SendInitialMetadata() override {
587  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
588 
590  ops;
591  ops.SendInitialMetadata(&ctx_->initial_metadata_,
592  ctx_->initial_metadata_flags());
593  if (ctx_->compression_level_set()) {
594  ops.set_compression_level(ctx_->compression_level());
595  }
596  ctx_->sent_initial_metadata_ = true;
597  call_->PerformOps(&ops);
598  call_->cq()->Pluck(&ops);
599  }
600 
601  bool NextMessageSize(uint32_t* sz) override {
602  int result = call_->max_receive_message_size();
603  *sz = (result > 0) ? result : UINT32_MAX;
604  return true;
605  }
606 
607  bool Read(R* msg) override {
609  ops.RecvMessage(msg);
610  call_->PerformOps(&ops);
611  return call_->cq()->Pluck(&ops) && ops.got_message;
612  }
613 
614  private:
615  ::grpc::internal::Call* const call_;
616  ServerContext* const ctx_;
617 
618  template <class ServiceType, class RequestType, class ResponseType>
620 
622  : call_(call), ctx_(ctx) {}
623 };
624 
626 template <class W>
628  public internal::WriterInterface<W> {};
629 
633 template <class W>
634 class ServerWriter final : public ServerWriterInterface<W> {
635  public:
640  void SendInitialMetadata() override {
641  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
642 
644  ops;
645  ops.SendInitialMetadata(&ctx_->initial_metadata_,
646  ctx_->initial_metadata_flags());
647  if (ctx_->compression_level_set()) {
648  ops.set_compression_level(ctx_->compression_level());
649  }
650  ctx_->sent_initial_metadata_ = true;
651  call_->PerformOps(&ops);
652  call_->cq()->Pluck(&ops);
653  }
654 
661  bool Write(const W& msg, ::grpc::WriteOptions options) override {
662  if (options.is_last_message()) {
663  options.set_buffer_hint();
664  }
665 
666  if (!ctx_->pending_ops_.SendMessagePtr(&msg, options).ok()) {
667  return false;
668  }
669  if (!ctx_->sent_initial_metadata_) {
670  ctx_->pending_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
671  ctx_->initial_metadata_flags());
672  if (ctx_->compression_level_set()) {
673  ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
674  }
675  ctx_->sent_initial_metadata_ = true;
676  }
677  call_->PerformOps(&ctx_->pending_ops_);
678  // if this is the last message we defer the pluck until AFTER we start
679  // the trailing md op. This prevents hangs. See
680  // https://github.com/grpc/grpc/issues/11546
681  if (options.is_last_message()) {
682  ctx_->has_pending_ops_ = true;
683  return true;
684  }
685  ctx_->has_pending_ops_ = false;
686  return call_->cq()->Pluck(&ctx_->pending_ops_);
687  }
688 
689  private:
690  ::grpc::internal::Call* const call_;
691  ::grpc_impl::ServerContext* const ctx_;
692 
693  template <class ServiceType, class RequestType, class ResponseType>
695 
697  : call_(call), ctx_(ctx) {}
698 };
699 
701 template <class W, class R>
703  public internal::WriterInterface<W>,
704  public internal::ReaderInterface<R> {};
705 
707 namespace internal {
708 template <class W, class R>
709 class ServerReaderWriterBody final {
710  public:
713  : call_(call), ctx_(ctx) {}
714 
716  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
717 
719  ops.SendInitialMetadata(&ctx_->initial_metadata_,
720  ctx_->initial_metadata_flags());
721  if (ctx_->compression_level_set()) {
723  }
724  ctx_->sent_initial_metadata_ = true;
725  call_->PerformOps(&ops);
726  call_->cq()->Pluck(&ops);
727  }
728 
729  bool NextMessageSize(uint32_t* sz) {
730  int result = call_->max_receive_message_size();
731  *sz = (result > 0) ? result : UINT32_MAX;
732  return true;
733  }
734 
735  bool Read(R* msg) {
737  ops.RecvMessage(msg);
738  call_->PerformOps(&ops);
739  return call_->cq()->Pluck(&ops) && ops.got_message;
740  }
741 
742  bool Write(const W& msg, ::grpc::WriteOptions options) {
743  if (options.is_last_message()) {
744  options.set_buffer_hint();
745  }
746  if (!ctx_->pending_ops_.SendMessagePtr(&msg, options).ok()) {
747  return false;
748  }
749  if (!ctx_->sent_initial_metadata_) {
750  ctx_->pending_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
751  ctx_->initial_metadata_flags());
752  if (ctx_->compression_level_set()) {
753  ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
754  }
755  ctx_->sent_initial_metadata_ = true;
756  }
757  call_->PerformOps(&ctx_->pending_ops_);
758  // if this is the last message we defer the pluck until AFTER we start
759  // the trailing md op. This prevents hangs. See
760  // https://github.com/grpc/grpc/issues/11546
761  if (options.is_last_message()) {
762  ctx_->has_pending_ops_ = true;
763  return true;
764  }
765  ctx_->has_pending_ops_ = false;
766  return call_->cq()->Pluck(&ctx_->pending_ops_);
767  }
768 
769  private:
770  grpc::internal::Call* const call_;
771  ::grpc_impl::ServerContext* const ctx_;
772 };
773 
774 } // namespace internal
775 
780 template <class W, class R>
782  public:
786  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
787 
788  bool NextMessageSize(uint32_t* sz) override {
789  return body_.NextMessageSize(sz);
790  }
791 
792  bool Read(R* msg) override { return body_.Read(msg); }
793 
800  bool Write(const W& msg, ::grpc::WriteOptions options) override {
801  return body_.Write(msg, options);
802  }
803 
804  private:
806 
811  : body_(call, ctx) {}
812 };
813 
822 template <class RequestType, class ResponseType>
824  : public ServerReaderWriterInterface<ResponseType, RequestType> {
825  public:
830  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
831 
833  bool NextMessageSize(uint32_t* sz) override {
834  return body_.NextMessageSize(sz);
835  }
836 
847  bool Read(RequestType* request) override {
848  if (read_done_) {
849  return false;
850  }
851  read_done_ = true;
852  return body_.Read(request);
853  }
854 
863  bool Write(const ResponseType& response,
864  ::grpc::WriteOptions options) override {
865  if (write_done_ || !read_done_) {
866  return false;
867  }
868  write_done_ = true;
869  return body_.Write(response, options);
870  }
871 
872  private:
874  bool read_done_;
875  bool write_done_;
876 
881  : body_(call, ctx), read_done_(false), write_done_(false) {}
882 };
883 
889 template <class RequestType, class ResponseType>
891  : public ServerReaderWriterInterface<ResponseType, RequestType> {
892  public:
897  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
898 
900  bool NextMessageSize(uint32_t* sz) override {
901  return body_.NextMessageSize(sz);
902  }
903 
914  bool Read(RequestType* request) override {
915  if (read_done_) {
916  return false;
917  }
918  read_done_ = true;
919  return body_.Read(request);
920  }
921 
930  bool Write(const ResponseType& response,
931  ::grpc::WriteOptions options) override {
932  return read_done_ && body_.Write(response, options);
933  }
934 
935  private:
937  bool read_done_;
938 
943  : body_(call, ctx), read_done_(false) {}
944 };
945 
946 } // namespace grpc_impl
947 
948 #endif // GRPCPP_IMPL_CODEGEN_SYNC_STREAM_IMPL_H
grpc_impl::internal::ServerStreamingInterface::~ServerStreamingInterface
virtual ~ServerStreamingInterface()
Definition: sync_stream_impl.h:68
grpc::internal::CallOpRecvInitialMetadata
Definition: call_op_set.h:719
grpc_impl::ServerWriter::SendInitialMetadata
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream_impl.h:640
grpc_impl::internal::ClientReaderWriterFactory
Definition: sync_stream_impl.h:432
grpc::internal::CallOpClientSendClose
Definition: call_op_set.h:617
grpc_impl::internal::ClientWriterFactory
Definition: sync_stream_impl.h:280
grpc::internal::CallOpGenericRecvMessage
Definition: call_op_set.h:524
grpc_impl::ClientReaderWriter::WritesDone
bool WritesDone() override
Half close writing from the client.
Definition: sync_stream_impl.h:517
grpc_impl::ClientReaderWriterInterface::WaitForInitialMetadata
virtual void WaitForInitialMetadata()=0
Block to wait for initial metadata from server.
grpc_impl::internal::ReaderInterface::Read
virtual bool Read(R *msg)=0
Block to read a message and parse to msg.
grpc::internal::Call::max_receive_message_size
int max_receive_message_size() const
Definition: call.h:75
grpc::internal::TemplatedBidiStreamingHandler
::grpc_impl::internal::TemplatedBidiStreamingHandler< Streamer, WriteNeeded > TemplatedBidiStreamingHandler
Definition: method_handler.h:50
grpc::internal::CallOpSet
Primary implementation of CallOpSetInterface.
Definition: call_op_set.h:849
status.h
grpc::internal::CallOpSendMessage
Definition: call_op_set.h:286
grpc_impl::internal::ClientStreamingInterface
Common interface for all synchronous client side streaming.
Definition: sync_stream_impl.h:34
grpc_impl::ServerContext::compression_level
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context_impl.h:215
grpc_impl::ServerReaderWriter::Write
bool Write(const W &msg, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:800
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:161
grpc_impl::internal::ServerReaderWriterBody::SendInitialMetadata
void SendInitialMetadata()
Definition: sync_stream_impl.h:715
grpc_impl::internal::ServerStreamingInterface
Common interface for all synchronous server side streaming.
Definition: sync_stream_impl.h:66
grpc_impl::ClientReaderWriter::Finish
::grpc::Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream_impl.h:529
service_type.h
grpc_impl::ServerReaderWriterInterface
Server-side interface for bi-directional streaming.
Definition: sync_stream_impl.h:702
grpc_impl::ClientReaderInterface
Client-side interface for streaming reads of message of type R.
Definition: sync_stream_impl.h:148
grpc_impl::internal::WriterInterface::WriteLast
void WriteLast(const W &msg, ::grpc::WriteOptions options)
Write msg and coalesce it with the writing of trailing metadata, using WriteOptions options.
Definition: sync_stream_impl.h:139
grpc_impl::ServerUnaryStreamer
A class to represent a flow-controlled unary call.
Definition: sync_stream_impl.h:823
grpc::ClientWriter
::grpc_impl::ClientWriter< W > ClientWriter
Definition: sync_stream.h:62
grpc_impl::internal::ServerReaderWriterBody::NextMessageSize
bool NextMessageSize(uint32_t *sz)
Definition: sync_stream_impl.h:729
grpc_impl::internal::ServerReaderWriterBody::Write
bool Write(const W &msg, ::grpc::WriteOptions options)
Definition: sync_stream_impl.h:742
grpc_impl::ClientReader::NextMessageSize
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the next message size available for reading on this stream.
Definition: sync_stream_impl.h:195
grpc::internal::Call
Straightforward wrapping of the C call object.
Definition: call.h:38
grpc_impl::internal::WriterInterface::Write
virtual bool Write(const W &msg, ::grpc::WriteOptions options)=0
Block to write msg to the stream with WriteOptions options.
grpc_impl::internal::ClientStreamingInterface::~ClientStreamingInterface
virtual ~ClientStreamingInterface()
Definition: sync_stream_impl.h:36
grpc_impl::internal::WriterInterface
An interface that can be fed a sequence of messages of type W.
Definition: sync_stream_impl.h:104
grpc_impl::ServerReaderWriter
Synchronous (blocking) server-side API for a bidirectional streaming call, where the incoming message...
Definition: sync_stream_impl.h:781
grpc_impl::ServerReader::SendInitialMetadata
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream_impl.h:586
core_codegen_interface.h
grpc::internal::CallOpSendInitialMetadata
Definition: call_op_set.h:216
grpc_impl::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_impl.h:230
grpc_impl::internal::ServerStreamingInterface::SendInitialMetadata
virtual void SendInitialMetadata()=0
Block to send initial metadata to client.
grpc_impl::ServerSplitStreamer::Write
bool Write(const ResponseType &response, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:930
grpc::internal::CallOpSendInitialMetadata::SendInitialMetadata
void SendInitialMetadata(std::multimap< grpc::string, grpc::string > *metadata, uint32_t flags)
Definition: call_op_set.h:222
grpc_impl::ClientReader
Synchronous (blocking) client-side API for doing server-streaming RPCs, where the stream of messages ...
Definition: channel_interface.h:31
grpc_impl::internal::ServerReaderWriterBody::ServerReaderWriterBody
ServerReaderWriterBody(grpc::internal::Call *call, ::grpc_impl::ServerContext *ctx)
Definition: sync_stream_impl.h:711
grpc_impl::internal::ReaderInterface::NextMessageSize
virtual bool NextMessageSize(uint32_t *sz)=0
Get an upper bound on the next message size available for reading on this stream.
grpc_impl::ClientReaderWriter
Synchronous (blocking) client-side API for bi-directional streaming RPCs, where the outgoing message ...
Definition: channel_interface.h:35
grpc_impl::ServerSplitStreamer::Read
bool Read(RequestType *request) override
Read a message of type R into msg.
Definition: sync_stream_impl.h:914
grpc_impl::ClientWriter::Finish
::grpc::Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream_impl.h:357
grpc::Status
Did it work? If it didn't, why?
Definition: status.h:31
grpc_impl::ServerContext
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context_impl.h:510
grpc_impl::ServerReaderWriter::Read
bool Read(R *msg) override
Block to read a message and parse to msg.
Definition: sync_stream_impl.h:792
grpc::internal::ServerStreamingHandler
::grpc_impl::internal::ServerStreamingHandler< ServiceType, RequestType, ResponseType > ServerStreamingHandler
Definition: method_handler.h:46
GRPC_CQ_DEFAULT_POLLING
The completion queue will have an associated pollset and there is no restriction on the type of file ...
Definition: grpc_types.h:708
grpc_impl::ClientWriter::WaitForInitialMetadata
void WaitForInitialMetadata()
See the ClientStreamingInterface.WaitForInitialMetadata method for semantics.
Definition: sync_stream_impl.h:304
grpc_impl::ServerWriter::Write
bool Write(const W &msg, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:661
grpc_impl::ClientReaderWriterInterface::WritesDone
virtual bool WritesDone()=0
Half close writing from the client.
grpc_impl::ClientReader::Finish
::grpc::Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream_impl.h:223
grpc_impl::ServerUnaryStreamer::Write
bool Write(const ResponseType &response, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:863
grpc_impl::internal::WriterInterface::Write
bool Write(const W &msg)
Block to write msg to the stream with default write options.
Definition: sync_stream_impl.h:123
grpc_impl::ServerUnaryStreamer::SendInitialMetadata
void SendInitialMetadata() override
Block to send initial metadata to client.
Definition: sync_stream_impl.h:830
grpc_impl::internal::ClientReaderFactory
Definition: sync_stream_impl.h:160
grpc_impl::internal::ClientStreamingInterface::Finish
virtual ::grpc::Status Finish()=0
Block waiting until the stream finishes and a final status of the call is available.
grpc_impl::ClientWriter::Write
bool Write(const W &msg, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:321
grpc_impl::ServerSplitStreamer::SendInitialMetadata
void SendInitialMetadata() override
Block to send initial metadata to client.
Definition: sync_stream_impl.h:897
grpc_impl::ClientReader::WaitForInitialMetadata
void WaitForInitialMetadata() override
See the ClientStreamingInterface.WaitForInitialMetadata method for semantics.
Definition: sync_stream_impl.h:185
grpc_impl::ServerWriter
Synchronous (blocking) server-side API for doing for doing a server-streaming RPCs,...
Definition: completion_queue_impl.h:61
grpc_impl::ServerContext::set_compression_level
void set_compression_level(grpc_compression_level level)
Set level to be the compression level used for the server call.
Definition: server_context_impl.h:222
grpc::ChannelInterface
Codegen interface for grpc::Channel.
Definition: channel_interface.h:74
grpc_impl::internal::ReaderInterface::~ReaderInterface
virtual ~ReaderInterface()
Definition: sync_stream_impl.h:83
grpc_impl::ServerSplitStreamer
A class to represent a flow-controlled server-side streaming call.
Definition: sync_stream_impl.h:890
grpc_impl::ClientWriterInterface
Client-side interface for streaming writes of message type W.
Definition: sync_stream_impl.h:266
GRPC_CQ_PLUCK
Events are popped out by calling grpc_completion_queue_pluck() API ONLY.
Definition: grpc_types.h:728
grpc_impl::ClientWriter::WritesDone
bool WritesDone() override
Half close writing from the client.
Definition: sync_stream_impl.h:344
grpc_impl::internal::ServerReaderWriterBody::Read
bool Read(R *msg)
Definition: sync_stream_impl.h:735
grpc::ClientWriterInterface
::grpc_impl::ClientWriterInterface< W > ClientWriterInterface
Definition: sync_stream.h:59
grpc_impl::ClientReaderWriter::NextMessageSize
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the next message size available for reading on this stream.
Definition: sync_stream_impl.h:466
grpc_completion_queue_attributes
Definition: grpc_types.h:759
grpc::internal::CallOpSendInitialMetadata::set_compression_level
void set_compression_level(grpc_compression_level level)
Definition: call_op_set.h:230
grpc_impl::ServerReaderWriter::NextMessageSize
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the next message size available for reading on this stream.
Definition: sync_stream_impl.h:788
grpc::protobuf::util::Status
::google::protobuf::util::Status Status
Definition: config_protobuf.h:90
grpc_impl::ServerWriterInterface
Server-side interface for streaming writes of message of type W.
Definition: sync_stream_impl.h:627
grpc_impl::ClientWriter
Synchronous (blocking) client-side API for doing client-streaming RPCs, where the outgoing message st...
Definition: channel_interface.h:33
grpc_impl::ClientReader::Read
bool Read(R *msg) override
See the ReaderInterface.Read method for semantics.
Definition: sync_stream_impl.h:206
grpc::ClientReaderInterface
::grpc_impl::ClientReaderInterface< R > ClientReaderInterface
Definition: sync_stream.h:53
grpc_impl::internal::ClientReaderFactory::Create
static ClientReader< R > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, const W &request)
Definition: sync_stream_impl.h:163
grpc::WriteOptions
Per-message write options.
Definition: call_op_set.h:79
server_context_impl.h
grpc_impl::ServerReader::NextMessageSize
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the next message size available for reading on this stream.
Definition: sync_stream_impl.h:601
grpc_impl::ServerReaderWriter::SendInitialMetadata
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream_impl.h:786
grpc_impl::ServerUnaryStreamer::NextMessageSize
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the request message size from the client.
Definition: sync_stream_impl.h:833
grpc_impl::CompletionQueue
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue_impl.h:103
channel_interface.h
grpc_impl::internal::ReaderInterface
An interface that yields a sequence of messages of type R.
Definition: sync_stream_impl.h:81
grpc_impl::internal::ServerReaderWriterBody
Definition: completion_queue_impl.h:65
GRPC_CQ_CURRENT_VERSION
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:757
grpc::internal::Call::PerformOps
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:68
grpc_impl::internal::ClientWriterFactory::Create
static ClientWriter< W > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, R *response)
Definition: sync_stream_impl.h:283
call.h
grpc_impl::ServerReader::Read
bool Read(R *msg) override
Block to read a message and parse to msg.
Definition: sync_stream_impl.h:607
grpc::internal::CallOpClientRecvStatus
Definition: call_op_set.h:767
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:122
grpc::ClientReader
::grpc_impl::ClientReader< R > ClientReader
Definition: sync_stream.h:56
grpc::ClientReaderWriterInterface
::grpc_impl::ClientReaderWriterInterface< W, R > ClientReaderWriterInterface
Definition: sync_stream.h:66
grpc_impl::ServerReader
Synchronous (blocking) server-side API for doing client-streaming RPCs, where the incoming message st...
Definition: completion_queue_impl.h:59
grpc_impl
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
grpc_impl::ClientReaderWriter::Read
bool Read(R *msg) override
See the ReaderInterface.Read method for semantics.
Definition: sync_stream_impl.h:476
grpc::ClientReaderWriter
::grpc_impl::ClientReaderWriter< W, R > ClientReaderWriter
Definition: sync_stream.h:69
GPR_CODEGEN_ASSERT
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:146
grpc::internal::Call::cq
::grpc_impl::CompletionQueue * cq() const
Definition: call.h:73
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:186
grpc_impl::ClientContext
A ClientContext allows the person implementing a service client to:
Definition: client_context_impl.h:184
grpc::internal::CallOpRecvMessage
Definition: byte_buffer.h:58
grpc_impl::ClientReaderInterface::WaitForInitialMetadata
virtual void WaitForInitialMetadata()=0
Block to wait for initial metadata from server.
grpc_impl::ServerSplitStreamer::NextMessageSize
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the request message size from the client.
Definition: sync_stream_impl.h:900
grpc_impl::internal::ClientReaderWriterFactory::Create
static ClientReaderWriter< W, R > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context)
Definition: sync_stream_impl.h:434
completion_queue_impl.h
client_context_impl.h
grpc_impl::ClientReaderWriterInterface
Client-side interface for bi-directional streaming with client-to-server stream messages of type W an...
Definition: sync_stream_impl.h:411
grpc_impl::ServerReaderInterface
Server-side interface for streaming reads of message of type R.
Definition: sync_stream_impl.h:574
grpc_impl::internal::WriterInterface::~WriterInterface
virtual ~WriterInterface()
Definition: sync_stream_impl.h:106
grpc::internal::ClientStreamingHandler
::grpc_impl::internal::ClientStreamingHandler< ServiceType, RequestType, ResponseType > ClientStreamingHandler
Definition: method_handler.h:41
grpc_impl::ClientReaderWriter::Write
bool Write(const W &msg, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:494
grpc_impl::ClientReaderWriter::WaitForInitialMetadata
void WaitForInitialMetadata() override
Block waiting to read initial metadata from the server.
Definition: sync_stream_impl.h:456
grpc::internal::CallOpRecvMessage::RecvMessage
void RecvMessage(R *message)
Definition: call_op_set.h:424
grpc_impl::ClientWriterInterface::WritesDone
virtual bool WritesDone()=0
Half close writing from the client.
grpc_impl::ServerUnaryStreamer::Read
bool Read(RequestType *request) override
Read a message of type R into msg.
Definition: sync_stream_impl.h:847