userver: ugrpc::server::OutputStream< Response > Class Template Reference
Loading...
Searching...
No Matches
ugrpc::server::OutputStream< Response > Class Template Referencefinal

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

Detailed Description

template<typename Response>
class ugrpc::server::OutputStream< 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 has been finished.

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

Definition at line 194 of file rpc.hpp.

+ Inheritance diagram for ugrpc::server::OutputStream< Response >:
+ Collaboration diagram for ugrpc::server::OutputStream< Response >:

Public Member Functions

void Write (const Response &response)
 Write the next outgoing message.
 
void Finish ()
 Complete the RPC successfully.
 
void FinishWithError (const grpc::Status &status) override
 Complete the RPC with an error.
 
void WriteAndFinish (const Response &response)
 Equivalent to Write + Finish
 
 OutputStream (impl::CallParams &&call_params, impl::RawWriter< Response > &stream)
 For internal use only.
 
 OutputStream (OutputStream &&)=delete
 
OutputStreamoperator= (OutputStream &&)=delete
 
bool IsFinished () const override
 
- Public Member Functions inherited from ugrpc::server::CallAnyBase
 CallAnyBase (impl::CallParams &&params)
 
grpc::ServerContext & GetContext ()
 
std::string_view GetCallName () const
 Name of the call. Consists of service and method names.
 
tracing::SpanGetSpan ()
 
utils::AnyStorage< StorageContext > & GetStorageContext ()
 Returns call context for storing per-call custom data.
 

Additional Inherited Members

- Protected Member Functions inherited from ugrpc::server::CallAnyBase
ugrpc::impl::RpcStatisticsScope & Statistics ()
 
logging::LoggerRef AccessTskvLogger ()
 
void LogFinish (grpc::Status status) const
 

Constructor & Destructor Documentation

◆ OutputStream()

template<typename Response >
ugrpc::server::OutputStream< Response >::OutputStream ( impl::CallParams && call_params,
impl::RawWriter< Response > & stream )

For internal use only.

Definition at line 406 of file rpc.hpp.

◆ ~OutputStream()

template<typename Response >
ugrpc::server::OutputStream< Response >::~OutputStream ( )

Definition at line 411 of file rpc.hpp.

Member Function Documentation

◆ Finish()

template<typename Response >
void ugrpc::server::OutputStream< Response >::Finish ( )

Complete the RPC successfully.

Finish must not be called multiple times.

Exceptions
ugrpc::server::RpcErroron an RPC error

Definition at line 434 of file rpc.hpp.

◆ FinishWithError()

template<typename Response >
void ugrpc::server::OutputStream< Response >::FinishWithError ( const grpc::Status & status)
overridevirtual

Complete the RPC with an error.

Finish must not be called multiple times.

Parameters
statuserror details
Exceptions
ugrpc::server::RpcErroron an RPC error

Implements ugrpc::server::CallAnyBase.

Definition at line 446 of file rpc.hpp.

◆ IsFinished()

template<typename Response >
bool ugrpc::server::OutputStream< Response >::IsFinished ( ) const
overridevirtual

Implements ugrpc::server::CallAnyBase.

Definition at line 473 of file rpc.hpp.

◆ Write()

template<typename Response >
void ugrpc::server::OutputStream< Response >::Write ( const Response & response)

Write the next outgoing message.

Parameters
responsethe next message to write
Exceptions
ugrpc::server::RpcErroron an RPC error

Definition at line 419 of file rpc.hpp.

◆ WriteAndFinish()

template<typename Response >
void ugrpc::server::OutputStream< Response >::WriteAndFinish ( const Response & response)

Equivalent to Write + Finish

This call saves one round-trip, compared to separate Write and Finish.

Finish must not be called multiple times.

Parameters
responsethe final response message
Exceptions
ugrpc::server::RpcErroron an RPC error

Definition at line 458 of file rpc.hpp.


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