19 #ifndef GRPCXX_IMPL_CODEGEN_SERVER_CONTEXT_H
20 #define GRPCXX_IMPL_CODEGEN_SERVER_CONTEXT_H
39 struct census_context;
43 template <
class W,
class R>
44 class ServerAsyncReader;
46 class ServerAsyncWriter;
48 class ServerAsyncResponseWriter;
49 template <
class W,
class R>
50 class ServerAsyncReaderWriter;
56 template <
class W,
class R>
57 class ServerReaderWriterBody;
58 template <
class ServiceType,
class RequestType,
class ResponseType>
59 class RpcMethodHandler;
60 template <
class ServiceType,
class RequestType,
class ResponseType>
61 class ClientStreamingHandler;
62 template <
class ServiceType,
class RequestType,
class ResponseType>
63 class ServerStreamingHandler;
64 template <
class ServiceType,
class RequestType,
class ResponseType>
65 class BidiStreamingHandler;
66 class UnknownMethodHandler;
67 template <
class Streamer,
bool WriteNeeded>
68 class TemplatedBidiStreamingHandler;
72 class CompletionQueue;
74 class ServerInterface;
77 class InteropServerContextInspector;
78 class ServerContextTestSpouse;
102 std::chrono::system_clock::time_point
deadline()
const {
167 return *client_metadata_.
map();
172 return compression_level_;
179 compression_level_set_ =
true;
180 compression_level_ = level;
190 return compression_algorithm_;
204 if (auth_context_.get() ==
nullptr) {
207 return auth_context_;
223 has_notify_when_done_tag_ =
true;
224 async_notify_when_done_tag_ = tag;
232 friend class ::grpc::testing::InteropServerContextInspector;
233 friend class ::grpc::testing::ServerContextTestSpouse;
234 friend class ::grpc::ServerInterface;
235 friend class ::grpc::Server;
236 template <
class W,
class R>
237 friend class ::grpc::ServerAsyncReader;
239 friend class ::grpc::ServerAsyncWriter;
241 friend class ::grpc::ServerAsyncResponseWriter;
242 template <
class W,
class R>
243 friend class ::grpc::ServerAsyncReaderWriter;
245 friend class ::grpc::ServerReader;
247 friend class ::grpc::ServerWriter;
248 template <
class W,
class R>
249 friend class ::grpc::internal::ServerReaderWriterBody;
250 template <
class ServiceType,
class RequestType,
class ResponseType>
251 friend class ::grpc::internal::RpcMethodHandler;
252 template <
class ServiceType,
class RequestType,
class ResponseType>
253 friend class ::grpc::internal::ClientStreamingHandler;
254 template <
class ServiceType,
class RequestType,
class ResponseType>
255 friend class ::grpc::internal::ServerStreamingHandler;
256 template <
class Streamer,
bool WriteNeeded>
257 friend class ::grpc::internal::TemplatedBidiStreamingHandler;
258 friend class ::grpc::internal::UnknownMethodHandler;
259 friend class ::grpc::ClientContext;
273 void set_call(
grpc_call* call) { call_ = call; }
275 uint32_t initial_metadata_flags()
const {
return 0; }
277 CompletionOp* completion_op_;
278 bool has_notify_when_done_tag_;
279 void* async_notify_when_done_tag_;
283 CompletionQueue* cq_;
284 bool sent_initial_metadata_;
285 mutable std::shared_ptr<const AuthContext> auth_context_;
286 internal::MetadataMap client_metadata_;
287 std::multimap<grpc::string, grpc::string> initial_metadata_;
288 std::multimap<grpc::string, grpc::string> trailing_metadata_;
290 bool compression_level_set_;
294 internal::CallOpSet<internal::CallOpSendInitialMetadata,
295 internal::CallOpSendMessage>
297 bool has_pending_ops_;
302 #endif // GRPCXX_IMPL_CODEGEN_SERVER_CONTEXT_H
grpc_compression_algorithm compression_algorithm() const
Return the compression algorithm to be used by the server call.
Definition: server_context.h:189
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:71
std::shared_ptr< const AuthContext > CreateAuthContext(grpc_call *call)
void SetLoadReportingCosts(const std::vector< grpc::string > &cost_data)
Set the load reporting costs in cost_data for the call.
void set_compression_algorithm(grpc_compression_algorithm algorithm)
Set algorithm to be the compression algorithm used for the server call.
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context.h:171
std::string string
Definition: config.h:35
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:26
gpr_timespec raw_deadline() const
Return a gpr_timespec representation of the server call's deadline.
Definition: server_context.h:107
void set_compression_level(grpc_compression_level level)
Set algorithm to be the compression algorithm used for the server call.
Definition: server_context.h:178
void AsyncNotifyWhenDone(void *tag)
Async only.
Definition: server_context.h:222
void TryCancel() const
Cancel the Call from the server.
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:97
void AddInitialMetadata(const grpc::string &key, const grpc::string &value)
Add the (meta_key, meta_value) pair to the initial metadata associated with a server call...
const struct census_context * census_context() const
Get the census context associated with this server call.
grpc_compression_algorithm
The various compression algorithms supported by gRPC.
Definition: compression_types.h:78
bool IsCancelled() const
IsCancelled is always safe to call when using sync API.
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:96
grpc::string peer() const
Return the peer uri in a string.
const std::multimap< grpc::string_ref, grpc::string_ref > & client_metadata() const
Return a collection of initial metadata key-value pairs sent from the client.
Definition: server_context.h:165
Analogous to struct timespec.
Definition: gpr_types.h:47
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t)
grpc_call * c_call()
Should be used for framework-level extensions only.
Definition: server_context.h:229
void AddTrailingMetadata(const grpc::string &key, const grpc::string &value)
Add the (meta_key, meta_value) pair to the initial metadata associated with a server call...
std::shared_ptr< const AuthContext > auth_context() const
Return the authentication context for this server call.
Definition: server_context.h:203
bool compression_level_set() const
Return a bool indicating whether the compression level for this call has been set (either implicitly ...
Definition: server_context.h:186
std::chrono::system_clock::time_point deadline() const
Return the deadline for the server call.
Definition: server_context.h:102
Straightforward wrapping of the C call object.
Definition: call.h:683