userver: ugrpc::client::UnaryCall< Response > Class Template Reference
Loading...
Searching...
No Matches
ugrpc::client::UnaryCall< Response > Class Template Referencefinal

#include <userver/ugrpc/client/rpc.hpp>

Detailed Description

template<typename Response>
class ugrpc::client::UnaryCall< Response >

Controls a single request -> single response RPC.

This class is not thread-safe except for GetContext.

The RPC is cancelled on destruction unless Finish or FinishAsync. In that case the connection is not closed (it will be reused for new RPCs), and the server receives RpcInterruptedError immediately.

Definition at line 157 of file rpc.hpp.

+ Inheritance diagram for ugrpc::client::UnaryCall< Response >:
+ Collaboration diagram for ugrpc::client::UnaryCall< Response >:

Public Member Functions

Response Finish ()
 Await and read the response.
 
UnaryFuture FinishAsync (Response &response)
 Asynchronously finish the call.
 
 UnaryCall (UnaryCall &&) noexcept=default
 
UnaryCalloperator= (UnaryCall &&) noexcept=default
 
- Public Member Functions inherited from ugrpc::client::CallAnyBase
grpc::ClientContext & GetContext ()
 
std::string_view GetClientName () const
 
std::string_view GetCallName () const
 
tracing::SpanGetSpan ()
 

Additional Inherited Members

- Protected Member Functions inherited from ugrpc::client::CallAnyBase
impl::RpcData & GetData ()
 

Member Function Documentation

◆ Finish()

template<typename Response >
Response ugrpc::client::UnaryCall< Response >::Finish ( )

Await and read the response.

Finish should not be called multiple times for the same RPC.

The connection is not closed, it will be reused for new RPCs.

Returns
the response on success
Exceptions
ugrpc::client::RpcErroron an RPC error
ugrpc::client::RpcCancelledErroron task cancellation

Definition at line 496 of file rpc.hpp.

◆ FinishAsync()

template<typename Response >
UnaryFuture ugrpc::client::UnaryCall< Response >::FinishAsync ( Response & response)

Asynchronously finish the call.

FinishAsync should not be called multiple times for the same RPC.

Finish and FinishAsync should not be called together for the same RPC.

Returns
the future for the single response

Definition at line 504 of file rpc.hpp.


The documentation for this class was generated from the following file: