34 #ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H 35 #define GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H 54 struct census_context;
60 class ChannelInterface;
61 class CompletionQueue;
62 class CallCredentials;
67 class CallOpClientRecvStatus;
68 class CallOpRecvInitialMetadata;
69 template <
class InputMessage,
class OutputMessage>
70 class BlockingUnaryCallImpl;
77 template <
class W,
class R>
78 class ClientReaderWriter;
80 class ClientAsyncReader;
82 class ClientAsyncWriter;
83 template <
class W,
class R>
84 class ClientAsyncReaderWriter;
86 class ClientAsyncResponseReader;
145 class InteropClientContextInspector;
177 static std::unique_ptr<ClientContext> FromServerContext(
202 const std::multimap<grpc::string_ref, grpc::string_ref>&
205 return *recv_initial_metadata_.map();
214 const std::multimap<grpc::string_ref, grpc::string_ref>&
217 return *trailing_metadata_.map();
226 template <
typename T>
251 wait_for_ready_ = wait_for_ready;
252 wait_for_ready_explicitly_set_ =
true;
259 std::chrono::system_clock::time_point
deadline()
const {
274 if (auth_context_.get() ==
nullptr) {
277 return auth_context_;
296 return compression_algorithm_;
315 initial_metadata_corked_ = corked;
330 return census_context_;
372 friend class ::grpc::testing::InteropClientContextInspector;
373 friend class ::grpc::internal::CallOpClientRecvStatus;
374 friend class ::grpc::internal::CallOpRecvInitialMetadata;
377 friend class ::grpc::ClientReader;
379 friend class ::grpc::ClientWriter;
380 template <
class W,
class R>
381 friend class ::grpc::ClientReaderWriter;
383 friend class ::grpc::ClientAsyncReader;
385 friend class ::grpc::ClientAsyncWriter;
386 template <
class W,
class R>
387 friend class ::grpc::ClientAsyncReaderWriter;
389 friend class ::grpc::ClientAsyncResponseReader;
390 template <
class InputMessage,
class OutputMessage>
391 friend class ::grpc::internal::BlockingUnaryCallImpl;
394 void set_debug_error_string(
const grpc::string& debug_error_string) {
395 debug_error_string_ = debug_error_string;
398 grpc_call* call()
const {
return call_; }
399 void set_call(
grpc_call* call,
const std::shared_ptr<Channel>& channel);
401 uint32_t initial_metadata_flags()
const {
405 (wait_for_ready_explicitly_set_
413 bool initial_metadata_received_;
414 bool wait_for_ready_;
415 bool wait_for_ready_explicitly_set_;
418 std::shared_ptr<Channel> channel_;
424 std::shared_ptr<CallCredentials> creds_;
425 mutable std::shared_ptr<const AuthContext> auth_context_;
426 struct census_context* census_context_;
427 std::multimap<grpc::string, grpc::string> send_initial_metadata_;
435 bool initial_metadata_corked_;
442 #endif // GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H const std::multimap< grpc::string_ref, grpc::string_ref > & GetServerInitialMetadata() const
Return a collection of initial metadata key-value pairs.
Definition: client_context.h:203
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
std::shared_ptr< const AuthContext > CreateAuthContext(grpc_call *call)
grpc::string debug_error_string() const
EXPERIMENTAL debugging API.
Definition: client_context.h:365
struct census_context * census_context() const
Definition: client_context.h:329
void set_idempotent(bool idempotent)
EXPERIMENTAL: Indicate that this request is idempotent.
Definition: client_context.h:237
PropagationOptions & enable_census_tracing_propagation()
Definition: client_context.h:118
PropagationOptions & enable_deadline_propagation()
Definition: client_context.h:98
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:138
std::string string
Definition: config.h:35
const std::multimap< grpc::string_ref, grpc::string_ref > & GetServerTrailingMetadata() const
Return a collection of trailing metadata key-value pairs.
Definition: client_context.h:215
void set_wait_for_ready(bool wait_for_ready)
EXPERIMENTAL: Trigger wait-for-ready or not on this request.
Definition: client_context.h:250
grpc_call * c_call()
Should be used for framework-level extensions only.
Definition: client_context.h:358
void set_deadline(const T &deadline)
Set the deadline for the client call.
Definition: client_context.h:227
void set_initial_metadata_corked(bool corked)
Flag whether the initial metadata should be corked.
Definition: client_context.h:314
PropagationOptions & disable_cancellation_propagation()
Definition: client_context.h:133
PropagationOptions & enable_census_stats_propagation()
Definition: client_context.h:108
#define GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET
Signal that GRPC_INITIAL_METADATA_WAIT_FOR_READY was explicitly set by the calling application...
Definition: grpc_types.h:410
gpr_timespec raw_time()
Definition: time.h:43
If you are trying to use CompletionQueue::AsyncNext with a time class that isn't either gpr_timespec ...
Definition: time.h:40
PropagationOptions & enable_cancellation_propagation()
Definition: client_context.h:128
#define GRPC_INITIAL_METADATA_CORKED
Signal that the initial metadata should be corked.
Definition: grpc_types.h:412
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:162
uint32_t c_bitmask() const
Definition: client_context.h:138
Options for ClientContext::FromServerContext specifying which traits from the ServerContext to propag...
Definition: client_context.h:94
void set_fail_fast(bool fail_fast)
DEPRECATED: Use set_wait_for_ready() instead.
Definition: client_context.h:256
void set_census_context(struct census_context *ccp)
Get and set census context.
Definition: client_context.h:328
std::shared_ptr< const AuthContext > auth_context() const
Return the authentication context for this client call.
Definition: client_context.h:273
#define GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT
Definition: propagation_bits.h:34
void set_cacheable(bool cacheable)
EXPERIMENTAL: Set this request to be cacheable.
Definition: client_context.h:242
Global Callbacks.
Definition: client_context.h:348
grpc_compression_algorithm
The various compression algorithms supported by gRPC.
Definition: compression_types.h:56
grpc_compression_algorithm compression_algorithm() const
Return the compression algorithm the client call will request be used.
Definition: client_context.h:295
An Alarm posts the user provided tag to its associated completion queue upon expiry or cancellation...
Definition: alarm.h:31
#define GRPC_INITIAL_METADATA_CACHEABLE_REQUEST
Signal that the call is cacheable.
Definition: grpc_types.h:407
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:96
PropagationOptions & disable_census_tracing_propagation()
Definition: client_context.h:123
#define GRPC_INITIAL_METADATA_WAIT_FOR_READY
Signal that the call should not return UNAVAILABLE before it has started.
Definition: grpc_types.h:405
#define GRPC_PROPAGATE_DEFAULTS
Default propagation mask: clients of the core API are encouraged to encode deltas from this in their ...
Definition: propagation_bits.h:43
#define GRPC_PROPAGATE_CENSUS_STATS_CONTEXT
Propagate census context.
Definition: propagation_bits.h:33
void set_authority(const grpc::string &authority)
Set the per call authority header (see https://tools.ietf.org/html/rfc7540#section-8.1.2.3).
Definition: client_context.h:268
Analogous to struct timespec.
Definition: gpr_types.h:47
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t)
#define GRPC_PROPAGATE_DEADLINE
Propagation bits: this can be bitwise or-ed to form propagation_mask for grpc_call.
Definition: propagation_bits.h:31
PropagationOptions()
Definition: client_context.h:96
gpr_timespec raw_deadline() const
Return a gpr_timespec representation of the client call's deadline.
Definition: client_context.h:264
void set_credentials(const std::shared_ptr< CallCredentials > &creds)
Set credentials for the client call.
Definition: client_context.h:288
PropagationOptions & disable_deadline_propagation()
Definition: client_context.h:103
std::chrono::system_clock::time_point deadline() const
Return the deadline for the client call.
Definition: client_context.h:259
PropagationOptions & disable_census_stats_propagation()
Definition: client_context.h:113
virtual ~GlobalCallbacks()
Definition: client_context.h:350
#define GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST
Initial metadata flags.
Definition: grpc_types.h:403
#define GRPC_PROPAGATE_CANCELLATION
Propagate cancellation.
Definition: propagation_bits.h:36
Channels represent a connection to an endpoint. Created by CreateChannel.
Definition: channel.h:34