6#include <grpcpp/server_context.h>
8#include <userver/tracing/span.hpp>
9#include <userver/utils/any_storage.hpp>
11#include <userver/ugrpc/server/storage_context.hpp>
12#include <userver/utils/impl/internal_tag_fwd.hpp>
14USERVER_NAMESPACE_BEGIN
16namespace ugrpc::server {
22class CallContextBase {
26 CallContextBase(
utils::impl::InternalTag, impl::CallState& state);
29 CallContextBase(CallContextBase&&) =
delete;
30 CallContextBase& operator=(CallContextBase&&) =
delete;
33 grpc::ServerContext& GetServerContext();
36 std::string_view GetCallName()
const;
39 std::string_view GetServiceName()
const;
42 std::string_view GetMethodName()
const;
69 utils::AnyStorage<StorageContext>& GetStorageContext();
74 const impl::CallState& GetCallState(
utils::impl::InternalTag)
const {
return state_; }
77 impl::CallState& GetCallState(
utils::impl::InternalTag) {
return state_; }
80 ~CallContextBase() =
default;
84 impl::CallState& state_;
88class CallContext
final :
public CallContextBase {
91 using CallContextBase::CallContextBase;
96class GenericCallContext
final :
public CallContextBase {
99 using CallContextBase::CallContextBase;
103 void SetMetricsCallName(std::string_view call_name);