Skip to content

Commit f619f76

Browse files
Yury-Fridlyandacarbonetto
authored andcommitted
Proto: Rename in RequestType enum according to Feng-Shui. (valkey-io#1387)
* Rename in `RequestType` enum according to Feng-Shui. (#262) Signed-off-by: Yury-Fridlyand <[email protected]> Co-authored-by: Andrew Carbonetto <[email protected]>
1 parent fa009cc commit f619f76

File tree

23 files changed

+699
-721
lines changed

23 files changed

+699
-721
lines changed

csharp/lib/AsyncClient.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public AsyncClient(string host, uint port, bool useTLS)
3838
IntPtr[] args = _arrayPool.Rent(2);
3939
args[0] = Marshal.StringToHGlobalAnsi(key);
4040
args[1] = Marshal.StringToHGlobalAnsi(value);
41-
string? result = await Command(args, 2, RequestType.SetString);
41+
string? result = await Command(args, 2, RequestType.Set);
4242
_arrayPool.Return(args);
4343
return result;
4444
}
@@ -47,7 +47,7 @@ public AsyncClient(string host, uint port, bool useTLS)
4747
{
4848
IntPtr[] args = _arrayPool.Rent(1);
4949
args[0] = Marshal.StringToHGlobalAnsi(key);
50-
string? result = await Command(args, 1, RequestType.GetString);
50+
string? result = await Command(args, 1, RequestType.Get);
5151
_arrayPool.Return(args);
5252
return result;
5353
}
@@ -129,8 +129,8 @@ private enum RequestType
129129
{
130130
InvalidRequest = 0,
131131
CustomCommand = 1,
132-
GetString = 2,
133-
SetString = 3,
132+
Get = 2,
133+
Set = 3,
134134
Ping = 4,
135135
Info = 5,
136136
Del = 6,
@@ -154,22 +154,22 @@ private enum RequestType
154154
ClientUnblock = 24,
155155
ClientUnpause = 25,
156156
Expire = 26,
157-
HashSet = 27,
158-
HashGet = 28,
159-
HashDel = 29,
160-
HashExists = 30,
157+
HSet = 27,
158+
HGet = 28,
159+
HDel = 29,
160+
HExists = 30,
161161
MGet = 31,
162162
MSet = 32,
163163
Incr = 33,
164164
IncrBy = 34,
165165
Decr = 35,
166166
IncrByFloat = 36,
167167
DecrBy = 37,
168-
HashGetAll = 38,
169-
HashMSet = 39,
170-
HashMGet = 40,
171-
HashIncrBy = 41,
172-
HashIncrByFloat = 42,
168+
HGetAll = 38,
169+
HMSet = 39,
170+
HMGet = 40,
171+
HIncrBy = 41,
172+
HIncrByFloat = 42,
173173
LPush = 43,
174174
LPop = 44,
175175
RPush = 45,
@@ -188,19 +188,19 @@ private enum RequestType
188188
Exists = 58,
189189
Unlink = 59,
190190
TTL = 60,
191-
Zadd = 61,
192-
Zrem = 62,
193-
Zrange = 63,
194-
Zcard = 64,
195-
Zcount = 65,
191+
ZAdd = 61,
192+
ZRem = 62,
193+
ZRange = 63,
194+
ZCard = 64,
195+
ZCount = 65,
196196
ZIncrBy = 66,
197197
ZScore = 67,
198198
Type = 68,
199199
HLen = 69,
200200
Echo = 70,
201201
ZPopMin = 71,
202202
Strlen = 72,
203-
Lindex = 73,
203+
LIndex = 73,
204204
ZPopMax = 74,
205205
XRead = 75,
206206
XAdd = 76,
@@ -211,21 +211,21 @@ private enum RequestType
211211
XGroupDestroy = 81,
212212
HSetNX = 82,
213213
SIsMember = 83,
214-
Hvals = 84,
214+
HVals = 84,
215215
PTTL = 85,
216216
ZRemRangeByRank = 86,
217217
Persist = 87,
218218
ZRemRangeByScore = 88,
219219
Time = 89,
220-
Zrank = 90,
220+
ZRank = 90,
221221
Rename = 91,
222222
DBSize = 92,
223-
Brpop = 93,
224-
Hkeys = 94,
223+
BRPop = 93,
224+
HKeys = 94,
225225
PfAdd = 96,
226226
PfCount = 97,
227227
PfMerge = 98,
228-
Blpop = 100,
228+
BLPop = 100,
229229
RPushX = 102,
230230
LPushX = 103,
231231
}

glide-core/src/client/value_conversion.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub(crate) enum ExpectedReturnType {
1414
BulkString,
1515
Set,
1616
DoubleOrNull,
17-
ZrankReturnType,
17+
ZRankReturnType,
1818
JsonToggleReturnType,
1919
ArrayOfBools,
2020
ArrayOfDoubleOrNull,
@@ -101,7 +101,7 @@ pub(crate) fn convert_to_expected_type(
101101
Value::Nil => Ok(value),
102102
_ => Ok(Value::Double(from_owned_redis_value::<f64>(value)?)),
103103
},
104-
ExpectedReturnType::ZrankReturnType => match value {
104+
ExpectedReturnType::ZRankReturnType => match value {
105105
Value::Nil => Ok(value),
106106
Value::Array(mut array) => {
107107
if array.len() != 2 {
@@ -119,7 +119,7 @@ pub(crate) fn convert_to_expected_type(
119119
}
120120
_ => Err((
121121
ErrorKind::TypeError,
122-
"Response couldn't be converted to Array (ZrankResponseType)",
122+
"Response couldn't be converted to Array (ZRankResponseType)",
123123
format!("(response was {:?})", value),
124124
)
125125
.into()),
@@ -419,7 +419,7 @@ pub(crate) fn expected_type_for_cmd(cmd: &Cmd) -> Option<ExpectedReturnType> {
419419
.map(|_| ExpectedReturnType::MapOfStringToDouble),
420420
b"ZRANK" | b"ZREVRANK" => cmd
421421
.position(b"WITHSCORE")
422-
.map(|_| ExpectedReturnType::ZrankReturnType),
422+
.map(|_| ExpectedReturnType::ZRankReturnType),
423423
b"SPOP" => {
424424
if cmd.arg_idx(2).is_some() {
425425
Some(ExpectedReturnType::Set)
@@ -751,7 +751,7 @@ mod tests {
751751
.arg("member")
752752
.arg("withscore")
753753
),
754-
Some(ExpectedReturnType::ZrankReturnType)
754+
Some(ExpectedReturnType::ZRankReturnType)
755755
));
756756

757757
assert!(expected_type_for_cmd(redis::cmd("zrank").arg("key").arg("member")).is_none());
@@ -763,7 +763,7 @@ mod tests {
763763
.arg("member")
764764
.arg("withscore")
765765
),
766-
Some(ExpectedReturnType::ZrankReturnType)
766+
Some(ExpectedReturnType::ZRankReturnType)
767767
));
768768

769769
assert!(expected_type_for_cmd(redis::cmd("ZREVRANK").arg("key").arg("member")).is_none());
@@ -899,7 +899,7 @@ mod tests {
899899
#[test]
900900
fn test_convert_to_zrank_return_type() {
901901
assert_eq!(
902-
convert_to_expected_type(Value::Nil, Some(ExpectedReturnType::ZrankReturnType)),
902+
convert_to_expected_type(Value::Nil, Some(ExpectedReturnType::ZRankReturnType)),
903903
Ok(Value::Nil)
904904
);
905905

@@ -910,7 +910,7 @@ mod tests {
910910

911911
let array_result = convert_to_expected_type(
912912
Value::Array(array),
913-
Some(ExpectedReturnType::ZrankReturnType),
913+
Some(ExpectedReturnType::ZRankReturnType),
914914
)
915915
.unwrap();
916916

@@ -927,7 +927,7 @@ mod tests {
927927
let array_err = vec![Value::BulkString(b"key".to_vec())];
928928
assert!(convert_to_expected_type(
929929
Value::Array(array_err),
930-
Some(ExpectedReturnType::ZrankReturnType)
930+
Some(ExpectedReturnType::ZRankReturnType)
931931
)
932932
.is_err());
933933
}

glide-core/src/protobuf/redis_request.proto

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ enum RequestType {
4141
InvalidRequest = 0;
4242
/// An unknown command, where all arguments are defined by the user.
4343
CustomCommand = 1;
44-
/// Type of a get string request.
45-
GetString = 2;
46-
/// Type of a set string request.
47-
SetString = 3;
44+
Get = 2;
45+
Set = 3;
4846
Ping = 4;
4947
Info = 5;
5048
Del = 6;
@@ -68,22 +66,22 @@ enum RequestType {
6866
ClientUnblock = 24;
6967
ClientUnpause = 25;
7068
Expire = 26;
71-
HashSet = 27;
72-
HashGet = 28;
73-
HashDel = 29;
74-
HashExists = 30;
69+
HSet = 27;
70+
HGet = 28;
71+
HDel = 29;
72+
HExists = 30;
7573
MGet=31;
7674
MSet=32;
7775
Incr=33;
7876
IncrBy=34;
7977
Decr=35;
8078
IncrByFloat=36;
8179
DecrBy=37;
82-
HashGetAll=38;
83-
HashMSet=39;
84-
HashMGet=40;
85-
HashIncrBy = 41;
86-
HashIncrByFloat = 42;
80+
HGetAll=38;
81+
HMSet=39;
82+
HMGet=40;
83+
HIncrBy = 41;
84+
HIncrByFloat = 42;
8785
LPush = 43;
8886
LPop = 44;
8987
RPush = 45;
@@ -102,19 +100,19 @@ enum RequestType {
102100
Exists = 58;
103101
Unlink = 59;
104102
TTL = 60;
105-
Zadd = 61;
106-
Zrem = 62;
107-
Zrange = 63;
108-
Zcard = 64;
109-
Zcount = 65;
103+
ZAdd = 61;
104+
ZRem = 62;
105+
ZRange = 63;
106+
ZCard = 64;
107+
ZCount = 65;
110108
ZIncrBy = 66;
111109
ZScore = 67;
112110
Type = 68;
113111
HLen = 69;
114112
Echo = 70;
115113
ZPopMin = 71;
116114
Strlen = 72;
117-
Lindex = 73;
115+
LIndex = 73;
118116
ZPopMax = 74;
119117
XRead = 75;
120118
XAdd = 76;
@@ -125,22 +123,22 @@ enum RequestType {
125123
XGroupDestroy = 81;
126124
HSetNX = 82;
127125
SIsMember = 83;
128-
Hvals = 84;
126+
HVals = 84;
129127
PTTL = 85;
130128
ZRemRangeByRank = 86;
131129
Persist = 87;
132130
ZRemRangeByScore = 88;
133131
Time = 89;
134-
Zrank = 90;
132+
ZRank = 90;
135133
Rename = 91;
136134
DBSize = 92;
137-
Brpop = 93;
138-
Hkeys = 94;
139-
Spop = 95;
135+
BRPop = 93;
136+
HKeys = 94;
137+
SPop = 95;
140138
PfAdd = 96;
141139
PfCount = 97;
142140
PfMerge = 98;
143-
Blpop = 100;
141+
BLPop = 100;
144142
LInsert = 101;
145143
RPushX = 102;
146144
LPushX = 103;
@@ -165,14 +163,14 @@ enum RequestType {
165163
GeoHash = 122;
166164
ObjectEncoding = 123;
167165
SDiff = 124;
168-
ObjectIdletime = 125;
169-
ObjectRefcount = 126;
170-
LOLWUT = 100500;
166+
ObjectIdleTime = 125;
167+
ObjectRefCount = 126;
168+
Lolwut = 100500;
171169
GeoDist = 127;
172170
GeoPos = 128;
173171
BZPopMax = 129;
174172
ObjectFreq = 130;
175-
RenameNx = 131;
173+
RenameNX = 131;
176174
Touch = 132;
177175
ZRevRank = 133;
178176
ZInterStore = 134;

0 commit comments

Comments
 (0)