#include <userver/ugrpc/client/response_future.hpp>
Controls a single request -> single response RPC.
This class is not thread-safe, it cannot be used from multiple tasks at the same time.
The RPC is cancelled on destruction unless the RPC is already finished. In that case the connection is not closed (it will be reused for new RPCs), and the server receives RpcInterruptedError
immediately.
Definition at line 20 of file response_future.hpp.
Public Member Functions | |
ResponseFuture (ResponseFuture &&) noexcept=default | |
ResponseFuture & | operator= (ResponseFuture &&) noexcept=default |
bool | IsReady () const noexcept |
Checks if the asynchronous call has completed Note, that once user gets result, IsReady should not be called. | |
engine::FutureStatus | WaitUntil (engine::Deadline deadline) const |
Await response until specified timepoint. | |
Response | Get () |
Await and read the response. | |
CallAnyBase & | GetCall () |
Get the original gRPC Call, useful e.g. for accessing metadata. | |
const CallAnyBase & | GetCall () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
|
inline |
Await and read the response.
Get
should not be called multiple times for the same UnaryFuture.
The connection is not closed, it will be reused for new RPCs.
ugrpc::client::RpcError | on an RPC error |
ugrpc::client::RpcCancelledError | on task cancellation |
Definition at line 48 of file response_future.hpp.
|
inline |
Get the original gRPC Call, useful e.g. for accessing metadata.
Definition at line 51 of file response_future.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 54 of file response_future.hpp.
|
inlinenodiscardnoexcept |
Checks if the asynchronous call has completed Note, that once user gets result, IsReady should not be called.
Definition at line 30 of file response_future.hpp.
|
inlinenodiscard |
Await response until specified timepoint.
ugrpc::client::RpcError | on an RPC error |
Definition at line 35 of file response_future.hpp.