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

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

Detailed Description

template<class Response>
class ugrpc::client::Reader< Response >

Client-side interface for server-streaming.

This class is not thread-safe except for GetContext.

The RPC should be completed by reading until ugrpc::client::Reader::Read returns false. If destroyed early, the RPC is cancelled. The server gets ugrpc::client::RpcInterruptedError and the abandoned-error metric is incremented. The connection stays open for reuse. gRPC provides no way to early-close a server-streaming RPC gracefully. See ugrpc::client::ReadRemainingAndFinish for graceful completion.

Definition at line 26 of file stream.hpp.

Public Member Functions

 Reader (Reader &&) noexcept=default
 
Reader & operator= (Reader &&) noexcept=default
 
bool Read (Response &response)
 Await and read the next incoming message.
 
CallContext & GetContext ()
 Get call context, useful e.g. for accessing metadata.
 
const CallContext & GetContext () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Member Function Documentation

◆ GetContext() [1/2]

template<class Response>
CallContext & ugrpc::client::Reader< Response >::GetContext ( )
inline

Get call context, useful e.g. for accessing metadata.

Definition at line 55 of file stream.hpp.

◆ GetContext() [2/2]

template<class Response>
const CallContext & ugrpc::client::Reader< Response >::GetContext ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 57 of file stream.hpp.

◆ Read()

template<class Response>
bool ugrpc::client::Reader< Response >::Read ( Response & response)
inlinenodiscard

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, task cancellation,
Exceptions
ugrpc::client::RpcErroron an RPC error

Definition at line 52 of file stream.hpp.


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