Skip to content

Commit

Permalink
more PR feedback
Browse files Browse the repository at this point in the history
Signed-off-by: limbooverlambda <[email protected]>
  • Loading branch information
limbooverlambda committed Jun 30, 2024
1 parent 9c907c9 commit 9d76994
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/kv/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl AsRef<Key> for KvPairTTL {

impl From<KvPairTTL> for (KvPair, u64) {
fn from(value: KvPairTTL) -> Self {
(value.0.clone(), value.1)
(value.0, value.1)
}
}

Expand Down
10 changes: 4 additions & 6 deletions src/raw/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::time::Duration;

use async_trait::async_trait;
use futures::stream::BoxStream;
use futures::StreamExt;

use tonic::transport::Channel;

Expand Down Expand Up @@ -202,12 +201,12 @@ impl Shardable for kvrpcpb::RawBatchPutRequest {
let kvs = self.pairs.clone();
let ttls = self.ttls.clone();
let mut kv_ttl: Vec<KvPairTTL> = kvs
.iter()
.into_iter()
.zip(ttls)
.map(|(kv, ttl)| KvPairTTL(kv.clone(), ttl))
.map(|(kv, ttl)| KvPairTTL(kv, ttl))
.collect();
kv_ttl.sort_by(|a, b| a.0.key.clone().cmp(&b.0.key));
store_stream_for_keys(kv_ttl.into_iter(), pd_client.clone()).boxed()
store_stream_for_keys(kv_ttl.into_iter(), pd_client.clone())
}

fn apply_shard(&mut self, shard: Self::Shard, store: &RegionStore) -> Result<()> {
Expand Down Expand Up @@ -672,8 +671,7 @@ mod test {
.retry_multi_region(DEFAULT_REGION_BACKOFF)
.plan();
let _ = plan.execute().await;
assert_eq!(actual_map.lock().unwrap().len(), 2);
assert_eq!(actual_map.lock().unwrap().deref().clone(), expected_map);
assert_eq!(actual_map.lock().unwrap().deref(), &expected_map);
Ok(())
}
}
2 changes: 1 addition & 1 deletion src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct RegionStore {
pub struct Store {
pub client: Arc<dyn KvClient + Send + Sync>,
}
#[allow(dead_code)]

/// Maps keys to a stream of stores. `key_data` must be sorted in increasing order
pub fn store_stream_for_keys<K, KOut, PdC>(
key_data: impl Iterator<Item = K> + Send + Sync + 'static,
Expand Down

0 comments on commit 9d76994

Please sign in to comment.