cargo fmt

This commit is contained in:
houseme
2025-06-06 15:30:27 +08:00
parent 3eaa3d68c7
commit 1f62c35846
18 changed files with 70 additions and 69 deletions
+1 -1
View File
@@ -346,7 +346,7 @@ impl BucketMetadata {
}
//let temp = self.bucket_targets_config_json.clone();
if !self.bucket_targets_config_json.is_empty() {
let arr:Vec<BucketTarget> = serde_json::from_slice(&self.bucket_targets_config_json)?;
let arr: Vec<BucketTarget> = serde_json::from_slice(&self.bucket_targets_config_json)?;
self.bucket_target_config = Some(BucketTargets { targets: arr });
} else {
self.bucket_target_config = Some(BucketTargets::default())
+1 -2
View File
@@ -558,7 +558,7 @@ impl BucketMetadataSys {
return Err(Error::new(BucketMetadataError::BucketReplicationConfigNotFound));
}
res
},
}
Err(err) => {
warn!("get_replication_config err {:?}", &err);
return if config::error::is_err_config_not_found(&err) {
@@ -593,7 +593,6 @@ impl BucketMetadataSys {
}
};
println!("573");
if let Some(config) = &bm.bucket_target_config {
+1 -1
View File
@@ -4,9 +4,9 @@ pub mod metadata_sys;
pub mod object_lock;
pub mod policy_sys;
mod quota;
pub mod replication;
pub mod tagging;
pub mod target;
pub mod utils;
pub mod versioning;
pub mod replication;
pub mod versioning_sys;
+1 -1
View File
@@ -24,4 +24,4 @@ impl StatusType {
pub fn is_empty(&self) -> bool {
matches!(self, StatusType::Pending) // Adjust this as needed
}
}
}
+1 -1
View File
@@ -1 +1 @@
pub mod datatypes;
pub mod datatypes;
-1
View File
@@ -6,7 +6,6 @@ use crate::bucket::versioning_sys::BucketVersioningSys;
use crate::new_object_layer_fn;
use crate::peer::RemotePeerS3Client;
use crate::store;
use crate::store_api;
use crate::store_api::ObjectIO;
use crate::store_api::ObjectInfo;
use crate::store_api::ObjectOptions;
-1
View File
@@ -13,7 +13,6 @@ use crate::{
//use tokio::sync::RwLock;
use aws_sdk_s3::Client as S3Client;
use chrono::Utc;
use futures::future::err;
use lazy_static::lazy_static;
use std::sync::Arc;
use std::{
+1 -1
View File
@@ -1,2 +1,2 @@
pub mod bucket_replication;
pub mod bucket_targets;
pub mod bucket_replication;
+24 -15
View File
@@ -18,10 +18,12 @@ use super::{
data_usage_cache::{DataUsageCache, DataUsageEntry, DataUsageHash},
heal_commands::{HealScanMode, HEAL_DEEP_SCAN, HEAL_NORMAL_SCAN},
};
use crate::{
bucket::{metadata_sys, versioning::VersioningApi, versioning_sys::BucketVersioningSys}, cmd::bucket_replication::{ReplicationStatusType}, heal::data_usage::DATA_USAGE_ROOT
};
use crate::cmd::bucket_replication::queue_replication_heal;
use crate::{
bucket::{metadata_sys, versioning::VersioningApi, versioning_sys::BucketVersioningSys},
cmd::bucket_replication::ReplicationStatusType,
heal::data_usage::DATA_USAGE_ROOT,
};
use crate::{
cache_value::metacache_set::{list_path_raw, ListPathRawOptions},
config::{
@@ -553,7 +555,13 @@ impl ScannerItem {
pub async fn apply_actions(&mut self, oi: &ObjectInfo, _size_s: &mut SizeSummary) -> (bool, usize) {
let done = ScannerMetrics::time(ScannerMetric::Ilm);
//todo: lifecycle
info!("apply_actions {} {} {:?} {:?}", oi.bucket.clone(), oi.name.clone(), oi.version_id.clone(), oi.user_defined.clone());
info!(
"apply_actions {} {} {:?} {:?}",
oi.bucket.clone(),
oi.name.clone(),
oi.version_id.clone(),
oi.user_defined.clone()
);
// Create a mutable clone if you need to modify fields
let mut oi = oi.clone();
@@ -561,7 +569,7 @@ impl ScannerItem {
oi.user_defined
.as_ref()
.and_then(|map| map.get("x-amz-bucket-replication-status"))
.unwrap_or(&"PENDING".to_string())
.unwrap_or(&"PENDING".to_string()),
);
info!("apply status is: {:?}", oi.replication_status);
self.heal_replication(&oi, _size_s).await;
@@ -572,11 +580,15 @@ impl ScannerItem {
pub async fn heal_replication(&mut self, oi: &ObjectInfo, size_s: &mut SizeSummary) {
if oi.version_id.is_none() {
error!("heal_replication: no version_id or replication config {} {} {}", oi.bucket, oi.name, oi.version_id.is_none());
error!(
"heal_replication: no version_id or replication config {} {} {}",
oi.bucket,
oi.name,
oi.version_id.is_none()
);
return;
}
//let config = s3s::dto::ReplicationConfiguration{ role: todo!(), rules: todo!() };
// Use the provided variable instead of borrowing self mutably.
let replication = match metadata_sys::get_replication_config(&oi.bucket).await {
@@ -597,16 +609,17 @@ impl ScannerItem {
//if oi.delete_marker || !oi.version_purge_status.is_empty() {
if oi.delete_marker {
error!("heal_replication: delete marker or version purge status {} {} {:?} {} {:?}", oi.bucket, oi.name, oi.version_id, oi.delete_marker, oi.version_purge_status);
error!(
"heal_replication: delete marker or version purge status {} {} {:?} {} {:?}",
oi.bucket, oi.name, oi.version_id, oi.delete_marker, oi.version_purge_status
);
return;
}
if oi.replication_status == ReplicationStatusType::Completed {
return;
}
info!("replication status is: {:?} and user define {:?}", oi.replication_status, oi.user_defined);
let roi = queue_replication_heal(&oi.bucket, oi, &replication, 3).await;
@@ -617,10 +630,7 @@ impl ScannerItem {
}
for (arn, tgt_status) in &roi.unwrap().target_statuses {
let tgt_size_s = size_s
.repl_target_stats
.entry(arn.clone())
.or_default();
let tgt_size_s = size_s.repl_target_stats.entry(arn.clone()).or_default();
match tgt_status {
ReplicationStatusType::Pending => {
@@ -650,7 +660,6 @@ impl ScannerItem {
size_s.replica_size += oi.size;
}
}
}
#[derive(Debug, Default)]
+1 -1
View File
@@ -3,6 +3,7 @@ pub mod bitrot;
pub mod bucket;
pub mod cache_value;
mod chunk_stream;
pub mod cmd;
pub mod config;
pub mod disk;
pub mod disks_layout;
@@ -32,7 +33,6 @@ pub mod store_list_objects;
mod store_utils;
pub mod utils;
pub mod xhttp;
pub mod cmd;
pub use global::new_object_layer_fn;
pub use global::set_global_endpoints;
+1 -1
View File
@@ -1374,7 +1374,7 @@ impl StorageAPI for ECStore {
info.versionning = sys.versioning();
info.object_locking = sys.object_locking();
}
Ok(info)
}
#[tracing::instrument(skip(self))]
+4 -6
View File
@@ -686,12 +686,11 @@ pub struct ObjectInfo {
pub inlined: bool,
pub metadata_only: bool,
pub version_only: bool,
pub replication_status_internal:String,
pub replication_status:ReplicationStatusType,
pub replication_status_internal: String,
pub replication_status: ReplicationStatusType,
pub version_purge_status_internal: String,
pub version_purge_status: VersionPurgeStatusType,
pub checksum:Vec<u8>,
pub checksum: Vec<u8>,
}
impl Clone for ObjectInfo {
@@ -724,10 +723,9 @@ impl Clone for ObjectInfo {
replication_status: self.replication_status.clone(),
version_purge_status_internal: self.version_purge_status_internal.clone(),
version_purge_status: self.version_purge_status.clone(),
checksum:Default::default(),
checksum: Default::default(),
}
}
}
impl ObjectInfo {