GRPC C++  1.46.2
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>
56 class ServerAsyncReader;
57 template <class W>
58 class ServerAsyncWriter;
59 template <class W>
60 class ServerAsyncResponseWriter;
61 template <class W, class R>
62 class ServerAsyncReaderWriter;
63 template <class R>
64 class ServerReader;
65 template <class W>
66 class ServerWriter;
67 
68 extern CoreCodegenInterface* g_core_codegen_interface;
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;
104 class GenericServerContext;
105 class Server;
106 class ServerInterface;
107 class ContextAllocator;
108 class GenericCallbackServerContext;
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 
122  public:
123  virtual ~ServerContextBase();
124 
126  std::chrono::system_clock::time_point deadline() const {
127  return grpc::Timespec2Timepoint(deadline_);
128  }
129 
131  gpr_timespec raw_deadline() const { return deadline_; }
132 
147 
156  void AddInitialMetadata(const std::string& key, const std::string& value);
157 
172 
181  void AddTrailingMetadata(const std::string& key, const std::string& value);
182 
194  bool IsCancelled() const;
195 
214  void TryCancel() const;
215 
225  const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata()
226  const {
227  return *client_metadata_.map();
228  }
229 
232  return compression_level_;
233  }
234 
239  compression_level_set_ = true;
240  compression_level_ = level;
241  }
242 
246  bool compression_level_set() const { return compression_level_set_; }
247 
253  return compression_algorithm_;
254  }
259 
261  void SetLoadReportingCosts(const std::vector<std::string>& cost_data);
262 
266  std::shared_ptr<const grpc::AuthContext> auth_context() const {
267  if (auth_context_ == nullptr) {
268  auth_context_ = grpc::CreateAuthContext(call_.call);
269  }
270  return auth_context_;
271  }
272 
277  std::string peer() const;
278 
280  const struct census_context* census_context() const;
281 
284  grpc_call* c_call() { return call_.call; }
285 
286  protected:
292  void AsyncNotifyWhenDone(void* tag) {
293  has_notify_when_done_tag_ = true;
294  async_notify_when_done_tag_ = tag;
295  }
296 
300  RpcAllocatorState* GetRpcAllocatorState() { return message_allocator_state_; }
301 
317  // Short-circuit the case where a default reactor was already set up by
318  // the TestPeer.
319  if (test_unary_ != nullptr) {
320  return reinterpret_cast<Reactor*>(&default_reactor_);
321  }
322  new (&default_reactor_) Reactor;
323 #ifndef NDEBUG
324  bool old = false;
325  assert(default_reactor_used_.compare_exchange_strong(
326  old, true, std::memory_order_relaxed));
327 #else
328  default_reactor_used_.store(true, std::memory_order_relaxed);
329 #endif
330  return reinterpret_cast<Reactor*>(&default_reactor_);
331  }
332 
336 
338  context_allocator_ = context_allocator;
339  }
340 
341  ContextAllocator* context_allocator() const { return context_allocator_; }
342 
343  private:
347  friend class grpc::ServerInterface;
348  friend class grpc::Server;
349  template <class W, class R>
351  template <class W>
353  template <class W>
355  template <class W, class R>
357  template <class R>
358  friend class grpc::ServerReader;
359  template <class W>
360  friend class grpc::ServerWriter;
361  template <class W, class R>
363  template <class ResponseType>
365  const internal::MethodHandler::HandlerParameter& param, ResponseType* rsp,
366  Status& status);
367  template <class ServiceType, class RequestType, class ResponseType,
368  class BaseRequestType, class BaseResponseType>
370  template <class ServiceType, class RequestType, class ResponseType>
372  template <class ServiceType, class RequestType, class ResponseType>
374  template <class Streamer, bool WriteNeeded>
376  template <class RequestType, class ResponseType>
378  template <class RequestType, class ResponseType>
380  template <class RequestType, class ResponseType>
382  template <class RequestType, class ResponseType>
384  template <grpc::StatusCode code>
386  template <class Base>
388  friend class grpc::ClientContext;
391 
394  ServerContextBase& operator=(const ServerContextBase&);
395 
396  class CompletionOp;
397 
398  void BeginCompletionOp(
399  grpc::internal::Call* call, std::function<void(bool)> callback,
400  grpc::internal::ServerCallbackCall* callback_controller);
402  grpc::internal::CompletionQueueTag* GetCompletionOpTag();
403 
404  void set_call(grpc_call* call) { call_.call = call; }
405 
406  void BindDeadlineAndMetadata(gpr_timespec deadline, grpc_metadata_array* arr);
407 
408  uint32_t initial_metadata_flags() const { return 0; }
409 
410  grpc::experimental::ServerRpcInfo* set_server_rpc_info(
411  const char* method, grpc::internal::RpcMethod::RpcType type,
412  const std::vector<std::unique_ptr<
414  if (!creators.empty()) {
415  rpc_info_ = new grpc::experimental::ServerRpcInfo(this, method, type);
416  rpc_info_->RegisterInterceptors(creators);
417  }
418  return rpc_info_;
419  }
420 
421  void set_message_allocator_state(RpcAllocatorState* allocator_state) {
422  message_allocator_state_ = allocator_state;
423  }
424 
425  void MaybeMarkCancelledOnRead() {
427  call_.call)) {
428  marked_cancelled_.store(true, std::memory_order_release);
429  }
430  }
431 
432  struct CallWrapper {
433  ~CallWrapper();
434 
435  grpc_call* call = nullptr;
436  };
437 
438  // NOTE: call_ must be the first data member of this object so that its
439  // destructor is the last to be called, since its destructor may unref
440  // the underlying core call which holds the arena that may be used to
441  // hold this object.
442  CallWrapper call_;
443 
444  CompletionOp* completion_op_ = nullptr;
445  bool has_notify_when_done_tag_ = false;
446  void* async_notify_when_done_tag_ = nullptr;
448 
449  gpr_timespec deadline_;
450  grpc::CompletionQueue* cq_ = nullptr;
451  bool sent_initial_metadata_ = false;
452  mutable std::shared_ptr<const grpc::AuthContext> auth_context_;
453  mutable grpc::internal::MetadataMap client_metadata_;
454  std::multimap<std::string, std::string> initial_metadata_;
455  std::multimap<std::string, std::string> trailing_metadata_;
456 
457  bool compression_level_set_ = false;
458  grpc_compression_level compression_level_;
459  grpc_compression_algorithm compression_algorithm_;
460 
463  pending_ops_;
464  bool has_pending_ops_ = false;
465 
466  grpc::experimental::ServerRpcInfo* rpc_info_ = nullptr;
467  RpcAllocatorState* message_allocator_state_ = nullptr;
468  ContextAllocator* context_allocator_ = nullptr;
469 
470  class Reactor : public grpc::ServerUnaryReactor {
471  public:
472  void OnCancel() override {}
473  void OnDone() override {}
474  // Override InternalInlineable for this class since its reactions are
475  // trivial and thus do not need to be run from the executor (triggering a
476  // thread hop). This should only be used by internal reactors (thus the
477  // name) and not by user application code.
478  bool InternalInlineable() override { return true; }
479  };
480 
481  void SetupTestDefaultReactor(std::function<void(grpc::Status)> func) {
482  // NOLINTNEXTLINE(modernize-make-unique)
483  test_unary_.reset(new TestServerCallbackUnary(this, std::move(func)));
484  }
485  bool test_status_set() const {
486  return (test_unary_ != nullptr) && test_unary_->status_set();
487  }
488  grpc::Status test_status() const { return test_unary_->status(); }
489 
490  class TestServerCallbackUnary : public grpc::ServerCallbackUnary {
491  public:
492  TestServerCallbackUnary(ServerContextBase* ctx,
493  std::function<void(grpc::Status)> func)
494  : reactor_(ctx->DefaultReactor()), func_(std::move(func)) {
495  this->BindReactor(reactor_);
496  }
497  void Finish(grpc::Status s) override {
498  status_ = s;
499  func_(std::move(s));
500  status_set_.store(true, std::memory_order_release);
501  }
502  void SendInitialMetadata() override {}
503 
504  bool status_set() const {
505  return status_set_.load(std::memory_order_acquire);
506  }
507  grpc::Status status() const { return status_; }
508 
509  private:
510  void CallOnDone() override {}
511  grpc::internal::ServerReactor* reactor() override { return reactor_; }
512 
513  grpc::ServerUnaryReactor* const reactor_;
514  std::atomic_bool status_set_{false};
515  grpc::Status status_;
516  const std::function<void(grpc::Status s)> func_;
517  };
518 
519  typename std::aligned_storage<sizeof(Reactor), alignof(Reactor)>::type
520  default_reactor_;
521  std::atomic_bool default_reactor_used_{false};
522 
523  std::atomic_bool marked_cancelled_{false};
524 
525  std::unique_ptr<TestServerCallbackUnary> test_unary_;
526 };
527 
545  public:
546  ServerContext() {} // for async calls
547 
565 
566  // Sync/CQ-based Async ServerContext only
568 
569  private:
570  // Constructor for internal use by server only
571  friend class grpc::Server;
573  : ServerContextBase(deadline, arr) {}
574 
575  // CallbackServerContext only
578 
580  ServerContext(const ServerContext&) = delete;
581  ServerContext& operator=(const ServerContext&) = delete;
582 };
583 
585  public:
589 
609 
610  // CallbackServerContext only
613 
614  private:
615  // Sync/CQ-based Async ServerContext only
617 
620  CallbackServerContext& operator=(const CallbackServerContext&) = delete;
621 };
622 
629  public:
630  virtual ~ContextAllocator() {}
631 
632  virtual CallbackServerContext* NewCallbackServerContext() { return nullptr; }
633 
635  return nullptr;
636  }
637 
638  virtual void Release(CallbackServerContext*) {}
639 
641 };
642 
643 } // namespace grpc
644 
645 static_assert(
646  std::is_base_of<grpc::ServerContextBase, grpc::ServerContext>::value,
647  "improper base class");
648 static_assert(std::is_base_of<grpc::ServerContextBase,
650  "improper base class");
651 static_assert(sizeof(grpc::ServerContextBase) == sizeof(grpc::ServerContext),
652  "wrong size");
653 static_assert(sizeof(grpc::ServerContextBase) ==
655  "wrong size");
656 
657 #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
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:634
grpc::ServerContext
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:544
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:584
grpc::ServerContextBase::set_context_allocator
void set_context_allocator(ContextAllocator *context_allocator)
Definition: server_context.h:337
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: async_stream.h:845
grpc::internal::ErrorMethodHandler
General method handler class for errors that prevent real method use e.g., handle unknown method by r...
Definition: byte_buffer.h:49
grpc::internal::MethodHandler::HandlerParameter
Definition: rpc_service_method.h:43
grpc_metadata_array
Definition: grpc_types.h:578
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:59
grpc::ServerContextBase::DefaultReactor
grpc::ServerUnaryReactor * DefaultReactor()
Get a library-owned default unary reactor for use in minimal reaction cases.
Definition: server_context.h:316
grpc::internal::Call
Straightforward wrapping of the C call object.
Definition: call.h:37
auth_context.h
grpc::ServerContextBase
Base class of ServerContext.
Definition: server_context.h:121
server_interceptor.h
grpc::ServerContextBase::context_allocator
ContextAllocator * context_allocator() const
Definition: server_context.h:341
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:346
grpc::ServerContextBase::ServerContextTestSpouse
friend class grpc::testing::ServerContextTestSpouse
Definition: server_context.h:345
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:33
grpc_metadata
A single metadata element.
Definition: grpc_types.h:536
grpc::ContextAllocator::Release
virtual void Release(CallbackServerContext *)
Definition: server_context.h:638
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:126
grpc::ServerContextBase::raw_deadline
gpr_timespec raw_deadline() const
Return a gpr_timespec representation of the server call's deadline.
Definition: server_context.h:131
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:300
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:69
grpc::internal::CallbackUnaryHandler
Definition: byte_buffer.h:41
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:266
grpc::internal::CallbackServerStreamingHandler
Definition: byte_buffer.h:43
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:246
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:632
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:588
grpc::GenericServerContext
Definition: async_generic_service.h:41
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::protobuf::util::Status
::google::protobuf::util::Status Status
Definition: config_protobuf.h:93
grpc::internal::CompletionQueueTag
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:28
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:225
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: byte_buffer.h:47
grpc::ServerAsyncResponseWriter
Async server-side API for handling unary calls, where the single response message sent to the client ...
Definition: async_unary_call.h:295
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:628
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:292
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:71
call_op_set.h
std
Definition: async_unary_call.h:407
grpc::ServerContextBase::InteropServerContextInspector
friend class grpc::testing::InteropServerContextInspector
Definition: server_context.h:344
grpc::GenericCallbackServerContext
Definition: async_generic_service.h:89
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::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:630
grpc::ServerAsyncReader
Async server-side API for doing client-streaming RPCs, where the incoming message stream from the cli...
Definition: async_stream.h:698
grpc::ServerAsyncReaderWriter
Async server-side API for doing bidirectional streaming RPCs, where the incoming message stream comin...
Definition: async_stream.h:1010
grpc::ServerInterface
Definition: server_interface.h:61
grpc::ServerContext::ServerContext
ServerContext()
Definition: server_context.h:546
gpr_timespec
Analogous to struct timespec.
Definition: gpr_types.h:49
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:252
grpc::ServerContextBase::c_call
grpc_call * c_call()
Should be used for framework-level extensions only.
Definition: server_context.h:284
grpc::Timespec2Timepoint
std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t)
grpc::ContextAllocator::Release
virtual void Release(GenericCallbackServerContext *)
Definition: server_context.h:640
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:238
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:231