mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-26 05:56:50 +00:00
fix: filemeta version handling and delete operations (#879)
* fix filemeta version * fix clippy * fix delete version * fix clippy/test
This commit is contained in:
@@ -1106,18 +1106,15 @@ impl TargetClient {
|
||||
SdkError::ServiceError(oe) => match oe.into_err() {
|
||||
HeadBucketError::NotFound(_) => Ok(false),
|
||||
other => Err(S3ClientError::new(format!(
|
||||
"failed to check bucket exists for bucket:{} please check the bucket name and credentials, error:{:?}",
|
||||
bucket, other
|
||||
"failed to check bucket exists for bucket:{bucket} please check the bucket name and credentials, error:{other:?}"
|
||||
))),
|
||||
},
|
||||
SdkError::DispatchFailure(e) => Err(S3ClientError::new(format!(
|
||||
"failed to dispatch bucket exists for bucket:{} error:{:?}",
|
||||
bucket, e
|
||||
"failed to dispatch bucket exists for bucket:{bucket} error:{e:?}"
|
||||
))),
|
||||
|
||||
_ => Err(S3ClientError::new(format!(
|
||||
"failed to check bucket exists for bucket:{} error:{:?}",
|
||||
bucket, e
|
||||
"failed to check bucket exists for bucket:{bucket} error:{e:?}"
|
||||
))),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -806,7 +806,7 @@ impl LocalDisk {
|
||||
Ok((bytes, modtime))
|
||||
}
|
||||
|
||||
async fn delete_versions_internal(&self, volume: &str, path: &str, fis: &Vec<FileInfo>) -> Result<()> {
|
||||
async fn delete_versions_internal(&self, volume: &str, path: &str, fis: &[FileInfo]) -> Result<()> {
|
||||
let volume_dir = self.get_bucket_path(volume)?;
|
||||
let xlpath = self.get_object_path(volume, format!("{path}/{STORAGE_FORMAT_FILE}").as_str())?;
|
||||
|
||||
@@ -820,7 +820,7 @@ impl LocalDisk {
|
||||
|
||||
fm.unmarshal_msg(&data)?;
|
||||
|
||||
for fi in fis {
|
||||
for fi in fis.iter() {
|
||||
let data_dir = match fm.delete_version(fi) {
|
||||
Ok(res) => res,
|
||||
Err(err) => {
|
||||
@@ -2300,7 +2300,6 @@ impl DiskAPI for LocalDisk {
|
||||
let buf = match self.read_all_data(volume, &volume_dir, &xl_path).await {
|
||||
Ok(res) => res,
|
||||
Err(err) => {
|
||||
//
|
||||
if err != DiskError::FileNotFound {
|
||||
return Err(err);
|
||||
}
|
||||
|
||||
@@ -1085,7 +1085,7 @@ mod tests {
|
||||
|
||||
drop(listener);
|
||||
|
||||
let url = url::Url::parse(&format!("http://{}:{}/data/rustfs0", ip, port)).unwrap();
|
||||
let url = url::Url::parse(&format!("http://{ip}:{port}/data/rustfs0")).unwrap();
|
||||
let endpoint = Endpoint {
|
||||
url,
|
||||
is_local: false,
|
||||
|
||||
@@ -4247,7 +4247,6 @@ impl StorageAPI for SetDisks {
|
||||
|
||||
for (_, mut fi_vers) in vers_map {
|
||||
fi_vers.versions.sort_by(|a, b| a.deleted.cmp(&b.deleted));
|
||||
fi_vers.versions.reverse();
|
||||
|
||||
if let Some(index) = fi_vers.versions.iter().position(|fi| fi.deleted) {
|
||||
fi_vers.versions.truncate(index + 1);
|
||||
@@ -4652,7 +4651,7 @@ impl StorageAPI for SetDisks {
|
||||
let tgt_client = match tier_config_mgr.get_driver(&opts.transition.tier).await {
|
||||
Ok(client) => client,
|
||||
Err(err) => {
|
||||
return Err(Error::other(format!("remote tier error: {}", err)));
|
||||
return Err(Error::other(format!("remote tier error: {err}")));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user