19 #ifndef GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H 20 #define GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H 42 struct census_context;
46 class GenericServerContext;
47 class CompletionQueue;
49 class ServerInterface;
50 template <
class W,
class R>
51 class ServerAsyncReader;
53 class ServerAsyncWriter;
55 class ServerAsyncResponseWriter;
56 template <
class W,
class R>
57 class ServerAsyncReaderWriter;
64 template <
class W,
class R>
65 class ServerReaderWriterBody;
66 template <
class ServiceType,
class RequestType,
class ResponseType>
67 class RpcMethodHandler;
68 template <
class ServiceType,
class RequestType,
class ResponseType>
69 class ClientStreamingHandler;
70 template <
class ServiceType,
class RequestType,
class ResponseType>
71 class ServerStreamingHandler;
72 template <
class ServiceType,
class RequestType,
class ResponseType>
73 class BidiStreamingHandler;
74 template <
class RequestType,
class ResponseType>
75 class CallbackUnaryHandler;
76 template <
class RequestType,
class ResponseType>
77 class CallbackClientStreamingHandler;
78 template <
class RequestType,
class ResponseType>
79 class CallbackServerStreamingHandler;
80 template <
class RequestType,
class ResponseType>
81 class CallbackBidiHandler;
82 template <
class Streamer,
bool WriteNeeded>
83 class TemplatedBidiStreamingHandler;
84 template <StatusCode code>
85 class ErrorMethodHandler;
91 class InteropServerContextInspector;
92 class ServerContextTestSpouse;
116 std::chrono::system_clock::time_point
deadline()
const {
168 bool IsCancelled()
const;
186 void TryCancel()
const;
199 return *client_metadata_.map();
204 return compression_level_;
211 compression_level_set_ =
true;
212 compression_level_ = level;
225 return compression_algorithm_;
233 void SetLoadReportingCosts(
const std::vector<grpc::string>& cost_data);
239 if (auth_context_.get() ==
nullptr) {
242 return auth_context_;
252 const struct census_context* census_context()
const;
260 has_notify_when_done_tag_ =
true;
261 async_notify_when_done_tag_ = tag;
269 friend class ::grpc::testing::InteropServerContextInspector;
270 friend class ::grpc::testing::ServerContextTestSpouse;
271 friend class ::grpc::ServerInterface;
272 friend class ::grpc::Server;
273 template <
class W,
class R>
274 friend class ::grpc::ServerAsyncReader;
276 friend class ::grpc::ServerAsyncWriter;
278 friend class ::grpc::ServerAsyncResponseWriter;
279 template <
class W,
class R>
280 friend class ::grpc::ServerAsyncReaderWriter;
282 friend class ::grpc::ServerReader;
284 friend class ::grpc::ServerWriter;
285 template <
class W,
class R>
286 friend class ::grpc::internal::ServerReaderWriterBody;
287 template <
class ServiceType,
class RequestType,
class ResponseType>
288 friend class ::grpc::internal::RpcMethodHandler;
289 template <
class ServiceType,
class RequestType,
class ResponseType>
290 friend class ::grpc::internal::ClientStreamingHandler;
291 template <
class ServiceType,
class RequestType,
class ResponseType>
292 friend class ::grpc::internal::ServerStreamingHandler;
293 template <
class Streamer,
bool WriteNeeded>
294 friend class ::grpc::internal::TemplatedBidiStreamingHandler;
295 template <
class RequestType,
class ResponseType>
296 friend class ::grpc::internal::CallbackUnaryHandler;
297 template <
class RequestType,
class ResponseType>
298 friend class ::grpc::internal::CallbackClientStreamingHandler;
299 template <
class RequestType,
class ResponseType>
300 friend class ::grpc::internal::CallbackServerStreamingHandler;
301 template <
class RequestType,
class ResponseType>
302 friend class ::grpc::internal::CallbackBidiHandler;
303 template <StatusCode code>
305 friend class ::grpc::ClientContext;
306 friend class ::grpc::GenericServerContext;
315 std::function<
void(
bool)> callback,
322 void set_call(
grpc_call* call) { call_ = call; }
330 uint32_t initial_metadata_flags()
const {
return 0; }
332 void SetCancelCallback(std::function<
void()> callback);
333 void ClearCancelCallback();
338 std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>&
340 if (creators.size() != 0) {
342 rpc_info_->RegisterInterceptors(creators);
347 CompletionOp* completion_op_;
348 bool has_notify_when_done_tag_;
349 void* async_notify_when_done_tag_;
355 bool sent_initial_metadata_;
356 mutable std::shared_ptr<const AuthContext> auth_context_;
358 std::multimap<grpc::string, grpc::string> initial_metadata_;
359 std::multimap<grpc::string, grpc::string> trailing_metadata_;
361 bool compression_level_set_;
368 bool has_pending_ops_;
375 #endif // GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
std::shared_ptr< const AuthContext > CreateAuthContext(grpc_call *call)
std::string string
Definition: config.h:35
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:26
Primary implementation of CallOpSetInterface.
Definition: call_op_set.h:828
void set_compression_level(grpc_compression_level level)
Set level to be the compression level used for the server call.
Definition: server_context.h:210
grpc_compression_algorithm compression_algorithm() const
Return the compression algorithm the server call will request be used.
Definition: server_context.h:224
void AsyncNotifyWhenDone(void *tag)
Async only.
Definition: server_context.h:259
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:71
RpcType
Definition: rpc_method.h:31
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:197
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context.h:203
std::chrono::system_clock::time_point deadline() const
Return the deadline for the server call.
Definition: server_context.h:116
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:218
Definition: call_op_set.h:294
grpc_compression_algorithm
The various compression algorithms supported by gRPC (not sorted by compression level) ...
Definition: compression_types.h:57
ServerRpcInfo represents the state of a particular RPC as it appears to an interceptor.
Definition: server_interceptor.h:58
Definition: server_callback.h:40
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:110
gpr_timespec raw_deadline() const
Return a gpr_timespec representation of the server call's deadline.
Definition: server_context.h:121
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:97
CallbackWithSuccessTag can be reused multiple times, and will be used in this fashion for streaming o...
Definition: callback_common.h:132
std::shared_ptr< const AuthContext > auth_context() const
Return the authentication context for this server call.
Definition: server_context.h:238
General method handler class for errors that prevent real method use e.g., handle unknown method by r...
Definition: byte_buffer.h:53
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:266
Straightforward wrapping of the C call object.
Definition: call.h:36