GRPC C++  1.2.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
call.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015, Google Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following disclaimer
14  * in the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of Google Inc. nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 #ifndef GRPCXX_IMPL_CODEGEN_CALL_H
35 #define GRPCXX_IMPL_CODEGEN_CALL_H
36 
37 #include <cstring>
38 #include <functional>
39 #include <map>
40 #include <memory>
41 
52 
55 
56 struct grpc_byte_buffer;
57 
58 namespace grpc {
59 
60 class ByteBuffer;
61 class Call;
62 class CallHook;
65 
66 // TODO(yangg) if the map is changed before we send, the pointers will be a
67 // mess. Make sure it does not happen.
69  const std::multimap<grpc::string, grpc::string>& metadata) {
70  if (metadata.empty()) {
71  return nullptr;
72  }
73  grpc_metadata* metadata_array =
75  metadata.size() * sizeof(grpc_metadata)));
76  size_t i = 0;
77  for (auto iter = metadata.cbegin(); iter != metadata.cend(); ++iter, ++i) {
78  metadata_array[i].key = SliceReferencingString(iter->first);
79  metadata_array[i].value = SliceReferencingString(iter->second);
80  }
81  return metadata_array;
82 }
83 
85 class WriteOptions {
86  public:
87  WriteOptions() : flags_(0) {}
88  WriteOptions(const WriteOptions& other) : flags_(other.flags_) {}
89 
91  inline void Clear() { flags_ = 0; }
92 
94  inline uint32_t flags() const { return flags_; }
95 
100  SetBit(GRPC_WRITE_NO_COMPRESS);
101  return *this;
102  }
103 
108  ClearBit(GRPC_WRITE_NO_COMPRESS);
109  return *this;
110  }
111 
116  inline bool get_no_compression() const {
117  return GetBit(GRPC_WRITE_NO_COMPRESS);
118  }
119 
125  SetBit(GRPC_WRITE_BUFFER_HINT);
126  return *this;
127  }
128 
134  ClearBit(GRPC_WRITE_BUFFER_HINT);
135  return *this;
136  }
137 
142  inline bool get_buffer_hint() const { return GetBit(GRPC_WRITE_BUFFER_HINT); }
143 
145  flags_ = rhs.flags_;
146  return *this;
147  }
148 
149  private:
150  void SetBit(const uint32_t mask) { flags_ |= mask; }
151 
152  void ClearBit(const uint32_t mask) { flags_ &= ~mask; }
153 
154  bool GetBit(const uint32_t mask) const { return (flags_ & mask) != 0; }
155 
156  uint32_t flags_;
157 };
158 
161 template <int I>
162 class CallNoOp {
163  protected:
164  void AddOp(grpc_op* ops, size_t* nops) {}
165  void FinishOp(bool* status) {}
166 };
167 
169  public:
171  maybe_compression_level_.is_set = false;
172  }
173 
175  const std::multimap<grpc::string, grpc::string>& metadata,
176  uint32_t flags) {
177  maybe_compression_level_.is_set = false;
178  send_ = true;
179  flags_ = flags;
180  initial_metadata_count_ = metadata.size();
182  }
183 
185  maybe_compression_level_.is_set = true;
187  }
188 
189  protected:
190  void AddOp(grpc_op* ops, size_t* nops) {
191  if (!send_) return;
192  grpc_op* op = &ops[(*nops)++];
194  op->flags = flags_;
195  op->reserved = NULL;
198  op->data.send_initial_metadata.maybe_compression_level.is_set =
200  op->data.send_initial_metadata.maybe_compression_level.level =
202  }
203  void FinishOp(bool* status) {
204  if (!send_) return;
206  send_ = false;
207  }
208 
209  bool send_;
210  uint32_t flags_;
213  struct {
214  bool is_set;
217 };
218 
220  public:
221  CallOpSendMessage() : send_buf_(nullptr), own_buf_(false) {}
222 
225  template <class M>
226  Status SendMessage(const M& message,
227  const WriteOptions& options) GRPC_MUST_USE_RESULT;
228 
229  template <class M>
230  Status SendMessage(const M& message) GRPC_MUST_USE_RESULT;
231 
232  protected:
233  void AddOp(grpc_op* ops, size_t* nops) {
234  if (send_buf_ == nullptr) return;
235  grpc_op* op = &ops[(*nops)++];
236  op->op = GRPC_OP_SEND_MESSAGE;
237  op->flags = write_options_.flags();
238  op->reserved = NULL;
239  op->data.send_message.send_message = send_buf_;
240  // Flags are per-message: clear them after use.
241  write_options_.Clear();
242  }
243  void FinishOp(bool* status) {
244  if (own_buf_) g_core_codegen_interface->grpc_byte_buffer_destroy(send_buf_);
245  send_buf_ = nullptr;
246  }
247 
248  private:
249  grpc_byte_buffer* send_buf_;
250  WriteOptions write_options_;
251  bool own_buf_;
252 };
253 
254 template <class M>
256  const WriteOptions& options) {
257  write_options_ = options;
258  return SerializationTraits<M>::Serialize(message, &send_buf_, &own_buf_);
259 }
260 
261 template <class M>
263  return SendMessage(message, WriteOptions());
264 }
265 
266 template <class R>
268  public:
270  : got_message(false),
271  message_(nullptr),
272  allow_not_getting_message_(false) {}
273 
274  void RecvMessage(R* message) { message_ = message; }
275 
276  // Do not change status if no message is received.
277  void AllowNoMessage() { allow_not_getting_message_ = true; }
278 
280 
281  protected:
282  void AddOp(grpc_op* ops, size_t* nops) {
283  if (message_ == nullptr) return;
284  grpc_op* op = &ops[(*nops)++];
285  op->op = GRPC_OP_RECV_MESSAGE;
286  op->flags = 0;
287  op->reserved = NULL;
288  op->data.recv_message.recv_message = &recv_buf_;
289  }
290 
291  void FinishOp(bool* status) {
292  if (message_ == nullptr) return;
293  if (recv_buf_) {
294  if (*status) {
295  got_message = *status =
296  SerializationTraits<R>::Deserialize(recv_buf_, message_).ok();
297  } else {
298  got_message = false;
300  }
301  } else {
302  got_message = false;
303  if (!allow_not_getting_message_) {
304  *status = false;
305  }
306  }
307  message_ = nullptr;
308  }
309 
310  private:
311  R* message_;
312  grpc_byte_buffer* recv_buf_;
313  bool allow_not_getting_message_;
314 };
315 
316 namespace CallOpGenericRecvMessageHelper {
318  public:
319  virtual Status Deserialize(grpc_byte_buffer* buf) = 0;
320  virtual ~DeserializeFunc() {}
321 };
322 
323 template <class R>
324 class DeserializeFuncType final : public DeserializeFunc {
325  public:
326  DeserializeFuncType(R* message) : message_(message) {}
328  return SerializationTraits<R>::Deserialize(buf, message_);
329  }
330 
331  ~DeserializeFuncType() override {}
332 
333  private:
334  R* message_; // Not a managed pointer because management is external to this
335 };
336 } // namespace CallOpGenericRecvMessageHelper
337 
339  public:
341  : got_message(false), allow_not_getting_message_(false) {}
342 
343  template <class R>
344  void RecvMessage(R* message) {
345  // Use an explicit base class pointer to avoid resolution error in the
346  // following unique_ptr::reset for some old implementations.
349  deserialize_.reset(func);
350  }
351 
352  // Do not change status if no message is received.
353  void AllowNoMessage() { allow_not_getting_message_ = true; }
354 
356 
357  protected:
358  void AddOp(grpc_op* ops, size_t* nops) {
359  if (!deserialize_) return;
360  grpc_op* op = &ops[(*nops)++];
361  op->op = GRPC_OP_RECV_MESSAGE;
362  op->flags = 0;
363  op->reserved = NULL;
364  op->data.recv_message.recv_message = &recv_buf_;
365  }
366 
367  void FinishOp(bool* status) {
368  if (!deserialize_) return;
369  if (recv_buf_) {
370  if (*status) {
371  got_message = true;
372  *status = deserialize_->Deserialize(recv_buf_).ok();
373  } else {
374  got_message = false;
376  }
377  } else {
378  got_message = false;
379  if (!allow_not_getting_message_) {
380  *status = false;
381  }
382  }
383  deserialize_.reset();
384  }
385 
386  private:
387  std::unique_ptr<CallOpGenericRecvMessageHelper::DeserializeFunc> deserialize_;
388  grpc_byte_buffer* recv_buf_;
389  bool allow_not_getting_message_;
390 };
391 
393  public:
394  CallOpClientSendClose() : send_(false) {}
395 
396  void ClientSendClose() { send_ = true; }
397 
398  protected:
399  void AddOp(grpc_op* ops, size_t* nops) {
400  if (!send_) return;
401  grpc_op* op = &ops[(*nops)++];
403  op->flags = 0;
404  op->reserved = NULL;
405  }
406  void FinishOp(bool* status) { send_ = false; }
407 
408  private:
409  bool send_;
410 };
411 
413  public:
414  CallOpServerSendStatus() : send_status_available_(false) {}
415 
417  const std::multimap<grpc::string, grpc::string>& trailing_metadata,
418  const Status& status) {
419  trailing_metadata_count_ = trailing_metadata.size();
420  trailing_metadata_ = FillMetadataArray(trailing_metadata);
421  send_status_available_ = true;
422  send_status_code_ = static_cast<grpc_status_code>(GetCanonicalCode(status));
423  send_status_details_ = status.error_message();
424  }
425 
426  protected:
427  void AddOp(grpc_op* ops, size_t* nops) {
428  if (!send_status_available_) return;
429  grpc_op* op = &ops[(*nops)++];
431  op->data.send_status_from_server.trailing_metadata_count =
432  trailing_metadata_count_;
433  op->data.send_status_from_server.trailing_metadata = trailing_metadata_;
434  op->data.send_status_from_server.status = send_status_code_;
435  status_details_slice_ = SliceReferencingString(send_status_details_);
436  op->data.send_status_from_server.status_details =
437  send_status_details_.empty() ? nullptr : &status_details_slice_;
438  op->flags = 0;
439  op->reserved = NULL;
440  }
441 
442  void FinishOp(bool* status) {
443  if (!send_status_available_) return;
444  g_core_codegen_interface->gpr_free(trailing_metadata_);
445  send_status_available_ = false;
446  }
447 
448  private:
449  bool send_status_available_;
450  grpc_status_code send_status_code_;
451  grpc::string send_status_details_;
452  size_t trailing_metadata_count_;
453  grpc_metadata* trailing_metadata_;
454  grpc_slice status_details_slice_;
455 };
456 
458  public:
459  CallOpRecvInitialMetadata() : metadata_map_(nullptr) {}
460 
462  context->initial_metadata_received_ = true;
463  metadata_map_ = &context->recv_initial_metadata_;
464  }
465 
466  protected:
467  void AddOp(grpc_op* ops, size_t* nops) {
468  if (metadata_map_ == nullptr) return;
469  grpc_op* op = &ops[(*nops)++];
471  op->data.recv_initial_metadata.recv_initial_metadata = metadata_map_->arr();
472  op->flags = 0;
473  op->reserved = NULL;
474  }
475 
476  void FinishOp(bool* status) {
477  if (metadata_map_ == nullptr) return;
478  metadata_map_->FillMap();
479  metadata_map_ = nullptr;
480  }
481 
482  private:
483  MetadataMap* metadata_map_;
484 };
485 
487  public:
488  CallOpClientRecvStatus() : recv_status_(nullptr) {}
489 
490  void ClientRecvStatus(ClientContext* context, Status* status) {
491  metadata_map_ = &context->trailing_metadata_;
492  recv_status_ = status;
493  }
494 
495  protected:
496  void AddOp(grpc_op* ops, size_t* nops) {
497  if (recv_status_ == nullptr) return;
498  grpc_op* op = &ops[(*nops)++];
500  op->data.recv_status_on_client.trailing_metadata = metadata_map_->arr();
501  op->data.recv_status_on_client.status = &status_code_;
502  op->data.recv_status_on_client.status_details = &status_details_;
503  op->flags = 0;
504  op->reserved = NULL;
505  }
506 
507  void FinishOp(bool* status) {
508  if (recv_status_ == nullptr) return;
509  metadata_map_->FillMap();
510  *recv_status_ = Status(static_cast<StatusCode>(status_code_),
511  grpc::string(GRPC_SLICE_START_PTR(status_details_),
512  GRPC_SLICE_END_PTR(status_details_)));
513  g_core_codegen_interface->grpc_slice_unref(status_details_);
514  recv_status_ = nullptr;
515  }
516 
517  private:
518  MetadataMap* metadata_map_;
519  Status* recv_status_;
520  grpc_status_code status_code_;
521  grpc_slice status_details_;
522 };
523 
533  : public std::enable_shared_from_this<CallOpSetCollectionInterface> {};
534 
541  public:
545  virtual void FillOps(grpc_op* ops, size_t* nops) = 0;
546 
548  void SetCollection(std::shared_ptr<CallOpSetCollectionInterface> collection) {
549  collection_ = collection;
550  }
551 
552  protected:
553  std::shared_ptr<CallOpSetCollectionInterface> collection_;
554 };
555 
562 template <class Op1 = CallNoOp<1>, class Op2 = CallNoOp<2>,
563  class Op3 = CallNoOp<3>, class Op4 = CallNoOp<4>,
564  class Op5 = CallNoOp<5>, class Op6 = CallNoOp<6>>
566  public Op1,
567  public Op2,
568  public Op3,
569  public Op4,
570  public Op5,
571  public Op6 {
572  public:
573  CallOpSet() : return_tag_(this) {}
574  void FillOps(grpc_op* ops, size_t* nops) override {
575  this->Op1::AddOp(ops, nops);
576  this->Op2::AddOp(ops, nops);
577  this->Op3::AddOp(ops, nops);
578  this->Op4::AddOp(ops, nops);
579  this->Op5::AddOp(ops, nops);
580  this->Op6::AddOp(ops, nops);
581  }
582 
583  bool FinalizeResult(void** tag, bool* status) override {
584  this->Op1::FinishOp(status);
585  this->Op2::FinishOp(status);
586  this->Op3::FinishOp(status);
587  this->Op4::FinishOp(status);
588  this->Op5::FinishOp(status);
589  this->Op6::FinishOp(status);
590  *tag = return_tag_;
591  collection_.reset(); // drop the ref at this point
592  return true;
593  }
594 
595  void set_output_tag(void* return_tag) { return_tag_ = return_tag; }
596 
597  private:
598  void* return_tag_;
599 };
600 
605 template <class Op1 = CallNoOp<1>, class Op2 = CallNoOp<2>,
606  class Op3 = CallNoOp<3>, class Op4 = CallNoOp<4>,
607  class Op5 = CallNoOp<5>, class Op6 = CallNoOp<6>>
608 class SneakyCallOpSet : public CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> {
609  public:
610  bool FinalizeResult(void** tag, bool* status) override {
612  return Base::FinalizeResult(tag, status) && false;
613  }
614 };
615 
616 // Straightforward wrapping of the C call object
617 class Call final {
618  public:
619  /* call is owned by the caller */
621  : call_hook_(call_hook),
622  cq_(cq),
623  call_(call),
624  max_receive_message_size_(-1) {}
625 
628  : call_hook_(call_hook),
629  cq_(cq),
630  call_(call),
631  max_receive_message_size_(max_receive_message_size) {}
632 
634  call_hook_->PerformOpsOnCall(ops, this);
635  }
636 
637  grpc_call* call() const { return call_; }
638  CompletionQueue* cq() const { return cq_; }
639 
640  int max_receive_message_size() const { return max_receive_message_size_; }
641 
642  private:
643  CallHook* call_hook_;
644  CompletionQueue* cq_;
645  grpc_call* call_;
646  int max_receive_message_size_;
647 };
648 
649 } // namespace grpc
650 
651 #endif // GRPCXX_IMPL_CODEGEN_CALL_H
void ServerSendStatus(const std::multimap< grpc::string, grpc::string > &trailing_metadata, const Status &status)
Definition: call.h:416
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:85
CallOpRecvInitialMetadata()
Definition: call.h:459
grpc_op_type op
Operation type, as defined by grpc_op_type.
Definition: grpc_types.h:428
void RecvMessage(R *message)
Definition: call.h:344
Call(grpc_call *call, CallHook *call_hook, CompletionQueue *cq, int max_receive_message_size)
Definition: call.h:626
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:40
WriteOptions & clear_buffer_hint()
Clears flag indicating that the write may be buffered and need not go out on the wire immediately...
Definition: call.h:133
Default argument for CallOpSet.
Definition: call.h:162
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:399
CallOpServerSendStatus()
Definition: call.h:414
void FinishOp(bool *status)
Definition: call.h:165
grpc_status_code
Definition: status.h:41
WriteOptions & set_buffer_hint()
Sets flag indicating that the write may be buffered and need not go out on the wire immediately...
Definition: call.h:124
grpc_metadata_array * recv_initial_metadata
Definition: grpc_types.h:466
grpc::string error_message() const
Return the instance's error message.
Definition: status.h:64
CallOpSendMessage()
Definition: call.h:221
std::string string
Definition: config.h:50
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:358
void SetCollection(std::shared_ptr< CallOpSetCollectionInterface > collection)
Mark this as belonging to a collection if needed.
Definition: call.h:548
union grpc_op::@12 data
WriteOptions & clear_no_compression()
Clears flag for the disabling of compression for the next message write.
Definition: call.h:107
StatusCode GetCanonicalCode(const Status &status)
Definition: status_helper.h:41
Send a close from the client: one and only one instance MUST be sent from the client, unless the call was cancelled - in which case this can be skipped.
Definition: grpc_types.h:392
An abstract collection of call ops, used to generate the grpc_call_op structure to pass down to the l...
Definition: call.h:540
Send status from the server: one and only one instance MUST be sent from the server unless the call w...
Definition: grpc_types.h:398
#define GRPC_WRITE_NO_COMPRESS
Force compression to be disabled for a particular write (start_write/add_metadata).
Definition: grpc_types.h:300
grpc_metadata_array * arr()
Definition: metadata_map.h:62
void AllowNoMessage()
Definition: call.h:277
grpc_slice key
Definition: grpc_types.h:326
void FinishOp(bool *status)
Definition: call.h:367
Definition: call.h:486
grpc_slice value
Definition: grpc_types.h:327
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:282
void Clear()
Clear all flags.
Definition: call.h:91
grpc_compression_level level
Definition: call.h:215
#define GRPC_MUST_USE_RESULT
Definition: port_platform.h:371
Definition: slice.h:90
#define GRPC_WRITE_BUFFER_HINT
Hint that the write may be buffered and need not go out on the wire immediately.
Definition: grpc_types.h:297
Call(grpc_call *call, CallHook *call_hook, CompletionQueue *cq)
Definition: call.h:620
Send a message: 0 or more of these operations can occur for each call.
Definition: grpc_types.h:386
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:427
An abstract collection of CallOpSet's, to be used whenever CallOpSet objects must be thought of as a ...
Definition: call.h:532
Status Deserialize(grpc_byte_buffer *buf) override
Definition: call.h:327
Definition: metadata_map.h:41
WriteOptions()
Definition: call.h:87
bool FinalizeResult(void **tag, bool *status) override
Definition: call.h:610
struct grpc_op::@12::@19 recv_status_on_client
Definition: grpc_types.h:55
grpc_slice SliceReferencingString(const grpc::string &str)
Definition: slice.h:53
Definition: call.h:412
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:84
uint32_t flags() const
Returns raw flags bitset.
Definition: call.h:94
#define GRPC_SLICE_START_PTR(slice)
Definition: slice.h:126
grpc_metadata * FillMetadataArray(const std::multimap< grpc::string, grpc::string > &metadata)
Definition: call.h:68
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:190
void FillMap()
Definition: metadata_map.h:49
WriteOptions & set_no_compression()
Sets flag for the disabling of compression for the next message write.
Definition: call.h:99
#define GRPC_SLICE_END_PTR(slice)
Definition: slice.h:135
Definition: client_context.h:154
WriteOptions & operator=(const WriteOptions &rhs)
Definition: call.h:144
void FillOps(grpc_op *ops, size_t *nops) override
Fills in grpc_op, starting from ops[*nops] and moving upwards.
Definition: call.h:574
virtual void grpc_byte_buffer_destroy(grpc_byte_buffer *bb)=0
Defines how to serialize and deserialize some type.
Definition: serialization_traits.h:64
void SendInitialMetadata(const std::multimap< grpc::string, grpc::string > &metadata, uint32_t flags)
Definition: call.h:174
Definition: call.h:219
bool FinalizeResult(void **tag, bool *status) override
Definition: call.h:583
void FinishOp(bool *status)
Definition: call.h:442
bool send_
Definition: call.h:209
CallOpClientRecvStatus()
Definition: call.h:488
bool get_no_compression() const
Get value for the flag indicating whether compression for the next message write is forcefully disabl...
Definition: call.h:116
struct grpc_byte_buffer * send_message
Definition: grpc_types.h:449
void FinishOp(bool *status)
Definition: call.h:406
CallOpSet()
Definition: call.h:573
Definition: call.h:392
bool is_set
Definition: call.h:214
struct grpc_byte_buffer ** recv_message
Definition: grpc_types.h:472
CallOpSendInitialMetadata()
Definition: call.h:170
void AllowNoMessage()
Definition: call.h:353
CompletionQueue * cq() const
Definition: call.h:638
int max_receive_message_size() const
Definition: call.h:640
A single metadata element.
Definition: grpc_types.h:323
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:496
Definition: call.h:617
Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT which has no arguments) ...
Definition: grpc_types.h:426
Receive initial metadata: one and only one MUST be made on the client, must not be made on the server...
Definition: grpc_types.h:403
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:164
CoreCodegenInterface * g_core_codegen_interface
Definition: call.h:63
CallOpSetInterface()
Definition: call.h:542
Send initial metadata: one and only one instance MUST be sent for each call, unless the call was canc...
Definition: grpc_types.h:382
WriteOptions(const WriteOptions &other)
Definition: call.h:88
Primary implementaiton of CallOpSetInterface.
Definition: call.h:565
struct grpc_op::@12::@14 send_initial_metadata
virtual Status Deserialize(grpc_byte_buffer *buf)=0
void ClientSendClose()
Definition: call.h:396
Definition: call.h:267
Per-message write options.
Definition: call.h:85
CallOpClientSendClose()
Definition: call.h:394
std::shared_ptr< CallOpSetCollectionInterface > collection_
Definition: call.h:553
bool get_buffer_hint() const
Get value for the flag indicating that the write may be buffered and need not go out on the wire imme...
Definition: call.h:142
void FinishOp(bool *status)
Definition: call.h:291
CallOpRecvMessage()
Definition: call.h:269
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:101
Status SendMessage(const M &message, const WriteOptions &options) GRPC_MUST_USE_RESULT
Send message using options for the write.
Definition: call.h:255
virtual void PerformOpsOnCall(CallOpSetInterface *ops, Call *call)=0
~DeserializeFuncType() override
Definition: call.h:331
void FinishOp(bool *status)
Definition: call.h:243
struct grpc_op::@12::@16 send_status_from_server
virtual void grpc_slice_unref(grpc_slice slice)=0
void FinishOp(bool *status)
Definition: call.h:476
bool got_message
Definition: call.h:279
void ClientRecvStatus(ClientContext *context, Status *status)
Definition: call.h:490
Interface between the codegen library and the minimal subset of core features required by the generat...
Definition: core_codegen_interface.h:56
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:633
DeserializeFuncType(R *message)
Definition: call.h:326
Did it work? If it didn't, why?
Definition: status.h:45
Receive status on the client: one and only one must be made on the client.
Definition: grpc_types.h:413
Definition: call.h:168
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:467
uint32_t flags
Write flags bitset for grpc_begin_messages.
Definition: grpc_types.h:430
struct grpc::CallOpSendInitialMetadata::@0 maybe_compression_level_
grpc_call * call() const
Definition: call.h:637
void RecvMessage(R *message)
Definition: call.h:274
void * reserved
Reserved for future usage.
Definition: grpc_types.h:432
CallOpGenericRecvMessage()
Definition: call.h:340
virtual void gpr_free(void *p)=0
void set_compression_level(grpc_compression_level level)
Definition: call.h:184
bool got_message
Definition: call.h:355
A CallOpSet that does not post completions to the completion queue.
Definition: call.h:608
virtual void FillOps(grpc_op *ops, size_t *nops)=0
Fills in grpc_op, starting from ops[*nops] and moving upwards.
void FinishOp(bool *status)
Definition: call.h:507
uint32_t flags_
Definition: call.h:210
void set_output_tag(void *return_tag)
Definition: call.h:595
size_t initial_metadata_count_
Definition: call.h:211
Receive a message: 0 or more of these operations can occur for each call.
Definition: grpc_types.h:407
Channel and Server implement this to allow them to hook performing ops.
Definition: call_hook.h:43
void RecvInitialMetadata(ClientContext *context)
Definition: call.h:461
Definition: call.h:457
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:233
virtual ~DeserializeFunc()
Definition: call.h:320
struct grpc_metadata grpc_metadata
A single metadata element.
grpc_metadata * initial_metadata_
Definition: call.h:212
Definition: call.h:338
virtual void * gpr_malloc(size_t size)=0
void FinishOp(bool *status)
Definition: call.h:203