@@ -97,13 +97,22 @@ def __init__(self, client, **kwargs):
97
97
# CMS_INCRBY: spaceHolder,
98
98
# CMS_QUERY: spaceHolder,
99
99
CMS_MERGE : bool_ok ,
100
+ }
101
+
102
+ RESP2_MODULE_CALLBACKS = {
100
103
CMS_INFO : CMSInfo ,
101
104
}
105
+ RESP3_MODULE_CALLBACKS = {}
102
106
103
107
self .client = client
104
108
self .commandmixin = CMSCommands
105
109
self .execute_command = client .execute_command
106
110
111
+ if self .client .connection_pool .connection_kwargs .get ("protocol" ) in ["3" , 3 ]:
112
+ MODULE_CALLBACKS .update (RESP3_MODULE_CALLBACKS )
113
+ else :
114
+ MODULE_CALLBACKS .update (RESP2_MODULE_CALLBACKS )
115
+
107
116
for k , v in MODULE_CALLBACKS .items ():
108
117
self .client .set_response_callback (k , v )
109
118
@@ -114,18 +123,27 @@ def __init__(self, client, **kwargs):
114
123
# Set the module commands' callbacks
115
124
MODULE_CALLBACKS = {
116
125
TOPK_RESERVE : bool_ok ,
117
- TOPK_ADD : parse_to_list ,
118
- TOPK_INCRBY : parse_to_list ,
119
126
# TOPK_QUERY: spaceHolder,
120
127
# TOPK_COUNT: spaceHolder,
128
+ }
129
+
130
+ RESP2_MODULE_CALLBACKS = {
131
+ TOPK_ADD : parse_to_list ,
132
+ TOPK_INCRBY : parse_to_list ,
121
133
TOPK_LIST : parse_to_list ,
122
134
TOPK_INFO : TopKInfo ,
123
135
}
136
+ RESP3_MODULE_CALLBACKS = {}
124
137
125
138
self .client = client
126
139
self .commandmixin = TOPKCommands
127
140
self .execute_command = client .execute_command
128
141
142
+ if self .client .connection_pool .connection_kwargs .get ("protocol" ) in ["3" , 3 ]:
143
+ MODULE_CALLBACKS .update (RESP3_MODULE_CALLBACKS )
144
+ else :
145
+ MODULE_CALLBACKS .update (RESP2_MODULE_CALLBACKS )
146
+
129
147
for k , v in MODULE_CALLBACKS .items ():
130
148
self .client .set_response_callback (k , v )
131
149
@@ -145,13 +163,22 @@ def __init__(self, client, **kwargs):
145
163
# CF_COUNT: spaceHolder,
146
164
# CF_SCANDUMP: spaceHolder,
147
165
# CF_LOADCHUNK: spaceHolder,
166
+ }
167
+
168
+ RESP2_MODULE_CALLBACKS = {
148
169
CF_INFO : CFInfo ,
149
170
}
171
+ RESP3_MODULE_CALLBACKS = {}
150
172
151
173
self .client = client
152
174
self .commandmixin = CFCommands
153
175
self .execute_command = client .execute_command
154
176
177
+ if self .client .connection_pool .connection_kwargs .get ("protocol" ) in ["3" , 3 ]:
178
+ MODULE_CALLBACKS .update (RESP3_MODULE_CALLBACKS )
179
+ else :
180
+ MODULE_CALLBACKS .update (RESP2_MODULE_CALLBACKS )
181
+
155
182
for k , v in MODULE_CALLBACKS .items ():
156
183
self .client .set_response_callback (k , v )
157
184
@@ -165,22 +192,29 @@ def __init__(self, client, **kwargs):
165
192
# TDIGEST_RESET: bool_ok,
166
193
# TDIGEST_ADD: spaceHolder,
167
194
# TDIGEST_MERGE: spaceHolder,
195
+ }
196
+
197
+ RESP2_MODULE_CALLBACKS = {
198
+ TDIGEST_BYRANK : parse_to_list ,
199
+ TDIGEST_BYREVRANK : parse_to_list ,
168
200
TDIGEST_CDF : parse_to_list ,
169
201
TDIGEST_QUANTILE : parse_to_list ,
170
202
TDIGEST_MIN : float ,
171
203
TDIGEST_MAX : float ,
172
204
TDIGEST_TRIMMED_MEAN : float ,
173
205
TDIGEST_INFO : TDigestInfo ,
174
- TDIGEST_RANK : parse_to_list ,
175
- TDIGEST_REVRANK : parse_to_list ,
176
- TDIGEST_BYRANK : parse_to_list ,
177
- TDIGEST_BYREVRANK : parse_to_list ,
178
206
}
207
+ RESP3_MODULE_CALLBACKS = {}
179
208
180
209
self .client = client
181
210
self .commandmixin = TDigestCommands
182
211
self .execute_command = client .execute_command
183
212
213
+ if self .client .connection_pool .connection_kwargs .get ("protocol" ) in ["3" , 3 ]:
214
+ MODULE_CALLBACKS .update (RESP3_MODULE_CALLBACKS )
215
+ else :
216
+ MODULE_CALLBACKS .update (RESP2_MODULE_CALLBACKS )
217
+
184
218
for k , v in MODULE_CALLBACKS .items ():
185
219
self .client .set_response_callback (k , v )
186
220
@@ -199,12 +233,21 @@ def __init__(self, client, **kwargs):
199
233
# BF_SCANDUMP: spaceHolder,
200
234
# BF_LOADCHUNK: spaceHolder,
201
235
# BF_CARD: spaceHolder,
236
+ }
237
+
238
+ RESP2_MODULE_CALLBACKS = {
202
239
BF_INFO : BFInfo ,
203
240
}
241
+ RESP3_MODULE_CALLBACKS = {}
204
242
205
243
self .client = client
206
244
self .commandmixin = BFCommands
207
245
self .execute_command = client .execute_command
208
246
247
+ if self .client .connection_pool .connection_kwargs .get ("protocol" ) in ["3" , 3 ]:
248
+ MODULE_CALLBACKS .update (RESP3_MODULE_CALLBACKS )
249
+ else :
250
+ MODULE_CALLBACKS .update (RESP2_MODULE_CALLBACKS )
251
+
209
252
for k , v in MODULE_CALLBACKS .items ():
210
253
self .client .set_response_callback (k , v )
0 commit comments