@@ -87,7 +87,7 @@ impl RedisManager {
87
87
}
88
88
}
89
89
90
- pub async fn get ( & self ) -> Result < PooledConnection < ' _ > , RunError < RedisError > > {
90
+ pub async fn get ( & self ) -> Result < RedisConnection < ' _ > , RunError < RedisError > > {
91
91
match self {
92
92
Self :: Clustered ( pool) => pool. get ( ) . await ,
93
93
Self :: NonClustered ( pool) => pool. get ( ) . await ,
@@ -103,11 +103,11 @@ pub struct ClusteredRedisPool {
103
103
}
104
104
105
105
impl ClusteredRedisPool {
106
- pub async fn get ( & self ) -> Result < PooledConnection < ' _ > , RunError < RedisError > > {
106
+ pub async fn get ( & self ) -> Result < RedisConnection < ' _ > , RunError < RedisError > > {
107
107
let con = ClusteredPooledConnection {
108
108
con : self . pool . get ( ) . await ?,
109
109
} ;
110
- Ok ( PooledConnection :: Clustered ( con) )
110
+ Ok ( RedisConnection :: Clustered ( con) )
111
111
}
112
112
}
113
113
@@ -117,8 +117,8 @@ pub struct ClusteredRedisUnpooled {
117
117
}
118
118
119
119
impl ClusteredRedisUnpooled {
120
- pub async fn get ( & self ) -> Result < PooledConnection < ' _ > , RunError < RedisError > > {
121
- Ok ( PooledConnection :: ClusteredUnpooled (
120
+ pub async fn get ( & self ) -> Result < RedisConnection < ' _ > , RunError < RedisError > > {
121
+ Ok ( RedisConnection :: ClusteredUnpooled (
122
122
ClusteredUnpooledConnection {
123
123
con : self . con . clone ( ) ,
124
124
} ,
@@ -138,8 +138,8 @@ pub struct NonClusteredRedisUnpooled {
138
138
}
139
139
140
140
impl NonClusteredRedisUnpooled {
141
- pub async fn get ( & self ) -> Result < PooledConnection < ' _ > , RunError < RedisError > > {
142
- Ok ( PooledConnection :: NonClusteredUnpooled (
141
+ pub async fn get ( & self ) -> Result < RedisConnection < ' _ > , RunError < RedisError > > {
142
+ Ok ( RedisConnection :: NonClusteredUnpooled (
143
143
NonClusteredUnpooledConnection {
144
144
con : self . con . clone ( ) ,
145
145
} ,
@@ -159,21 +159,21 @@ pub struct NonClusteredRedisPool {
159
159
}
160
160
161
161
impl NonClusteredRedisPool {
162
- pub async fn get ( & self ) -> Result < PooledConnection < ' _ > , RunError < RedisError > > {
162
+ pub async fn get ( & self ) -> Result < RedisConnection < ' _ > , RunError < RedisError > > {
163
163
let con = self . pool . get ( ) . await ?;
164
164
let con = NonClusteredPooledConnection { con } ;
165
- Ok ( PooledConnection :: NonClustered ( con) )
165
+ Ok ( RedisConnection :: NonClustered ( con) )
166
166
}
167
167
}
168
168
169
- pub enum PooledConnection < ' a > {
169
+ pub enum RedisConnection < ' a > {
170
170
Clustered ( ClusteredPooledConnection < ' a > ) ,
171
171
ClusteredUnpooled ( ClusteredUnpooledConnection ) ,
172
172
NonClustered ( NonClusteredPooledConnection < ' a > ) ,
173
173
NonClusteredUnpooled ( NonClusteredUnpooledConnection ) ,
174
174
}
175
175
176
- impl PooledConnection < ' _ > {
176
+ impl RedisConnection < ' _ > {
177
177
pub async fn query_async < T : FromRedisValue > ( & mut self , cmd : redis:: Cmd ) -> RedisResult < T > {
178
178
cmd. query_async ( self ) . await
179
179
}
@@ -186,16 +186,16 @@ impl PooledConnection<'_> {
186
186
}
187
187
}
188
188
189
- impl redis:: aio:: ConnectionLike for PooledConnection < ' _ > {
189
+ impl redis:: aio:: ConnectionLike for RedisConnection < ' _ > {
190
190
fn req_packed_command < ' a > (
191
191
& ' a mut self ,
192
192
cmd : & ' a redis:: Cmd ,
193
193
) -> redis:: RedisFuture < ' a , redis:: Value > {
194
194
match self {
195
- PooledConnection :: Clustered ( conn) => conn. con . req_packed_command ( cmd) ,
196
- PooledConnection :: NonClustered ( conn) => conn. con . req_packed_command ( cmd) ,
197
- PooledConnection :: ClusteredUnpooled ( conn) => conn. con . req_packed_command ( cmd) ,
198
- PooledConnection :: NonClusteredUnpooled ( conn) => conn. con . req_packed_command ( cmd) ,
195
+ RedisConnection :: Clustered ( conn) => conn. con . req_packed_command ( cmd) ,
196
+ RedisConnection :: NonClustered ( conn) => conn. con . req_packed_command ( cmd) ,
197
+ RedisConnection :: ClusteredUnpooled ( conn) => conn. con . req_packed_command ( cmd) ,
198
+ RedisConnection :: NonClusteredUnpooled ( conn) => conn. con . req_packed_command ( cmd) ,
199
199
}
200
200
}
201
201
@@ -206,25 +206,23 @@ impl redis::aio::ConnectionLike for PooledConnection<'_> {
206
206
count : usize ,
207
207
) -> redis:: RedisFuture < ' a , Vec < redis:: Value > > {
208
208
match self {
209
- PooledConnection :: Clustered ( conn) => conn. con . req_packed_commands ( cmd, offset, count) ,
210
- PooledConnection :: NonClustered ( conn) => {
209
+ RedisConnection :: Clustered ( conn) => conn. con . req_packed_commands ( cmd, offset, count) ,
210
+ RedisConnection :: NonClustered ( conn) => conn. con . req_packed_commands ( cmd, offset, count) ,
211
+ RedisConnection :: ClusteredUnpooled ( conn) => {
211
212
conn. con . req_packed_commands ( cmd, offset, count)
212
213
}
213
- PooledConnection :: ClusteredUnpooled ( conn) => {
214
- conn. con . req_packed_commands ( cmd, offset, count)
215
- }
216
- PooledConnection :: NonClusteredUnpooled ( conn) => {
214
+ RedisConnection :: NonClusteredUnpooled ( conn) => {
217
215
conn. con . req_packed_commands ( cmd, offset, count)
218
216
}
219
217
}
220
218
}
221
219
222
220
fn get_db ( & self ) -> i64 {
223
221
match self {
224
- PooledConnection :: Clustered ( conn) => conn. con . get_db ( ) ,
225
- PooledConnection :: NonClustered ( conn) => conn. con . get_db ( ) ,
226
- PooledConnection :: ClusteredUnpooled ( conn) => conn. con . get_db ( ) ,
227
- PooledConnection :: NonClusteredUnpooled ( conn) => conn. con . get_db ( ) ,
222
+ RedisConnection :: Clustered ( conn) => conn. con . get_db ( ) ,
223
+ RedisConnection :: NonClustered ( conn) => conn. con . get_db ( ) ,
224
+ RedisConnection :: ClusteredUnpooled ( conn) => conn. con . get_db ( ) ,
225
+ RedisConnection :: NonClusteredUnpooled ( conn) => conn. con . get_db ( ) ,
228
226
}
229
227
}
230
228
}
0 commit comments