userver: userver/ugrpc/client/qos.hpp Source File
Loading...
Searching...
No Matches
qos.hpp
1#pragma once
2
3/// @file userver/ugrpc/client/qos.hpp
4/// @brief @copybrief ugrpc::client::Qos
5
6#include <chrono>
7#include <optional>
8
9#include <userver/formats/json_fwd.hpp>
10
11USERVER_NAMESPACE_BEGIN
12
13namespace ugrpc::client {
14
15/// @brief Per-RPC quality-of-service config. Taken from
16/// @ref ugrpc::client::ClientQos. Can also be passed to ugrpc client methods
17/// manually.
18struct Qos final {
19 // clang-format off
20 /// @brief An upper bound on the deadline applied to the entire RPC.
21 /// If `std::nullopt`, no static deadline is applied, which is reasonable
22 /// for streaming RPCs.
23 ///
24 /// @ref scripts/docs/en/userver/deadline_propagation.md "Deadline propagation",
25 /// when enabled, also puts an upper bound on the RPC deadline.
26 ///
27 /// @note The problem of "dead servers" is typically solved using
28 /// [keepalive pings](https://github.com/grpc/grpc/blob/master/doc/keepalive.md),
29 /// not using timeouts.
30 // clang-format on
31 std::optional<std::chrono::milliseconds> timeout;
32};
33
34bool operator==(const Qos& lhs, const Qos& rhs) noexcept;
35
36Qos Parse(const formats::json::Value& value, formats::parse::To<Qos>);
37
38formats::json::Value Serialize(const Qos& qos, formats::serialize::To<formats::json::Value>);
39
40} // namespace ugrpc::client
41
42USERVER_NAMESPACE_END