GRPC C++  1.32.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::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::ClientContext* context_;
237 
241  template <class W>
243  const ::grpc::internal::RpcMethod& method,
244  ::grpc::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::ClientContext* context, R* response) {
286  return new ClientWriter<W>(channel, method, context, response);
287  }
288 };
289 } // namespace internal
290 
294 template <class W>
295 class ClientWriter : public ClientWriterInterface<W> {
296  public:
300  // Side effect:
304  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
305 
307  ops;
308  ops.RecvInitialMetadata(context_);
309  call_.PerformOps(&ops);
310  cq_.Pluck(&ops); // status ignored
311  }
312 
320  bool Write(const W& msg, ::grpc::WriteOptions options) override {
324  ops;
325 
326  if (options.is_last_message()) {
327  options.set_buffer_hint();
328  ops.ClientSendClose();
329  }
330  if (context_->initial_metadata_corked_) {
331  ops.SendInitialMetadata(&context_->send_initial_metadata_,
332  context_->initial_metadata_flags());
333  context_->set_initial_metadata_corked(false);
334  }
335  if (!ops.SendMessagePtr(&msg, options).ok()) {
336  return false;
337  }
338 
339  call_.PerformOps(&ops);
340  return cq_.Pluck(&ops);
341  }
342 
343  bool WritesDone() override {
345  ops.ClientSendClose();
346  call_.PerformOps(&ops);
347  return cq_.Pluck(&ops);
348  }
349 
356  ::grpc::Status Finish() override {
357  ::grpc::Status status;
358  if (!context_->initial_metadata_received_) {
359  finish_ops_.RecvInitialMetadata(context_);
360  }
361  finish_ops_.ClientRecvStatus(context_, &status);
362  call_.PerformOps(&finish_ops_);
363  GPR_CODEGEN_ASSERT(cq_.Pluck(&finish_ops_));
364  return status;
365  }
366 
367  private:
369 
375  template <class R>
377  const ::grpc::internal::RpcMethod& method,
378  ::grpc::ClientContext* context, R* response)
379  : context_(context),
382  nullptr}), // Pluckable cq
383  call_(channel->CreateCall(method, context, &cq_)) {
384  finish_ops_.RecvMessage(response);
385  finish_ops_.AllowNoMessage();
386 
387  if (!context_->initial_metadata_corked_) {
389  ops;
390  ops.SendInitialMetadata(&context->send_initial_metadata_,
391  context->initial_metadata_flags());
392  call_.PerformOps(&ops);
393  cq_.Pluck(&ops);
394  }
395  }
396 
397  ::grpc::ClientContext* context_;
401  finish_ops_;
404 };
405 
409 template <class W, class R>
411  public internal::WriterInterface<W>,
412  public internal::ReaderInterface<R> {
413  public:
418  virtual void WaitForInitialMetadata() = 0;
419 
426  virtual bool WritesDone() = 0;
427 };
428 
429 namespace internal {
430 template <class W, class R>
432  public:
434  ::grpc::ChannelInterface* channel,
435  const ::grpc::internal::RpcMethod& method,
436  ::grpc::ClientContext* context) {
437  return new ClientReaderWriter<W, R>(channel, method, context);
438  }
439 };
440 } // namespace internal
441 
446 template <class W, class R>
447 class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
448  public:
455  void WaitForInitialMetadata() override {
456  GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
457 
459  ops;
460  ops.RecvInitialMetadata(context_);
461  call_.PerformOps(&ops);
462  cq_.Pluck(&ops); // status ignored
463  }
464 
465  bool NextMessageSize(uint32_t* sz) override {
466  int result = call_.max_receive_message_size();
467  *sz = (result > 0) ? result : UINT32_MAX;
468  return true;
469  }
470 
475  bool Read(R* msg) override {
478  ops;
479  if (!context_->initial_metadata_received_) {
480  ops.RecvInitialMetadata(context_);
481  }
482  ops.RecvMessage(msg);
483  call_.PerformOps(&ops);
484  return cq_.Pluck(&ops) && ops.got_message;
485  }
486 
493  bool Write(const W& msg, ::grpc::WriteOptions options) override {
497  ops;
498 
499  if (options.is_last_message()) {
500  options.set_buffer_hint();
501  ops.ClientSendClose();
502  }
503  if (context_->initial_metadata_corked_) {
504  ops.SendInitialMetadata(&context_->send_initial_metadata_,
505  context_->initial_metadata_flags());
506  context_->set_initial_metadata_corked(false);
507  }
508  if (!ops.SendMessagePtr(&msg, options).ok()) {
509  return false;
510  }
511 
512  call_.PerformOps(&ops);
513  return cq_.Pluck(&ops);
514  }
515 
516  bool WritesDone() override {
518  ops.ClientSendClose();
519  call_.PerformOps(&ops);
520  return cq_.Pluck(&ops);
521  }
522 
528  ::grpc::Status Finish() override {
531  ops;
532  if (!context_->initial_metadata_received_) {
533  ops.RecvInitialMetadata(context_);
534  }
535  ::grpc::Status status;
536  ops.ClientRecvStatus(context_, &status);
537  call_.PerformOps(&ops);
538  GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
539  return status;
540  }
541 
542  private:
544 
545  ::grpc::ClientContext* context_;
548 
553  const ::grpc::internal::RpcMethod& method,
554  ::grpc::ClientContext* context)
555  : context_(context),
558  nullptr}), // Pluckable cq
559  call_(channel->CreateCall(method, context, &cq_)) {
560  if (!context_->initial_metadata_corked_) {
562  ops;
563  ops.SendInitialMetadata(&context->send_initial_metadata_,
564  context->initial_metadata_flags());
565  call_.PerformOps(&ops);
566  cq_.Pluck(&ops);
567  }
568  }
569 };
570 
572 template <class R>
574  public internal::ReaderInterface<R> {};
575 
579 template <class R>
580 class ServerReader final : public ServerReaderInterface<R> {
581  public:
585  void SendInitialMetadata() override {
586  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
587 
589  ops;
590  ops.SendInitialMetadata(&ctx_->initial_metadata_,
591  ctx_->initial_metadata_flags());
592  if (ctx_->compression_level_set()) {
593  ops.set_compression_level(ctx_->compression_level());
594  }
595  ctx_->sent_initial_metadata_ = true;
596  call_->PerformOps(&ops);
597  call_->cq()->Pluck(&ops);
598  }
599 
600  bool NextMessageSize(uint32_t* sz) override {
601  int result = call_->max_receive_message_size();
602  *sz = (result > 0) ? result : UINT32_MAX;
603  return true;
604  }
605 
606  bool Read(R* msg) override {
608  ops.RecvMessage(msg);
609  call_->PerformOps(&ops);
610  return call_->cq()->Pluck(&ops) && ops.got_message;
611  }
612 
613  private:
614  ::grpc::internal::Call* const call_;
615  ServerContext* const ctx_;
616 
617  template <class ServiceType, class RequestType, class ResponseType>
619 
621  : call_(call), ctx_(ctx) {}
622 };
623 
625 template <class W>
627  public internal::WriterInterface<W> {};
628 
632 template <class W>
633 class ServerWriter final : public ServerWriterInterface<W> {
634  public:
639  void SendInitialMetadata() override {
640  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
641 
643  ops;
644  ops.SendInitialMetadata(&ctx_->initial_metadata_,
645  ctx_->initial_metadata_flags());
646  if (ctx_->compression_level_set()) {
647  ops.set_compression_level(ctx_->compression_level());
648  }
649  ctx_->sent_initial_metadata_ = true;
650  call_->PerformOps(&ops);
651  call_->cq()->Pluck(&ops);
652  }
653 
660  bool Write(const W& msg, ::grpc::WriteOptions options) override {
661  if (options.is_last_message()) {
662  options.set_buffer_hint();
663  }
664 
665  if (!ctx_->pending_ops_.SendMessagePtr(&msg, options).ok()) {
666  return false;
667  }
668  if (!ctx_->sent_initial_metadata_) {
669  ctx_->pending_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
670  ctx_->initial_metadata_flags());
671  if (ctx_->compression_level_set()) {
672  ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
673  }
674  ctx_->sent_initial_metadata_ = true;
675  }
676  call_->PerformOps(&ctx_->pending_ops_);
677  // if this is the last message we defer the pluck until AFTER we start
678  // the trailing md op. This prevents hangs. See
679  // https://github.com/grpc/grpc/issues/11546
680  if (options.is_last_message()) {
681  ctx_->has_pending_ops_ = true;
682  return true;
683  }
684  ctx_->has_pending_ops_ = false;
685  return call_->cq()->Pluck(&ctx_->pending_ops_);
686  }
687 
688  private:
689  ::grpc::internal::Call* const call_;
690  ::grpc_impl::ServerContext* const ctx_;
691 
692  template <class ServiceType, class RequestType, class ResponseType>
694 
696  : call_(call), ctx_(ctx) {}
697 };
698 
700 template <class W, class R>
702  public internal::WriterInterface<W>,
703  public internal::ReaderInterface<R> {};
704 
706 namespace internal {
707 template <class W, class R>
708 class ServerReaderWriterBody final {
709  public:
712  : call_(call), ctx_(ctx) {}
713 
715  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
716 
718  ops.SendInitialMetadata(&ctx_->initial_metadata_,
719  ctx_->initial_metadata_flags());
720  if (ctx_->compression_level_set()) {
721  ops.set_compression_level(ctx_->compression_level());
722  }
723  ctx_->sent_initial_metadata_ = true;
724  call_->PerformOps(&ops);
725  call_->cq()->Pluck(&ops);
726  }
727 
728  bool NextMessageSize(uint32_t* sz) {
729  int result = call_->max_receive_message_size();
730  *sz = (result > 0) ? result : UINT32_MAX;
731  return true;
732  }
733 
734  bool Read(R* msg) {
736  ops.RecvMessage(msg);
737  call_->PerformOps(&ops);
738  return call_->cq()->Pluck(&ops) && ops.got_message;
739  }
740 
741  bool Write(const W& msg, ::grpc::WriteOptions options) {
742  if (options.is_last_message()) {
743  options.set_buffer_hint();
744  }
745  if (!ctx_->pending_ops_.SendMessagePtr(&msg, options).ok()) {
746  return false;
747  }
748  if (!ctx_->sent_initial_metadata_) {
749  ctx_->pending_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
750  ctx_->initial_metadata_flags());
751  if (ctx_->compression_level_set()) {
752  ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
753  }
754  ctx_->sent_initial_metadata_ = true;
755  }
756  call_->PerformOps(&ctx_->pending_ops_);
757  // if this is the last message we defer the pluck until AFTER we start
758  // the trailing md op. This prevents hangs. See
759  // https://github.com/grpc/grpc/issues/11546
760  if (options.is_last_message()) {
761  ctx_->has_pending_ops_ = true;
762  return true;
763  }
764  ctx_->has_pending_ops_ = false;
765  return call_->cq()->Pluck(&ctx_->pending_ops_);
766  }
767 
768  private:
769  grpc::internal::Call* const call_;
770  ::grpc_impl::ServerContext* const ctx_;
771 };
772 
773 } // namespace internal
774 
779 template <class W, class R>
781  public:
785  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
786 
787  bool NextMessageSize(uint32_t* sz) override {
788  return body_.NextMessageSize(sz);
789  }
790 
791  bool Read(R* msg) override { return body_.Read(msg); }
792 
799  bool Write(const W& msg, ::grpc::WriteOptions options) override {
800  return body_.Write(msg, options);
801  }
802 
803  private:
805 
810  : body_(call, ctx) {}
811 };
812 
821 template <class RequestType, class ResponseType>
823  : public ServerReaderWriterInterface<ResponseType, RequestType> {
824  public:
829  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
830 
832  bool NextMessageSize(uint32_t* sz) override {
833  return body_.NextMessageSize(sz);
834  }
835 
846  bool Read(RequestType* request) override {
847  if (read_done_) {
848  return false;
849  }
850  read_done_ = true;
851  return body_.Read(request);
852  }
853 
862  bool Write(const ResponseType& response,
863  ::grpc::WriteOptions options) override {
864  if (write_done_ || !read_done_) {
865  return false;
866  }
867  write_done_ = true;
868  return body_.Write(response, options);
869  }
870 
871  private:
873  bool read_done_;
874  bool write_done_;
875 
880  : body_(call, ctx), read_done_(false), write_done_(false) {}
881 };
882 
888 template <class RequestType, class ResponseType>
890  : public ServerReaderWriterInterface<ResponseType, RequestType> {
891  public:
896  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
897 
899  bool NextMessageSize(uint32_t* sz) override {
900  return body_.NextMessageSize(sz);
901  }
902 
913  bool Read(RequestType* request) override {
914  if (read_done_) {
915  return false;
916  }
917  read_done_ = true;
918  return body_.Read(request);
919  }
920 
929  bool Write(const ResponseType& response,
930  ::grpc::WriteOptions options) override {
931  return read_done_ && body_.Write(response, options);
932  }
933 
934  private:
936  bool read_done_;
937 
942  : body_(call, ctx), read_done_(false) {}
943 };
944 
945 } // namespace grpc_impl
946 
947 #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:720
grpc_impl::ServerWriter::SendInitialMetadata
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream_impl.h:639
grpc_impl::internal::ClientReaderWriterFactory
Definition: sync_stream_impl.h:431
grpc::internal::CallOpClientSendClose
Definition: call_op_set.h:618
grpc_impl::internal::ClientWriterFactory
Definition: sync_stream_impl.h:280
grpc::internal::CallOpGenericRecvMessage
Definition: call_op_set.h:525
grpc_impl::ClientReaderWriter::WritesDone
bool WritesDone() override
Definition: sync_stream_impl.h:516
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:72
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:850
status.h
grpc::internal::CallOpSendMessage
Definition: call_op_set.h:287
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:225
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:799
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:714
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:528
service_type.h
grpc_impl::ServerReaderWriterInterface
Server-side interface for bi-directional streaming.
Definition: sync_stream_impl.h:701
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
client_context.h
grpc_impl::ServerUnaryStreamer
A class to represent a flow-controlled unary call.
Definition: sync_stream_impl.h:822
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:728
grpc_impl::internal::ServerReaderWriterBody::Write
bool Write(const W &msg, ::grpc::WriteOptions options)
Definition: sync_stream_impl.h:741
grpc_impl::ClientReader::NextMessageSize
bool NextMessageSize(uint32_t *sz) override
Definition: sync_stream_impl.h:195
grpc::internal::Call
Straightforward wrapping of the C call object.
Definition: call.h:35
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:780
grpc_impl::ServerReader::SendInitialMetadata
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream_impl.h:585
core_codegen_interface.h
grpc::internal::CallOpSendInitialMetadata
Definition: call_op_set.h:217
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:240
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:929
grpc_impl::ClientReader
Synchronous (blocking) client-side API for doing server-streaming RPCs, where the stream of messages ...
Definition: channel_interface.h:29
grpc_impl::internal::ServerReaderWriterBody::ServerReaderWriterBody
ServerReaderWriterBody(grpc::internal::Call *call, ::grpc_impl::ServerContext *ctx)
Definition: sync_stream_impl.h:710
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:33
grpc_impl::ServerSplitStreamer::Read
bool Read(RequestType *request) override
Read a message of type R into msg.
Definition: sync_stream_impl.h:913
grpc_impl::ClientWriter::Finish
::grpc::Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream_impl.h:356
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:520
grpc_impl::ServerReaderWriter::Read
bool Read(R *msg) override
Block to read a message and parse to msg.
Definition: sync_stream_impl.h:791
grpc::internal::ServerStreamingHandler
::grpc_impl::internal::ServerStreamingHandler< ServiceType, RequestType, ResponseType > ServerStreamingHandler
Definition: method_handler.h:46
GRPC_CQ_DEFAULT_POLLING
@ 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:710
grpc_impl::ClientWriter::WaitForInitialMetadata
void WaitForInitialMetadata()
See the ClientStreamingInterface.WaitForInitialMetadata method for semantics.
Definition: sync_stream_impl.h:303
grpc_impl::ServerWriter::Write
bool Write(const W &msg, ::grpc::WriteOptions options) override
Definition: sync_stream_impl.h:660
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::ClientContext
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:195
grpc_impl::internal::ClientWriterFactory::Create
static ClientWriter< W > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc::ClientContext *context, R *response)
Definition: sync_stream_impl.h:283
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:862
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:829
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
Definition: sync_stream_impl.h:320
grpc_impl::ServerSplitStreamer::SendInitialMetadata
void SendInitialMetadata() override
Block to send initial metadata to client.
Definition: sync_stream_impl.h:896
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.h:59
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:232
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:889
grpc_impl::ClientWriterInterface
Client-side interface for streaming writes of message type W.
Definition: sync_stream_impl.h:266
GRPC_CQ_PLUCK
@ GRPC_CQ_PLUCK
Events are popped out by calling grpc_completion_queue_pluck() API ONLY.
Definition: grpc_types.h:730
grpc_impl::ClientWriter::WritesDone
bool WritesDone() override
Definition: sync_stream_impl.h:343
grpc_impl::internal::ServerReaderWriterBody::Read
bool Read(R *msg)
Definition: sync_stream_impl.h:734
grpc::ClientWriterInterface
::grpc_impl::ClientWriterInterface< W > ClientWriterInterface
Definition: sync_stream.h:59
grpc::internal::Call::cq
::grpc::CompletionQueue * cq() const
Definition: call.h:70
grpc_impl::ClientReaderWriter::NextMessageSize
bool NextMessageSize(uint32_t *sz) override
Definition: sync_stream_impl.h:465
grpc_completion_queue_attributes
Definition: grpc_types.h:761
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:787
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:626
grpc_impl::ClientWriter
Synchronous (blocking) client-side API for doing client-streaming RPCs, where the outgoing message st...
Definition: channel_interface.h:31
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::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
Definition: sync_stream_impl.h:600
grpc_impl::ServerReaderWriter::SendInitialMetadata
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream_impl.h:785
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:832
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.h:63
GRPC_CQ_CURRENT_VERSION
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:759
grpc::internal::Call::PerformOps
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:65
call.h
grpc_impl::ServerReader::Read
bool Read(R *msg) override
Definition: sync_stream_impl.h:606
grpc::internal::CallOpClientRecvStatus
Definition: call_op_set.h:768
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.h:57
grpc::CompletionQueue
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:99
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::internal::ClientReaderFactory::Create
static ClientReader< R > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc::ClientContext *context, const W &request)
Definition: sync_stream_impl.h:163
grpc_impl::ClientReaderWriter::Read
bool Read(R *msg) override
See the ReaderInterface.Read method for semantics.
Definition: sync_stream_impl.h:475
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::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::internal::ClientReaderWriterFactory::Create
static ClientReaderWriter< W, R > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc::ClientContext *context)
Definition: sync_stream_impl.h:433
grpc::internal::CallOpRecvMessage
Definition: byte_buffer.h:58
completion_queue.h
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:899
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:410
grpc_impl::ServerReaderInterface
Server-side interface for streaming reads of message of type R.
Definition: sync_stream_impl.h:573
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
Definition: sync_stream_impl.h:493
grpc_impl::ClientReaderWriter::WaitForInitialMetadata
void WaitForInitialMetadata() override
Block waiting to read initial metadata from the server.
Definition: sync_stream_impl.h:455
grpc::internal::CallOpRecvMessage::RecvMessage
void RecvMessage(R *message)
Definition: call_op_set.h:425
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:846