GRPC C++  1.62.0
server_context.h
Go to the documentation of this file.
1 //
2 //
3 // Copyright 2015 gRPC authors.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 //
18 
19 #ifndef GRPCPP_SERVER_CONTEXT_H
20 #define GRPCPP_SERVER_CONTEXT_H
21 
23 
24 #include <atomic>
25 #include <cassert>
26 #include <map>
27 #include <memory>
28 #include <type_traits>
29 #include <vector>
30 
31 #include <grpc/grpc.h>
33 #include <grpcpp/impl/call.h>
42 #include <grpcpp/support/config.h>
46 #include <grpcpp/support/status.h>
48 #include <grpcpp/support/time.h>
49 
50 struct grpc_metadata;
51 struct grpc_call;
52 struct census_context;
53 
54 namespace grpc {
55 template <class W, class R>
57 template <class W>
59 template <class W>
61 template <class W, class R>
63 template <class R>
64 class ServerReader;
65 template <class W>
66 class ServerWriter;
67 
68 namespace internal {
69 template <class ServiceType, class RequestType, class ResponseType>
71 template <class RequestType, class ResponseType>
73 template <class RequestType, class ResponseType>
75 template <class RequestType, class ResponseType>
77 template <class RequestType, class ResponseType>
79 template <class ServiceType, class RequestType, class ResponseType>
81 template <class ResponseType>
83  ResponseType*, Status&);
84 template <class ServiceType, class RequestType, class ResponseType,
85  class BaseRequestType, class BaseResponseType>
86 class RpcMethodHandler;
87 template <class Base>
89 template <class W, class R>
91 template <class ServiceType, class RequestType, class ResponseType>
93 class ServerReactor;
94 template <class Streamer, bool WriteNeeded>
96 template <grpc::StatusCode code>
97 class ErrorMethodHandler;
98 } // namespace internal
99 
100 class ClientContext;
101 class CompletionQueue;
103 class Server;
104 class ServerInterface;
105 class ContextAllocator;
107 
108 namespace internal {
109 class Call;
110 } // namespace internal
111 
112 namespace testing {
113 class InteropServerContextInspector;
114 class ServerContextTestSpouse;
115 class DefaultReactorTestPeer;
116 } // namespace testing
117 
118 namespace experimental {
119 class CallMetricRecorder;
120 class ServerMetricRecorder;
121 } // namespace experimental
122 
125  public:
126  virtual ~ServerContextBase();
127 
129  std::chrono::system_clock::time_point deadline() const {
130  return grpc::Timespec2Timepoint(deadline_);
131  }
132 
134  gpr_timespec raw_deadline() const { return deadline_; }
135 
159  void AddInitialMetadata(const std::string& key, const std::string& value);
160 
184  void AddTrailingMetadata(const std::string& key, const std::string& value);
185 
197  bool IsCancelled() const;
198 
219  void TryCancel() const;
220 
230  const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata()
231  const {
232  return *client_metadata_.map();
233  }
234 
237  return compression_level_;
238  }
239 
244  compression_level_set_ = true;
245  compression_level_ = level;
246  }
247 
251  bool compression_level_set() const { return compression_level_set_; }
252 
258  return compression_algorithm_;
259  }
264 
266  void SetLoadReportingCosts(const std::vector<std::string>& cost_data);
267 
271  std::shared_ptr<const grpc::AuthContext> auth_context() const {
272  if (auth_context_ == nullptr) {
273  auth_context_ = grpc::CreateAuthContext(call_.call);
274  }
275  return auth_context_;
276  }
277 
282  std::string peer() const;
283 
285  const struct census_context* census_context() const;
286 
289  grpc_call* c_call() { return call_.call; }
290 
297  return call_metric_recorder_;
298  }
299 
303 
304  protected:
310  void AsyncNotifyWhenDone(void* tag) {
311  has_notify_when_done_tag_ = true;
312  async_notify_when_done_tag_ = tag;
313  }
314 
318  RpcAllocatorState* GetRpcAllocatorState() { return message_allocator_state_; }
319 
335  // Short-circuit the case where a default reactor was already set up by
336  // the TestPeer.
337  if (test_unary_ != nullptr) {
338  return reinterpret_cast<Reactor*>(&default_reactor_);
339  }
340  new (&default_reactor_) Reactor;
341 #ifndef NDEBUG
342  bool old = false;
343  assert(default_reactor_used_.compare_exchange_strong(
344  old, true, std::memory_order_relaxed));
345 #else
346  default_reactor_used_.store(true, std::memory_order_relaxed);
347 #endif
348  return reinterpret_cast<Reactor*>(&default_reactor_);
349  }
350 
354 
356  context_allocator_ = context_allocator;
357  }
358 
359  ContextAllocator* context_allocator() const { return context_allocator_; }
360 
361  private:
365  friend class grpc::ServerInterface;
366  friend class grpc::Server;
367  template <class W, class R>
369  template <class W>
371  template <class W>
373  template <class W, class R>
375  template <class R>
376  friend class grpc::ServerReader;
377  template <class W>
378  friend class grpc::ServerWriter;
379  template <class W, class R>
381  template <class ResponseType>
383  const internal::MethodHandler::HandlerParameter& param, ResponseType* rsp,
384  Status& status);
385  template <class ServiceType, class RequestType, class ResponseType,
386  class BaseRequestType, class BaseResponseType>
388  template <class ServiceType, class RequestType, class ResponseType>
390  template <class ServiceType, class RequestType, class ResponseType>
392  template <class Streamer, bool WriteNeeded>
394  template <class RequestType, class ResponseType>
396  template <class RequestType, class ResponseType>
398  template <class RequestType, class ResponseType>
400  template <class RequestType, class ResponseType>
402  template <grpc::StatusCode code>
404  template <class Base>
406  friend class grpc::ClientContext;
409 
412  ServerContextBase& operator=(const ServerContextBase&);
413 
414  class CompletionOp;
415 
416  void BeginCompletionOp(
417  grpc::internal::Call* call, std::function<void(bool)> callback,
418  grpc::internal::ServerCallbackCall* callback_controller);
420  grpc::internal::CompletionQueueTag* GetCompletionOpTag();
421 
422  void set_call(grpc_call* call, bool call_metric_recording_enabled,
423  experimental::ServerMetricRecorder* server_metric_recorder) {
424  call_.call = call;
425  if (call_metric_recording_enabled) {
426  CreateCallMetricRecorder(server_metric_recorder);
427  }
428  }
429 
430  void BindDeadlineAndMetadata(gpr_timespec deadline, grpc_metadata_array* arr);
431 
432  uint32_t initial_metadata_flags() const { return 0; }
433 
434  grpc::experimental::ServerRpcInfo* set_server_rpc_info(
435  const char* method, grpc::internal::RpcMethod::RpcType type,
436  const std::vector<std::unique_ptr<
438  if (!creators.empty()) {
439  rpc_info_ = new grpc::experimental::ServerRpcInfo(this, method, type);
440  rpc_info_->RegisterInterceptors(creators);
441  }
442  return rpc_info_;
443  }
444 
445  void set_message_allocator_state(RpcAllocatorState* allocator_state) {
446  message_allocator_state_ = allocator_state;
447  }
448 
449  void MaybeMarkCancelledOnRead() {
450  if (grpc_call_failed_before_recv_message(call_.call)) {
451  marked_cancelled_.store(true, std::memory_order_release);
452  }
453  }
454 
455  // This should be called only once and only when call metric recording is
456  // enabled.
457  void CreateCallMetricRecorder(
458  experimental::ServerMetricRecorder* server_metric_recorder = nullptr);
459 
460  struct CallWrapper {
461  ~CallWrapper();
462 
463  grpc_call* call = nullptr;
464  };
465 
466  // NOTE: call_ must be the first data member of this object so that its
467  // destructor is the last to be called, since its destructor may unref
468  // the underlying core call which holds the arena that may be used to
469  // hold this object.
470  CallWrapper call_;
471 
472  CompletionOp* completion_op_ = nullptr;
473  bool has_notify_when_done_tag_ = false;
474  void* async_notify_when_done_tag_ = nullptr;
476 
477  gpr_timespec deadline_;
478  grpc::CompletionQueue* cq_ = nullptr;
479  bool sent_initial_metadata_ = false;
480  mutable std::shared_ptr<const grpc::AuthContext> auth_context_;
481  mutable grpc::internal::MetadataMap client_metadata_;
482  std::multimap<std::string, std::string> initial_metadata_;
483  std::multimap<std::string, std::string> trailing_metadata_;
484 
485  bool compression_level_set_ = false;
486  grpc_compression_level compression_level_;
487  grpc_compression_algorithm compression_algorithm_;
488 
491  pending_ops_;
492  bool has_pending_ops_ = false;
493 
494  grpc::experimental::ServerRpcInfo* rpc_info_ = nullptr;
495  RpcAllocatorState* message_allocator_state_ = nullptr;
496  ContextAllocator* context_allocator_ = nullptr;
497  experimental::CallMetricRecorder* call_metric_recorder_ = nullptr;
498 
499  class Reactor : public grpc::ServerUnaryReactor {
500  public:
501  void OnCancel() override {}
502  void OnDone() override {}
503  // Override InternalInlineable for this class since its reactions are
504  // trivial and thus do not need to be run from the executor (triggering a
505  // thread hop). This should only be used by internal reactors (thus the
506  // name) and not by user application code.
507  bool InternalInlineable() override { return true; }
508  };
509 
510  void SetupTestDefaultReactor(std::function<void(grpc::Status)> func) {
511  // NOLINTNEXTLINE(modernize-make-unique)
512  test_unary_.reset(new TestServerCallbackUnary(this, std::move(func)));
513  }
514  bool test_status_set() const {
515  return (test_unary_ != nullptr) && test_unary_->status_set();
516  }
517  grpc::Status test_status() const { return test_unary_->status(); }
518 
519  class TestServerCallbackUnary : public grpc::ServerCallbackUnary {
520  public:
521  TestServerCallbackUnary(ServerContextBase* ctx,
522  std::function<void(grpc::Status)> func)
523  : reactor_(ctx->DefaultReactor()), func_(std::move(func)) {
524  this->BindReactor(reactor_);
525  }
526  void Finish(grpc::Status s) override {
527  status_ = s;
528  func_(std::move(s));
529  status_set_.store(true, std::memory_order_release);
530  }
531  void SendInitialMetadata() override {}
532 
533  bool status_set() const {
534  return status_set_.load(std::memory_order_acquire);
535  }
536  grpc::Status status() const { return status_; }
537 
538  private:
539  void CallOnDone() override {}
540  grpc::internal::ServerReactor* reactor() override { return reactor_; }
541 
542  grpc::ServerUnaryReactor* const reactor_;
543  std::atomic_bool status_set_{false};
544  grpc::Status status_;
545  const std::function<void(grpc::Status s)> func_;
546  };
547 
548  alignas(Reactor) char default_reactor_[sizeof(Reactor)];
549  std::atomic_bool default_reactor_used_{false};
550 
551  std::atomic_bool marked_cancelled_{false};
552 
553  std::unique_ptr<TestServerCallbackUnary> test_unary_;
554 };
555 
573  public:
574  ServerContext() {} // for async calls
575 
593 
594  // Sync/CQ-based Async ServerContext only
596 
597  private:
598  // Constructor for internal use by server only
599  friend class grpc::Server;
601  : ServerContextBase(deadline, arr) {}
602 
603  // CallbackServerContext only
606 
608  ServerContext(const ServerContext&) = delete;
609  ServerContext& operator=(const ServerContext&) = delete;
610 };
611 
613  public:
617 
637 
638  // CallbackServerContext only
641 
642  private:
643  // Sync/CQ-based Async ServerContext only
645 
648  CallbackServerContext& operator=(const CallbackServerContext&) = delete;
649 };
650 
657  public:
658  virtual ~ContextAllocator() {}
659 
660  virtual CallbackServerContext* NewCallbackServerContext() { return nullptr; }
661 
663  return nullptr;
664  }
665 
666  virtual void Release(CallbackServerContext*) {}
667 
669 };
670 
671 } // namespace grpc
672 
673 static_assert(
674  std::is_base_of<grpc::ServerContextBase, grpc::ServerContext>::value,
675  "improper base class");
676 static_assert(std::is_base_of<grpc::ServerContextBase,
678  "improper base class");
679 static_assert(sizeof(grpc::ServerContextBase) == sizeof(grpc::ServerContext),
680  "wrong size");
681 static_assert(sizeof(grpc::ServerContextBase) ==
683  "wrong size");
684 
685 #endif // GRPCPP_SERVER_CONTEXT_H
grpc::internal::CallbackWithSuccessTag
CallbackWithSuccessTag can be reused multiple times, and will be used in this fashion for streaming o...
Definition: callback_common.h:136
grpc::string_ref
This class is a non owning reference to a string.
Definition: string_ref.h:41
census_context
struct census_context census_context
A Census Context is a handle used by Census to represent the current tracing and stats collection inf...
Definition: census.h:34
grpc::ServerContextBase::set_compression_algorithm
void set_compression_algorithm(grpc_compression_algorithm algorithm)
Set algorithm to be the compression algorithm used for the server call.
time.h
grpc::ServerContextBase::SetLoadReportingCosts
void SetLoadReportingCosts(const std::vector< std::string > &cost_data)
Set the serialized load reporting costs in cost_data for the call.
message_allocator.h
grpc::experimental::ServerMetricRecorder
Records server wide metrics to be reported to the client.
Definition: server_metric_recorder.h:42
grpc::ContextAllocator::NewGenericCallbackServerContext
virtual GenericCallbackServerContext * NewGenericCallbackServerContext()
Definition: server_context.h:662
grpc::ServerContext
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:572
grpc::Server
Represents a gRPC server.
Definition: server.h:58
grpc::ServerContextBase::census_context
const struct census_context * census_context() const
Get the census context associated with this server call.
grpc
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
grpc::internal::CallOpSet
Primary implementation of CallOpSetInterface.
Definition: completion_queue.h:96
grpc::ServerContextBase::IsCancelled
bool IsCancelled() const
Return whether this RPC failed before the server could provide its status back to the client.
grpc::CallbackServerContext
Definition: server_context.h:612
grpc::ServerContextBase::set_context_allocator
void set_context_allocator(ContextAllocator *context_allocator)
Definition: server_context.h:355
grpc::internal::CallOpSendMessage
Definition: call_op_set.h:286
grpc::RpcAllocatorState
Definition: message_allocator.h:26
grpc_call_failed_before_recv_message
GRPCAPI int grpc_call_failed_before_recv_message(const grpc_call *c)
grpc::ServerAsyncWriter
Async server-side API for doing server streaming RPCs, where the outgoing message stream from the ser...
Definition: server_context.h:58
grpc::internal::ErrorMethodHandler
General method handler class for errors that prevent real method use e.g., handle unknown method by r...
Definition: completion_queue.h:80
grpc::internal::MethodHandler::HandlerParameter
Definition: rpc_service_method.h:41
grpc_metadata_array
Definition: grpc_types.h:253
grpc::internal::RpcMethodHandler
A wrapper class of an application provided rpc method handler.
Definition: completion_queue.h:72
grpc::ServerWriter
Synchronous (blocking) server-side API for doing for doing a server-streaming RPCs,...
Definition: completion_queue.h:61
grpc_compression_algorithm
grpc_compression_algorithm
The various compression algorithms supported by gRPC (not sorted by compression level)
Definition: compression_types.h:60
grpc::ServerContextBase::DefaultReactor
grpc::ServerUnaryReactor * DefaultReactor()
Get a library-owned default unary reactor for use in minimal reaction cases.
Definition: server_context.h:334
grpc::internal::Call
Straightforward wrapping of the C call object.
Definition: call.h:36
grpc::ServerContextBase
Base class of ServerContext.
Definition: server_context.h:124
rpc_service_method.h
grpc::ServerContextBase::context_allocator
ContextAllocator * context_allocator() const
Definition: server_context.h:359
status.h
grpc::ServerCallbackUnary::BindReactor
void BindReactor(Reactor *reactor)
Definition: server_callback.h:201
grpc::internal::CallOpSendInitialMetadata
Definition: call_op_set.h:216
grpc::ServerContextBase::ServerContextBase
ServerContextBase()
Constructors for use by derived classes.
completion_queue_tag.h
grpc::internal::MetadataMap
Definition: metadata_map.h:34
metadata_map.h
grpc::internal::ServerReaderWriterBody
Definition: completion_queue.h:64
grpc::ServerContextBase::DefaultReactorTestPeer
friend class grpc::testing::DefaultReactorTestPeer
Definition: server_context.h:364
grpc::ServerContextBase::ServerContextTestSpouse
friend class grpc::testing::ServerContextTestSpouse
Definition: server_context.h:363
grpc::internal::MetadataMap::map
std::multimap< grpc::string_ref, grpc::string_ref > * map()
Definition: metadata_map.h:67
grpc::Status
Did it work? If it didn't, why?
Definition: status.h:35
grpc_metadata
A single metadata element.
Definition: grpc_types.h:211
grpc::ContextAllocator::Release
virtual void Release(CallbackServerContext *)
Definition: server_context.h:666
grpc::experimental::CallMetricRecorder
Records call metrics for the purpose of load balancing.
Definition: call_metric_recorder.h:37
grpc::ServerContextBase::ExperimentalGetCallMetricRecorder
experimental::CallMetricRecorder * ExperimentalGetCallMetricRecorder()
Get the CallMetricRecorder object for the current RPC.
Definition: server_context.h:296
grpc::internal::ServerCallbackCall
The base class of ServerCallbackUnary etc.
Definition: server_callback.h:73
grpc::CreateAuthContext
std::shared_ptr< const AuthContext > CreateAuthContext(grpc_call *call)
TODO(ctiller): not sure we want to make this a permanent thing.
grpc::ServerReader
Synchronous (blocking) server-side API for doing client-streaming RPCs, where the incoming message st...
Definition: completion_queue.h:59
grpc::ServerContextBase::deadline
std::chrono::system_clock::time_point deadline() const
Return the deadline for the server call.
Definition: server_context.h:129
grpc::ServerContextBase::raw_deadline
gpr_timespec raw_deadline() const
Return a gpr_timespec representation of the server call's deadline.
Definition: server_context.h:134
callback_common.h
grpc::ClientContext
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:193
grpc::ServerContextBase::GetRpcAllocatorState
RpcAllocatorState * GetRpcAllocatorState()
NOTE: This is an API for advanced users who need custom allocators.
Definition: server_context.h:318
grpc::ServerContextBase::AddInitialMetadata
void AddInitialMetadata(const std::string &key, const std::string &value)
Add the (key, value) pair to the initial metadata associated with a server call.
grpc.h
grpc_call
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
grpc::internal::CallbackUnaryHandler
Definition: server_callback_handlers.h:33
grpc::ServerContextBase::auth_context
std::shared_ptr< const grpc::AuthContext > auth_context() const
Return the authentication context for this server call.
Definition: server_context.h:271
grpc::internal::CallbackServerStreamingHandler
Definition: server_callback_handlers.h:442
grpc::ServerContextBase::compression_level_set
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:251
grpc::ContextAllocator::NewCallbackServerContext
virtual CallbackServerContext * NewCallbackServerContext()
Definition: server_context.h:660
grpc::internal::RpcMethod::RpcType
RpcType
Definition: rpc_method.h:31
grpc::CallbackServerContext::CallbackServerContext
CallbackServerContext()
Public constructors are for direct use only by mocking tests.
Definition: server_context.h:616
grpc::GenericServerContext
Definition: async_generic_service.h:39
grpc::ServerContextBase::AddTrailingMetadata
void AddTrailingMetadata(const std::string &key, const std::string &value)
Add the (key, value) pair to the initial metadata associated with a server call.
grpc::experimental::ServerRpcInfo
ServerRpcInfo represents the state of a particular RPC as it appears to an interceptor.
Definition: server_interceptor.h:57
grpc::internal::FinishOnlyReactor
Definition: server_context.h:88
server_interceptor.h
grpc::internal::CompletionQueueTag
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:26
compression_types.h
grpc::ServerContextBase::client_metadata
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:230
server_callback.h
grpc::experimental::ServerInterceptorFactoryInterface
Definition: server_interceptor.h:44
grpc::ServerContextBase::~ServerContextBase
virtual ~ServerContextBase()
grpc::internal::ServerStreamingHandler
A wrapper class of an application provided server streaming handler.
Definition: completion_queue.h:76
grpc::ServerAsyncResponseWriter
Async server-side API for handling unary calls, where the single response message sent to the client ...
Definition: server_context.h:60
grpc::internal::CallbackBidiHandler
Definition: server_callback_handlers.h:668
grpc::ContextAllocator
A CallbackServerContext allows users to use the contents of the CallbackServerContext or GenericCallb...
Definition: server_context.h:656
grpc::internal::ClientStreamingHandler
A wrapper class of an application provided client streaming handler.
Definition: completion_queue.h:74
grpc::ServerContextBase::AsyncNotifyWhenDone
void AsyncNotifyWhenDone(void *tag)
Async only.
Definition: server_context.h:310
grpc::internal::TemplatedBidiStreamingHandler
A wrapper class of an application provided bidi-streaming handler.
Definition: completion_queue.h:78
config.h
grpc::internal::BidiStreamingHandler
Definition: server_context.h:70
grpc_compression_level
grpc_compression_level
Compression levels allow a party with knowledge of its peer's accepted encodings to request compressi...
Definition: compression_types.h:72
call_op_set.h
std
Definition: async_unary_call.h:405
call.h
grpc::ServerContextBase::InteropServerContextInspector
friend class grpc::testing::InteropServerContextInspector
Definition: server_context.h:362
grpc::GenericCallbackServerContext
Definition: async_generic_service.h:87
create_auth_context.h
grpc::ServerContextBase::peer
std::string peer() const
Return the peer uri in a string.
grpc::internal::ServerReactor
Definition: server_callback.h:49
grpc::CompletionQueue
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:103
grpc::ServerContextBase::ExperimentalGetAuthority
grpc::string_ref ExperimentalGetAuthority() const
EXPERIMENTAL API Returns the call's authority.
grpc::internal::CallbackClientStreamingHandler
Definition: server_callback_handlers.h:251
grpc::ServerContextBase::TryCancel
void TryCancel() const
Cancel the Call from the server.
grpc::ContextAllocator::~ContextAllocator
virtual ~ContextAllocator()
Definition: server_context.h:658
grpc::ServerAsyncReader
Async server-side API for doing client-streaming RPCs, where the incoming message stream from the cli...
Definition: server_context.h:56
grpc::ServerAsyncReaderWriter
Async server-side API for doing bidirectional streaming RPCs, where the incoming message stream comin...
Definition: server_context.h:62
grpc::ServerInterface
Definition: server_interface.h:60
grpc::ServerContext::ServerContext
ServerContext()
Definition: server_context.h:574
gpr_timespec
Analogous to struct timespec.
Definition: time.h:48
grpc::internal::UnaryRunHandlerHelper
void UnaryRunHandlerHelper(const grpc::internal::MethodHandler::HandlerParameter &, ResponseType *, grpc::Status &)
A helper function with reduced templating to do the common work needed to actually send the server re...
Definition: method_handler.h:58
grpc::ServerCallbackUnary
Definition: server_callback.h:191
grpc::ServerUnaryReactor
Definition: server_callback.h:697
auth_context.h
grpc::ServerContextBase::compression_algorithm
grpc_compression_algorithm compression_algorithm() const
Return the compression algorithm the server call will request be used.
Definition: server_context.h:257
grpc::ServerContextBase::c_call
grpc_call * c_call()
Should be used for framework-level extensions only.
Definition: server_context.h:289
grpc::Timespec2Timepoint
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t)
grpc::ContextAllocator::Release
virtual void Release(GenericCallbackServerContext *)
Definition: server_context.h:668
string_ref.h
grpc::ServerContextBase::set_compression_level
void set_compression_level(grpc_compression_level level)
Set level to be the compression level used for the server call.
Definition: server_context.h:243
metadata_map.h
port_platform.h
grpc::ServerContextBase::compression_level
grpc_compression_level compression_level() const
Return the compression algorithm to be used by the server call.
Definition: server_context.h:236