49 #ifndef GRPCXX_IMPL_CODEGEN_CLIENT_CONTEXT_H
50 #define GRPCXX_IMPL_CODEGEN_CLIENT_CONTEXT_H
69 struct census_context;
75 class ChannelInterface;
76 class CompletionQueue;
77 class CallCredentials;
83 template <
class W,
class R>
84 class ClientReaderWriter;
86 class ClientAsyncReader;
88 class ClientAsyncWriter;
89 template <
class W,
class R>
90 class ClientAsyncReaderWriter;
92 class ClientAsyncResponseReader;
151 class InteropClientContextInspector;
208 const std::multimap<grpc::string_ref, grpc::string_ref>&
211 return *recv_initial_metadata_.
map();
220 const std::multimap<grpc::string_ref, grpc::string_ref>&
223 return *trailing_metadata_.
map();
232 template <
typename T>
257 wait_for_ready_ = wait_for_ready;
258 wait_for_ready_explicitly_set_ =
true;
265 std::chrono::system_clock::time_point
deadline()
const {
280 if (auth_context_.get() ==
nullptr) {
283 return auth_context_;
300 return compression_algorithm_;
316 initial_metadata_corked_ = corked;
331 return census_context_;
362 friend class ::grpc::testing::InteropClientContextInspector;
367 friend class ::grpc::ClientReader;
369 friend class ::grpc::ClientWriter;
370 template <
class W,
class R>
371 friend class ::grpc::ClientReaderWriter;
373 friend class ::grpc::ClientAsyncReader;
375 friend class ::grpc::ClientAsyncWriter;
376 template <
class W,
class R>
377 friend class ::grpc::ClientAsyncReaderWriter;
379 friend class ::grpc::ClientAsyncResponseReader;
380 template <
class InputMessage,
class OutputMessage>
384 const InputMessage& request,
385 OutputMessage* result);
387 grpc_call* call()
const {
return call_; }
388 void set_call(
grpc_call* call,
const std::shared_ptr<Channel>& channel);
390 uint32_t initial_metadata_flags()
const {
394 (wait_for_ready_explicitly_set_
402 bool initial_metadata_received_;
403 bool wait_for_ready_;
404 bool wait_for_ready_explicitly_set_;
407 std::shared_ptr<Channel> channel_;
413 std::shared_ptr<CallCredentials> creds_;
414 mutable std::shared_ptr<const AuthContext> auth_context_;
416 std::multimap<grpc::string, grpc::string> send_initial_metadata_;
417 MetadataMap recv_initial_metadata_;
418 MetadataMap trailing_metadata_;
421 PropagationOptions propagation_options_;
424 bool initial_metadata_corked_;
429 #endif // GRPCXX_IMPL_CODEGEN_CLIENT_CONTEXT_H
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:86
std::shared_ptr< const AuthContext > CreateAuthContext(grpc_call *call)
void set_idempotent(bool idempotent)
EXPERIMENTAL: Indicate that this request is idempotent.
Definition: client_context.h:243
PropagationOptions & enable_census_tracing_propagation()
Definition: client_context.h:124
PropagationOptions & enable_deadline_propagation()
Definition: client_context.h:104
std::string string
Definition: config.h:50
void set_wait_for_ready(bool wait_for_ready)
EXPERIMENTAL: Trigger wait-for-ready or not on this request.
Definition: client_context.h:256
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:137
grpc_call * c_call()
Should be used for framework-level extensions only.
Definition: client_context.h:355
void set_deadline(const T &deadline)
Set the deadline for the client call.
Definition: client_context.h:233
grpc::string peer() const
Return the peer uri in a string.
void set_initial_metadata_corked(bool corked)
Flag whether the initial metadata should be corked.
Definition: client_context.h:315
PropagationOptions & disable_cancellation_propagation()
Definition: client_context.h:139
PropagationOptions & enable_census_stats_propagation()
Definition: client_context.h:114
#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:371
gpr_timespec raw_time()
Definition: time.h:56
If you are trying to use CompletionQueue::AsyncNext with a time class that isn't either gpr_timespec ...
Definition: time.h:53
PropagationOptions & enable_cancellation_propagation()
Definition: client_context.h:134
#define GRPC_INITIAL_METADATA_CORKED
Signal that the initial metadata should be corked.
Definition: grpc_types.h:373
virtual void Destructor(ClientContext *context)=0
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:168
std::shared_ptr< const AuthContext > auth_context() const
Return the authentication context for this client call.
Definition: client_context.h:279
struct census_context * census_context() const
Definition: client_context.h:330
void TryCancel()
Send a best-effort out-of-band cancel on the call associated with this client context.
Options for ClientContext::FromServerContext specifying which traits from the ServerContext to propag...
Definition: client_context.h:100
void set_fail_fast(bool fail_fast)
DEPRECATED: Use set_wait_for_ready() instead.
Definition: client_context.h:262
void set_census_context(struct census_context *ccp)
Get and set census context.
Definition: client_context.h:329
#define GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT
Definition: propagation_bits.h:49
void set_cacheable(bool cacheable)
EXPERIMENTAL: Set this request to be cacheable.
Definition: client_context.h:248
Global Callbacks.
Definition: client_context.h:345
grpc_compression_algorithm
The various compression algorithms supported by gRPC.
Definition: compression_types.h:71
grpc_compression_algorithm compression_algorithm() const
Return the compression algorithm to be used by the client call.
Definition: client_context.h:299
friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const InputMessage &request, OutputMessage *result)
Wrapper that performs a blocking unary call.
Definition: client_unary_call.h:52
Codegen interface for grpc::Channel.
Definition: channel_interface.h:64
#define GRPC_INITIAL_METADATA_CACHEABLE_REQUEST
Signal that the call is cacheable.
Definition: grpc_types.h:368
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:109
const std::multimap< grpc::string_ref, grpc::string_ref > & GetServerTrailingMetadata() const
Return a collection of trailing metadata key-value pairs.
Definition: client_context.h:221
static void SetGlobalCallbacks(GlobalCallbacks *callbacks)
PropagationOptions & disable_census_tracing_propagation()
Definition: client_context.h:129
#define GRPC_INITIAL_METADATA_WAIT_FOR_READY
Signal that the call should not return UNAVAILABLE before it has started.
Definition: grpc_types.h:366
Descriptor of an RPC method.
Definition: rpc_method.h:44
gpr_timespec raw_deadline() const
Return a gpr_timespec representation of the client call's deadline.
Definition: client_context.h:270
#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:58
#define GRPC_PROPAGATE_CENSUS_STATS_CONTEXT
Propagate census context.
Definition: propagation_bits.h:48
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:274
std::chrono::system_clock::time_point deadline() const
Return the deadline for the client call.
Definition: client_context.h:265
Did it work? If it didn't, why?
Definition: status.h:45
Analogous to struct timespec.
Definition: gpr_types.h:62
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t)
virtual void DefaultConstructor(ClientContext *context)=0
const std::multimap< grpc::string_ref, grpc::string_ref > & GetServerInitialMetadata() const
Return a collection of initial metadata key-value pairs.
Definition: client_context.h:209
#define GRPC_PROPAGATE_DEADLINE
Propagation bits: this can be bitwise or-ed to form propagation_mask for grpc_call.
Definition: propagation_bits.h:46
PropagationOptions()
Definition: client_context.h:102
uint32_t c_bitmask() const
Definition: client_context.h:144
void set_credentials(const std::shared_ptr< CallCredentials > &creds)
Set credentials for the client call.
Definition: client_context.h:294
void set_compression_algorithm(grpc_compression_algorithm algorithm)
Set algorithm to be the compression algorithm used for the client call.
PropagationOptions & disable_deadline_propagation()
Definition: client_context.h:109
static std::unique_ptr< ClientContext > FromServerContext(const ServerContext &server_context, PropagationOptions options=PropagationOptions())
Create a new ClientContext as a child of an incoming server call, according to options (...
void AddMetadata(const grpc::string &meta_key, const grpc::string &meta_value)
Add the (meta_key, meta_value) pair to the metadata associated with a client call.
PropagationOptions & disable_census_stats_propagation()
Definition: client_context.h:119
virtual ~GlobalCallbacks()
Definition: client_context.h:347
#define GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST
Initial metadata flags.
Definition: grpc_types.h:364
#define GRPC_PROPAGATE_CANCELLATION
Propagate cancellation.
Definition: propagation_bits.h:51
Channels represent a connection to an endpoint. Created by CreateChannel.
Definition: channel.h:49