34 #ifndef GRPCXX_IMPL_CODEGEN_CALL_H
35 #define GRPCXX_IMPL_CODEGEN_CALL_H
69 const std::multimap<grpc::string, grpc::string>& metadata) {
70 if (metadata.empty()) {
77 for (
auto iter = metadata.cbegin(); iter != metadata.cend(); ++iter, ++i) {
81 return metadata_array;
91 inline void Clear() { flags_ = 0; }
94 inline uint32_t
flags()
const {
return flags_; }
150 void SetBit(
const uint32_t mask) { flags_ |= mask; }
152 void ClearBit(
const uint32_t mask) { flags_ &= ~mask; }
154 bool GetBit(
const uint32_t mask)
const {
return (flags_ & mask) != 0; }
175 const std::multimap<grpc::string, grpc::string>& metadata,
234 if (send_buf_ ==
nullptr)
return;
241 write_options_.
Clear();
257 write_options_ = options;
272 allow_not_getting_message_(false) {}
283 if (message_ ==
nullptr)
return;
292 if (message_ ==
nullptr)
return;
303 if (!allow_not_getting_message_) {
313 bool allow_not_getting_message_;
316 namespace CallOpGenericRecvMessageHelper {
341 :
got_message(false), allow_not_getting_message_(false) {}
349 deserialize_.reset(func);
359 if (!deserialize_)
return;
368 if (!deserialize_)
return;
372 *status = deserialize_->Deserialize(recv_buf_).ok();
379 if (!allow_not_getting_message_) {
383 deserialize_.reset();
387 std::unique_ptr<CallOpGenericRecvMessageHelper::DeserializeFunc> deserialize_;
389 bool allow_not_getting_message_;
417 const std::multimap<grpc::string, grpc::string>& trailing_metadata,
419 trailing_metadata_count_ = trailing_metadata.size();
421 send_status_available_ =
true;
428 if (!send_status_available_)
return;
432 trailing_metadata_count_;
437 send_status_details_.empty() ?
nullptr : &status_details_slice_;
443 if (!send_status_available_)
return;
445 send_status_available_ =
false;
449 bool send_status_available_;
452 size_t trailing_metadata_count_;
462 context->initial_metadata_received_ =
true;
463 metadata_map_ = &context->recv_initial_metadata_;
468 if (metadata_map_ ==
nullptr)
return;
477 if (metadata_map_ ==
nullptr)
return;
479 metadata_map_ =
nullptr;
491 metadata_map_ = &context->trailing_metadata_;
492 recv_status_ = status;
497 if (recv_status_ ==
nullptr)
return;
508 if (recv_status_ ==
nullptr)
return;
510 *recv_status_ =
Status(static_cast<StatusCode>(status_code_),
514 recv_status_ =
nullptr;
533 :
public std::enable_shared_from_this<CallOpSetCollectionInterface> {};
548 void SetCollection(std::shared_ptr<CallOpSetCollectionInterface> collection) {
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>>
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);
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);
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>>
612 return Base::FinalizeResult(tag, status) &&
false;
621 : call_hook_(call_hook),
624 max_receive_message_size_(-1) {}
628 : call_hook_(call_hook),
631 max_receive_message_size_(max_receive_message_size) {}
646 int max_receive_message_size_;
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
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
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
void AllowNoMessage()
Definition: call.h:277
void FinishOp(bool *status)
Definition: call.h:367
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:282
void Clear()
Clear all flags.
Definition: call.h:91
#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
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
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
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
bool FinalizeResult(void **tag, bool *status) override
Definition: call.h:583
void FinishOp(bool *status)
Definition: call.h:442
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
struct grpc_byte_buffer ** recv_message
Definition: grpc_types.h:472
void AllowNoMessage()
Definition: call.h:353
CompletionQueue * cq() const
Definition: call.h:638
int max_receive_message_size() const
Definition: call.h:640
void AddOp(grpc_op *ops, size_t *nops)
Definition: call.h:496
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
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
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
uint32_t flags
Write flags bitset for grpc_begin_messages.
Definition: grpc_types.h:430
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
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
void set_output_tag(void *return_tag)
Definition: call.h:595
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 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.
virtual void * gpr_malloc(size_t size)=0