Skip to content

Commit d4789dd

Browse files
committed
Don't pass an arg in and out of kv_client
Signed-off-by: Nick Cameron <nrc@ncameron.org>
1 parent 4ad75c5 commit d4789dd

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/rpc/client.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ impl RpcClientInner {
8585
self.pd.get_region(key.as_ref())
8686
}
8787

88-
fn kv_client(&self, context: RegionContext) -> Result<(RegionContext, Arc<KvClient>)> {
88+
fn kv_client(&self, context: &RegionContext) -> Result<Arc<KvClient>> {
8989
if let Some(conn) = self.tikv.read().unwrap().get(context.address()) {
90-
return Ok((context, Arc::clone(conn)));
90+
return Ok(Arc::clone(conn));
9191
};
9292
info!("connect to tikv endpoint: {:?}", context.address());
9393
let tikv = Arc::clone(&self.tikv);
@@ -102,7 +102,7 @@ impl RpcClientInner {
102102
tikv.write()
103103
.unwrap()
104104
.insert(context.address().to_owned(), Arc::clone(&c));
105-
(context, c)
105+
c
106106
})
107107
}
108108

@@ -118,7 +118,7 @@ impl RpcClientInner {
118118
self.load_store(store_id)
119119
.map_ok(|store| RegionContext { region, store })
120120
})
121-
.and_then(move |region| future::ready(self2.kv_client(region)))
121+
.and_then(move |region| future::ready(self2.kv_client(&region).map(|c| ((region, c)))))
122122
}
123123

124124
fn region_context_for_key(
@@ -395,13 +395,11 @@ impl RpcClient {
395395

396396
pub fn raw_batch_scan(
397397
&self,
398-
ranges: Vec<BoundRange>,
398+
_ranges: Vec<BoundRange>,
399399
_each_limit: u32,
400400
_key_only: bool,
401-
cf: Option<ColumnFamily>,
401+
_cf: Option<ColumnFamily>,
402402
) -> impl Future<Output = Result<Vec<KvPair>>> {
403-
drop(ranges);
404-
drop(cf);
405403
future::err(Error::unimplemented())
406404
}
407405

0 commit comments

Comments
 (0)