GRPC C++  1.78.1
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 
22 #include <grpc/grpc.h>
23 #include <grpc/impl/call.h>
26 #include <grpcpp/impl/call.h>
35 #include <grpcpp/support/config.h>
39 #include <grpcpp/support/status.h>
41 #include <grpcpp/support/time.h>
42 
43 #include <atomic>
44 #include <cassert>
45 #include <map>
46 #include <memory>
47 #include <type_traits>
48 #include <vector>
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 
301  return memory_allocator_;
302  }
303 
307 
308  protected:
314  void AsyncNotifyWhenDone(void* tag) {
315  has_notify_when_done_tag_ = true;
316  async_notify_when_done_tag_ = tag;
317  }
318 
322  RpcAllocatorState* GetRpcAllocatorState() { return message_allocator_state_; }
323 
339  // Short-circuit the case where a default reactor was already set up by
340  // the TestPeer.
341  if (test_unary_ != nullptr) {
342  return reinterpret_cast<Reactor*>(&default_reactor_);
343  }
344  new (&default_reactor_) Reactor;
345 #ifndef NDEBUG
346  bool old = false;
347  assert(default_reactor_used_.compare_exchange_strong(
348  old, true, std::memory_order_relaxed));
349 #else
350  default_reactor_used_.store(true, std::memory_order_relaxed);
351 #endif
352  return reinterpret_cast<Reactor*>(&default_reactor_);
353  }
354 
358 
360  context_allocator_ = context_allocator;
361  }
362 
363  ContextAllocator* context_allocator() const { return context_allocator_; }
364 
365  private:
369  friend class grpc::ServerInterface;
370  friend class grpc::Server;
371  template <class W, class R>
373  template <class W>
375  template <class W>
377  template <class W, class R>
379  template <class R>
380  friend class grpc::ServerReader;
381  template <class W>
382  friend class grpc::ServerWriter;
383  template <class W, class R>
385  template <class ResponseType>
387  const internal::MethodHandler::HandlerParameter& param, ResponseType* rsp,
388  Status& status);
389  template <class ServiceType, class RequestType, class ResponseType,
390  class BaseRequestType, class BaseResponseType>
392  template <class ServiceType, class RequestType, class ResponseType>
394  template <class ServiceType, class RequestType, class ResponseType>
396  template <class Streamer, bool WriteNeeded>
398  template <class RequestType, class ResponseType>
400  template <class RequestType, class ResponseType>
402  template <class RequestType, class ResponseType>
404  template <class RequestType, class ResponseType>
406  template <grpc::StatusCode code>
408  template <class Base>
410  friend class grpc::ClientContext;
413 
416  ServerContextBase& operator=(const ServerContextBase&);
417 
418  class CompletionOp;
419 
420  void BeginCompletionOp(
421  grpc::internal::Call* call, std::function<void(bool)> callback,
422  grpc::internal::ServerCallbackCall* callback_controller);
424  grpc::internal::CompletionQueueTag* GetCompletionOpTag();
425 
426  void set_call(
427  grpc_call* call, bool call_metric_recording_enabled,
428  experimental::ServerMetricRecorder* server_metric_recorder,
430  call_.call = call;
431  if (call_metric_recording_enabled) {
432  CreateCallMetricRecorder(server_metric_recorder);
433  }
434  memory_allocator_ = memory_allocator;
435  }
436 
437  void BindDeadlineAndMetadata(gpr_timespec deadline, grpc_metadata_array* arr);
438 
439  uint32_t initial_metadata_flags() const { return 0; }
440 
441  grpc::experimental::ServerRpcInfo* set_server_rpc_info(
442  const char* method, grpc::internal::RpcMethod::RpcType type,
443  const std::vector<std::unique_ptr<
445  if (!creators.empty()) {
446  rpc_info_ = new grpc::experimental::ServerRpcInfo(this, method, type);
447  rpc_info_->RegisterInterceptors(creators);
448  }
449  return rpc_info_;
450  }
451 
452  void set_message_allocator_state(RpcAllocatorState* allocator_state) {
453  message_allocator_state_ = allocator_state;
454  }
455 
456  void MaybeMarkCancelledOnRead() {
457  if (grpc_call_failed_before_recv_message(call_.call)) {
458  marked_cancelled_.store(true, std::memory_order_release);
459  }
460  }
461 
462  // This should be called only once and only when call metric recording is
463  // enabled.
464  void CreateCallMetricRecorder(
465  experimental::ServerMetricRecorder* server_metric_recorder = nullptr);
466 
467  struct CallWrapper {
468  ~CallWrapper();
469 
470  grpc_call* call = nullptr;
471  };
472 
473  // NOTE: call_ must be the first data member of this object so that its
474  // destructor is the last to be called, since its destructor may unref
475  // the underlying core call which holds the arena that may be used to
476  // hold this object.
477  CallWrapper call_;
478 
479  CompletionOp* completion_op_ = nullptr;
480  bool has_notify_when_done_tag_ = false;
481  void* async_notify_when_done_tag_ = nullptr;
483 
484  gpr_timespec deadline_;
485  grpc::CompletionQueue* cq_ = nullptr;
486  bool sent_initial_metadata_ = false;
487  mutable std::shared_ptr<const grpc::AuthContext> auth_context_;
488  mutable grpc::internal::MetadataMap client_metadata_;
489  std::multimap<std::string, std::string> initial_metadata_;
490  std::multimap<std::string, std::string> trailing_metadata_;
491 
492  bool compression_level_set_ = false;
493  grpc_compression_level compression_level_;
494  grpc_compression_algorithm compression_algorithm_;
495 
498  pending_ops_;
499  bool has_pending_ops_ = false;
500 
501  grpc::experimental::ServerRpcInfo* rpc_info_ = nullptr;
502  RpcAllocatorState* message_allocator_state_ = nullptr;
503  ContextAllocator* context_allocator_ = nullptr;
504  experimental::CallMetricRecorder* call_metric_recorder_ = nullptr;
505  grpc_event_engine::experimental::MemoryAllocator* memory_allocator_ = nullptr;
506 
507  class Reactor : public grpc::ServerUnaryReactor {
508  public:
509  void OnCancel() override {}
510  void OnDone() override {}
511  // Override InternalInlineable for this class since its reactions are
512  // trivial and thus do not need to be run from the EventEngine (potentially
513  // triggering a thread hop). This should only be used by internal reactors
514  // (thus the name) and not by user application code.
515  bool InternalInlineable() override { return true; }
516  };
517 
518  void SetupTestDefaultReactor(std::function<void(grpc::Status)> func) {
519  // NOLINTNEXTLINE(modernize-make-unique)
520  test_unary_.reset(new TestServerCallbackUnary(this, std::move(func)));
521  }
522  bool test_status_set() const {
523  return (test_unary_ != nullptr) && test_unary_->status_set();
524  }
525  grpc::Status test_status() const { return test_unary_->status(); }
526 
527  class TestServerCallbackUnary : public grpc::ServerCallbackUnary {
528  public:
529  TestServerCallbackUnary(ServerContextBase* ctx,
530  std::function<void(grpc::Status)> func)
531  : reactor_(ctx->DefaultReactor()),
532  func_(std::move(func)),
533  call_(ctx->c_call()) {
534  this->BindReactor(reactor_);
535  }
536  void Finish(grpc::Status s) override {
537  status_ = s;
538  func_(std::move(s));
539  status_set_.store(true, std::memory_order_release);
540  }
541  void SendInitialMetadata() override {}
542 
543  bool status_set() const {
544  return status_set_.load(std::memory_order_acquire);
545  }
546  grpc::Status status() const { return status_; }
547 
548  private:
549  void CallOnDone() override {}
550 
551  grpc_call* call() override { return call_; }
552 
553  grpc::internal::ServerReactor* reactor() override { return reactor_; }
554 
555  grpc::ServerUnaryReactor* const reactor_;
556  std::atomic_bool status_set_{false};
557  grpc::Status status_;
558  const std::function<void(grpc::Status s)> func_;
559  grpc_call* call_;
560  };
561 
562  alignas(Reactor) char default_reactor_[sizeof(Reactor)];
563  std::atomic_bool default_reactor_used_{false};
564 
565  std::atomic_bool marked_cancelled_{false};
566 
567  std::unique_ptr<TestServerCallbackUnary> test_unary_;
568 };
569 
587  public:
588  ServerContext() {} // for async calls
589 
607 
608  // Sync/CQ-based Async ServerContext only
610 
611  private:
612  // Constructor for internal use by server only
613  friend class grpc::Server;
615  : ServerContextBase(deadline, arr) {}
616 
617  // CallbackServerContext only
620 
622  ServerContext(const ServerContext&) = delete;
623  ServerContext& operator=(const ServerContext&) = delete;
624 };
625 
627  public:
631 
651 
652  // CallbackServerContext only
655 
656  private:
657  // Sync/CQ-based Async ServerContext only
659 
662  CallbackServerContext& operator=(const CallbackServerContext&) = delete;
663 };
664 
671  public:
672  virtual ~ContextAllocator() {}
673 
674  virtual CallbackServerContext* NewCallbackServerContext() { return nullptr; }
675 
677  return nullptr;
678  }
679 
680  virtual void Release(CallbackServerContext*) {}
681 
683 };
684 
685 } // namespace grpc
686 
687 static_assert(
688  std::is_base_of<grpc::ServerContextBase, grpc::ServerContext>::value,
689  "improper base class");
690 static_assert(std::is_base_of<grpc::ServerContextBase,
692  "improper base class");
693 static_assert(sizeof(grpc::ServerContextBase) == sizeof(grpc::ServerContext),
694  "wrong size");
695 static_assert(sizeof(grpc::ServerContextBase) ==
697  "wrong size");
698 
699 #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:148
grpc::string_ref
This class is a non owning reference to a string.
Definition: string_ref.h:40
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:33
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:676
grpc::ServerContext
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:586
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:97
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:626
grpc::ServerContextBase::set_context_allocator
void set_context_allocator(ContextAllocator *context_allocator)
Definition: server_context.h:359
grpc::internal::CallOpSendMessage
Definition: call_op_set.h:289
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:81
grpc::internal::MethodHandler::HandlerParameter
Definition: rpc_service_method.h:43
grpc_metadata_array
Definition: grpc_types.h:251
grpc::internal::RpcMethodHandler
A wrapper class of an application provided rpc method handler.
Definition: completion_queue.h:73
grpc::ServerWriter
Synchronous (blocking) server-side API for doing for doing a server-streaming RPCs,...
Definition: completion_queue.h:62
grpc_compression_algorithm
grpc_compression_algorithm
The various compression algorithms supported by gRPC (not sorted by compression level)
Definition: compression_types.h:61
grpc::ServerContextBase::DefaultReactor
grpc::ServerUnaryReactor * DefaultReactor()
Get a library-owned default unary reactor for use in minimal reaction cases.
Definition: server_context.h:338
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::memory_allocator
grpc_event_engine::experimental::MemoryAllocator * memory_allocator()
Definition: server_context.h:300
grpc::ServerContextBase::context_allocator
ContextAllocator * context_allocator() const
Definition: server_context.h:363
status.h
grpc::ServerCallbackUnary::BindReactor
void BindReactor(Reactor *reactor)
Definition: server_callback.h:210
grpc::internal::CallOpSendInitialMetadata
Definition: call_op_set.h:219
grpc::ServerContextBase::ServerContextBase
ServerContextBase()
Constructors for use by derived classes.
completion_queue_tag.h
grpc::internal::MetadataMap
Definition: metadata_map.h:33
metadata_map.h
grpc::internal::ServerReaderWriterBody
Definition: completion_queue.h:65
grpc::ServerContextBase::DefaultReactorTestPeer
friend class grpc::testing::DefaultReactorTestPeer
Definition: server_context.h:368
grpc::ServerContextBase::ServerContextTestSpouse
friend class grpc::testing::ServerContextTestSpouse
Definition: server_context.h:367
grpc::internal::MetadataMap::map
std::multimap< grpc::string_ref, grpc::string_ref > * map()
Definition: metadata_map.h:66
grpc::Status
Did it work? If it didn't, why?
Definition: status.h:34
grpc_metadata
A single metadata element.
Definition: grpc_types.h:209
grpc::ContextAllocator::Release
virtual void Release(CallbackServerContext *)
Definition: server_context.h:680
grpc::experimental::CallMetricRecorder
Records call metrics for the purpose of load balancing.
Definition: call_metric_recorder.h:36
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:76
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:60
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:194
grpc::ServerContextBase::GetRpcAllocatorState
RpcAllocatorState * GetRpcAllocatorState()
NOTE: This is an API for advanced users who need custom allocators.
Definition: server_context.h:322
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:68
grpc::internal::CallbackUnaryHandler
Definition: server_callback_handlers.h:35
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:449
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:674
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:630
grpc::GenericServerContext
Definition: async_generic_service.h:37
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_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:45
grpc::ServerContextBase::~ServerContextBase
virtual ~ServerContextBase()
grpc::internal::ServerStreamingHandler
A wrapper class of an application provided server streaming handler.
Definition: completion_queue.h:77
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:680
grpc::ContextAllocator
A CallbackServerContext allows users to use the contents of the CallbackServerContext or GenericCallb...
Definition: server_context.h:670
grpc::internal::ClientStreamingHandler
A wrapper class of an application provided client streaming handler.
Definition: completion_queue.h:75
grpc::ServerContextBase::AsyncNotifyWhenDone
void AsyncNotifyWhenDone(void *tag)
Async only.
Definition: server_context.h:314
grpc::internal::TemplatedBidiStreamingHandler
A wrapper class of an application provided bidi-streaming handler.
Definition: completion_queue.h:79
config.h
call.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:73
call_op_set.h
std
Definition: async_unary_call.h:410
call.h
grpc::ServerContextBase::InteropServerContextInspector
friend class grpc::testing::InteropServerContextInspector
Definition: server_context.h:366
grpc::GenericCallbackServerContext
Definition: callback_generic_service.h:36
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:52
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_handlers.h:255
grpc_event_engine::experimental::MemoryAllocator
Definition: memory_allocator.h:33
grpc::ServerContextBase::TryCancel
void TryCancel() const
Cancel the Call from the server.
grpc::ContextAllocator::~ContextAllocator
virtual ~ContextAllocator()
Definition: server_context.h:672
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:588
gpr_timespec
Analogous to struct timespec.
Definition: time.h:47
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:200
grpc::ServerUnaryReactor
Definition: server_callback.h:706
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:682
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