6#include <userver/storages/redis/impl/base.hpp>
7#include <userver/storages/redis/impl/reply/expire_reply.hpp>
8#include <userver/storages/redis/impl/reply/ttl_reply.hpp>
9#include <userver/utils/void_t.hpp>
11#include <userver/storages/redis/key_type.hpp>
12#include <userver/storages/redis/reply_fwd.hpp>
13#include <userver/storages/redis/scan_tag.hpp>
15USERVER_NAMESPACE_BEGIN
19using ExpireReply = USERVER_NAMESPACE::redis::ExpireReply;
21enum class HsetReply { kCreated, kUpdated };
27 bool operator==(
const Point& rhs)
const {
28 return std::tie(lon, lat) == std::tie(rhs.lon, rhs.lat);
32struct GeoPoint
final {
34 std::optional<
double> dist;
35 std::optional<uint64_t> hash;
36 std::optional<
Point> point;
40 GeoPoint(std::string member, std::optional<
double> dist,
41 std::optional<uint64_t> hash, std::optional<
Point> point)
42 : member(std::move(member)), dist(dist), hash(hash), point(point) {}
44 bool operator==(
const GeoPoint& rhs)
const {
45 return std::tie(member, dist, hash, point) ==
46 std::tie(rhs.member, rhs.dist, rhs.hash, rhs.point);
49 bool operator!=(
const GeoPoint& rhs)
const {
return !(*
this == rhs); }
52struct MemberScore
final {
56 MemberScore() =
default;
57 MemberScore(std::string member,
double score)
58 : member(std::move(member)), score(score) {}
60 operator std::pair<std::string,
double>()
const& {
return {member, score}; }
62 operator std::pair<std::string,
double>() && {
63 return {std::move(member), score};
66 operator std::pair<
const std::string,
double>()
const& {
67 return {member, score};
70 operator std::pair<
const std::string,
double>() && {
71 return {std::move(member), score};
74 bool operator==(
const MemberScore& rhs)
const {
75 return member == rhs.member && score == rhs.score;
78 bool operator!=(
const MemberScore& rhs)
const {
return !(*
this == rhs); }
81enum class PersistReply { kKeyOrTimeoutNotFound, kTimeoutRemoved };
87struct ScanReplyElem<ScanTag::kScan> {
88 using type = std::string;
92struct ScanReplyElem<ScanTag::kSscan> {
93 using type = std::string;
97struct ScanReplyElem<ScanTag::kHscan> {
98 using type = std::pair<std::string, std::string>;
102struct ScanReplyElem<ScanTag::kZscan> {
103 using type = MemberScore;
106enum class SetReply { kSet, kNotSet };
108enum class StatusOk { kOk };
110enum class StatusPong { kPong };
112using TtlReply = USERVER_NAMESPACE::redis::TtlReply;