userver: userver/ugrpc/server/call_context.hpp Source File
Loading...
Searching...
No Matches
call_context.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/ugrpc/server/call_context.hpp
4/// @brief @copybrief ugrpc::server::CallContext
5
6#include <grpcpp/server_context.h>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace ugrpc::server {
11
12class CallAnyBase;
13
14/// @brief gRPC call context
16public:
17 /// @cond
18 explicit CallContext(CallAnyBase& call);
19 /// @endcond
20
21 /// @returns the `ServerContext` used for this RPC
22 grpc::ServerContext& GetServerContext();
23
24 /// @brief Name of the RPC in the format `full.path.ServiceName/MethodName`
26
27 /// @brief Get name of gRPC service
29
30 /// @brief Get name of called gRPC method
32
33protected:
34 /// @cond
35 const CallAnyBase& GetCall() const;
36
37 CallAnyBase& GetCall();
38 /// @endcond
39
40private:
41 CallAnyBase& call_;
42};
43
44/// @brief generic gRPC call context
46public:
47 /// @cond
48 using CallContext::CallContext;
49 /// @endcond
50
51 /// @brief Set a custom call name for metric labels
52 void SetMetricsCallName(std::string_view call_name);
53};
54
55} // namespace ugrpc::server
56
57USERVER_NAMESPACE_END