#include <client_context.h>
Classes | |
class | GlobalCallbacks |
Static Public Member Functions | |
static std::unique_ptr< ClientContext > | FromCallbackServerContext (const grpc::CallbackServerContext &server_context, PropagationOptions options=PropagationOptions()) |
static std::unique_ptr< ClientContext > | FromServerContext (const grpc::ServerContextBase &server_context, PropagationOptions options=PropagationOptions()) |
static void | SetGlobalCallbacks (GlobalCallbacks *callbacks) |
Private Member Functions | |
std::string | authority () |
grpc_call * | call () const |
ClientContext (const ClientContext &) | |
uint32_t | initial_metadata_flags () const |
ClientContext & | operator= (const ClientContext &) |
void | SendCancelToInterceptors () |
void | set_call (grpc_call *call, const std::shared_ptr< grpc::Channel > &channel) |
grpc::experimental::ClientRpcInfo * | set_client_rpc_info (const char *method, const char *suffix_for_stats, grpc::internal::RpcMethod::RpcType type, grpc::ChannelInterface *channel, const std::vector< std::unique_ptr< grpc::experimental::ClientInterceptorFactoryInterface >> &creators, size_t interceptor_pos) |
void | set_debug_error_string (const std::string &debug_error_string) |
Static Private Member Functions | |
static std::unique_ptr< ClientContext > | FromInternalServerContext (const grpc::ServerContextBase &server_context, PropagationOptions options) |
Private Attributes | |
std::shared_ptr< const grpc::AuthContext > | auth_context_ |
grpc::string | authority_ |
grpc_call * | call_ |
bool | call_canceled_ |
struct census_context * | census_context_ |
std::shared_ptr< grpc::Channel > | channel_ |
grpc_compression_algorithm | compression_algorithm_ |
std::shared_ptr< grpc::CallCredentials > | creds_ |
gpr_timespec | deadline_ |
std::string | debug_error_string_ |
bool | initial_metadata_corked_ |
bool | initial_metadata_received_ |
grpc::internal::Mutex | mu_ |
grpc_call * | propagate_from_call_ |
PropagationOptions | propagation_options_ |
grpc::internal::MetadataMap | recv_initial_metadata_ |
grpc::experimental::ClientRpcInfo | rpc_info_ |
std::multimap< std::string, std::string > | send_initial_metadata_ |
grpc::internal::MetadataMap | trailing_metadata_ |
bool | wait_for_ready_ |
bool | wait_for_ready_explicitly_set_ |
A ClientContext allows the person implementing a service client to:
Context settings are only relevant to the call they are invoked with, that is to say, they aren't sticky. Some of these settings, such as the compression options, can be made persistent at channel construction time (see grpc::CreateCustomChannel).
Definition at line 195 of file grpcpp/impl/codegen/client_context.h.
grpc::ClientContext::ClientContext | ( | ) |
Definition at line 64 of file client_context.cc.
grpc::ClientContext::~ClientContext | ( | ) |
Definition at line 79 of file client_context.cc.
|
private |
void grpc::ClientContext::AddMetadata | ( | const std::string & | meta_key, |
const std::string & | meta_value | ||
) |
Add the (meta_key, meta_value) pair to the metadata associated with a client call. These are made available at the server side by the grpc::ServerContext::client_metadata() method.
meta_key | The metadata key. If meta_value is binary data, it must end in "-bin". |
meta_value | The metadata value. If its value is binary, the key name must end in "-bin". |
Metadata must conform to the following format:
Custom-Metadata -> Binary-Header / ASCII-Header Binary-Header -> {Header-Name "-bin" } {binary value} ASCII-Header -> Header-Name ASCII-Value Header-Name -> 1*( %x30-39 / %x61-7A / "_" / "-" / ".") ; 0-9 a-z _ - . ASCII-Value -> 1*( %x20-%x7E ) ; space and printable ASCII Custom-Metadata -> Binary-Header / ASCII-Header
Definition at line 121 of file client_context.cc.
|
inline |
Return the authentication context for the associated client call. It is only valid to call this during the lifetime of the client call.
Definition at line 309 of file grpcpp/impl/codegen/client_context.h.
|
inlineprivate |
Definition at line 482 of file grpcpp/impl/codegen/client_context.h.
|
inline |
Should be used for framework-level extensions only. Applications never need to call this method.
Definition at line 407 of file grpcpp/impl/codegen/client_context.h.
|
inlineprivate |
Definition at line 459 of file grpcpp/impl/codegen/client_context.h.
|
inline |
Returns the census context that has been set, or nullptr if not set.
Definition at line 378 of file grpcpp/impl/codegen/client_context.h.
|
inline |
Return the compression algorithm the client call will request be used. Note that the gRPC runtime may decide to ignore this request, for example, due to resource constraints.
Definition at line 338 of file grpcpp/impl/codegen/client_context.h.
|
inline |
EXPERIMENTAL debugging API
Returns the credentials for the client call. This should be used only in tests and for diagnostic purposes, and should not be used by application logic.
Definition at line 333 of file grpcpp/impl/codegen/client_context.h.
|
inline |
Return the deadline for the client call.
Definition at line 294 of file grpcpp/impl/codegen/client_context.h.
|
inline |
EXPERIMENTAL debugging API
if status is not ok() for an RPC, this will return a detailed string of the gRPC Core error that led to the failure. It should not be relied upon for anything other than gaining more debug data in failure cases.
Definition at line 414 of file grpcpp/impl/codegen/client_context.h.
|
static |
Definition at line 115 of file client_context.cc.
|
staticprivate |
Definition at line 102 of file client_context.cc.
|
static |
Create a new ClientContext as a child of an incoming server call, according to options (
server_context | The source server context to use as the basis for constructing the client context. |
options | The options controlling what to copy from the server_context. |
Definition at line 110 of file client_context.cc.
|
inline |
Return a collection of initial metadata key-value pairs. Note that keys may happen more than once (ie, a std::multimap is returned).
Definition at line 250 of file grpcpp/impl/codegen/client_context.h.
|
inline |
Return a collection of trailing metadata key-value pairs. Note that keys may happen more than once (ie, a std::multimap is returned).
Definition at line 262 of file grpcpp/impl/codegen/client_context.h.
|
inlineprivate |
Definition at line 474 of file grpcpp/impl/codegen/client_context.h.
|
private |
std::string grpc::ClientContext::peer | ( | ) | const |
Return the peer uri in a string. It is only valid to call this during the lifetime of the client call.
Definition at line 174 of file client_context.cc.
|
inline |
Return a gpr_timespec representation of the client call's deadline.
Definition at line 299 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 167 of file client_context.cc.
|
inline |
Set the per call authority header (see https://tools.ietf.org/html/rfc7540#section-8.1.2.3).
Definition at line 303 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 126 of file client_context.cc.
|
inline |
Sets the census context. It is only valid to call this before the client call is created. A common place of setting census context is from within the DefaultConstructor method of GlobalCallbacks.
Definition at line 375 of file grpcpp/impl/codegen/client_context.h.
|
inlineprivate |
Definition at line 462 of file grpcpp/impl/codegen/client_context.h.
void grpc::ClientContext::set_compression_algorithm | ( | grpc_compression_algorithm | algorithm | ) |
Set algorithm to be the compression algorithm used for the client call.
algorithm | The compression algorithm used for the client call. |
Definition at line 144 of file client_context.cc.
void grpc::ClientContext::set_credentials | ( | const std::shared_ptr< grpc::CallCredentials > & | creds | ) |
Set credentials for the client call.
A credentials object encapsulates all the state needed by a client to authenticate with a server and make various assertions, e.g., about the client’s identity, role, or whether it is authorized to make a particular call.
It is legal to call this only before initial metadata is sent.
Definition at line 86 of file client_context.cc.
Set the deadline for the client call.
deadline | the deadline for the client call. Units are determined by the type used. The deadline is an absolute (not relative) time. |
Definition at line 274 of file grpcpp/impl/codegen/client_context.h.
|
inlineprivate |
Definition at line 455 of file grpcpp/impl/codegen/client_context.h.
|
inline |
DEPRECATED: Use set_wait_for_ready() instead.
Definition at line 291 of file grpcpp/impl/codegen/client_context.h.
|
inline |
Flag whether the initial metadata should be corked
If corked is true, then the initial metadata will be coalesced with the write of first message in the stream. As a result, any tag set for the initial metadata operation (starting a client-streaming or bidi-streaming RPC) will not actually be sent to the completion queue or delivered via Next.
corked | The flag indicating whether the initial metadata is to be corked or not. |
Definition at line 357 of file grpcpp/impl/codegen/client_context.h.
|
inline |
Trigger wait-for-ready or not on this request. See https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md. If set, if an RPC is made when a channel's connectivity state is TRANSIENT_FAILURE or CONNECTING, the call will not "fail fast", and the channel will wait until the channel is READY before making the call.
Definition at line 285 of file grpcpp/impl/codegen/client_context.h.
|
static |
Definition at line 184 of file client_context.cc.
void grpc::ClientContext::TryCancel | ( | ) |
Send a best-effort out-of-band cancel on the call associated with this client context. The call could be in any stage; e.g., if it is already finished, it may still return success.
There is no guarantee the call will be cancelled.
Note that TryCancel() does not change any of the tags that are pending on the completion queue. All pending tags will still be delivered (though their ok result may reflect the effect of cancellation).
Definition at line 157 of file client_context.cc.
|
friend |
Definition at line 425 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 433 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 437 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 439 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 435 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 427 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 431 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 429 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 442 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 444 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 423 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 424 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 440 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 448 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 446 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 451 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 450 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 452 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 422 of file grpcpp/impl/codegen/client_context.h.
|
friend |
Definition at line 421 of file grpcpp/impl/codegen/client_context.h.
|
mutableprivate |
Definition at line 500 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 498 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 495 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 496 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 501 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 493 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 509 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 499 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 497 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 512 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 510 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 490 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 494 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 506 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 507 of file grpcpp/impl/codegen/client_context.h.
|
mutableprivate |
Definition at line 503 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 514 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 502 of file grpcpp/impl/codegen/client_context.h.
|
mutableprivate |
Definition at line 504 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 491 of file grpcpp/impl/codegen/client_context.h.
|
private |
Definition at line 492 of file grpcpp/impl/codegen/client_context.h.