34 #ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_IMPL_H
35 #define GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_IMPL_H
56 struct census_context;
61 class ChannelInterface;
65 template <
class InputMessage,
class OutputMessage>
66 class BlockingUnaryCallImpl;
67 class CallOpClientRecvStatus;
68 class CallOpRecvInitialMetadata;
69 class ServerContextImpl;
73 class InteropClientContextInspector;
79 template <
class InputMessage,
class OutputMessage>
80 class CallbackUnaryCallImpl;
81 template <
class Request,
class Response>
82 class ClientCallbackReaderWriterImpl;
83 template <
class Response>
84 class ClientCallbackReaderImpl;
85 template <
class Request>
86 class ClientCallbackWriterImpl;
87 class ClientCallbackUnaryImpl;
88 class ClientContextAccessor;
99 template <
class W,
class R>
105 template <
class W,
class R>
234 const std::multimap<grpc::string_ref, grpc::string_ref>&
237 return *recv_initial_metadata_.
map();
246 const std::multimap<grpc::string_ref, grpc::string_ref>&
249 return *trailing_metadata_.
map();
258 template <
typename T>
283 wait_for_ready_ = wait_for_ready;
284 wait_for_ready_explicitly_set_ =
true;
291 std::chrono::system_clock::time_point
deadline()
const {
307 if (auth_context_.get() ==
nullptr) {
310 return auth_context_;
324 const std::shared_ptr<grpc_impl::CallCredentials>& creds);
331 std::shared_ptr<grpc_impl::CallCredentials>
credentials() {
return creds_; }
337 return compression_algorithm_;
356 initial_metadata_corked_ = corked;
377 return census_context_;
419 friend class ::grpc::testing::InteropClientContextInspector;
420 friend class ::grpc::internal::CallOpClientRecvStatus;
421 friend class ::grpc::internal::CallOpRecvInitialMetadata;
427 template <
class W,
class R>
433 template <
class W,
class R>
437 template <
class InputMessage,
class OutputMessage>
438 friend class ::grpc::internal::BlockingUnaryCallImpl;
439 template <
class InputMessage,
class OutputMessage>
440 friend class ::grpc_impl::internal::CallbackUnaryCallImpl;
441 template <
class Request,
class Response>
442 friend class ::grpc_impl::internal::ClientCallbackReaderWriterImpl;
443 template <
class Response>
444 friend class ::grpc_impl::internal::ClientCallbackReaderImpl;
445 template <
class Request>
446 friend class ::grpc_impl::internal::ClientCallbackWriterImpl;
447 friend class ::grpc_impl::internal::ClientCallbackUnaryImpl;
448 friend class ::grpc_impl::internal::ClientContextAccessor;
455 grpc_call* call()
const {
return call_; }
457 const std::shared_ptr<::grpc_impl::Channel>& channel);
462 const std::vector<std::unique_ptr<
464 size_t interceptor_pos) {
466 rpc_info_.RegisterInterceptors(creators, interceptor_pos);
470 uint32_t initial_metadata_flags()
const {
474 (wait_for_ready_explicitly_set_
482 void SendCancelToInterceptors();
484 static std::unique_ptr<ClientContext> FromInternalServerContext(
488 bool initial_metadata_received_;
489 bool wait_for_ready_;
490 bool wait_for_ready_explicitly_set_;
493 std::shared_ptr<::grpc_impl::Channel> channel_;
499 std::shared_ptr<grpc_impl::CallCredentials> creds_;
500 mutable std::shared_ptr<const grpc::AuthContext> auth_context_;
502 std::multimap<grpc::string, grpc::string> send_initial_metadata_;
510 bool initial_metadata_corked_;
Codegen interface for grpc::Channel.
Definition: channel_interface.h:74
If you are trying to use CompletionQueue::AsyncNext with a time class that isn't either gpr_timespec ...
Definition: time.h:40
gpr_timespec raw_time()
Definition: time.h:43
Definition: client_interceptor.h:49
Definition: client_interceptor.h:69
RpcType
Definition: rpc_method.h:31
Definition: server_context_impl.h:528
Global Callbacks.
Definition: client_context_impl.h:395
virtual void Destructor(ClientContext *context)=0
virtual void DefaultConstructor(ClientContext *context)=0
virtual ~GlobalCallbacks()
Definition: client_context_impl.h:397
A ClientContext allows the person implementing a service client to:
Definition: client_context_impl.h:184
void set_fail_fast(bool fail_fast)
DEPRECATED: Use set_wait_for_ready() instead.
Definition: client_context_impl.h:288
void set_credentials(const std::shared_ptr< grpc_impl::CallCredentials > &creds)
Set credentials for the client call.
void set_cacheable(bool cacheable)
EXPERIMENTAL: Set this request to be cacheable.
Definition: client_context_impl.h:274
void set_authority(const grpc::string &authority)
Set the per call authority header (see https://tools.ietf.org/html/rfc7540#section-8....
Definition: client_context_impl.h:300
void TryCancel()
Send a best-effort out-of-band cancel on the call associated with this client context.
void set_census_context(struct census_context *ccp)
Sets the census context.
Definition: client_context_impl.h:373
void set_initial_metadata_corked(bool corked)
Flag whether the initial metadata should be corked.
Definition: client_context_impl.h:355
grpc::string peer() const
Return the peer uri in a string.
std::chrono::system_clock::time_point deadline() const
Return the deadline for the client call.
Definition: client_context_impl.h:291
static void SetGlobalCallbacks(GlobalCallbacks *callbacks)
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.
grpc_call * c_call()
Should be used for framework-level extensions only.
Definition: client_context_impl.h:405
void set_deadline(const T &deadline)
Set the deadline for the client call.
Definition: client_context_impl.h:259
void set_idempotent(bool idempotent)
EXPERIMENTAL: Indicate that this request is idempotent.
Definition: client_context_impl.h:269
const std::multimap< grpc::string_ref, grpc::string_ref > & GetServerTrailingMetadata() const
Return a collection of trailing metadata key-value pairs.
Definition: client_context_impl.h:247
grpc_compression_algorithm compression_algorithm() const
Return the compression algorithm the client call will request be used.
Definition: client_context_impl.h:336
void set_compression_algorithm(grpc_compression_algorithm algorithm)
Set algorithm to be the compression algorithm used for the client call.
std::shared_ptr< grpc_impl::CallCredentials > credentials()
EXPERIMENTAL debugging API.
Definition: client_context_impl.h:331
struct census_context * census_context() const
Returns the census context that has been set, or nullptr if not set.
Definition: client_context_impl.h:376
static std::unique_ptr< ClientContext > FromCallbackServerContext(const grpc_impl::CallbackServerContext &server_context, PropagationOptions options=PropagationOptions())
void set_wait_for_ready(bool wait_for_ready)
EXPERIMENTAL: Trigger wait-for-ready or not on this request.
Definition: client_context_impl.h:282
std::shared_ptr< const grpc::AuthContext > auth_context() const
Return the authentication context for the associated client call.
Definition: client_context_impl.h:306
grpc::string debug_error_string() const
EXPERIMENTAL debugging API.
Definition: client_context_impl.h:412
gpr_timespec raw_deadline() const
Return a gpr_timespec representation of the client call's deadline.
Definition: client_context_impl.h:296
const std::multimap< grpc::string_ref, grpc::string_ref > & GetServerInitialMetadata() const
Return a collection of initial metadata key-value pairs.
Definition: client_context_impl.h:235
static std::unique_ptr< ClientContext > FromServerContext(const grpc_impl::ServerContext &server_context, PropagationOptions options=PropagationOptions())
Create a new ClientContext as a child of an incoming server call, according to options (.
Options for ClientContext::FromServerContext specifying which traits from the ServerContext to propag...
Definition: client_context_impl.h:118
PropagationOptions & enable_census_tracing_propagation()
Definition: client_context_impl.h:142
PropagationOptions & enable_deadline_propagation()
Definition: client_context_impl.h:122
PropagationOptions & disable_deadline_propagation()
Definition: client_context_impl.h:127
PropagationOptions & disable_cancellation_propagation()
Definition: client_context_impl.h:157
uint32_t c_bitmask() const
Definition: client_context_impl.h:162
PropagationOptions & disable_census_stats_propagation()
Definition: client_context_impl.h:137
PropagationOptions & disable_census_tracing_propagation()
Definition: client_context_impl.h:147
PropagationOptions & enable_cancellation_propagation()
Definition: client_context_impl.h:152
PropagationOptions & enable_census_stats_propagation()
Definition: client_context_impl.h:132
PropagationOptions()
Definition: client_context_impl.h:120
Base class of ServerContext. Experimental until callback API is final.
Definition: server_context_impl.h:117
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context_impl.h:488
grpc_compression_algorithm
The various compression algorithms supported by gRPC (not sorted by compression level)
Definition: compression_types.h:57
#define GRPC_INITIAL_METADATA_CORKED
Signal that the initial metadata should be corked.
Definition: grpc_types.h:474
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
#define GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST
Initial metadata flags.
Definition: grpc_types.h:465
#define GRPC_INITIAL_METADATA_CACHEABLE_REQUEST
Signal that the call is cacheable.
Definition: grpc_types.h:469
#define GRPC_INITIAL_METADATA_WAIT_FOR_READY
Signal that the call should not return UNAVAILABLE before it has started.
Definition: grpc_types.h:467
#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:472
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:146
::grpc_impl::ServerContextBase ServerContextBase
Definition: server_context.h:30
::grpc_impl::CallbackServerContext CallbackServerContext
Definition: server_context.h:31
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t)
std::shared_ptr< const AuthContext > CreateAuthContext(grpc_call *call)
::grpc_impl::ServerContext ServerContext
Definition: server_context.h:26
::grpc_impl::CallCredentials CallCredentials
Definition: credentials.h:27
::grpc_impl::ClientAsyncWriter< W > ClientAsyncWriter
Definition: async_stream.h:49
::grpc_impl::Channel Channel
Definition: channel.h:26
::grpc_impl::ClientReader< R > ClientReader
Definition: sync_stream.h:56
::grpc_impl::PropagationOptions PropagationOptions
Definition: client_context.h:27
::grpc_impl::ClientWriter< W > ClientWriter
Definition: sync_stream.h:62
::grpc_impl::ClientAsyncReader< R > ClientAsyncReader
Definition: async_stream.h:43
::grpc_impl::CompletionQueue CompletionQueue
Definition: completion_queue.h:26
::grpc_impl::ClientReaderWriter< W, R > ClientReaderWriter
Definition: sync_stream.h:69
std::string string
Definition: config.h:35
::grpc_impl::ClientAsyncReaderWriter< W, R > ClientAsyncReaderWriter
Definition: async_stream.h:56
grpc_impl::ClientAsyncResponseReader< R > ClientAsyncResponseReader
Definition: async_unary_call.h:31
#define GRPC_PROPAGATE_CENSUS_STATS_CONTEXT
Propagate census context.
Definition: propagation_bits.h:33
#define GRPC_PROPAGATE_DEADLINE
Propagation bits: this can be bitwise or-ed to form propagation_mask for grpc_call.
Definition: propagation_bits.h:31
#define GRPC_PROPAGATE_CANCELLATION
Propagate cancellation.
Definition: propagation_bits.h:36
#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_TRACING_CONTEXT
Definition: propagation_bits.h:34
Analogous to struct timespec.
Definition: gpr_types.h:47