Your opinion will help to improve our service
Leave a feedback >#include <userver/ugrpc/server/middlewares/base.hpp>
Context for middleware-specific data during gRPC call.
Public Member Functions | |
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. | |
|
inherited |
ServerContext
used for this RPC
|
inherited |
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.
In authentication middleware:
In client handler:
|
noexcept |
|
noexcept |
|
noexcept |
Aborts the RPC, returning the specified status to the upstream client, see details below.
It should be the last command in middlewares hooks.
If that method is called in methods:
SetError
OnCallFinish
hooks will be called.OnCallFinish
hooks will be called.OnCallFinish
will be called, despite of SetError
and exceptions. If the request is going to end with the error status, then the status is replaced with the status of the current hook.Example usage