12#include <userver/storages/redis/impl/types.hpp>
14USERVER_NAMESPACE_BEGIN
22inline constexpr std::chrono::milliseconds kDefaultTimeoutSingle{500};
23inline constexpr std::chrono::milliseconds kDefaultTimeoutAll{2000};
24inline constexpr std::size_t kDefaultMaxRetries{4};
32 bool IsAny()
const {
return id_ == -1; }
34 bool operator==(
const ServerId& other)
const {
return other.id_ == id_; }
35 bool operator!=(
const ServerId& other)
const {
return !(other == *
this); }
37 bool operator<(
const ServerId& other)
const {
return id_ < other.id_; }
45 static ServerId Invalid() {
return invalid_; }
47 int64_t GetId()
const {
return id_; }
49 void SetDescription(std::string description)
const;
50 void RemoveDescription()
const;
51 std::string GetDescription()
const;
54 static std::atomic<std::int64_t> next_id_;
61 std::size_t operator()(
ServerId server_id)
const noexcept {
return std::hash<std::size_t>{}(server_id.GetId()); }
133 CommandControl() =
default;
135 const std::optional<std::chrono::milliseconds>& timeout_single,
136 const std::optional<std::chrono::milliseconds>& timeout_all,
137 const std::optional<size_t>& max_retries
146 std::string ToString()
const;