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 209 of file rpc.hpp.

+ Inheritance diagram for ugrpc::client::InputStream< Response >:
+ Collaboration 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
 
- 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

◆ 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 533 of file rpc.hpp.


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