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

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

Detailed Description

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

Controls a single request -> response stream RPC.

This class is not thread-safe except for GetContext.

The RPC is cancelled on destruction unless the stream is closed (Read has returned false). In that case the connection is not closed (it will be reused for new RPCs), and the server receives RpcInterruptedError immediately. gRPC provides no way to early-close a server-streaming RPC gracefully.

If any method throws, further methods must not be called on the same stream, except for GetContext.

Definition at line 227 of file rpc.hpp.

+ Inheritance diagram for ugrpc::client::InputStream< Response >:

Public Member Functions

bool Read (Response &response)
 Await and read the next incoming message.
 
 InputStream (InputStream &&) noexcept=default
 
InputStreamoperator= (InputStream &&) noexcept=default
 
grpc::ClientContext & GetContext ()
 
std::string_view GetClientName () const
 
std::string_view GetCallName () const
 
tracing::SpanGetSpan ()
 

Protected Member Functions

impl::RpcData & GetData ()
 

Member Function Documentation

◆ GetCallName()

std::string_view ugrpc::client::CallAnyBase::GetCallName ( ) const
inherited
Returns
RPC name

◆ GetClientName()

std::string_view ugrpc::client::CallAnyBase::GetClientName ( ) const
inherited
Returns
client name

◆ GetContext()

grpc::ClientContext & ugrpc::client::CallAnyBase::GetContext ( )
inherited
Returns
the ClientContext used for this RPC

◆ GetSpan()

tracing::Span & ugrpc::client::CallAnyBase::GetSpan ( )
inherited
Returns
RPC span

◆ Read()

template<typename Response >
bool ugrpc::client::InputStream< Response >::Read ( Response & response)

Await and read the next incoming message.

On end-of-input, Finish is called automatically.

Parameters
responsewhere to put response on success
Returns
true on success, false on end-of-input or task cancellation
Exceptions
ugrpc::client::RpcErroron an RPC error

Definition at line 550 of file rpc.hpp.


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