userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
response_future.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <userver/compiler/impl/lifetime.hpp>
7
#include <
userver/proto-structs/convert.hpp
>
8
#include <
userver/ugrpc/client/response_future.hpp
>
9
#include <
userver/ugrpc/client/stream.hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
grpc_proto_structs::client {
14
16
template
<
typename
Response>
17
class
ResponseFuture final {
18
public
:
19
using
VanillaResponse = proto_structs::traits::CompatibleMessageType<Response>;
20
using
VanillaFuture =
ugrpc::client::ResponseFuture<VanillaResponse>
;
21
22
explicit
ResponseFuture(VanillaFuture&& future)
23
: future_{std::move(future)}
24
{}
25
29
[[nodiscard]]
bool
IsReady
()
const
{
return
future_.IsReady(); }
30
34
[[nodiscard]]
engine::FutureStatus
WaitUntil
(
engine::Deadline
deadline)
const
noexcept
{
35
return
future_.WaitUntil(deadline);
36
}
37
47
Response
Get
() {
return
proto_structs::MessageToStruct<Response>
(future_.Get()); }
48
50
void
Cancel
() {
return
future_.Cancel(); }
51
53
ugrpc::client::CallContext
&
GetContext
() {
return
future_.GetContext(); }
54
56
const
ugrpc::client::CallContext
&
GetContext
()
const
{
return
future_.GetContext(); }
57
59
engine::AwaitableToken
GetAwaitableToken
() noexcept USERVER_IMPL_LIFETIME_BOUND {
60
return
future_.GetAwaitableToken();
61
}
62
63
private
:
64
VanillaFuture future_;
65
};
66
67
}
// namespace grpc_proto_structs::client
68
69
USERVER_NAMESPACE_END
grpc-proto-structs
include
userver
grpc-proto-structs
client
response_future.hpp
Generated on
for userver by
Doxygen
1.17.0