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
17namespace storages::
redis {
19using ExpireReply = USERVER_NAMESPACE::redis::ExpireReply;
21enum class HsetReply { kCreated, kUpdated };
27 bool operator==(
const Point& rhs)
const {
return std::tie(lon, lat) == std::tie(rhs.lon, rhs.lat); }
30struct GeoPoint
final {
32 std::optional<
double> dist;
33 std::optional<uint64_t> hash;
34 std::optional<
Point> point;
38 GeoPoint(std::string member, std::optional<
double> dist, std::optional<uint64_t> hash, std::optional<
Point> point)
39 : member(std::move(member)), dist(dist), hash(hash), point(point) {}
41 bool operator==(
const GeoPoint& rhs)
const {
42 return std::tie(member, dist, hash, point) == std::tie(rhs.member, rhs.dist, rhs.hash, rhs.point);
45 bool operator!=(
const GeoPoint& rhs)
const {
return !(*
this == rhs); }
48struct MemberScore
final {
52 MemberScore() =
default;
53 MemberScore(std::string member,
double score) : member(std::move(member)), score(score) {}
55 operator std::pair<std::string,
double>()
const& {
return {member, score}; }
57 operator std::pair<std::string,
double>() && {
return {std::move(member), score}; }
59 operator std::pair<
const std::string,
double>()
const& {
return {member, score}; }
61 operator std::pair<
const std::string,
double>() && {
return {std::move(member), score}; }
63 bool operator==(
const MemberScore& rhs)
const {
return member == rhs.member && score == rhs.score; }
65 bool operator!=(
const MemberScore& rhs)
const {
return !(*
this == rhs); }
68enum class PersistReply { kKeyOrTimeoutNotFound, kTimeoutRemoved };
74struct ScanReplyElem<ScanTag::kScan> {
75 using type = std::string;
79struct ScanReplyElem<ScanTag::kSscan> {
80 using type = std::string;
84struct ScanReplyElem<ScanTag::kHscan> {
85 using type = std::pair<std::string, std::string>;
89struct ScanReplyElem<ScanTag::kZscan> {
90 using type = MemberScore;
93enum class SetReply { kSet, kNotSet };
95enum class StatusOk { kOk };
97enum class StatusPong { kPong };
99using TtlReply = USERVER_NAMESPACE::redis::TtlReply;