userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
reply_types.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <string>
7
#include <vector>
8
9
#include <
userver/storages/redis/base.hpp
>
10
#include <
userver/storages/redis/expire_reply.hpp
>
11
#include <
userver/storages/redis/ttl_reply.hpp
>
12
13
#include <
userver/storages/redis/key_type.hpp
>
14
#include <
userver/storages/redis/reply_fwd.hpp
>
15
#include <
userver/storages/redis/scan_tag.hpp
>
16
17
USERVER_NAMESPACE_BEGIN
18
19
namespace
storages::redis
{
20
21
enum class
HsetReply { kCreated, kUpdated };
22
24
enum class
HsetexReply
: std::int8_t {
25
kConditionNotMet
= 0,
26
kFieldsSet
= 1,
27
};
28
30
enum class
MsetexReply
: std::int8_t {
31
kConditionNotMet
= 0,
32
kKeysSet
= 1,
33
};
34
35
struct
Point
{
36
double
lon;
37
double
lat;
38
39
bool
operator==(
const
Point
& rhs)
const
{
return
std::tie(lon, lat) == std::tie(rhs.lon, rhs.lat); }
40
};
41
42
struct
GeoPoint final {
43
std::string member;
44
std::optional<double> dist;
45
std::optional<uint64_t> hash;
46
std::optional<Point> point;
47
48
GeoPoint() =
default
;
49
50
GeoPoint(std::string member, std::optional<double> dist, std::optional<uint64_t> hash, std::optional<Point> point)
51
: member(std::move(member)),
52
dist(dist),
53
hash(hash),
54
point(point)
55
{}
56
57
bool
operator==(
const
GeoPoint& rhs)
const
{
58
return
std::tie(member, dist, hash, point) == std::tie(rhs.member, rhs.dist, rhs.hash, rhs.point);
59
}
60
};
61
66
struct
MemberScore final {
67
std::string member;
68
double
score{0.0};
69
70
MemberScore() =
default
;
71
MemberScore(std::string member,
double
score)
72
: member(std::move(member)),
73
score(score)
74
{}
75
76
operator
std::pair<std::string, double>()
const
& {
return
{member, score}; }
77
78
operator
std::pair<std::string, double>() && {
return
{std::move(member), score}; }
79
80
operator
std::pair<const std::string, double>()
const
& {
return
{member, score}; }
81
82
operator
std::pair<const std::string, double>() && {
return
{std::move(member), score}; }
83
84
bool
operator==(
const
MemberScore& rhs)
const
{
return
member == rhs.member && score == rhs.score; }
85
};
86
87
enum class
PersistReply { kKeyOrTimeoutNotFound, kTimeoutRemoved };
88
90
enum class
HexpireReply
: std::int8_t {
91
kFieldDoesNotExist = -2,
92
kConditionNotMet
= 0,
93
kExpirationUpdated
= 1,
94
kFieldDeleted
= 2,
95
};
96
98
enum class
HpersistReply
: std::int8_t {
99
kFieldDoesNotExist = -2,
100
kFieldHasNoExpiration = -1,
101
kExpirationRemoved = 1,
102
};
103
104
template
<ScanTag>
105
struct
ScanReplyElem
;
106
107
template
<>
108
struct
ScanReplyElem
<
ScanTag
::
kScan
> {
109
using
type = std::string;
110
};
111
112
template
<>
113
struct
ScanReplyElem
<
ScanTag
::
kSscan
> {
114
using
type = std::string;
115
};
116
117
template
<>
118
struct
ScanReplyElem
<
ScanTag
::
kHscan
> {
119
using
type = std::pair<std::string, std::string>;
120
};
121
122
template
<>
123
struct
ScanReplyElem
<
ScanTag
::
kZscan
> {
124
using
type =
MemberScore
;
125
};
126
127
enum class
SetReply { kSet, kNotSet };
128
129
enum class
StatusOk { kOk };
130
131
enum class
StatusPong { kPong };
132
133
}
// namespace storages::redis
134
135
USERVER_NAMESPACE_END
userver
storages
redis
reply_types.hpp
Generated on
for userver by
Doxygen
1.17.0