34 #ifndef GRPCXX_CLIENT_CONTEXT_H
35 #define GRPCXX_CLIENT_CONTEXT_H
41 #include <grpc/compression.h>
42 #include <grpc/support/log.h>
43 #include <grpc/support/time.h>
50 struct grpc_completion_queue;
51 struct census_context;
55 class ChannelInterface;
56 class CompletionQueue;
63 template <
class R,
class W>
69 template <
class R,
class W>
83 GPR_ASSERT(initial_metadata_received_);
84 return recv_initial_metadata_;
89 return trailing_metadata_;
98 #ifndef GRPC_CXX0X_NO_CHRONO
99 std::chrono::system_clock::time_point
deadline() {
102 #endif // !GRPC_CXX0X_NO_CHRONO
114 return compression_algorithm_;
119 std::shared_ptr<const AuthContext>
auth_context()
const;
142 friend class ::grpc::ClientReader;
144 friend class ::grpc::ClientWriter;
145 template <
class R,
class W>
146 friend class ::grpc::ClientReaderWriter;
148 friend class ::grpc::ClientAsyncReader;
150 friend class ::grpc::ClientAsyncWriter;
151 template <
class R,
class W>
152 friend class ::grpc::ClientAsyncReaderWriter;
154 friend class ::grpc::ClientAsyncResponseReader;
155 template <
class InputMessage,
class OutputMessage>
159 const InputMessage& request,
160 OutputMessage* result);
162 grpc_call* call() {
return call_; }
163 void set_call(grpc_call* call,
164 const std::shared_ptr<ChannelInterface>& channel);
166 grpc_completion_queue* cq() {
return cq_; }
167 void set_cq(grpc_completion_queue* cq) { cq_ = cq; }
171 bool initial_metadata_received_;
172 std::shared_ptr<ChannelInterface> channel_;
174 grpc_completion_queue* cq_;
175 gpr_timespec deadline_;
177 std::shared_ptr<Credentials> creds_;
178 mutable std::shared_ptr<const AuthContext> auth_context_;
180 std::multimap<grpc::string, grpc::string> send_initial_metadata_;
181 std::multimap<grpc::string, grpc::string> recv_initial_metadata_;
182 std::multimap<grpc::string, grpc::string> trailing_metadata_;
184 grpc_compression_algorithm compression_algorithm_;
189 #endif // GRPCXX_CLIENT_CONTEXT_H
Definition: client_context.h:70
Definition: client_context.h:60
std::string string
Definition: config.h:112
std::chrono::system_clock::time_point deadline()
Definition: client_context.h:99
const std::multimap< grpc::string, grpc::string > & GetServerTrailingMetadata()
Definition: client_context.h:87
void set_deadline(const T &deadline)
Definition: client_context.h:93
grpc::string peer() const
Definition: client_context.cc:108
std::shared_ptr< const AuthContext > auth_context() const
Definition: client_context.cc:95
gpr_timespec raw_time()
Definition: time.h:56
Definition: async_unary_call.h:57
Definition: client_context.h:74
ClientContext()
Definition: client_context.cc:47
struct census_context * census_context() const
Definition: client_context.h:129
void TryCancel()
Definition: client_context.cc:102
void set_census_context(struct census_context *ccp)
Definition: client_context.h:128
grpc_compression_algorithm compression_algorithm() const
Definition: client_context.h:113
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t)
Definition: time.cc:81
friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const InputMessage &request, OutputMessage *result)
Definition: client_unary_call.h:51
Definition: channel_interface.h:52
Definition: client_context.h:68
Definition: rpc_method.h:39
void set_authority(const grpc::string &authority)
Definition: client_context.h:106
gpr_timespec raw_deadline()
Definition: client_context.h:104
const std::multimap< grpc::string, grpc::string > & GetServerInitialMetadata()
Definition: client_context.h:82
Definition: client_context.h:64
Definition: client_context.h:66
Definition: client_context.h:62
void set_compression_algorithm(grpc_compression_algorithm algorithm)
Definition: client_context.cc:83
void set_credentials(const std::shared_ptr< Credentials > &creds)
Definition: client_context.h:109
void AddMetadata(const grpc::string &meta_key, const grpc::string &meta_value)
Definition: client_context.cc:67
~ClientContext()
Definition: client_context.cc:53