#include <userver/ugrpc/server/rpc.hpp>
Controls a request stream -> single response RPC.
This class is not thread-safe except for GetContext
.
The RPC is cancelled on destruction unless the stream has been finished.
If any method throws, further methods must not be called on the same stream, except for GetContext
.
Public Member Functions | |
bool | Read (Request &request) override |
Await and read the next incoming message. | |
void | Finish (Response &response) |
Complete the RPC successfully. | |
void | Finish (Response &&response) |
Complete the RPC successfully. | |
void | FinishWithError (const grpc::Status &status) override |
Complete the RPC with an error. | |
InputStream (impl::CallParams &&call_params, impl::RawReader< Request, Response > &stream) | |
For internal use only. | |
InputStream (InputStream &&)=delete | |
InputStream & | operator= (InputStream &&)=delete |
bool | IsFinished () const override |
Useful for generic error reporting via FinishWithError. | |
grpc::ServerContext & | GetContext () |
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. Span's lifetime covers the Handle call of the outermost middleware. | |
CallKind | GetCallKind () const |
Get RPCs kind of method. | |
utils::AnyStorage< StorageContext > & | GetStorageContext () |
Returns call context for storing per-call custom data. | |
void | SetMetricsCallName (std::string_view call_name) |
Set a custom call name for metric labels. | |
Protected Member Functions | |
ugrpc::impl::RpcStatisticsScope & | GetStatistics () |
logging::LoggerRef | AccessTskvLogger () |
void | LogFinish (grpc::Status status) const |
void | ApplyRequestHook (google::protobuf::Message *request) |
void | ApplyResponseHook (google::protobuf::Message *response) |
ugrpc::server::InputStream< Request, Response >::InputStream | ( | impl::CallParams && | call_params, |
impl::RawReader< Request, Response > & | stream ) |
|
override |
|
inlineprotectedinherited |
void ugrpc::server::InputStream< Request, Response >::Finish | ( | Response && | response | ) |
Complete the RPC successfully.
Finish
must not be called multiple times for the same RPC.
response | the single Response to send to the client |
ugrpc::server::RpcError | on an RPC error |
void ugrpc::server::InputStream< Request, Response >::Finish | ( | Response & | response | ) |
Complete the RPC successfully.
Finish
must not be called multiple times for the same RPC.
response | the single Response to send to the client |
ugrpc::server::RpcError | on an RPC error |
|
overridevirtual |
Complete the RPC with an error.
Finish
must not be called multiple times for the same RPC.
status | error details |
ugrpc::server::RpcError | on an RPC error |
Implements ugrpc::server::CallAnyBase.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
ServerContext
used for this RPC Finish
call
|
inlineinherited |
Get the span of the current RPC. Span's lifetime covers the Handle
call of the outermost middleware.
|
inlineprotectedinherited |
|
inlineinherited |
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:
|
overridevirtual |
Useful for generic error reporting via FinishWithError.
Implements ugrpc::server::CallAnyBase.
|
overridevirtual |
Await and read the next incoming message.
request | where to put the request on success |
true
on success, false
on end-of-input Implements ugrpc::server::Reader< Request >.