userver
C++ Async Framework
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
8
USERVER_NAMESPACE_BEGIN
9
10
namespace
ugrpc::
server
{
11
12
class
CallAnyBase
;
13
14
/// @brief gRPC call context
15
class
CallContext
{
16
public
:
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`
25
std
::
string_view
GetCallName
()
const
;
26
27
/// @brief Get name of gRPC service
28
std
::
string_view
GetServiceName
()
const
;
29
30
/// @brief Get name of called gRPC method
31
std
::
string_view
GetMethodName
()
const
;
32
33
protected
:
34
/// @cond
35
const
CallAnyBase
& GetCall()
const
;
36
37
CallAnyBase
& GetCall();
38
/// @endcond
39
40
private
:
41
CallAnyBase
& call_;
42
};
43
44
/// @brief generic gRPC call context
45
class
GenericCallContext
:
public
CallContext
{
46
public
:
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
57
USERVER_NAMESPACE_END
userver
ugrpc
server
call_context.hpp
Generated on Mon Oct 21 2024 13:49:37 for userver by
Doxygen
1.10.0