19 #ifndef GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H 20 #define GRPCPP_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 template <
class Streamer,
bool WriteNeeded>
67 class TemplatedBidiStreamingHandler;
68 template <StatusCode code>
69 class ErrorMethodHandler;
73 class CompletionQueue;
75 class ServerInterface;
78 class InteropServerContextInspector;
79 class ServerContextTestSpouse;
103 std::chrono::system_clock::time_point
deadline()
const {
141 bool IsCancelled()
const;
159 void TryCancel()
const;
172 return *client_metadata_.map();
177 return compression_level_;
184 compression_level_set_ =
true;
185 compression_level_ = level;
198 return compression_algorithm_;
206 void SetLoadReportingCosts(
const std::vector<grpc::string>& cost_data);
212 if (auth_context_.get() ==
nullptr) {
215 return auth_context_;
225 const struct census_context* census_context()
const;
233 has_notify_when_done_tag_ =
true;
234 async_notify_when_done_tag_ = tag;
242 friend class ::grpc::testing::InteropServerContextInspector;
243 friend class ::grpc::testing::ServerContextTestSpouse;
244 friend class ::grpc::ServerInterface;
245 friend class ::grpc::Server;
246 template <
class W,
class R>
247 friend class ::grpc::ServerAsyncReader;
249 friend class ::grpc::ServerAsyncWriter;
251 friend class ::grpc::ServerAsyncResponseWriter;
252 template <
class W,
class R>
253 friend class ::grpc::ServerAsyncReaderWriter;
255 friend class ::grpc::ServerReader;
257 friend class ::grpc::ServerWriter;
258 template <
class W,
class R>
259 friend class ::grpc::internal::ServerReaderWriterBody;
260 template <
class ServiceType,
class RequestType,
class ResponseType>
261 friend class ::grpc::internal::RpcMethodHandler;
262 template <
class ServiceType,
class RequestType,
class ResponseType>
263 friend class ::grpc::internal::ClientStreamingHandler;
264 template <
class ServiceType,
class RequestType,
class ResponseType>
265 friend class ::grpc::internal::ServerStreamingHandler;
266 template <
class Streamer,
bool WriteNeeded>
267 friend class ::grpc::internal::TemplatedBidiStreamingHandler;
268 template <StatusCode code>
270 friend class ::grpc::ClientContext;
284 void set_call(
grpc_call* call) { call_ = call; }
286 uint32_t initial_metadata_flags()
const {
return 0; }
288 CompletionOp* completion_op_;
289 bool has_notify_when_done_tag_;
290 void* async_notify_when_done_tag_;
295 bool sent_initial_metadata_;
296 mutable std::shared_ptr<const AuthContext> auth_context_;
298 std::multimap<grpc::string, grpc::string> initial_metadata_;
299 std::multimap<grpc::string, grpc::string> trailing_metadata_;
301 bool compression_level_set_;
308 bool has_pending_ops_;
313 #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.h:618
void set_compression_level(grpc_compression_level level)
Set algorithm to be the compression algorithm used for the server call.
Definition: server_context.h:183
grpc_compression_algorithm compression_algorithm() const
Return the compression algorithm the server call will request be used.
Definition: server_context.h:197
void AsyncNotifyWhenDone(void *tag)
Async only.
Definition: server_context.h:232
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:70
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:170
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context.h:176
std::chrono::system_clock::time_point deadline() const
Return the deadline for the server call.
Definition: server_context.h:103
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:191
grpc_compression_algorithm
The various compression algorithms supported by gRPC.
Definition: compression_types.h:56
An Alarm posts the user provided tag to its associated completion queue upon expiry or cancellation...
Definition: alarm.h:31
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:97
gpr_timespec raw_deadline() const
Return a gpr_timespec representation of the server call's deadline.
Definition: server_context.h:108
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:95
std::shared_ptr< const AuthContext > auth_context() const
Return the authentication context for this server call.
Definition: server_context.h:211
General method handler class for errors that prevent real method use e.g., handle unknown method by r...
Definition: byte_buffer.h:49
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:239
Straightforward wrapping of the C call object.
Definition: call.h:668