mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-25 09:31:00 +00:00
[dep-upgrade-202402] remove useless mut
This commit is contained in:
parent
c2e1e172d4
commit
ad5ce968d2
3 changed files with 10 additions and 10 deletions
|
@ -7,7 +7,7 @@ use futures::try_join;
|
||||||
use md5::{digest::generic_array::*, Digest as Md5Digest, Md5};
|
use md5::{digest::generic_array::*, Digest as Md5Digest, Md5};
|
||||||
use sha2::Sha256;
|
use sha2::Sha256;
|
||||||
|
|
||||||
use hyper::body::{Body, Bytes};
|
use hyper::body::Bytes;
|
||||||
use hyper::header::{HeaderMap, HeaderValue};
|
use hyper::header::{HeaderMap, HeaderValue};
|
||||||
use hyper::{Request, Response};
|
use hyper::{Request, Response};
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ impl<'a> BucketHelper<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks ok, add alias
|
// Checks ok, add alias
|
||||||
let mut bucket_p = bucket.state.as_option_mut().unwrap();
|
let bucket_p = bucket.state.as_option_mut().unwrap();
|
||||||
|
|
||||||
let alias_ts = increment_logical_clock_2(
|
let alias_ts = increment_logical_clock_2(
|
||||||
bucket_p.aliases.get_timestamp(alias_name),
|
bucket_p.aliases.get_timestamp(alias_name),
|
||||||
|
@ -163,7 +163,7 @@ impl<'a> BucketHelper<'a> {
|
||||||
alias_name: &String,
|
alias_name: &String,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let mut bucket = self.get_existing_bucket(bucket_id).await?;
|
let mut bucket = self.get_existing_bucket(bucket_id).await?;
|
||||||
let mut bucket_state = bucket.state.as_option_mut().unwrap();
|
let bucket_state = bucket.state.as_option_mut().unwrap();
|
||||||
|
|
||||||
let mut alias = self
|
let mut alias = self
|
||||||
.0
|
.0
|
||||||
|
@ -245,7 +245,7 @@ impl<'a> BucketHelper<'a> {
|
||||||
self.0.bucket_alias_table.insert(&alias).await?;
|
self.0.bucket_alias_table.insert(&alias).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(mut bucket_state) = bucket.state.as_option_mut() {
|
if let Some(bucket_state) = bucket.state.as_option_mut() {
|
||||||
bucket_state.aliases = LwwMap::raw_item(alias_name.clone(), alias_ts, false);
|
bucket_state.aliases = LwwMap::raw_item(alias_name.clone(), alias_ts, false);
|
||||||
self.0.bucket_table.insert(&bucket).await?;
|
self.0.bucket_table.insert(&bucket).await?;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ impl<'a> BucketHelper<'a> {
|
||||||
let mut bucket = self.get_existing_bucket(bucket_id).await?;
|
let mut bucket = self.get_existing_bucket(bucket_id).await?;
|
||||||
let mut key = key_helper.get_existing_key(key_id).await?;
|
let mut key = key_helper.get_existing_key(key_id).await?;
|
||||||
|
|
||||||
let mut key_param = key.state.as_option_mut().unwrap();
|
let key_param = key.state.as_option_mut().unwrap();
|
||||||
|
|
||||||
if let Some(Some(existing_alias)) = key_param.local_aliases.get(alias_name) {
|
if let Some(Some(existing_alias)) = key_param.local_aliases.get(alias_name) {
|
||||||
if *existing_alias != bucket_id {
|
if *existing_alias != bucket_id {
|
||||||
|
@ -283,7 +283,7 @@ impl<'a> BucketHelper<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks ok, add alias
|
// Checks ok, add alias
|
||||||
let mut bucket_p = bucket.state.as_option_mut().unwrap();
|
let bucket_p = bucket.state.as_option_mut().unwrap();
|
||||||
let bucket_p_local_alias_key = (key.key_id.clone(), alias_name.clone());
|
let bucket_p_local_alias_key = (key.key_id.clone(), alias_name.clone());
|
||||||
|
|
||||||
// Calculate the timestamp to assign to this aliasing in the two local_aliases maps
|
// Calculate the timestamp to assign to this aliasing in the two local_aliases maps
|
||||||
|
@ -326,7 +326,7 @@ impl<'a> BucketHelper<'a> {
|
||||||
let mut bucket = self.get_existing_bucket(bucket_id).await?;
|
let mut bucket = self.get_existing_bucket(bucket_id).await?;
|
||||||
let mut key = key_helper.get_existing_key(key_id).await?;
|
let mut key = key_helper.get_existing_key(key_id).await?;
|
||||||
|
|
||||||
let mut bucket_p = bucket.state.as_option_mut().unwrap();
|
let bucket_p = bucket.state.as_option_mut().unwrap();
|
||||||
|
|
||||||
if key
|
if key
|
||||||
.state
|
.state
|
||||||
|
@ -359,7 +359,7 @@ impl<'a> BucketHelper<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks ok, remove alias
|
// Checks ok, remove alias
|
||||||
let mut key_param = key.state.as_option_mut().unwrap();
|
let key_param = key.state.as_option_mut().unwrap();
|
||||||
let bucket_p_local_alias_key = (key.key_id.clone(), alias_name.clone());
|
let bucket_p_local_alias_key = (key.key_id.clone(), alias_name.clone());
|
||||||
|
|
||||||
let alias_ts = increment_logical_clock_2(
|
let alias_ts = increment_logical_clock_2(
|
||||||
|
|
|
@ -232,7 +232,7 @@ impl<T: CountedItem> IndexCounter<T> {
|
||||||
|
|
||||||
let now = now_msec();
|
let now = now_msec();
|
||||||
for (s, inc) in counts.iter() {
|
for (s, inc) in counts.iter() {
|
||||||
let mut ent = entry.values.entry(s.to_string()).or_insert((0, 0));
|
let ent = entry.values.entry(s.to_string()).or_insert((0, 0));
|
||||||
ent.0 = std::cmp::max(ent.0 + 1, now);
|
ent.0 = std::cmp::max(ent.0 + 1, now);
|
||||||
ent.1 += *inc;
|
ent.1 += *inc;
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ impl<T: CountedItem> IndexCounter<T> {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
for (s, v) in counts.iter() {
|
for (s, v) in counts.iter() {
|
||||||
let mut tv = local_counter.values.entry(s.to_string()).or_insert((0, 0));
|
let tv = local_counter.values.entry(s.to_string()).or_insert((0, 0));
|
||||||
tv.0 = std::cmp::max(tv.0 + 1, now);
|
tv.0 = std::cmp::max(tv.0 + 1, now);
|
||||||
tv.1 += v;
|
tv.1 += v;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue