#include <userver/ugrpc/client/stream.hpp>
Client-side interface for client-streaming.
This class is not thread-safe except for GetContext.
The RPC should be completed by calling ugrpc::client::Writer::Finish. If destroyed early, the RPC is cancelled. The server gets ugrpc::client::RpcInterruptedError and the abandoned-error metric is incremented. When properly finished, the connection stays open for reuse.
Definition at line 69 of file stream.hpp.
Public Member Functions | |
| Writer (Writer &&) noexcept=default | |
| Writer & | operator= (Writer &&) noexcept=default |
| bool | Write (const Request &request) |
| Write the next outgoing message. | |
| void | WriteAndCheck (const Request &request) |
| Write the next outgoing message and check result. | |
| Response | Finish () |
| Complete the RPC successfully. | |
| 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. | |
|
inline |
Complete the RPC successfully.
Should be called once all the data is written. The server will then send a single Response.
Finish should not be called multiple times.
The connection is not closed, it will be reused for new RPCs.
Response received after finishing the writes | ugrpc::client::RpcError | on an RPC error |
| ugrpc::client::RpcCancelledError | on task cancellation |
Definition at line 123 of file stream.hpp.
|
inline |
Get call context, useful e.g. for accessing metadata.
Definition at line 126 of file stream.hpp.
|
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 128 of file stream.hpp.
|
inlinenodiscard |
Write the next outgoing message.
Write doesn't store any references to request, so it can be deallocated right after the call.
| request | the next message to write |
Definition at line 95 of file stream.hpp.
|
inline |
Write the next outgoing message and check result.
WriteAndCheck doesn't store any references to request, so it can be deallocated right after the call.
WriteAndCheck verifies result of the write and generates exception in case of issues.
| request | the next message to write |
| ugrpc::client::RpcError | on an RPC error |
| ugrpc::client::RpcCancelledError | on task cancellation |
| ugrpc::client::RpcError | if the stream is already closed for writes |
Definition at line 109 of file stream.hpp.