GRPC C++  1.26.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  *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  ::grpc::Status Finish() override {
224  ::grpc::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  ::grpc_impl::ClientContext* context_;
236 
240  template <class W>
242  const ::grpc::internal::RpcMethod& method,
243  ::grpc_impl::ClientContext* context, const W& request)
244  : context_(context),
247  nullptr}), // 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.SendMessagePtr(&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  ::grpc_impl::ClientContext* context,
285  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 {
321  ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
322  ::grpc::internal::CallOpSendMessage,
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_impl::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_impl::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_impl::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  *sz = call_.max_receive_message_size();
467  return true;
468  }
469 
474  bool Read(R* msg) override {
477  ops;
478  if (!context_->initial_metadata_received_) {
479  ops.RecvInitialMetadata(context_);
480  }
481  ops.RecvMessage(msg);
482  call_.PerformOps(&ops);
483  return cq_.Pluck(&ops) && ops.got_message;
484  }
485 
492  bool Write(const W& msg, ::grpc::WriteOptions options) override {
493  ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
494  ::grpc::internal::CallOpSendMessage,
496  ops;
497 
498  if (options.is_last_message()) {
499  options.set_buffer_hint();
500  ops.ClientSendClose();
501  }
502  if (context_->initial_metadata_corked_) {
503  ops.SendInitialMetadata(&context_->send_initial_metadata_,
504  context_->initial_metadata_flags());
505  context_->set_initial_metadata_corked(false);
506  }
507  if (!ops.SendMessagePtr(&msg, options).ok()) {
508  return false;
509  }
510 
511  call_.PerformOps(&ops);
512  return cq_.Pluck(&ops);
513  }
514 
515  bool WritesDone() override {
517  ops.ClientSendClose();
518  call_.PerformOps(&ops);
519  return cq_.Pluck(&ops);
520  }
521 
527  ::grpc::Status Finish() override {
530  ops;
531  if (!context_->initial_metadata_received_) {
532  ops.RecvInitialMetadata(context_);
533  }
534  ::grpc::Status status;
535  ops.ClientRecvStatus(context_, &status);
536  call_.PerformOps(&ops);
537  GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
538  return status;
539  }
540 
541  private:
543 
544  ::grpc_impl::ClientContext* context_;
547 
552  const ::grpc::internal::RpcMethod& method,
553  ::grpc_impl::ClientContext* context)
554  : context_(context),
557  nullptr}), // Pluckable cq
558  call_(channel->CreateCall(method, context, &cq_)) {
559  if (!context_->initial_metadata_corked_) {
561  ops;
562  ops.SendInitialMetadata(&context->send_initial_metadata_,
563  context->initial_metadata_flags());
564  call_.PerformOps(&ops);
565  cq_.Pluck(&ops);
566  }
567  }
568 };
569 
571 template <class R>
573  public internal::ReaderInterface<R> {};
574 
578 template <class R>
579 class ServerReader final : public ServerReaderInterface<R> {
580  public:
584  void SendInitialMetadata() override {
585  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
586 
588  ops;
589  ops.SendInitialMetadata(&ctx_->initial_metadata_,
590  ctx_->initial_metadata_flags());
591  if (ctx_->compression_level_set()) {
592  ops.set_compression_level(ctx_->compression_level());
593  }
594  ctx_->sent_initial_metadata_ = true;
595  call_->PerformOps(&ops);
596  call_->cq()->Pluck(&ops);
597  }
598 
599  bool NextMessageSize(uint32_t* sz) override {
600  *sz = call_->max_receive_message_size();
601  return true;
602  }
603 
604  bool Read(R* msg) override {
606  ops.RecvMessage(msg);
607  call_->PerformOps(&ops);
608  return call_->cq()->Pluck(&ops) && ops.got_message;
609  }
610 
611  private:
612  ::grpc::internal::Call* const call_;
613  ServerContext* const ctx_;
614 
615  template <class ServiceType, class RequestType, class ResponseType>
617 
619  : call_(call), ctx_(ctx) {}
620 };
621 
623 template <class W>
625  public internal::WriterInterface<W> {};
626 
630 template <class W>
631 class ServerWriter final : public ServerWriterInterface<W> {
632  public:
637  void SendInitialMetadata() override {
638  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
639 
641  ops;
642  ops.SendInitialMetadata(&ctx_->initial_metadata_,
643  ctx_->initial_metadata_flags());
644  if (ctx_->compression_level_set()) {
645  ops.set_compression_level(ctx_->compression_level());
646  }
647  ctx_->sent_initial_metadata_ = true;
648  call_->PerformOps(&ops);
649  call_->cq()->Pluck(&ops);
650  }
651 
658  bool Write(const W& msg, ::grpc::WriteOptions options) override {
659  if (options.is_last_message()) {
660  options.set_buffer_hint();
661  }
662 
663  if (!ctx_->pending_ops_.SendMessagePtr(&msg, options).ok()) {
664  return false;
665  }
666  if (!ctx_->sent_initial_metadata_) {
667  ctx_->pending_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
668  ctx_->initial_metadata_flags());
669  if (ctx_->compression_level_set()) {
670  ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
671  }
672  ctx_->sent_initial_metadata_ = true;
673  }
674  call_->PerformOps(&ctx_->pending_ops_);
675  // if this is the last message we defer the pluck until AFTER we start
676  // the trailing md op. This prevents hangs. See
677  // https://github.com/grpc/grpc/issues/11546
678  if (options.is_last_message()) {
679  ctx_->has_pending_ops_ = true;
680  return true;
681  }
682  ctx_->has_pending_ops_ = false;
683  return call_->cq()->Pluck(&ctx_->pending_ops_);
684  }
685 
686  private:
687  ::grpc::internal::Call* const call_;
688  ::grpc_impl::ServerContext* const ctx_;
689 
690  template <class ServiceType, class RequestType, class ResponseType>
692 
694  : call_(call), ctx_(ctx) {}
695 };
696 
698 template <class W, class R>
700  public internal::WriterInterface<W>,
701  public internal::ReaderInterface<R> {};
702 
704 namespace internal {
705 template <class W, class R>
706 class ServerReaderWriterBody final {
707  public:
710  : call_(call), ctx_(ctx) {}
711 
713  GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
714 
716  ops.SendInitialMetadata(&ctx_->initial_metadata_,
717  ctx_->initial_metadata_flags());
718  if (ctx_->compression_level_set()) {
719  ops.set_compression_level(ctx_->compression_level());
720  }
721  ctx_->sent_initial_metadata_ = true;
722  call_->PerformOps(&ops);
723  call_->cq()->Pluck(&ops);
724  }
725 
726  bool NextMessageSize(uint32_t* sz) {
727  *sz = call_->max_receive_message_size();
728  return true;
729  }
730 
731  bool Read(R* msg) {
733  ops.RecvMessage(msg);
734  call_->PerformOps(&ops);
735  return call_->cq()->Pluck(&ops) && ops.got_message;
736  }
737 
738  bool Write(const W& msg, ::grpc::WriteOptions options) {
739  if (options.is_last_message()) {
740  options.set_buffer_hint();
741  }
742  if (!ctx_->pending_ops_.SendMessagePtr(&msg, options).ok()) {
743  return false;
744  }
745  if (!ctx_->sent_initial_metadata_) {
746  ctx_->pending_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
747  ctx_->initial_metadata_flags());
748  if (ctx_->compression_level_set()) {
749  ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
750  }
751  ctx_->sent_initial_metadata_ = true;
752  }
753  call_->PerformOps(&ctx_->pending_ops_);
754  // if this is the last message we defer the pluck until AFTER we start
755  // the trailing md op. This prevents hangs. See
756  // https://github.com/grpc/grpc/issues/11546
757  if (options.is_last_message()) {
758  ctx_->has_pending_ops_ = true;
759  return true;
760  }
761  ctx_->has_pending_ops_ = false;
762  return call_->cq()->Pluck(&ctx_->pending_ops_);
763  }
764 
765  private:
766  grpc::internal::Call* const call_;
767  ::grpc_impl::ServerContext* const ctx_;
768 };
769 
770 } // namespace internal
771 
776 template <class W, class R>
778  public:
782  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
783 
784  bool NextMessageSize(uint32_t* sz) override {
785  return body_.NextMessageSize(sz);
786  }
787 
788  bool Read(R* msg) override { return body_.Read(msg); }
789 
796  bool Write(const W& msg, ::grpc::WriteOptions options) override {
797  return body_.Write(msg, options);
798  }
799 
800  private:
802 
807  : body_(call, ctx) {}
808 };
809 
818 template <class RequestType, class ResponseType>
820  : public ServerReaderWriterInterface<ResponseType, RequestType> {
821  public:
826  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
827 
829  bool NextMessageSize(uint32_t* sz) override {
830  return body_.NextMessageSize(sz);
831  }
832 
843  bool Read(RequestType* request) override {
844  if (read_done_) {
845  return false;
846  }
847  read_done_ = true;
848  return body_.Read(request);
849  }
850 
859  bool Write(const ResponseType& response,
860  ::grpc::WriteOptions options) override {
861  if (write_done_ || !read_done_) {
862  return false;
863  }
864  write_done_ = true;
865  return body_.Write(response, options);
866  }
867 
868  private:
870  bool read_done_;
871  bool write_done_;
872 
877  : body_(call, ctx), read_done_(false), write_done_(false) {}
878 };
879 
885 template <class RequestType, class ResponseType>
887  : public ServerReaderWriterInterface<ResponseType, RequestType> {
888  public:
893  void SendInitialMetadata() override { body_.SendInitialMetadata(); }
894 
896  bool NextMessageSize(uint32_t* sz) override {
897  return body_.NextMessageSize(sz);
898  }
899 
910  bool Read(RequestType* request) override {
911  if (read_done_) {
912  return false;
913  }
914  read_done_ = true;
915  return body_.Read(request);
916  }
917 
926  bool Write(const ResponseType& response,
927  ::grpc::WriteOptions options) override {
928  return read_done_ && body_.Write(response, options);
929  }
930 
931  private:
933  bool read_done_;
934 
939  : body_(call, ctx), read_done_(false) {}
940 };
941 
942 } // namespace grpc_impl
943 
944 #endif // GRPCPP_IMPL_CODEGEN_SYNC_STREAM_IMPL_H
::grpc::Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream_impl.h:527
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream_impl.h:584
bool Write(const W &msg, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:796
virtual ~ReaderInterface()
Definition: sync_stream_impl.h:83
::grpc::Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream_impl.h:222
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
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:146
Synchronous (blocking) client-side API for bi-directional streaming RPCs, where the outgoing message ...
Definition: channel_interface.h:35
::grpc_impl::internal::ClientStreamingHandler< ServiceType, RequestType, ResponseType > ClientStreamingHandler
Definition: method_handler.h:41
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream_impl.h:637
bool Write(const W &msg, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:492
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
bool WritesDone() override
Half close writing from the client.
Definition: sync_stream_impl.h:515
::grpc_impl::ServerSplitStreamer< RequestType, ResponseType > ServerSplitStreamer
Definition: sync_stream.h:96
Synchronous (blocking) client-side API for doing server-streaming RPCs, where the stream of messages ...
Definition: channel_interface.h:31
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::CompletionQueue * cq() const
Definition: call.h:73
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the request message size from the client.
Definition: sync_stream_impl.h:829
::grpc_impl::internal::TemplatedBidiStreamingHandler< Streamer, WriteNeeded > TemplatedBidiStreamingHandler
Definition: method_handler.h:50
bool Read(R *msg) override
See the ReaderInterface.Read method for semantics.
Definition: sync_stream_impl.h:205
Definition: sync_stream_impl.h:160
Primary implementation of CallOpSetInterface.
Definition: call_op_set.h:824
Server-side interface for bi-directional streaming.
Definition: sync_stream_impl.h:699
Definition: sync_stream_impl.h:431
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:740
bool Write(const ResponseType &response, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:926
Definition: completion_queue_impl.h:62
bool Read(RequestType *request) override
Read a message of type R into msg.
Definition: sync_stream_impl.h:910
bool Write(const W &msg, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:320
bool Write(const W &msg, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:658
Definition: grpc_types.h:742
A ServerContext or CallbackServerContext allows the code implementing a service handler to: ...
Definition: server_context_impl.h:488
Server-side interface for streaming writes of message of type W.
Definition: sync_stream_impl.h:624
virtual ::grpc::Status Finish()=0
Block waiting until the stream finishes and a final status of the call is available.
::google::protobuf::util::Status Status
Definition: config_protobuf.h:90
virtual ~WriterInterface()
Definition: sync_stream_impl.h:106
Synchronous (blocking) server-side API for doing client-streaming RPCs, where the incoming message st...
Definition: completion_queue_impl.h:56
void set_compression_level(grpc_compression_level level)
Definition: call_op_set.h:230
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:784
Definition: call_op_set.h:216
::grpc_impl::ServerReader< R > ServerReader
Definition: sync_stream.h:75
::grpc_impl::ServerUnaryStreamer< RequestType, ResponseType > ServerUnaryStreamer
Definition: sync_stream.h:92
Events are popped out by calling grpc_completion_queue_pluck() API ONLY.
Definition: grpc_types.h:711
::grpc_impl::ServerReaderWriter< W, R > ServerReaderWriter
Definition: sync_stream.h:88
Definition: call_op_set.h:694
Definition: call_op_set.h:286
bool Read(RequestType *request) override
Read a message of type R into msg.
Definition: sync_stream_impl.h:843
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:599
Definition: sync_stream_impl.h:279
bool Read(R *msg) override
Block to read a message and parse to msg.
Definition: sync_stream_impl.h:788
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_impl.h:58
::grpc_impl::ClientReaderWriter< W, R > ClientReaderWriter
Definition: sync_stream.h:69
bool NextMessageSize(uint32_t *sz)
Definition: sync_stream_impl.h:726
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
bool Write(const W &msg, ::grpc::WriteOptions options)
Definition: sync_stream_impl.h:738
bool NextMessageSize(uint32_t *sz) override
Get an upper bound on the request message size from the client.
Definition: sync_stream_impl.h:896
::grpc::Status Finish() override
See the ClientStreamingInterface.Finish method for semantics.
Definition: sync_stream_impl.h:356
Codegen interface for grpc::Channel.
Definition: channel_interface.h:74
void SendInitialMetadata() override
Block to send initial metadata to client.
Definition: sync_stream_impl.h:826
void SendInitialMetadata(std::multimap< grpc::string, grpc::string > *metadata, uint32_t flags)
Definition: call_op_set.h:222
Client-side interface for streaming writes of message type W.
Definition: sync_stream_impl.h:265
The completion queue will have an associated pollset and there is no restriction on the type of file ...
Definition: grpc_types.h:691
static ClientWriter< W > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context, R *response)
Definition: sync_stream_impl.h:282
bool Write(const W &msg)
Block to write msg to the stream with default write options.
Definition: sync_stream_impl.h:123
An interface that can be fed a sequence of messages of type W.
Definition: sync_stream_impl.h:104
::grpc_impl::ClientWriter< W > ClientWriter
Definition: sync_stream.h:62
Definition: byte_buffer.h:58
::grpc_impl::internal::ServerStreamingHandler< ServiceType, RequestType, ResponseType > ServerStreamingHandler
Definition: method_handler.h:46
Per-message write options.
Definition: call_op_set.h:79
bool WritesDone() override
Half close writing from the client.
Definition: sync_stream_impl.h:343
bool Write(const ResponseType &response, ::grpc::WriteOptions options) override
Block to write msg to the stream with WriteOptions options.
Definition: sync_stream_impl.h:859
void SendInitialMetadata() override
Block to send initial metadata to client.
Definition: sync_stream_impl.h:893
A class to represent a flow-controlled unary call.
Definition: sync_stream_impl.h:819
A class to represent a flow-controlled server-side streaming call.
Definition: sync_stream_impl.h:886
bool Read(R *msg) override
See the ReaderInterface.Read method for semantics.
Definition: sync_stream_impl.h:474
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
Definition: call_op_set.h:592
bool Read(R *msg) override
Block to read a message and parse to msg.
Definition: sync_stream_impl.h:604
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:465
void RecvMessage(R *message)
Definition: call_op_set.h:429
static ClientReaderWriter< W, R > * Create(::grpc::ChannelInterface *channel, const ::grpc::internal::RpcMethod &method, ::grpc_impl::ClientContext *context)
Definition: sync_stream_impl.h:433
int max_receive_message_size() const
Definition: call.h:75
virtual ~ServerStreamingInterface()
Definition: sync_stream_impl.h:68
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue_impl.h:100
void SendInitialMetadata()
Definition: sync_stream_impl.h:712
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
void WaitForInitialMetadata() override
Block waiting to read initial metadata from the server.
Definition: sync_stream_impl.h:455
A ClientContext allows the person implementing a service client to:
Definition: client_context_impl.h:184
Did it work? If it didn&#39;t, why?
Definition: status.h:31
Common interface for all synchronous client side streaming.
Definition: sync_stream_impl.h:34
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::ServerWriter< W > ServerWriter
Definition: sync_stream.h:81
Definition: call_op_set.h:514
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:68
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
void SendInitialMetadata() override
See the ServerStreamingInterface.SendInitialMetadata method for semantics.
Definition: sync_stream_impl.h:782
Definition: call_op_set.h:742
Synchronous (blocking) client-side API for doing client-streaming RPCs, where the outgoing message st...
Definition: channel_interface.h:33
Synchronous (blocking) server-side API for a bidirectional streaming call, where the incoming message...
Definition: sync_stream_impl.h:777
Client-side interface for streaming reads of message of type R.
Definition: sync_stream_impl.h:148
bool Read(R *msg)
Definition: sync_stream_impl.h:731
ServerReaderWriterBody(grpc::internal::Call *call, ::grpc_impl::ServerContext *ctx)
Definition: sync_stream_impl.h:708
An interface that yields a sequence of messages of type R.
Definition: sync_stream_impl.h:81
virtual ~ClientStreamingInterface()
Definition: sync_stream_impl.h:36
void WaitForInitialMetadata() override
See the ClientStreamingInterface.WaitForInitialMetadata method for semantics.
Definition: sync_stream_impl.h:185
Common interface for all synchronous server side streaming.
Definition: sync_stream_impl.h:66
void WaitForInitialMetadata()
See the ClientStreamingInterface.WaitForInitialMetadata method for semantics.
Definition: sync_stream_impl.h:303
::grpc_impl::ClientReader< R > ClientReader
Definition: sync_stream.h:56
Server-side interface for streaming reads of message of type R.
Definition: sync_stream_impl.h:572
Straightforward wrapping of the C call object.
Definition: call.h:38