#include <userver/ugrpc/server/middlewares/base.hpp>
|
void | SetError (grpc::Status &&status) noexcept |
| Aborts the RPC, returning the specified status to the upstream client, see details below.
|
|
bool | IsClientStreaming () const noexcept |
|
bool | IsServerStreaming () const noexcept |
|
const dynamic_config::Snapshot & | GetInitialDynamicConfig () const |
| Get values extracted from dynamic_config. Snapshot will be deleted when the last middleware completes.
|
|
grpc::ServerContext & | GetServerContext () |
|
std::string_view | GetCallName () const |
| Name of the RPC in the format full.path.ServiceName/MethodName
|
|
std::string_view | GetServiceName () const |
| Get name of gRPC service.
|
|
std::string_view | GetMethodName () const |
| Get name of called gRPC method.
|
|
tracing::Span & | GetSpan () |
| Get the span of the current RPC.
|
|
utils::AnyStorage< StorageContext > & | GetStorageContext () |
| Returns call context for storing per-call custom data.
|
|
◆ GetServerContext()
grpc::ServerContext & ugrpc::server::CallContextBase::GetServerContext |
( |
| ) |
|
|
inherited |
◆ GetStorageContext()
Returns call context for storing per-call custom data.
The context can be used to pass data from server middleware to client handler or from one middleware to another one.
Example usage:
In authentication middleware:
if (password_is_correct) {
context.GetStorageContext().Emplace(kAuthUsername, username);
}
In client handler:
const auto& username = context.GetStorageContext().Get(kAuthUsername);
auto msg = fmt::format("Hello, {}!", username);
◆ IsClientStreaming()
bool ugrpc::server::MiddlewareCallContext::IsClientStreaming |
( |
| ) |
const |
|
noexcept |
- Returns
- Is a client-side streaming call
◆ IsServerStreaming()
bool ugrpc::server::MiddlewareCallContext::IsServerStreaming |
( |
| ) |
const |
|
noexcept |
- Returns
- Is a server-side streaming call
◆ SetError()
void ugrpc::server::MiddlewareCallContext::SetError |
( |
grpc::Status && |
status | ) |
|
|
noexcept |
The documentation for this class was generated from the following file:
- userver/ugrpc/server/middlewares/base.hpp