GRPC C++  1.6.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 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPCXX_IMPL_CODEGEN_CALL_H
20 #define GRPCXX_IMPL_CODEGEN_CALL_H
21 
22 #include <assert.h>
23 #include <cstring>
24 #include <functional>
25 #include <map>
26 #include <memory>
27 
37 
38 #include <grpc/impl/codegen/atm.h>
41 
42 struct grpc_byte_buffer;
43 
44 namespace grpc {
45 
46 class ByteBuffer;
47 class Call;
48 class CallHook;
51 
52 const char kBinaryErrorDetailsKey[] = "grpc-status-details-bin";
53 
54 // TODO(yangg) if the map is changed before we send, the pointers will be a
55 // mess. Make sure it does not happen.
57  const std::multimap<grpc::string, grpc::string>& metadata,
58  size_t* metadata_count, const grpc::string& optional_error_details) {
59  *metadata_count = metadata.size() + (optional_error_details.empty() ? 0 : 1);
60  if (*metadata_count == 0) {
61  return nullptr;
62  }
63  grpc_metadata* metadata_array =
65  (*metadata_count) * sizeof(grpc_metadata)));
66  size_t i = 0;
67  for (auto iter = metadata.cbegin(); iter != metadata.cend(); ++iter, ++i) {
68  metadata_array[i].key = SliceReferencingString(iter->first);
69  metadata_array[i].value = SliceReferencingString(iter->second);
70  }
71  if (!optional_error_details.empty()) {
72  metadata_array[i].key =
75  metadata_array[i].value = SliceReferencingString(optional_error_details);
76  }
77  return metadata_array;
78 }
79 
81 class WriteOptions {
82  public:
83  WriteOptions() : flags_(0), last_message_(false) {}
84  WriteOptions(const WriteOptions& other)
85  : flags_(other.flags_), last_message_(other.last_message_) {}
86 
88  inline void Clear() { flags_ = 0; }
89 
91  inline uint32_t flags() const { return flags_; }
92 
97  SetBit(GRPC_WRITE_NO_COMPRESS);
98  return *this;
99  }
100 
105  ClearBit(GRPC_WRITE_NO_COMPRESS);
106  return *this;
107  }
108 
113  inline bool get_no_compression() const {
114  return GetBit(GRPC_WRITE_NO_COMPRESS);
115  }
116 
122  SetBit(GRPC_WRITE_BUFFER_HINT);
123  return *this;
124  }
125 
131  ClearBit(GRPC_WRITE_BUFFER_HINT);
132  return *this;
133  }
134 
139  inline bool get_buffer_hint() const { return GetBit(GRPC_WRITE_BUFFER_HINT); }
140 
144  SetBit(GRPC_WRITE_BUFFER_HINT);
145  return *this;
146  }
147 
149  ClearBit(GRPC_WRITE_BUFFER_HINT);
150  return *this;
151  }
152 
153  inline bool is_corked() const { return GetBit(GRPC_WRITE_BUFFER_HINT); }
154 
161  last_message_ = true;
162  return *this;
163  }
164 
168  last_message_ = false;
169  return *this;
170  }
171 
176  bool is_last_message() const { return last_message_; }
177 
179  flags_ = rhs.flags_;
180  return *this;
181  }
182 
183  private:
184  void SetBit(const uint32_t mask) { flags_ |= mask; }
185 
186  void ClearBit(const uint32_t mask) { flags_ &= ~mask; }
187 
188  bool GetBit(const uint32_t mask) const { return (flags_ & mask) != 0; }
189 
190  uint32_t flags_;
191  bool last_message_;
192 };
193 
196 template <int I>
197 class CallNoOp {
198  protected:
199  void AddOp(grpc_op* ops, size_t* nops) {}
200  void FinishOp(bool* status) {}
201 };
202 
204  public:
206  maybe_compression_level_.is_set = false;
207  }
208 
210  const std::multimap<grpc::string, grpc::string>& metadata,
211  uint32_t flags) {
212  maybe_compression_level_.is_set = false;
213  send_ = true;
214  flags_ = flags;
217  }
218 
220  maybe_compression_level_.is_set = true;
222  }
223 
224  protected:
225  void AddOp(grpc_op* ops, size_t* nops) {
226  if (!send_) return;
227  grpc_op* op = &ops[(*nops)++];
229  op->flags = flags_;
230  op->reserved = NULL;
235  if (maybe_compression_level_.is_set) {
238  }
239  }
240  void FinishOp(bool* status) {
241  if (!send_) return;
243  send_ = false;
244  }
245 
246  bool send_;
247  uint32_t flags_;
250  struct {
251  bool is_set;
254 };
255 
257  public:
258  CallOpSendMessage() : send_buf_(nullptr), own_buf_(false) {}
259 
262  template <class M>
263  Status SendMessage(const M& message,
265 
266  template <class M>
267  Status SendMessage(const M& message) GRPC_MUST_USE_RESULT;
268 
269  protected:
270  void AddOp(grpc_op* ops, size_t* nops) {
271  if (send_buf_ == nullptr) return;
272  grpc_op* op = &ops[(*nops)++];
273  op->op = GRPC_OP_SEND_MESSAGE;
274  op->flags = write_options_.flags();
275  op->reserved = NULL;
276  op->data.send_message.send_message = send_buf_;
277  // Flags are per-message: clear them after use.
278  write_options_.Clear();
279  }
280  void FinishOp(bool* status) {
281  if (own_buf_) g_core_codegen_interface->grpc_byte_buffer_destroy(send_buf_);
282  send_buf_ = nullptr;
283  }
284 
285  private:
286  grpc_byte_buffer* send_buf_;
287  WriteOptions write_options_;
288  bool own_buf_;
289 };
290 
291 template <class M>
293  write_options_ = options;
294  return SerializationTraits<M>::Serialize(message, &send_buf_, &own_buf_);
295 }
296 
297 template <class M>
299  return SendMessage(message, WriteOptions());
300 }
301 
302 template <class R>
304  public:
306  : got_message(false),
307  message_(nullptr),
308  allow_not_getting_message_(false) {}
309 
310  void RecvMessage(R* message) { message_ = message; }
311 
312  // Do not change status if no message is received.
313  void AllowNoMessage() { allow_not_getting_message_ = true; }
314 
316 
317  protected:
318  void AddOp(grpc_op* ops, size_t* nops) {
319  if (message_ == nullptr) return;
320  grpc_op* op = &ops[(*nops)++];
321  op->op = GRPC_OP_RECV_MESSAGE;
322  op->flags = 0;
323  op->reserved = NULL;
324  op->data.recv_message.recv_message = &recv_buf_;
325  }
326 
327  void FinishOp(bool* status) {
328  if (message_ == nullptr) return;
329  if (recv_buf_) {
330  if (*status) {
331  got_message = *status =
332  SerializationTraits<R>::Deserialize(recv_buf_, message_).ok();
333  } else {
334  got_message = false;
336  }
337  } else {
338  got_message = false;
339  if (!allow_not_getting_message_) {
340  *status = false;
341  }
342  }
343  message_ = nullptr;
344  }
345 
346  private:
347  R* message_;
348  grpc_byte_buffer* recv_buf_;
349  bool allow_not_getting_message_;
350 };
351 
352 namespace CallOpGenericRecvMessageHelper {
354  public:
355  virtual Status Deserialize(grpc_byte_buffer* buf) = 0;
356  virtual ~DeserializeFunc() {}
357 };
358 
359 template <class R>
360 class DeserializeFuncType final : public DeserializeFunc {
361  public:
362  DeserializeFuncType(R* message) : message_(message) {}
364  return SerializationTraits<R>::Deserialize(buf, message_);
365  }
366 
367  ~DeserializeFuncType() override {}
368 
369  private:
370  R* message_; // Not a managed pointer because management is external to this
371 };
372 } // namespace CallOpGenericRecvMessageHelper
373 
375  public:
377  : got_message(false), allow_not_getting_message_(false) {}
378 
379  template <class R>
380  void RecvMessage(R* message) {
381  // Use an explicit base class pointer to avoid resolution error in the
382  // following unique_ptr::reset for some old implementations.
385  deserialize_.reset(func);
386  }
387 
388  // Do not change status if no message is received.
389  void AllowNoMessage() { allow_not_getting_message_ = true; }
390 
392 
393  protected:
394  void AddOp(grpc_op* ops, size_t* nops) {
395  if (!deserialize_) return;
396  grpc_op* op = &ops[(*nops)++];
397  op->op = GRPC_OP_RECV_MESSAGE;
398  op->flags = 0;
399  op->reserved = NULL;
400  op->data.recv_message.recv_message = &recv_buf_;
401  }
402 
403  void FinishOp(bool* status) {
404  if (!deserialize_) return;
405  if (recv_buf_) {
406  if (*status) {
407  got_message = true;
408  *status = deserialize_->Deserialize(recv_buf_).ok();
409  } else {
410  got_message = false;
412  }
413  } else {
414  got_message = false;
415  if (!allow_not_getting_message_) {
416  *status = false;
417  }
418  }
419  deserialize_.reset();
420  }
421 
422  private:
423  std::unique_ptr<CallOpGenericRecvMessageHelper::DeserializeFunc> deserialize_;
424  grpc_byte_buffer* recv_buf_;
425  bool allow_not_getting_message_;
426 };
427 
429  public:
430  CallOpClientSendClose() : send_(false) {}
431 
432  void ClientSendClose() { send_ = true; }
433 
434  protected:
435  void AddOp(grpc_op* ops, size_t* nops) {
436  if (!send_) return;
437  grpc_op* op = &ops[(*nops)++];
439  op->flags = 0;
440  op->reserved = NULL;
441  }
442  void FinishOp(bool* status) { send_ = false; }
443 
444  private:
445  bool send_;
446 };
447 
449  public:
450  CallOpServerSendStatus() : send_status_available_(false) {}
451 
453  const std::multimap<grpc::string, grpc::string>& trailing_metadata,
454  const Status& status) {
455  send_error_details_ = status.error_details();
456  trailing_metadata_ = FillMetadataArray(
457  trailing_metadata, &trailing_metadata_count_, send_error_details_);
458  send_status_available_ = true;
459  send_status_code_ = static_cast<grpc_status_code>(status.error_code());
460  send_error_message_ = status.error_message();
461  }
462 
463  protected:
464  void AddOp(grpc_op* ops, size_t* nops) {
465  if (!send_status_available_) return;
466  grpc_op* op = &ops[(*nops)++];
469  trailing_metadata_count_;
470  op->data.send_status_from_server.trailing_metadata = trailing_metadata_;
471  op->data.send_status_from_server.status = send_status_code_;
472  error_message_slice_ = SliceReferencingString(send_error_message_);
474  send_error_message_.empty() ? nullptr : &error_message_slice_;
475  op->flags = 0;
476  op->reserved = NULL;
477  }
478 
479  void FinishOp(bool* status) {
480  if (!send_status_available_) return;
481  g_core_codegen_interface->gpr_free(trailing_metadata_);
482  send_status_available_ = false;
483  }
484 
485  private:
486  bool send_status_available_;
487  grpc_status_code send_status_code_;
488  grpc::string send_error_details_;
489  grpc::string send_error_message_;
490  size_t trailing_metadata_count_;
491  grpc_metadata* trailing_metadata_;
492  grpc_slice error_message_slice_;
493 };
494 
496  public:
497  CallOpRecvInitialMetadata() : metadata_map_(nullptr) {}
498 
500  context->initial_metadata_received_ = true;
501  metadata_map_ = &context->recv_initial_metadata_;
502  }
503 
504  protected:
505  void AddOp(grpc_op* ops, size_t* nops) {
506  if (metadata_map_ == nullptr) return;
507  grpc_op* op = &ops[(*nops)++];
509  op->data.recv_initial_metadata.recv_initial_metadata = metadata_map_->arr();
510  op->flags = 0;
511  op->reserved = NULL;
512  }
513 
514  void FinishOp(bool* status) {
515  if (metadata_map_ == nullptr) return;
516  metadata_map_->FillMap();
517  metadata_map_ = nullptr;
518  }
519 
520  private:
521  MetadataMap* metadata_map_;
522 };
523 
525  public:
526  CallOpClientRecvStatus() : recv_status_(nullptr) {}
527 
528  void ClientRecvStatus(ClientContext* context, Status* status) {
529  metadata_map_ = &context->trailing_metadata_;
530  recv_status_ = status;
531  error_message_ = g_core_codegen_interface->grpc_empty_slice();
532  }
533 
534  protected:
535  void AddOp(grpc_op* ops, size_t* nops) {
536  if (recv_status_ == nullptr) return;
537  grpc_op* op = &ops[(*nops)++];
539  op->data.recv_status_on_client.trailing_metadata = metadata_map_->arr();
540  op->data.recv_status_on_client.status = &status_code_;
541  op->data.recv_status_on_client.status_details = &error_message_;
542  op->flags = 0;
543  op->reserved = NULL;
544  }
545 
546  void FinishOp(bool* status) {
547  if (recv_status_ == nullptr) return;
548  metadata_map_->FillMap();
549  grpc::string binary_error_details;
550  auto iter = metadata_map_->map()->find(kBinaryErrorDetailsKey);
551  if (iter != metadata_map_->map()->end()) {
552  binary_error_details =
553  grpc::string(iter->second.begin(), iter->second.length());
554  }
555  *recv_status_ = Status(static_cast<StatusCode>(status_code_),
556  grpc::string(GRPC_SLICE_START_PTR(error_message_),
557  GRPC_SLICE_END_PTR(error_message_)),
558  binary_error_details);
560  recv_status_ = nullptr;
561  }
562 
563  private:
564  MetadataMap* metadata_map_;
565  Status* recv_status_;
566  grpc_status_code status_code_;
567  grpc_slice error_message_;
568 };
569 
576  public:
579  virtual void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) = 0;
580 };
581 
588 template <class Op1 = CallNoOp<1>, class Op2 = CallNoOp<2>,
589  class Op3 = CallNoOp<3>, class Op4 = CallNoOp<4>,
590  class Op5 = CallNoOp<5>, class Op6 = CallNoOp<6>>
592  public Op1,
593  public Op2,
594  public Op3,
595  public Op4,
596  public Op5,
597  public Op6 {
598  public:
599  CallOpSet() : return_tag_(this) {}
600  void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) override {
601  this->Op1::AddOp(ops, nops);
602  this->Op2::AddOp(ops, nops);
603  this->Op3::AddOp(ops, nops);
604  this->Op4::AddOp(ops, nops);
605  this->Op5::AddOp(ops, nops);
606  this->Op6::AddOp(ops, nops);
608  call_ = call;
609  }
610 
611  bool FinalizeResult(void** tag, bool* status) override {
612  this->Op1::FinishOp(status);
613  this->Op2::FinishOp(status);
614  this->Op3::FinishOp(status);
615  this->Op4::FinishOp(status);
616  this->Op5::FinishOp(status);
617  this->Op6::FinishOp(status);
618  *tag = return_tag_;
619 
621  return true;
622  }
623 
624  void set_output_tag(void* return_tag) { return_tag_ = return_tag; }
625 
626  private:
627  void* return_tag_;
628  grpc_call* call_;
629 };
630 
635 template <class Op1 = CallNoOp<1>, class Op2 = CallNoOp<2>,
636  class Op3 = CallNoOp<3>, class Op4 = CallNoOp<4>,
637  class Op5 = CallNoOp<5>, class Op6 = CallNoOp<6>>
638 class SneakyCallOpSet : public CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> {
639  public:
640  bool FinalizeResult(void** tag, bool* status) override {
642  return Base::FinalizeResult(tag, status) && false;
643  }
644 };
645 
647 class Call final {
648  public:
651  : call_hook_(call_hook),
652  cq_(cq),
653  call_(call),
654  max_receive_message_size_(-1) {}
655 
658  : call_hook_(call_hook),
659  cq_(cq),
660  call_(call),
661  max_receive_message_size_(max_receive_message_size) {}
662 
664  call_hook_->PerformOpsOnCall(ops, this);
665  }
666 
667  grpc_call* call() const { return call_; }
668  CompletionQueue* cq() const { return cq_; }
669 
670  int max_receive_message_size() const { return max_receive_message_size_; }
671 
672  private:
673  CallHook* call_hook_;
674  CompletionQueue* cq_;
675  grpc_call* call_;
676  int max_receive_message_size_;
677 };
678 
679 } // namespace grpc
680 
681 #endif // GRPCXX_IMPL_CODEGEN_CALL_H
void ServerSendStatus(const std::multimap< grpc::string, grpc::string > &trailing_metadata, const Status &status)
Definition: call.h:452
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:71
CallOpRecvInitialMetadata()
Definition: call.h:497
grpc_op_type op
Operation type, as defined by grpc_op_type.
Definition: grpc_types.h:489
grpc_metadata_array * recv_initial_metadata
Definition: grpc_types.h:527
union grpc_op::grpc_op_data data
void RecvMessage(R *message)
Definition: call.h:380
Call(grpc_call *call, CallHook *call_hook, CompletionQueue *cq, int max_receive_message_size)
Definition: call.h:656
bool is_corked() const
Definition: call.h:153
void * reserved
Reserved for future usage.
Definition: grpc_types.h:493
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:25
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:130
Default argument for CallOpSet.
Definition: call.h:197
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:435
CallOpServerSendStatus()
Definition: call.h:450
void FinishOp(bool *status)
Definition: call.h:200
grpc_status_code
Definition: status.h:26
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:121
virtual void grpc_call_ref(grpc_call *call)=0
grpc::string error_message() const
Return the instance's error message.
Definition: status.h:58
CallOpSendMessage()
Definition: call.h:258
std::string string
Definition: config.h:35
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:394
WriteOptions & clear_no_compression()
Clears flag for the disabling of compression for the next message write.
Definition: call.h:104
struct grpc_byte_buffer ** recv_message
Definition: grpc_types.h:533
struct grpc_byte_buffer * send_message
Definition: grpc_types.h:510
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:454
An abstract collection of call ops, used to generate the grpc_call_op structure to pass down to the l...
Definition: call.h:575
Send status from the server: one and only one instance MUST be sent from the server unless the call w...
Definition: grpc_types.h:459
WriteOptions & set_last_message()
last-message bit: indicates this is the last message in a stream client-side: makes Write the equival...
Definition: call.h:160
#define GRPC_WRITE_NO_COMPRESS
Force compression to be disabled for a particular write (start_write/add_metadata).
Definition: grpc_types.h:357
grpc_metadata_array * arr()
Definition: metadata_map.h:47
void AllowNoMessage()
Definition: call.h:313
grpc_slice key
the key, value values are expected to line up with grpc_mdelem: if changing them, update metadata...
Definition: grpc_types.h:386
void FinishOp(bool *status)
Definition: call.h:403
Definition: call.h:524
struct grpc_op::grpc_op_data::grpc_op_recv_message recv_message
grpc_slice value
Definition: grpc_types.h:387
grpc_slice * status_details
Definition: grpc_types.h:543
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:318
void Clear()
Clear all flags.
Definition: call.h:88
grpc_compression_level level
Definition: call.h:252
virtual grpc_slice grpc_empty_slice()=0
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1]. ...
Definition: slice.h:76
#define GRPC_WRITE_BUFFER_HINT
Write Flags:
Definition: grpc_types.h:354
const char kBinaryErrorDetailsKey[]
Definition: call.h:52
Call(grpc_call *call, CallHook *call_hook, CompletionQueue *cq)
call is owned by the caller
Definition: call.h:650
Send a message: 0 or more of these operations can occur for each call.
Definition: grpc_types.h:449
virtual void grpc_call_unref(grpc_call *call)=0
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:464
WriteOptions & clear_last_messsage()
Clears flag indicating that this is the last message in a stream, disabling coalescing.
Definition: call.h:167
Status Deserialize(grpc_byte_buffer *buf) override
Definition: call.h:363
Definition: metadata_map.h:26
WriteOptions()
Definition: call.h:83
bool FinalizeResult(void **tag, bool *status) override
Called prior to returning from Next(), return value is the status of the operation (return status is ...
Definition: call.h:640
Definition: grpc_types.h:41
grpc_slice SliceReferencingString(const grpc::string &str)
Definition: slice.h:38
Definition: call.h:448
struct grpc_op::grpc_op_data::grpc_op_send_initial_metadata::grpc_op_send_initial_metadata_maybe_compression_level maybe_compression_level
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:68
uint32_t flags() const
Returns raw flags bitset.
Definition: call.h:91
#define GRPC_SLICE_START_PTR(slice)
Definition: slice.h:112
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:225
grpc_metadata_array * trailing_metadata
ownership of the array is with the caller, but ownership of the elements stays with the call object (...
Definition: grpc_types.h:541
void FillMap()
Definition: metadata_map.h:34
WriteOptions & clear_corked()
Definition: call.h:148
WriteOptions & set_no_compression()
Sets flag for the disabling of compression for the next message write.
Definition: call.h:96
#define GRPC_SLICE_END_PTR(slice)
Definition: slice.h:121
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:153
WriteOptions & operator=(const WriteOptions &rhs)
Definition: call.h:178
virtual void grpc_byte_buffer_destroy(grpc_byte_buffer *bb)=0
Defines how to serialize and deserialize some type.
Definition: serialization_traits.h:49
void SendInitialMetadata(const std::multimap< grpc::string, grpc::string > &metadata, uint32_t flags)
Definition: call.h:209
Definition: call.h:256
bool FinalizeResult(void **tag, bool *status) override
Called prior to returning from Next(), return value is the status of the operation (return status is ...
Definition: call.h:611
void FinishOp(bool *status)
Definition: call.h:479
bool send_
Definition: call.h:246
CallOpClientRecvStatus()
Definition: call.h:526
bool get_no_compression() const
Get value for the flag indicating whether compression for the next message write is forcefully disabl...
Definition: call.h:113
void FinishOp(bool *status)
Definition: call.h:442
CallOpSet()
Definition: call.h:599
Definition: call.h:428
Status SendMessage(const M &message, WriteOptions options) GRPC_MUST_USE_RESULT
Send message using options for the write.
Definition: call.h:292
bool is_set
Definition: call.h:251
CallOpSendInitialMetadata()
Definition: call.h:205
void AllowNoMessage()
Definition: call.h:389
CompletionQueue * cq() const
Definition: call.h:668
int max_receive_message_size() const
Definition: call.h:670
struct grpc_op::grpc_op_data::grpc_op_recv_initial_metadata recv_initial_metadata
A single metadata element.
Definition: grpc_types.h:383
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:535
struct grpc_op::grpc_op_data::grpc_op_send_initial_metadata send_initial_metadata
Straightforward wrapping of the C call object.
Definition: call.h:647
Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT which has no arguments) ...
Definition: grpc_types.h:487
virtual grpc_slice grpc_slice_from_static_buffer(const void *buffer, size_t length)=0
Receive initial metadata: one and only one MUST be made on the client, must not be made on the server...
Definition: grpc_types.h:464
std::multimap< grpc::string_ref, grpc::string_ref > * map()
Definition: metadata_map.h:43
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:199
struct grpc_op::grpc_op_data::grpc_op_send_message send_message
CoreCodegenInterface * g_core_codegen_interface
Definition: call.h:49
#define GRPC_MUST_USE_RESULT
Definition: port_platform.h:375
Send initial metadata: one and only one instance MUST be sent for each call, unless the call was canc...
Definition: grpc_types.h:445
WriteOptions(const WriteOptions &other)
Definition: call.h:84
Primary implementaiton of CallOpSetInterface.
Definition: call.h:591
virtual Status Deserialize(grpc_byte_buffer *buf)=0
void ClientSendClose()
Definition: call.h:432
Definition: call.h:303
Per-message write options.
Definition: call.h:81
grpc_slice * status_details
optional: set to NULL if no details need sending, non-NULL if they do pointer will not be retained pa...
Definition: grpc_types.h:519
CallOpClientSendClose()
Definition: call.h:430
size_t trailing_metadata_count
Definition: grpc_types.h:513
grpc_metadata * metadata
Definition: grpc_types.h:501
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:139
virtual void FillOps(grpc_call *call, 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:327
CallOpRecvMessage()
Definition: call.h:305
StatusCode error_code() const
Return the instance's error code.
Definition: status.h:56
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:86
virtual void PerformOpsOnCall(CallOpSetInterface *ops, Call *call)=0
~DeserializeFuncType() override
Definition: call.h:367
void FinishOp(bool *status)
Definition: call.h:280
virtual void grpc_slice_unref(grpc_slice slice)=0
void FinishOp(bool *status)
Definition: call.h:514
bool got_message
Definition: call.h:315
grpc::string error_details() const
Return the (binary) error details.
Definition: status.h:61
void ClientRecvStatus(ClientContext *context, Status *status)
Definition: call.h:528
struct grpc_op::grpc_op_data::grpc_op_send_status_from_server send_status_from_server
Interface between the codegen library and the minimal subset of core features required by the generat...
Definition: core_codegen_interface.h:41
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:663
WriteOptions & set_corked()
corked bit: aliases set_buffer_hint currently, with the intent that set_buffer_hint will be removed i...
Definition: call.h:143
DeserializeFuncType(R *message)
Definition: call.h:362
Did it work? If it didn't, why?
Definition: status.h:30
Receive status on the client: one and only one must be made on the client.
Definition: grpc_types.h:474
Definition: call.h:203
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:505
grpc_status_code status
Definition: grpc_types.h:515
grpc_status_code * status
Definition: grpc_types.h:542
size_t count
Definition: grpc_types.h:500
uint32_t flags
Write flags bitset for grpc_begin_messages.
Definition: grpc_types.h:491
void FillOps(grpc_call *call, grpc_op *ops, size_t *nops) override
Fills in grpc_op, starting from ops[*nops] and moving upwards.
Definition: call.h:600
grpc_metadata * FillMetadataArray(const std::multimap< grpc::string, grpc::string > &metadata, size_t *metadata_count, const grpc::string &optional_error_details)
Definition: call.h:56
struct grpc::CallOpSendInitialMetadata::@0 maybe_compression_level_
grpc_call * call() const
Definition: call.h:667
void RecvMessage(R *message)
Definition: call.h:310
CallOpGenericRecvMessage()
Definition: call.h:376
virtual void gpr_free(void *p)=0
void set_compression_level(grpc_compression_level level)
Definition: call.h:219
bool got_message
Definition: call.h:391
A CallOpSet that does not post completions to the completion queue.
Definition: call.h:638
void FinishOp(bool *status)
Definition: call.h:546
uint32_t flags_
Definition: call.h:247
void set_output_tag(void *return_tag)
Definition: call.h:624
size_t initial_metadata_count_
Definition: call.h:248
Receive a message: 0 or more of these operations can occur for each call.
Definition: grpc_types.h:468
This is an interface that Channel and Server implement to allow them to hook performing ops...
Definition: call_hook.h:29
void RecvInitialMetadata(ClientContext *context)
Definition: call.h:499
Definition: call.h:495
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:270
virtual ~DeserializeFunc()
Definition: call.h:356
bool is_last_message() const
Get value for the flag indicating that this is the last message, and should be coalesced with trailin...
Definition: call.h:176
grpc_metadata * initial_metadata_
Definition: call.h:249
Definition: call.h:374
grpc_metadata * trailing_metadata
Definition: grpc_types.h:514
struct grpc_op::grpc_op_data::grpc_op_recv_status_on_client recv_status_on_client
virtual void * gpr_malloc(size_t size)=0
void FinishOp(bool *status)
Definition: call.h:240