#include <userver/ugrpc/client/middlewares/base.hpp>
Context for middleware-specific data during gRPC call.
It is created for each gRPC Call and it stores aux. data used by middlewares. Each registered middleware is called by Middleware::Handle with the context passed as an argument. A middleware may access Call and initial request (if any) using the context.
- Examples
- samples/grpc_middleware_service/src/middlewares/client/auth.cpp, and samples/grpc_middleware_service/src/middlewares/client/auth.hpp.
Definition at line 58 of file base.hpp.
◆ GetCallName()
| std::string_view ugrpc::client::MiddlewareCallContext::GetCallName |
( |
| ) |
const |
|
noexcept |
◆ GetClientContext()
| grpc::ClientContext & ugrpc::client::MiddlewareCallContext::GetClientContext |
( |
| ) |
|
|
noexcept |
◆ GetClientName()
| std::string_view ugrpc::client::MiddlewareCallContext::GetClientName |
( |
| ) |
const |
|
noexcept |
◆ GetLatestRequestSizeBytes()
| std::optional< std::size_t > ugrpc::client::MiddlewareCallContext::GetLatestRequestSizeBytes |
( |
| ) |
const |
|
noexcept |
Serialized size of the request message.
This is the size of the wire buffer, which is cheaper than calling google::protobuf::Message::ByteSizeLong on the request.
Only unary RPCs fill it: the request is serialized once before the first PreSendMessage and reused by every attempt. Streaming RPCs serialize messages inside grpcpp, so for them it is always empty.
◆ GetLatestResponseSizeBytes()
| std::optional< std::size_t > ugrpc::client::MiddlewareCallContext::GetLatestResponseSizeBytes |
( |
| ) |
const |
|
noexcept |
Serialized size of the response message of the current attempt.
This is the size of the wire buffer, which is cheaper than calling google::protobuf::Message::ByteSizeLong on the parsed response.
Only unary RPCs fill it, before PostRecvMessage. It stays available in PostFinish, including when a response was received but could not be parsed. It is empty if the attempt finished with an error status or was interrupted before the response arrived. Streaming RPCs parse messages inside grpcpp, so for them it is always empty.
◆ GetRpcType()
| RpcType ugrpc::client::MiddlewareCallContext::GetRpcType |
( |
| ) |
const |
|
noexcept |
◆ GetSpan()
| tracing::Span & ugrpc::client::MiddlewareCallContext::GetSpan |
( |
| ) |
|
|
noexcept |
The documentation for this class was generated from the following file:
- userver/ugrpc/client/middlewares/base.hpp