GRPC C++  1.53.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 
217  void TryCancel() const;
218 
228  const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata()
229  const {
230  return *client_metadata_.map();
231  }
232 
235  return compression_level_;
236  }
237 
242  compression_level_set_ = true;
243  compression_level_ = level;
244  }
245 
249  bool compression_level_set() const { return compression_level_set_; }
250 
256  return compression_algorithm_;
257  }
262 
264  void SetLoadReportingCosts(const std::vector<std::string>& cost_data);
265 
269  std::shared_ptr<const grpc::AuthContext> auth_context() const {
270  if (auth_context_ == nullptr) {
271  auth_context_ = grpc::CreateAuthContext(call_.call);
272  }
273  return auth_context_;
274  }
275 
280  std::string peer() const;
281 
283  const struct census_context* census_context() const;
284 
287  grpc_call* c_call() { return call_.call; }
288 
295  return call_metric_recorder_;
296  }
297 
301 
302  protected:
308  void AsyncNotifyWhenDone(void* tag) {
309  has_notify_when_done_tag_ = true;
310  async_notify_when_done_tag_ = tag;
311  }
312 
316  RpcAllocatorState* GetRpcAllocatorState() { return message_allocator_state_; }
317 
333  // Short-circuit the case where a default reactor was already set up by
334  // the TestPeer.
335  if (test_unary_ != nullptr) {
336  return reinterpret_cast<Reactor*>(&default_reactor_);
337  }
338  new (&default_reactor_) Reactor;
339 #ifndef NDEBUG
340  bool old = false;
341  assert(default_reactor_used_.compare_exchange_strong(
342  old, true, std::memory_order_relaxed));
343 #else
344  default_reactor_used_.store(true, std::memory_order_relaxed);
345 #endif
346  return reinterpret_cast<Reactor*>(&default_reactor_);
347  }
348 
352 
354  context_allocator_ = context_allocator;
355  }
356 
357  ContextAllocator* context_allocator() const { return context_allocator_; }
358 
359  private:
363  friend class grpc::ServerInterface;
364  friend class grpc::Server;
365  template <class W, class R>
367  template <class W>
369  template <class W>
371  template <class W, class R>
373  template <class R>
374  friend class grpc::ServerReader;
375  template <class W>
376  friend class grpc::ServerWriter;
377  template <class W, class R>
379  template <class ResponseType>
381  const internal::MethodHandler::HandlerParameter& param, ResponseType* rsp,
382  Status& status);
383  template <class ServiceType, class RequestType, class ResponseType,
384  class BaseRequestType, class BaseResponseType>
386  template <class ServiceType, class RequestType, class ResponseType>
388  template <class ServiceType, class RequestType, class ResponseType>
390  template <class Streamer, bool WriteNeeded>
392  template <class RequestType, class ResponseType>
394  template <class RequestType, class ResponseType>
396  template <class RequestType, class ResponseType>
398  template <class RequestType, class ResponseType>
400  template <grpc::StatusCode code>
402  template <class Base>
404  friend class grpc::ClientContext;
407 
410  ServerContextBase& operator=(const ServerContextBase&);
411 
412  class CompletionOp;
413 
414  void BeginCompletionOp(
415  grpc::internal::Call* call, std::function<void(bool)> callback,
416  grpc::internal::ServerCallbackCall* callback_controller);
418  grpc::internal::CompletionQueueTag* GetCompletionOpTag();
419 
420  void set_call(grpc_call* call, bool call_metric_recording_enabled,
421  experimental::ServerMetricRecorder* server_metric_recorder) {
422  call_.call = call;
423  if (call_metric_recording_enabled) {
424  CreateCallMetricRecorder(server_metric_recorder);
425  }
426  }
427 
428  void BindDeadlineAndMetadata(gpr_timespec deadline, grpc_metadata_array* arr);
429 
430  uint32_t initial_metadata_flags() const { return 0; }
431 
432  grpc::experimental::ServerRpcInfo* set_server_rpc_info(
433  const char* method, grpc::internal::RpcMethod::RpcType type,
434  const std::vector<std::unique_ptr<
436  if (!creators.empty()) {
437  rpc_info_ = new grpc::experimental::ServerRpcInfo(this, method, type);
438  rpc_info_->RegisterInterceptors(creators);
439  }
440  return rpc_info_;
441  }
442 
443  void set_message_allocator_state(RpcAllocatorState* allocator_state) {
444  message_allocator_state_ = allocator_state;
445  }
446 
447  void MaybeMarkCancelledOnRead() {
448  if (grpc_call_failed_before_recv_message(call_.call)) {
449  marked_cancelled_.store(true, std::memory_order_release);
450  }
451  }
452 
453  // This should be called only once and only when call metric recording is
454  // enabled.
455  void CreateCallMetricRecorder(
456  experimental::ServerMetricRecorder* server_metric_recorder = nullptr);
457 
458  struct CallWrapper {
459  ~CallWrapper();
460 
461  grpc_call* call = nullptr;
462  };
463 
464  // NOTE: call_ must be the first data member of this object so that its
465  // destructor is the last to be called, since its destructor may unref
466  // the underlying core call which holds the arena that may be used to
467  // hold this object.
468  CallWrapper call_;
469 
470  CompletionOp* completion_op_ = nullptr;
471  bool has_notify_when_done_tag_ = false;
472  void* async_notify_when_done_tag_ = nullptr;
474 
475  gpr_timespec deadline_;
476  grpc::CompletionQueue* cq_ = nullptr;
477  bool sent_initial_metadata_ = false;
478  mutable std::shared_ptr<const grpc::AuthContext> auth_context_;
479  mutable grpc::internal::MetadataMap client_metadata_;
480  std::multimap<std::string, std::string> initial_metadata_;
481  std::multimap<std::string, std::string> trailing_metadata_;
482 
483  bool compression_level_set_ = false;
484  grpc_compression_level compression_level_;
485  grpc_compression_algorithm compression_algorithm_;
486 
489  pending_ops_;
490  bool has_pending_ops_ = false;
491 
492  grpc::experimental::ServerRpcInfo* rpc_info_ = nullptr;
493  RpcAllocatorState* message_allocator_state_ = nullptr;
494  ContextAllocator* context_allocator_ = nullptr;
495  experimental::CallMetricRecorder* call_metric_recorder_ = nullptr;
496 
497  class Reactor : public grpc::ServerUnaryReactor {
498  public:
499  void OnCancel() override {}
500  void OnDone() override {}
501  // Override InternalInlineable for this class since its reactions are
502  // trivial and thus do not need to be run from the executor (triggering a
503  // thread hop). This should only be used by internal reactors (thus the
504  // name) and not by user application code.
505  bool InternalInlineable() override { return true; }
506  };
507 
508  void SetupTestDefaultReactor(std::function<void(grpc::Status)> func) {
509  // NOLINTNEXTLINE(modernize-make-unique)
510  test_unary_.reset(new TestServerCallbackUnary(this, std::move(func)));
511  }
512  bool test_status_set() const {
513  return (test_unary_ != nullptr) && test_unary_->status_set();
514  }
515  grpc::Status test_status() const { return test_unary_->status(); }
516 
517  class TestServerCallbackUnary : public grpc::ServerCallbackUnary {
518  public:
519  TestServerCallbackUnary(ServerContextBase* ctx,
520  std::function<void(grpc::Status)> func)
521  : reactor_(ctx->DefaultReactor()), func_(std::move(func)) {
522  this->BindReactor(reactor_);
523  }
524  void Finish(grpc::Status s) override {
525  status_ = s;
526  func_(std::move(s));
527  status_set_.store(true, std::memory_order_release);
528  }
529  void SendInitialMetadata() override {}
530 
531  bool status_set() const {
532  return status_set_.load(std::memory_order_acquire);
533  }
534  grpc::Status status() const { return status_; }
535 
536  private:
537  void CallOnDone() override {}
538  grpc::internal::ServerReactor* reactor() override { return reactor_; }
539 
540  grpc::ServerUnaryReactor* const reactor_;
541  std::atomic_bool status_set_{false};
542  grpc::Status status_;
543  const std::function<void(grpc::Status s)> func_;
544  };
545 
546  typename std::aligned_storage<sizeof(Reactor), alignof(Reactor)>::type
547  default_reactor_;
548  std::atomic_bool default_reactor_used_{false};
549 
550  std::atomic_bool marked_cancelled_{false};
551 
552  std::unique_ptr<TestServerCallbackUnary> test_unary_;
553 };
554 
572  public:
573  ServerContext() {} // for async calls
574 
592 
593  // Sync/CQ-based Async ServerContext only
595 
596  private:
597  // Constructor for internal use by server only
598  friend class grpc::Server;
600  : ServerContextBase(deadline, arr) {}
601 
602  // CallbackServerContext only
605 
607  ServerContext(const ServerContext&) = delete;
608  ServerContext& operator=(const ServerContext&) = delete;
609 };
610 
612  public:
616 
636 
637  // CallbackServerContext only
640 
641  private:
642  // Sync/CQ-based Async ServerContext only
644 
647  CallbackServerContext& operator=(const CallbackServerContext&) = delete;
648 };
649 
656  public:
657  virtual ~ContextAllocator() {}
658 
659  virtual CallbackServerContext* NewCallbackServerContext() { return nullptr; }
660 
662  return nullptr;
663  }
664 
665  virtual void Release(CallbackServerContext*) {}
666 
668 };
669 
670 } // namespace grpc
671 
672 static_assert(
673  std::is_base_of<grpc::ServerContextBase, grpc::ServerContext>::value,
674  "improper base class");
675 static_assert(std::is_base_of<grpc::ServerContextBase,
677  "improper base class");
678 static_assert(sizeof(grpc::ServerContextBase) == sizeof(grpc::ServerContext),
679  "wrong size");
680 static_assert(sizeof(grpc::ServerContextBase) ==
682  "wrong size");
683 
684 #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:661
grpc::ServerContext
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:571
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:32
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:611
grpc::ServerContextBase::set_context_allocator
void set_context_allocator(ContextAllocator *context_allocator)
Definition: server_context.h:353
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:591
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:332
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:357
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:362
grpc::ServerContextBase::ServerContextTestSpouse
friend class grpc::testing::ServerContextTestSpouse
Definition: server_context.h:361
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:549
grpc::ContextAllocator::Release
virtual void Release(CallbackServerContext *)
Definition: server_context.h:665
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:294
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:316
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:69
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:269
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:249
grpc::ContextAllocator::NewCallbackServerContext
virtual CallbackServerContext * NewCallbackServerContext()
Definition: server_context.h:659
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:615
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:228
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:655
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:308
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:360
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:657
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:573
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:255
grpc::ServerContextBase::c_call
grpc_call * c_call()
Should be used for framework-level extensions only.
Definition: server_context.h:287
grpc::Timespec2Timepoint
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t)
grpc::ContextAllocator::Release
virtual void Release(GenericCallbackServerContext *)
Definition: server_context.h:667
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:241
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:234