GRPC C++  1.50.0
server_context.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2019 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_IMPL_CODEGEN_SERVER_CONTEXT_H
20 #define GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H
21 
22 // IWYU pragma: private, include <grpcpp/server_context.h>
23 
25 
26 #include <atomic>
27 #include <cassert>
28 #include <map>
29 #include <memory>
30 #include <type_traits>
31 #include <vector>
32 
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 
69 
70 namespace internal {
71 template <class ServiceType, class RequestType, class ResponseType>
72 class BidiStreamingHandler;
73 template <class RequestType, class ResponseType>
74 class CallbackUnaryHandler;
75 template <class RequestType, class ResponseType>
76 class CallbackClientStreamingHandler;
77 template <class RequestType, class ResponseType>
78 class CallbackServerStreamingHandler;
79 template <class RequestType, class ResponseType>
80 class CallbackBidiHandler;
81 template <class ServiceType, class RequestType, class ResponseType>
82 class ClientStreamingHandler;
83 template <class ResponseType>
84 void UnaryRunHandlerHelper(const MethodHandler::HandlerParameter&,
85  ResponseType*, Status&);
86 template <class ServiceType, class RequestType, class ResponseType,
87  class BaseRequestType, class BaseResponseType>
88 class RpcMethodHandler;
89 template <class Base>
90 class FinishOnlyReactor;
91 template <class W, class R>
92 class ServerReaderWriterBody;
93 template <class ServiceType, class RequestType, class ResponseType>
94 class ServerStreamingHandler;
95 class ServerReactor;
96 template <class Streamer, bool WriteNeeded>
97 class TemplatedBidiStreamingHandler;
98 template <grpc::StatusCode code>
99 class ErrorMethodHandler;
100 } // namespace internal
101 
102 class ClientContext;
103 class CompletionQueue;
105 class Server;
106 class ServerInterface;
107 class ContextAllocator;
109 
110 namespace internal {
111 class Call;
112 } // namespace internal
113 
114 namespace testing {
115 class InteropServerContextInspector;
116 class ServerContextTestSpouse;
117 class DefaultReactorTestPeer;
118 } // namespace testing
119 
120 namespace experimental {
121 class OrcaServerInterceptor;
122 class CallMetricRecorder;
123 } // namespace experimental
124 
127  public:
128  virtual ~ServerContextBase();
129 
131  std::chrono::system_clock::time_point deadline() const {
132  return grpc::Timespec2Timepoint(deadline_);
133  }
134 
136  gpr_timespec raw_deadline() const { return deadline_; }
137 
152 
161  void AddInitialMetadata(const std::string& key, const std::string& value);
162 
177 
186  void AddTrailingMetadata(const std::string& key, const std::string& value);
187 
199  bool IsCancelled() const;
200 
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;
410 
413  ServerContextBase& operator=(const ServerContextBase&);
414 
415  class CompletionOp;
416 
417  void BeginCompletionOp(
418  grpc::internal::Call* call, std::function<void(bool)> callback,
419  grpc::internal::ServerCallbackCall* callback_controller);
421  grpc::internal::CompletionQueueTag* GetCompletionOpTag();
422 
423  void set_call(grpc_call* call) { call_.call = call; }
424 
425  void BindDeadlineAndMetadata(gpr_timespec deadline, grpc_metadata_array* arr);
426 
427  uint32_t initial_metadata_flags() const { return 0; }
428 
429  grpc::experimental::ServerRpcInfo* set_server_rpc_info(
430  const char* method, grpc::internal::RpcMethod::RpcType type,
431  const std::vector<std::unique_ptr<
433  if (!creators.empty()) {
434  rpc_info_ = new grpc::experimental::ServerRpcInfo(this, method, type);
435  rpc_info_->RegisterInterceptors(creators);
436  }
437  return rpc_info_;
438  }
439 
440  void set_message_allocator_state(RpcAllocatorState* allocator_state) {
441  message_allocator_state_ = allocator_state;
442  }
443 
444  void MaybeMarkCancelledOnRead() {
446  call_.call)) {
447  marked_cancelled_.store(true, std::memory_order_release);
448  }
449  }
450 
451  void CreateCallMetricRecorder();
452 
453  struct CallWrapper {
454  ~CallWrapper();
455 
456  grpc_call* call = nullptr;
457  };
458 
459  // NOTE: call_ must be the first data member of this object so that its
460  // destructor is the last to be called, since its destructor may unref
461  // the underlying core call which holds the arena that may be used to
462  // hold this object.
463  CallWrapper call_;
464 
465  CompletionOp* completion_op_ = nullptr;
466  bool has_notify_when_done_tag_ = false;
467  void* async_notify_when_done_tag_ = nullptr;
469 
470  gpr_timespec deadline_;
471  grpc::CompletionQueue* cq_ = nullptr;
472  bool sent_initial_metadata_ = false;
473  mutable std::shared_ptr<const grpc::AuthContext> auth_context_;
474  mutable grpc::internal::MetadataMap client_metadata_;
475  std::multimap<std::string, std::string> initial_metadata_;
476  std::multimap<std::string, std::string> trailing_metadata_;
477 
478  bool compression_level_set_ = false;
479  grpc_compression_level compression_level_;
480  grpc_compression_algorithm compression_algorithm_;
481 
484  pending_ops_;
485  bool has_pending_ops_ = false;
486 
487  grpc::experimental::ServerRpcInfo* rpc_info_ = nullptr;
488  RpcAllocatorState* message_allocator_state_ = nullptr;
489  ContextAllocator* context_allocator_ = nullptr;
490  experimental::CallMetricRecorder* call_metric_recorder_ = nullptr;
491 
492  class Reactor : public grpc::ServerUnaryReactor {
493  public:
494  void OnCancel() override {}
495  void OnDone() override {}
496  // Override InternalInlineable for this class since its reactions are
497  // trivial and thus do not need to be run from the executor (triggering a
498  // thread hop). This should only be used by internal reactors (thus the
499  // name) and not by user application code.
500  bool InternalInlineable() override { return true; }
501  };
502 
503  void SetupTestDefaultReactor(std::function<void(grpc::Status)> func) {
504  // NOLINTNEXTLINE(modernize-make-unique)
505  test_unary_.reset(new TestServerCallbackUnary(this, std::move(func)));
506  }
507  bool test_status_set() const {
508  return (test_unary_ != nullptr) && test_unary_->status_set();
509  }
510  grpc::Status test_status() const { return test_unary_->status(); }
511 
512  class TestServerCallbackUnary : public grpc::ServerCallbackUnary {
513  public:
514  TestServerCallbackUnary(ServerContextBase* ctx,
515  std::function<void(grpc::Status)> func)
516  : reactor_(ctx->DefaultReactor()), func_(std::move(func)) {
517  this->BindReactor(reactor_);
518  }
519  void Finish(grpc::Status s) override {
520  status_ = s;
521  func_(std::move(s));
522  status_set_.store(true, std::memory_order_release);
523  }
524  void SendInitialMetadata() override {}
525 
526  bool status_set() const {
527  return status_set_.load(std::memory_order_acquire);
528  }
529  grpc::Status status() const { return status_; }
530 
531  private:
532  void CallOnDone() override {}
533  grpc::internal::ServerReactor* reactor() override { return reactor_; }
534 
535  grpc::ServerUnaryReactor* const reactor_;
536  std::atomic_bool status_set_{false};
537  grpc::Status status_;
538  const std::function<void(grpc::Status s)> func_;
539  };
540 
541  typename std::aligned_storage<sizeof(Reactor), alignof(Reactor)>::type
542  default_reactor_;
543  std::atomic_bool default_reactor_used_{false};
544 
545  std::atomic_bool marked_cancelled_{false};
546 
547  std::unique_ptr<TestServerCallbackUnary> test_unary_;
548 };
549 
567  public:
568  ServerContext() {} // for async calls
569 
587 
588  // Sync/CQ-based Async ServerContext only
590 
591  private:
592  // Constructor for internal use by server only
593  friend class grpc::Server;
595  : ServerContextBase(deadline, arr) {}
596 
597  // CallbackServerContext only
600 
602  ServerContext(const ServerContext&) = delete;
603  ServerContext& operator=(const ServerContext&) = delete;
604 };
605 
607  public:
611 
631 
632  // CallbackServerContext only
635 
636  private:
637  // Sync/CQ-based Async ServerContext only
639 
642  CallbackServerContext& operator=(const CallbackServerContext&) = delete;
643 };
644 
651  public:
652  virtual ~ContextAllocator() {}
653 
654  virtual CallbackServerContext* NewCallbackServerContext() { return nullptr; }
655 
657  return nullptr;
658  }
659 
660  virtual void Release(CallbackServerContext*) {}
661 
663 };
664 
665 } // namespace grpc
666 
667 static_assert(
668  std::is_base_of<grpc::ServerContextBase, grpc::ServerContext>::value,
669  "improper base class");
670 static_assert(std::is_base_of<grpc::ServerContextBase,
672  "improper base class");
673 static_assert(sizeof(grpc::ServerContextBase) == sizeof(grpc::ServerContext),
674  "wrong size");
675 static_assert(sizeof(grpc::ServerContextBase) ==
677  "wrong size");
678 
679 #endif // GRPCPP_IMPL_CODEGEN_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:137
grpc::string_ref
This class is a non owning reference to a string.
Definition: string_ref.h:43
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.
grpc::ServerContextBase::SetLoadReportingCosts
void SetLoadReportingCosts(const std::vector< std::string > &cost_data)
Set the serialized load reporting costs in cost_data for the call.
grpc::ContextAllocator::NewGenericCallbackServerContext
virtual GenericCallbackServerContext * NewGenericCallbackServerContext()
Definition: server_context.h:656
grpc::ServerContext
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:566
grpc::Server
Represents a gRPC server.
Definition: server.h:59
time.h
rpc_service_method.h
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: call_op_set.h:859
grpc::ServerContextBase::IsCancelled
bool IsCancelled() const
Return whether this RPC failed before the server could provide its status back to the client.
status.h
grpc::CallbackServerContext
Definition: server_context.h:606
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:289
grpc::RpcAllocatorState
Definition: message_allocator.h:28
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:79
grpc::internal::MethodHandler::HandlerParameter
Definition: rpc_service_method.h:43
grpc_metadata_array
Definition: grpc_types.h:582
grpc::internal::RpcMethodHandler
A wrapper class of an application provided rpc method handler.
Definition: completion_queue.h:71
grpc::ServerWriter
Synchronous (blocking) server-side API for doing for doing a server-streaming RPCs,...
Definition: completion_queue.h:60
config.h
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::OrcaServerInterceptor
friend class grpc::experimental::OrcaServerInterceptor
Definition: server_context.h:409
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
auth_context.h
grpc::ServerContextBase
Base class of ServerContext.
Definition: server_context.h:126
server_interceptor.h
grpc::ServerContextBase::context_allocator
ContextAllocator * context_allocator() const
Definition: server_context.h:359
grpc::ServerCallbackUnary::BindReactor
void BindReactor(Reactor *reactor)
Definition: server_callback.h:203
server_callback.h
grpc::internal::CallOpSendInitialMetadata
Definition: call_op_set.h:219
grpc::ServerContextBase::ServerContextBase
ServerContextBase()
Constructors for use by derived classes.
grpc::internal::MetadataMap
Definition: metadata_map.h:35
metadata_map.h
grpc::internal::ServerReaderWriterBody
Definition: completion_queue.h:63
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:68
grpc::Status
Did it work? If it didn't, why?
Definition: status.h:35
grpc_metadata
A single metadata element.
Definition: grpc_types.h:540
grpc::ContextAllocator::Release
virtual void Release(CallbackServerContext *)
Definition: server_context.h:660
grpc::experimental::CallMetricRecorder
Records call metrics for the purpose of load balancing.
Definition: call_metric_recorder.h:52
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:75
grpc::CreateAuthContext
std::shared_ptr< const AuthContext > CreateAuthContext(grpc_call *call)
grpc::ServerReader
Synchronous (blocking) server-side API for doing client-streaming RPCs, where the incoming message st...
Definition: completion_queue.h:58
grpc::ServerContextBase::deadline
std::chrono::system_clock::time_point deadline() const
Return the deadline for the server call.
Definition: server_context.h:131
grpc::ServerContextBase::raw_deadline
gpr_timespec raw_deadline() const
Return a gpr_timespec representation of the server call's deadline.
Definition: server_context.h:136
grpc::ClientContext
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:195
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_call
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
grpc::internal::CallbackUnaryHandler
Definition: server_callback.h:43
completion_queue_tag.h
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.h:47
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::CoreCodegenInterface::grpc_call_failed_before_recv_message
virtual int grpc_call_failed_before_recv_message(const grpc_call *c)=0
grpc::ContextAllocator::NewCallbackServerContext
virtual CallbackServerContext * NewCallbackServerContext()
Definition: server_context.h:654
grpc::internal::RpcMethod::RpcType
RpcType
Definition: rpc_method.h:33
grpc::CallbackServerContext::CallbackServerContext
CallbackServerContext()
Public constructors are for direct use only by mocking tests.
Definition: server_context.h:610
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:58
grpc::internal::FinishOnlyReactor
Definition: server_callback.h:770
grpc::internal::CompletionQueueTag
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:28
grpc::CoreCodegenInterface
Interface between the codegen library and the minimal subset of core features required by the generat...
Definition: core_codegen_interface.h:40
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
string_ref.h
grpc::experimental::ServerInterceptorFactoryInterface
Definition: server_interceptor.h:45
grpc::ServerContextBase::~ServerContextBase
virtual ~ServerContextBase()
callback_common.h
grpc::internal::ServerStreamingHandler
A wrapper class of an application provided server streaming handler.
Definition: completion_queue.h:75
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.h:49
grpc::ContextAllocator
A CallbackServerContext allows users to use the contents of the CallbackServerContext or GenericCallb...
Definition: server_context.h:650
grpc::internal::ClientStreamingHandler
A wrapper class of an application provided client streaming handler.
Definition: completion_queue.h:73
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:77
port_platform.h
call.h
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:407
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:51
grpc::CompletionQueue
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:104
grpc::ServerContextBase::ExperimentalGetAuthority
grpc::string_ref ExperimentalGetAuthority() const
EXPERIMENTAL API Returns the call's authority.
grpc::internal::CallbackClientStreamingHandler
Definition: server_callback.h:45
grpc::ServerContextBase::TryCancel
void TryCancel() const
Cancel the Call from the server.
grpc::g_core_codegen_interface
CoreCodegenInterface * g_core_codegen_interface
Definition: completion_queue.h:98
grpc::ContextAllocator::~ContextAllocator
virtual ~ContextAllocator()
Definition: server_context.h:652
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:61
grpc::ServerContext::ServerContext
ServerContext()
Definition: server_context.h:568
gpr_timespec
Analogous to struct timespec.
Definition: gpr_types.h:50
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:59
grpc::ServerCallbackUnary
Definition: server_callback.h:193
grpc::ServerUnaryReactor
Definition: server_callback.h:699
message_allocator.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:662
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
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