From f795299d53c26789e8edb740ed8058f5093a8f2e Mon Sep 17 00:00:00 2001 From: houseme Date: Tue, 13 Jan 2026 15:02:54 +0800 Subject: [PATCH] Optimization and collation of dependencies introduction processing (#1493) --- crates/ecstore/src/bitrot.rs | 3 +- .../ecstore/src/bucket/bucket_target_sys.rs | 17 +++--- .../lifecycle/bucket_lifecycle_audit.rs | 2 +- .../ecstore/src/bucket/lifecycle/lifecycle.rs | 3 +- .../bucket/lifecycle/tier_last_day_stats.rs | 4 +- .../src/bucket/lifecycle/tier_sweeper.rs | 7 +-- crates/ecstore/src/bucket/metadata.rs | 8 +-- crates/ecstore/src/bucket/metadata_sys.rs | 10 ++- .../src/bucket/object_lock/objectlock.rs | 5 +- .../src/bucket/object_lock/objectlock_sys.rs | 11 ++-- .../ecstore/src/bucket/replication/config.rs | 2 +- .../bucket/replication/replication_pool.rs | 26 +++++--- .../replication/replication_resyncer.rs | 16 ++++- .../bucket/replication/replication_state.rs | 14 +++++ crates/ecstore/src/bucket/replication/rule.rs | 3 +- crates/ecstore/src/bucket/tagging/mod.rs | 3 +- crates/ecstore/src/bucket/target/arn.rs | 2 +- crates/ecstore/src/bucket/utils.rs | 5 +- crates/ecstore/src/bucket/versioning/mod.rs | 3 +- crates/ecstore/src/cache_value/mod.rs | 3 +- crates/ecstore/src/compress.rs | 3 +- crates/ecstore/src/data_usage.rs | 50 +++++++-------- .../ecstore/src/data_usage/local_snapshot.rs | 24 ++++++-- crates/ecstore/src/disk/endpoint.rs | 2 +- crates/ecstore/src/disk/error.rs | 1 - crates/ecstore/src/disk/error_conv.rs | 2 +- crates/ecstore/src/disk/error_reduce.rs | 2 +- crates/ecstore/src/disk/format.rs | 4 +- crates/ecstore/src/disk/fs.rs | 1 - crates/ecstore/src/disk/os.rs | 10 ++- crates/ecstore/src/endpoints.rs | 7 +-- crates/ecstore/src/erasure_coding/decode.rs | 12 ++-- crates/ecstore/src/erasure_coding/encode.rs | 4 +- crates/ecstore/src/erasure_coding/heal.rs | 6 +- crates/ecstore/src/erasure_coding/mod.rs | 3 +- crates/ecstore/src/error.rs | 6 +- crates/ecstore/src/event/targetlist.rs | 3 +- crates/ecstore/src/event_notification.rs | 7 +-- crates/ecstore/src/metrics_realtime.rs | 7 +-- crates/ecstore/src/rpc/client.rs | 6 +- crates/ecstore/src/rpc/peer_rest_client.rs | 2 +- crates/ecstore/src/rpc/remote_disk.rs | 61 +++++++++---------- crates/ecstore/src/rpc/remote_locker.rs | 7 ++- crates/ecstore/src/sets.rs | 9 +-- crates/ecstore/src/store_init.rs | 1 - rustfs/src/server/http.rs | 4 +- 46 files changed, 196 insertions(+), 195 deletions(-) diff --git a/crates/ecstore/src/bitrot.rs b/crates/ecstore/src/bitrot.rs index 8443b1ca..c02467a7 100644 --- a/crates/ecstore/src/bitrot.rs +++ b/crates/ecstore/src/bitrot.rs @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::disk::error::DiskError; -use crate::disk::{self, DiskAPI as _, DiskStore}; +use crate::disk::{self, DiskAPI as _, DiskStore, error::DiskError}; use crate::erasure_coding::{BitrotReader, BitrotWriterWrapper, CustomWriter}; use rustfs_utils::HashAlgorithm; use std::io::Cursor; diff --git a/crates/ecstore/src/bucket/bucket_target_sys.rs b/crates/ecstore/src/bucket/bucket_target_sys.rs index 5c83e4e3..595e3255 100644 --- a/crates/ecstore/src/bucket/bucket_target_sys.rs +++ b/crates/ecstore/src/bucket/bucket_target_sys.rs @@ -13,6 +13,14 @@ // limitations under the License. use crate::bucket::metadata::BucketMetadata; +use crate::bucket::metadata_sys::get_bucket_targets_config; +use crate::bucket::metadata_sys::get_replication_config; +use crate::bucket::replication::ObjectOpts; +use crate::bucket::replication::ReplicationConfigurationExt; +use crate::bucket::target::ARN; +use crate::bucket::target::BucketTargetType; +use crate::bucket::target::{self, BucketTarget, BucketTargets, Credentials}; +use crate::bucket::versioning_sys::BucketVersioningSys; use aws_credential_types::Credentials as SdkCredentials; use aws_sdk_s3::config::Region as SdkRegion; use aws_sdk_s3::error::SdkError; @@ -52,15 +60,6 @@ use tracing::warn; use url::Url; use uuid::Uuid; -use crate::bucket::metadata_sys::get_bucket_targets_config; -use crate::bucket::metadata_sys::get_replication_config; -use crate::bucket::replication::ObjectOpts; -use crate::bucket::replication::ReplicationConfigurationExt; -use crate::bucket::target::ARN; -use crate::bucket::target::BucketTargetType; -use crate::bucket::target::{self, BucketTarget, BucketTargets, Credentials}; -use crate::bucket::versioning_sys::BucketVersioningSys; - const DEFAULT_HEALTH_CHECK_DURATION: Duration = Duration::from_secs(5); const DEFAULT_HEALTH_CHECK_RELOAD_DURATION: Duration = Duration::from_secs(30 * 60); diff --git a/crates/ecstore/src/bucket/lifecycle/bucket_lifecycle_audit.rs b/crates/ecstore/src/bucket/lifecycle/bucket_lifecycle_audit.rs index 18945a08..d3420fc1 100644 --- a/crates/ecstore/src/bucket/lifecycle/bucket_lifecycle_audit.rs +++ b/crates/ecstore/src/bucket/lifecycle/bucket_lifecycle_audit.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::lifecycle; +use crate::bucket::lifecycle::lifecycle; #[derive(Debug, Clone, Default)] pub enum LcEventSrc { diff --git a/crates/ecstore/src/bucket/lifecycle/lifecycle.rs b/crates/ecstore/src/bucket/lifecycle/lifecycle.rs index a46620de..c1ffd8b2 100644 --- a/crates/ecstore/src/bucket/lifecycle/lifecycle.rs +++ b/crates/ecstore/src/bucket/lifecycle/lifecycle.rs @@ -18,6 +18,7 @@ #![allow(unused_must_use)] #![allow(clippy::all)] +use crate::bucket::lifecycle::rule::TransitionOps; use s3s::dto::{ BucketLifecycleConfiguration, ExpirationStatus, LifecycleExpiration, LifecycleRule, NoncurrentVersionTransition, ObjectLockConfiguration, ObjectLockEnabled, RestoreRequest, Transition, @@ -30,8 +31,6 @@ use time::macros::{datetime, offset}; use time::{self, Duration, OffsetDateTime}; use tracing::info; -use crate::bucket::lifecycle::rule::TransitionOps; - pub const TRANSITION_COMPLETE: &str = "complete"; pub const TRANSITION_PENDING: &str = "pending"; diff --git a/crates/ecstore/src/bucket/lifecycle/tier_last_day_stats.rs b/crates/ecstore/src/bucket/lifecycle/tier_last_day_stats.rs index 557d6189..e987f47b 100644 --- a/crates/ecstore/src/bucket/lifecycle/tier_last_day_stats.rs +++ b/crates/ecstore/src/bucket/lifecycle/tier_last_day_stats.rs @@ -18,15 +18,13 @@ #![allow(unused_must_use)] #![allow(clippy::all)] +use rustfs_common::data_usage::TierStats; use sha2::Sha256; - use std::collections::HashMap; use std::ops::Sub; use time::OffsetDateTime; use tracing::{error, warn}; -use rustfs_common::data_usage::TierStats; - pub type DailyAllTierStats = HashMap; #[derive(Clone)] diff --git a/crates/ecstore/src/bucket/lifecycle/tier_sweeper.rs b/crates/ecstore/src/bucket/lifecycle/tier_sweeper.rs index 26f94031..cf73f043 100644 --- a/crates/ecstore/src/bucket/lifecycle/tier_sweeper.rs +++ b/crates/ecstore/src/bucket/lifecycle/tier_sweeper.rs @@ -18,15 +18,14 @@ #![allow(unused_must_use)] #![allow(clippy::all)] +use crate::bucket::lifecycle::bucket_lifecycle_ops::{ExpiryOp, GLOBAL_ExpiryState, TransitionedObject}; +use crate::bucket::lifecycle::lifecycle::{self, ObjectOpts}; +use crate::global::GLOBAL_TierConfigMgr; use sha2::{Digest, Sha256}; use std::any::Any; use std::io::Write; use xxhash_rust::xxh64; -use super::bucket_lifecycle_ops::{ExpiryOp, GLOBAL_ExpiryState, TransitionedObject}; -use super::lifecycle::{self, ObjectOpts}; -use crate::global::GLOBAL_TierConfigMgr; - static XXHASH_SEED: u64 = 0; #[derive(Default)] diff --git a/crates/ecstore/src/bucket/metadata.rs b/crates/ecstore/src/bucket/metadata.rs index 5c75571e..d4a9ddac 100644 --- a/crates/ecstore/src/bucket/metadata.rs +++ b/crates/ecstore/src/bucket/metadata.rs @@ -12,14 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::{quota::BucketQuota, target::BucketTargets}; - use super::object_lock::ObjectLockApi; use super::versioning::VersioningApi; +use super::{quota::BucketQuota, target::BucketTargets}; use crate::bucket::utils::deserialize; use crate::config::com::{read_config, save_config}; +use crate::disk::BUCKET_META_PREFIX; use crate::error::{Error, Result}; use crate::new_object_layer_fn; +use crate::store::ECStore; use byteorder::{BigEndian, ByteOrder, LittleEndian}; use rmp_serde::Serializer as rmpSerializer; use rustfs_policy::policy::BucketPolicy; @@ -34,9 +35,6 @@ use std::sync::Arc; use time::OffsetDateTime; use tracing::error; -use crate::disk::BUCKET_META_PREFIX; -use crate::store::ECStore; - pub const BUCKET_METADATA_FILE: &str = ".metadata.bin"; pub const BUCKET_METADATA_FORMAT: u16 = 1; pub const BUCKET_METADATA_VERSION: u16 = 1; diff --git a/crates/ecstore/src/bucket/metadata_sys.rs b/crates/ecstore/src/bucket/metadata_sys.rs index 395a8b76..dad17b97 100644 --- a/crates/ecstore/src/bucket/metadata_sys.rs +++ b/crates/ecstore/src/bucket/metadata_sys.rs @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use super::metadata::{BucketMetadata, load_bucket_metadata}; +use super::quota::BucketQuota; +use super::target::BucketTargets; use crate::StorageAPI as _; use crate::bucket::bucket_target_sys::BucketTargetSys; use crate::bucket::metadata::{BUCKET_LIFECYCLE_CONFIG, load_bucket_metadata_parse}; @@ -20,6 +23,7 @@ use crate::error::{Error, Result, is_err_bucket_not_found}; use crate::global::{GLOBAL_Endpoints, is_dist_erasure, is_erasure, new_object_layer_fn}; use crate::store::ECStore; use futures::future::join_all; +use lazy_static::lazy_static; use rustfs_common::heal_channel::HealOpts; use rustfs_policy::policy::BucketPolicy; use s3s::dto::ReplicationConfiguration; @@ -36,12 +40,6 @@ use tokio::sync::RwLock; use tokio::time::sleep; use tracing::error; -use super::metadata::{BucketMetadata, load_bucket_metadata}; -use super::quota::BucketQuota; -use super::target::BucketTargets; - -use lazy_static::lazy_static; - lazy_static! { pub static ref GLOBAL_BucketMetadataSys: OnceLock>> = OnceLock::new(); } diff --git a/crates/ecstore/src/bucket/object_lock/objectlock.rs b/crates/ecstore/src/bucket/object_lock/objectlock.rs index 4309739b..6452506f 100644 --- a/crates/ecstore/src/bucket/object_lock/objectlock.rs +++ b/crates/ecstore/src/bucket/object_lock/objectlock.rs @@ -12,11 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::HashMap; -use time::{OffsetDateTime, format_description}; - use s3s::dto::{Date, ObjectLockLegalHold, ObjectLockLegalHoldStatus, ObjectLockRetention, ObjectLockRetentionMode}; use s3s::header::{X_AMZ_OBJECT_LOCK_LEGAL_HOLD, X_AMZ_OBJECT_LOCK_MODE, X_AMZ_OBJECT_LOCK_RETAIN_UNTIL_DATE}; +use std::collections::HashMap; +use time::{OffsetDateTime, format_description}; const _ERR_MALFORMED_BUCKET_OBJECT_CONFIG: &str = "invalid bucket object lock config"; const _ERR_INVALID_RETENTION_DATE: &str = "date must be provided in ISO 8601 format"; diff --git a/crates/ecstore/src/bucket/object_lock/objectlock_sys.rs b/crates/ecstore/src/bucket/object_lock/objectlock_sys.rs index fb71339a..92e2e84d 100644 --- a/crates/ecstore/src/bucket/object_lock/objectlock_sys.rs +++ b/crates/ecstore/src/bucket/object_lock/objectlock_sys.rs @@ -12,16 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::bucket::metadata_sys::get_object_lock_config; +use crate::bucket::object_lock::objectlock; +use crate::store_api::ObjectInfo; +use s3s::dto::{DefaultRetention, ObjectLockLegalHoldStatus, ObjectLockRetentionMode}; use std::sync::Arc; use time::OffsetDateTime; -use s3s::dto::{DefaultRetention, ObjectLockLegalHoldStatus, ObjectLockRetentionMode}; - -use crate::bucket::metadata_sys::get_object_lock_config; -use crate::store_api::ObjectInfo; - -use super::objectlock; - pub struct BucketObjectLockSys {} impl BucketObjectLockSys { diff --git a/crates/ecstore/src/bucket/replication/config.rs b/crates/ecstore/src/bucket/replication/config.rs index 422b76be..ed137698 100644 --- a/crates/ecstore/src/bucket/replication/config.rs +++ b/crates/ecstore/src/bucket/replication/config.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::ReplicationRuleExt as _; +use crate::bucket::replication::ReplicationRuleExt as _; use crate::bucket::tagging::decode_tags_to_map; use rustfs_filemeta::ReplicationType; use s3s::dto::DeleteMarkerReplicationStatus; diff --git a/crates/ecstore/src/bucket/replication/replication_pool.rs b/crates/ecstore/src/bucket/replication/replication_pool.rs index 181096e6..04e5a5bd 100644 --- a/crates/ecstore/src/bucket/replication/replication_pool.rs +++ b/crates/ecstore/src/bucket/replication/replication_pool.rs @@ -1,22 +1,30 @@ +// Copyright 2024 RustFS Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use crate::StorageAPI; use crate::bucket::replication::ResyncOpts; use crate::bucket::replication::ResyncStatusType; use crate::bucket::replication::replicate_delete; use crate::bucket::replication::replicate_object; -use crate::disk::BUCKET_META_PREFIX; -use std::any::Any; -use std::sync::Arc; -use std::sync::atomic::AtomicI32; -use std::sync::atomic::Ordering; - use crate::bucket::replication::replication_resyncer::{ BucketReplicationResyncStatus, DeletedObjectReplicationInfo, ReplicationResyncer, }; use crate::bucket::replication::replication_state::ReplicationStats; use crate::config::com::read_config; +use crate::disk::BUCKET_META_PREFIX; use crate::error::Error as EcstoreError; use crate::store_api::ObjectInfo; - use lazy_static::lazy_static; use rustfs_filemeta::MrfReplicateEntry; use rustfs_filemeta::ReplicateDecision; @@ -29,6 +37,10 @@ use rustfs_filemeta::ResyncDecision; use rustfs_filemeta::replication_statuses_map; use rustfs_filemeta::version_purge_statuses_map; use rustfs_utils::http::RESERVED_METADATA_PREFIX_LOWER; +use std::any::Any; +use std::sync::Arc; +use std::sync::atomic::AtomicI32; +use std::sync::atomic::Ordering; use time::OffsetDateTime; use time::format_description::well_known::Rfc3339; use tokio::sync::Mutex; diff --git a/crates/ecstore/src/bucket/replication/replication_resyncer.rs b/crates/ecstore/src/bucket/replication/replication_resyncer.rs index 39f1cf56..117ec77c 100644 --- a/crates/ecstore/src/bucket/replication/replication_resyncer.rs +++ b/crates/ecstore/src/bucket/replication/replication_resyncer.rs @@ -1,3 +1,17 @@ +// Copyright 2024 RustFS Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use crate::bucket::bucket_target_sys::{ AdvancedPutOptions, BucketTargetSys, PutObjectOptions, PutObjectPartOptions, RemoveObjectOptions, TargetClient, }; @@ -16,7 +30,6 @@ use crate::event_notification::{EventArgs, send_event}; use crate::global::GLOBAL_LocalNodeName; use crate::store_api::{DeletedObject, ObjectInfo, ObjectOptions, ObjectToDelete, WalkOptions}; use crate::{StorageAPI, new_object_layer_fn}; - use aws_sdk_s3::error::SdkError; use aws_sdk_s3::operation::head_object::HeadObjectOutput; use aws_sdk_s3::primitives::ByteStream; @@ -24,7 +37,6 @@ use aws_sdk_s3::types::{CompletedPart, ObjectLockLegalHoldStatus}; use byteorder::ByteOrder; use futures::future::join_all; use http::HeaderMap; - use regex::Regex; use rustfs_filemeta::{ MrfReplicateEntry, REPLICATE_EXISTING, REPLICATE_EXISTING_DELETE, REPLICATION_RESET, ReplicateDecision, ReplicateObjectInfo, diff --git a/crates/ecstore/src/bucket/replication/replication_state.rs b/crates/ecstore/src/bucket/replication/replication_state.rs index 1b887141..28971c7b 100644 --- a/crates/ecstore/src/bucket/replication/replication_state.rs +++ b/crates/ecstore/src/bucket/replication/replication_state.rs @@ -1,3 +1,17 @@ +// Copyright 2024 RustFS Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use crate::error::Error; use rustfs_filemeta::{ReplicatedTargetInfo, ReplicationStatusType, ReplicationType}; use serde::{Deserialize, Serialize}; diff --git a/crates/ecstore/src/bucket/replication/rule.rs b/crates/ecstore/src/bucket/replication/rule.rs index 136c5480..b8df680e 100644 --- a/crates/ecstore/src/bucket/replication/rule.rs +++ b/crates/ecstore/src/bucket/replication/rule.rs @@ -12,11 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::bucket::replication::ObjectOpts; use s3s::dto::ReplicaModificationsStatus; use s3s::dto::ReplicationRule; -use super::ObjectOpts; - pub trait ReplicationRuleExt { fn prefix(&self) -> &str; fn metadata_replicate(&self, obj: &ObjectOpts) -> bool; diff --git a/crates/ecstore/src/bucket/tagging/mod.rs b/crates/ecstore/src/bucket/tagging/mod.rs index 62e428a4..9c5f16be 100644 --- a/crates/ecstore/src/bucket/tagging/mod.rs +++ b/crates/ecstore/src/bucket/tagging/mod.rs @@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::HashMap; - use s3s::dto::Tag; +use std::collections::HashMap; use url::form_urlencoded; pub fn decode_tags(tags: &str) -> Vec { diff --git a/crates/ecstore/src/bucket/target/arn.rs b/crates/ecstore/src/bucket/target/arn.rs index a9104077..543b75d0 100644 --- a/crates/ecstore/src/bucket/target/arn.rs +++ b/crates/ecstore/src/bucket/target/arn.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::BucketTargetType; +use crate::bucket::target::BucketTargetType; use std::fmt::Display; use std::str::FromStr; diff --git a/crates/ecstore/src/bucket/utils.rs b/crates/ecstore/src/bucket/utils.rs index 8eb60ccb..ee7012a3 100644 --- a/crates/ecstore/src/bucket/utils.rs +++ b/crates/ecstore/src/bucket/utils.rs @@ -14,16 +14,15 @@ use crate::disk::RUSTFS_META_BUCKET; use crate::error::{Error, Result, StorageError}; +use regex::Regex; use rustfs_utils::path::SLASH_SEPARATOR_STR; use s3s::xml; +use tracing::instrument; pub fn is_meta_bucketname(name: &str) -> bool { name.starts_with(RUSTFS_META_BUCKET) } -use regex::Regex; -use tracing::instrument; - lazy_static::lazy_static! { static ref VALID_BUCKET_NAME: Regex = Regex::new(r"^[A-Za-z0-9][A-Za-z0-9\.\-\_\:]{1,61}[A-Za-z0-9]$").unwrap(); static ref VALID_BUCKET_NAME_STRICT: Regex = Regex::new(r"^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$").unwrap(); diff --git a/crates/ecstore/src/bucket/versioning/mod.rs b/crates/ecstore/src/bucket/versioning/mod.rs index 2750ee77..05f5b22e 100644 --- a/crates/ecstore/src/bucket/versioning/mod.rs +++ b/crates/ecstore/src/bucket/versioning/mod.rs @@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use s3s::dto::{BucketVersioningStatus, VersioningConfiguration}; - use rustfs_utils::string::match_simple; +use s3s::dto::{BucketVersioningStatus, VersioningConfiguration}; pub trait VersioningApi { fn enabled(&self) -> bool; diff --git a/crates/ecstore/src/cache_value/mod.rs b/crates/ecstore/src/cache_value/mod.rs index 9dfbb3b8..b268fc04 100644 --- a/crates/ecstore/src/cache_value/mod.rs +++ b/crates/ecstore/src/cache_value/mod.rs @@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::sync::Arc; - use lazy_static::lazy_static; +use std::sync::Arc; use tokio_util::sync::CancellationToken; pub mod metacache_set; diff --git a/crates/ecstore/src/compress.rs b/crates/ecstore/src/compress.rs index aaa43154..29e0baa6 100644 --- a/crates/ecstore/src/compress.rs +++ b/crates/ecstore/src/compress.rs @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use rustfs_utils::string::has_pattern; -use rustfs_utils::string::has_string_suffix_in_slice; +use rustfs_utils::string::{has_pattern, has_string_suffix_in_slice}; use std::env; use tracing::error; diff --git a/crates/ecstore/src/data_usage.rs b/crates/ecstore/src/data_usage.rs index bd434855..e38188a2 100644 --- a/crates/ecstore/src/data_usage.rs +++ b/crates/ecstore/src/data_usage.rs @@ -12,33 +12,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{ - collections::{HashMap, hash_map::Entry}, - sync::Arc, - time::{Duration, SystemTime}, -}; -use tokio::sync::RwLock; -use tracing::debug; - pub mod local_snapshot; + +use crate::{ + bucket::metadata_sys::get_replication_config, config::com::read_config, disk::DiskAPI, error::Error, store::ECStore, + store_api::StorageAPI, +}; pub use local_snapshot::{ DATA_USAGE_DIR, DATA_USAGE_STATE_DIR, LOCAL_USAGE_SNAPSHOT_VERSION, LocalUsageSnapshot, LocalUsageSnapshotMeta, data_usage_dir, data_usage_state_dir, ensure_data_usage_layout, read_snapshot as read_local_snapshot, snapshot_file_name, snapshot_object_path, snapshot_path, write_snapshot as write_local_snapshot, }; - -use crate::{ - bucket::metadata_sys::get_replication_config, config::com::read_config, disk::DiskAPI, store::ECStore, store_api::StorageAPI, -}; use rustfs_common::data_usage::{ BucketTargetUsageInfo, BucketUsageInfo, DataUsageCache, DataUsageEntry, DataUsageInfo, DiskUsageStatus, SizeSummary, }; use rustfs_utils::path::SLASH_SEPARATOR_STR; -use std::sync::OnceLock; +use std::{ + collections::{HashMap, hash_map::Entry}, + sync::{Arc, OnceLock}, + time::{Duration, SystemTime}, +}; use tokio::fs; -use tracing::{error, info, warn}; - -use crate::error::Error; +use tokio::sync::RwLock; +use tracing::{debug, error, info, warn}; // Data usage storage constants pub const DATA_USAGE_ROOT: &str = SLASH_SEPARATOR_STR; @@ -112,8 +108,8 @@ pub async fn load_data_usage_from_backend(store: Arc) -> Result data, Err(e) => { error!("Failed to read data usage info from backend: {}", e); - if e == crate::error::Error::ConfigNotFound { - warn!("Data usage config not found, building basic statistics"); + if e == Error::ConfigNotFound { + info!("Data usage config not found, building basic statistics"); return build_basic_data_usage_info(store).await; } return Err(Error::other(e)); @@ -146,7 +142,7 @@ pub async fn load_data_usage_from_backend(store: Arc) -> Result) -> Result<(Vec) -> Result<(Vec, bucket_name: &str) -> Res continuation = result.next_continuation_token.clone(); if continuation.is_none() { - warn!( + info!( "Bucket {} listing marked truncated but no continuation token returned; stopping early", bucket_name ); @@ -567,7 +563,7 @@ pub fn cache_to_data_usage_info(cache: &DataUsageCache, path: &str, buckets: &[c None => continue, }; let flat = cache.flatten(&e); - let mut bui = rustfs_common::data_usage::BucketUsageInfo { + let mut bui = BucketUsageInfo { size: flat.size as u64, versions_count: flat.versions as u64, objects_count: flat.objects as u64, @@ -645,7 +641,7 @@ pub async fn load_data_usage_cache(store: &crate::set_disk::SetDisks, name: &str break; } Err(err) => match err { - crate::error::Error::FileNotFound | crate::error::Error::VolumeNotFound => { + Error::FileNotFound | Error::VolumeNotFound => { match store .get_object_reader( RUSTFS_META_BUCKET, @@ -666,7 +662,7 @@ pub async fn load_data_usage_cache(store: &crate::set_disk::SetDisks, name: &str break; } Err(_) => match err { - crate::error::Error::FileNotFound | crate::error::Error::VolumeNotFound => { + Error::FileNotFound | Error::VolumeNotFound => { break; } _ => {} @@ -695,9 +691,9 @@ pub async fn save_data_usage_cache(cache: &DataUsageCache, name: &str) -> crate: use std::path::Path; let Some(store) = new_object_layer_fn() else { - return Err(crate::error::Error::other("errServerNotInitialized")); + return Err(Error::other("errServerNotInitialized")); }; - let buf = cache.marshal_msg().map_err(crate::error::Error::other)?; + let buf = cache.marshal_msg().map_err(Error::other)?; let buf_clone = buf.clone(); let store_clone = store.clone(); diff --git a/crates/ecstore/src/data_usage/local_snapshot.rs b/crates/ecstore/src/data_usage/local_snapshot.rs index fa232f73..0ed2b6e1 100644 --- a/crates/ecstore/src/data_usage/local_snapshot.rs +++ b/crates/ecstore/src/data_usage/local_snapshot.rs @@ -1,13 +1,25 @@ -use std::collections::HashMap; -use std::path::{Path, PathBuf}; -use std::time::SystemTime; - -use serde::{Deserialize, Serialize}; -use tokio::fs; +// Copyright 2024 RustFS Team +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. use crate::data_usage::BucketUsageInfo; use crate::disk::RUSTFS_META_BUCKET; use crate::error::{Error, Result}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::path::{Path, PathBuf}; +use std::time::SystemTime; +use tokio::fs; /// Directory used to store per-disk usage snapshots under the metadata bucket. pub const DATA_USAGE_DIR: &str = "datausage"; diff --git a/crates/ecstore/src/disk/endpoint.rs b/crates/ecstore/src/disk/endpoint.rs index 952cda94..5339d964 100644 --- a/crates/ecstore/src/disk/endpoint.rs +++ b/crates/ecstore/src/disk/endpoint.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::error::{Error, Result}; +use crate::disk::error::{Error, Result}; use path_absolutize::Absolutize; use rustfs_utils::{is_local_host, is_socket_addr}; use std::{fmt::Display, path::Path}; diff --git a/crates/ecstore/src/disk/error.rs b/crates/ecstore/src/disk/error.rs index ebe9df4f..669b286b 100644 --- a/crates/ecstore/src/disk/error.rs +++ b/crates/ecstore/src/disk/error.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// use crate::quorum::CheckErrorFn; use std::hash::{Hash, Hasher}; use std::io::{self}; use std::path::PathBuf; diff --git a/crates/ecstore/src/disk/error_conv.rs b/crates/ecstore/src/disk/error_conv.rs index ed8487a9..0ee28878 100644 --- a/crates/ecstore/src/disk/error_conv.rs +++ b/crates/ecstore/src/disk/error_conv.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::error::DiskError; +use crate::disk::error::DiskError; pub fn to_file_error(io_err: std::io::Error) -> std::io::Error { match io_err.kind() { diff --git a/crates/ecstore/src/disk/error_reduce.rs b/crates/ecstore/src/disk/error_reduce.rs index d3264334..0ad53f48 100644 --- a/crates/ecstore/src/disk/error_reduce.rs +++ b/crates/ecstore/src/disk/error_reduce.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::error::Error; +use crate::disk::error::Error; pub static OBJECT_OP_IGNORED_ERRS: &[Error] = &[ Error::DiskNotFound, diff --git a/crates/ecstore/src/disk/format.rs b/crates/ecstore/src/disk/format.rs index aca63c7d..592f6f93 100644 --- a/crates/ecstore/src/disk/format.rs +++ b/crates/ecstore/src/disk/format.rs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::error::{Error, Result}; -use super::{DiskInfo, error::DiskError}; +use crate::disk::error::{Error, Result}; +use crate::disk::{DiskInfo, error::DiskError}; use serde::{Deserialize, Serialize}; use serde_json::Error as JsonError; use uuid::Uuid; diff --git a/crates/ecstore/src/disk/fs.rs b/crates/ecstore/src/disk/fs.rs index df22eb7d..d2299d45 100644 --- a/crates/ecstore/src/disk/fs.rs +++ b/crates/ecstore/src/disk/fs.rs @@ -17,7 +17,6 @@ use std::{ path::Path, sync::{Arc, OnceLock}, }; - use tokio::{ fs::{self, File}, io, diff --git a/crates/ecstore/src/disk/os.rs b/crates/ecstore/src/disk/os.rs index 660deec5..92677957 100644 --- a/crates/ecstore/src/disk/os.rs +++ b/crates/ecstore/src/disk/os.rs @@ -12,19 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::disk::error::DiskError; +use crate::disk::error::Result; +use crate::disk::error_conv::to_file_error; +use rustfs_utils::path::SLASH_SEPARATOR_STR; use std::{ io, path::{Component, Path}, }; - -use super::error::Result; -use crate::disk::error_conv::to_file_error; -use rustfs_utils::path::SLASH_SEPARATOR_STR; use tokio::fs; use tracing::warn; -use super::error::DiskError; - /// Check path length according to OS limits. pub fn check_path_length(path_name: &str) -> Result<()> { // Apple OS X path length is limited to 1016 diff --git a/crates/ecstore/src/endpoints.rs b/crates/ecstore/src/endpoints.rs index 1a334c07..ff8427d1 100644 --- a/crates/ecstore/src/endpoints.rs +++ b/crates/ecstore/src/endpoints.rs @@ -12,19 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -use rustfs_utils::{XHost, check_local_server_addr, get_host_ip, is_local_host}; -use tracing::{error, info, instrument, warn}; - use crate::{ disk::endpoint::{Endpoint, EndpointType}, disks_layout::DisksLayout, global::global_rustfs_port, }; -use std::io::{Error, Result}; +use rustfs_utils::{XHost, check_local_server_addr, get_host_ip, is_local_host}; use std::{ collections::{HashMap, HashSet, hash_map::Entry}, + io::{Error, Result}, net::IpAddr, }; +use tracing::{error, info, instrument, warn}; /// enum for setup type. #[derive(PartialEq, Eq, Debug, Clone)] diff --git a/crates/ecstore/src/erasure_coding/decode.rs b/crates/ecstore/src/erasure_coding/decode.rs index c2a1daac..9e0925d8 100644 --- a/crates/ecstore/src/erasure_coding/decode.rs +++ b/crates/ecstore/src/erasure_coding/decode.rs @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::BitrotReader; -use super::Erasure; use crate::disk::error::Error; use crate::disk::error_reduce::reduce_errs; +use crate::erasure_coding::{BitrotReader, Erasure}; use futures::stream::{FuturesUnordered, StreamExt}; use pin_project_lite::pin_project; use std::io; @@ -312,11 +311,12 @@ impl Erasure { #[cfg(test)] mod tests { - use rustfs_utils::HashAlgorithm; - - use crate::{disk::error::DiskError, erasure_coding::BitrotWriter}; - use super::*; + use crate::{ + disk::error::DiskError, + erasure_coding::{BitrotReader, BitrotWriter}, + }; + use rustfs_utils::HashAlgorithm; use std::io::Cursor; #[tokio::test] diff --git a/crates/ecstore/src/erasure_coding/encode.rs b/crates/ecstore/src/erasure_coding/encode.rs index 1b082550..cb7bd7ed 100644 --- a/crates/ecstore/src/erasure_coding/encode.rs +++ b/crates/ecstore/src/erasure_coding/encode.rs @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::BitrotWriterWrapper; -use super::Erasure; use crate::disk::error::Error; use crate::disk::error_reduce::count_errs; use crate::disk::error_reduce::{OBJECT_OP_IGNORED_ERRS, reduce_write_quorum_errs}; +use crate::erasure_coding::BitrotWriterWrapper; +use crate::erasure_coding::Erasure; use bytes::Bytes; use futures::StreamExt; use futures::stream::FuturesUnordered; diff --git a/crates/ecstore/src/erasure_coding/heal.rs b/crates/ecstore/src/erasure_coding/heal.rs index e654a678..422ae7da 100644 --- a/crates/ecstore/src/erasure_coding/heal.rs +++ b/crates/ecstore/src/erasure_coding/heal.rs @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::BitrotReader; -use super::BitrotWriterWrapper; -use super::decode::ParallelReader; use crate::disk::error::{Error, Result}; +use crate::erasure_coding::BitrotReader; +use crate::erasure_coding::BitrotWriterWrapper; +use crate::erasure_coding::decode::ParallelReader; use crate::erasure_coding::encode::MultiWriter; use bytes::Bytes; use tokio::io::AsyncRead; diff --git a/crates/ecstore/src/erasure_coding/mod.rs b/crates/ecstore/src/erasure_coding/mod.rs index 947bf4da..766562a9 100644 --- a/crates/ecstore/src/erasure_coding/mod.rs +++ b/crates/ecstore/src/erasure_coding/mod.rs @@ -12,12 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +mod bitrot; pub mod decode; pub mod encode; pub mod erasure; pub mod heal; - -mod bitrot; pub use bitrot::*; pub use erasure::{Erasure, ReedSolomonEncoder, calc_shard_size}; diff --git a/crates/ecstore/src/error.rs b/crates/ecstore/src/error.rs index 410faa72..dc747c36 100644 --- a/crates/ecstore/src/error.rs +++ b/crates/ecstore/src/error.rs @@ -12,12 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use s3s::{S3Error, S3ErrorCode}; - -use rustfs_utils::path::decode_dir_object; - use crate::bucket::error::BucketMetadataError; use crate::disk::error::DiskError; +use rustfs_utils::path::decode_dir_object; +use s3s::{S3Error, S3ErrorCode}; pub type Error = StorageError; pub type Result = core::result::Result; diff --git a/crates/ecstore/src/event/targetlist.rs b/crates/ecstore/src/event/targetlist.rs index f45b2cbc..29927b06 100644 --- a/crates/ecstore/src/event/targetlist.rs +++ b/crates/ecstore/src/event/targetlist.rs @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::event::targetid::TargetID; use std::sync::atomic::AtomicI64; -use super::targetid::TargetID; - #[derive(Default)] pub struct TargetList { pub current_send_calls: AtomicI64, diff --git a/crates/ecstore/src/event_notification.rs b/crates/ecstore/src/event_notification.rs index 3d909542..fdbc007d 100644 --- a/crates/ecstore/src/event_notification.rs +++ b/crates/ecstore/src/event_notification.rs @@ -14,15 +14,14 @@ // limitations under the License. #![allow(unused_variables)] -use std::collections::HashMap; -use std::sync::Arc; -use tokio::sync::RwLock; - use crate::bucket::metadata::BucketMetadata; use crate::event::name::EventName; use crate::event::targetlist::TargetList; use crate::store::ECStore; use crate::store_api::ObjectInfo; +use std::collections::HashMap; +use std::sync::Arc; +use tokio::sync::RwLock; pub struct EventNotifier { target_list: TargetList, diff --git a/crates/ecstore/src/metrics_realtime.rs b/crates/ecstore/src/metrics_realtime.rs index 3e7af4b3..8f1b159d 100644 --- a/crates/ecstore/src/metrics_realtime.rs +++ b/crates/ecstore/src/metrics_realtime.rs @@ -12,12 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::{ - admin_server_info::get_local_server_property, - new_object_layer_fn, - store_api::StorageAPI, - // utils::os::get_drive_stats, -}; +use crate::{admin_server_info::get_local_server_property, new_object_layer_fn, store_api::StorageAPI}; use chrono::Utc; use rustfs_common::{GLOBAL_LOCAL_NODE_NAME, GLOBAL_RUSTFS_ADDR, heal_channel::DriveState, metrics::global_metrics}; use rustfs_madmin::metrics::{DiskIOStats, DiskMetric, RealtimeMetrics}; diff --git a/crates/ecstore/src/rpc/client.rs b/crates/ecstore/src/rpc/client.rs index fe966d86..a9830ef8 100644 --- a/crates/ecstore/src/rpc/client.rs +++ b/crates/ecstore/src/rpc/client.rs @@ -12,16 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::error::Error; - +use crate::rpc::{TONIC_RPC_PREFIX, gen_signature_headers}; use http::Method; use rustfs_common::GLOBAL_CONN_MAP; use rustfs_protos::{create_new_channel, proto_gen::node_service::node_service_client::NodeServiceClient}; +use std::error::Error; use tonic::{service::interceptor::InterceptedService, transport::Channel}; use tracing::debug; -use crate::rpc::{TONIC_RPC_PREFIX, gen_signature_headers}; - /// 3. Subsequent calls will attempt fresh connections /// 4. If node is still down, connection will fail fast (3s timeout) pub async fn node_service_time_out_client( diff --git a/crates/ecstore/src/rpc/peer_rest_client.rs b/crates/ecstore/src/rpc/peer_rest_client.rs index fc6d5374..78d50b5e 100644 --- a/crates/ecstore/src/rpc/peer_rest_client.rs +++ b/crates/ecstore/src/rpc/peer_rest_client.rs @@ -27,7 +27,6 @@ use rustfs_madmin::{ net::NetInfo, }; use rustfs_protos::evict_failed_connection; -use rustfs_protos::proto_gen::node_service::node_service_client::NodeServiceClient; use rustfs_protos::proto_gen::node_service::{ DeleteBucketMetadataRequest, DeletePolicyRequest, DeleteServiceAccountRequest, DeleteUserRequest, GetCpusRequest, GetMemInfoRequest, GetMetricsRequest, GetNetInfoRequest, GetOsInfoRequest, GetPartitionsRequest, GetProcInfoRequest, @@ -35,6 +34,7 @@ use rustfs_protos::proto_gen::node_service::{ LoadPolicyMappingRequest, LoadPolicyRequest, LoadRebalanceMetaRequest, LoadServiceAccountRequest, LoadTransitionTierConfigRequest, LoadUserRequest, LocalStorageInfoRequest, Mss, ReloadPoolMetaRequest, ReloadSiteReplicationConfigRequest, ServerInfoRequest, SignalServiceRequest, StartProfilingRequest, StopRebalanceRequest, + node_service_client::NodeServiceClient, }; use rustfs_utils::XHost; use serde::{Deserialize, Serialize as _}; diff --git a/crates/ecstore/src/rpc/remote_disk.rs b/crates/ecstore/src/rpc/remote_disk.rs index f4f03468..5c40866c 100644 --- a/crates/ecstore/src/rpc/remote_disk.rs +++ b/crates/ecstore/src/rpc/remote_disk.rs @@ -12,15 +12,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{ - path::PathBuf, - sync::{Arc, atomic::Ordering}, - time::Duration, +use crate::{ + disk::{ + CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskLocation, DiskOption, FileInfoVersions, + FileReader, FileWriter, ReadMultipleReq, ReadMultipleResp, ReadOptions, RenameDataResp, UpdateMetadataOpts, VolumeInfo, + WalkDirOptions, + disk_store::{ + CHECK_EVERY, CHECK_TIMEOUT_DURATION, ENV_RUSTFS_DRIVE_ACTIVE_MONITORING, SKIP_IF_SUCCESS_BEFORE, + get_max_timeout_duration, + }, + endpoint::Endpoint, + { + disk_store::DiskHealthTracker, + error::{DiskError, Error, Result}, + }, + }, + rpc::build_auth_headers, + rpc::client::{TonicInterceptor, gen_tonic_signature_interceptor, node_service_time_out_client}, }; - use bytes::Bytes; use futures::lock::Mutex; use http::{HeaderMap, HeaderValue, Method, header::CONTENT_TYPE}; +use rustfs_filemeta::{FileInfo, ObjectPartInfo, RawFileInfo}; +use rustfs_protos::proto_gen::node_service::RenamePartRequest; use rustfs_protos::proto_gen::node_service::{ CheckPartsRequest, DeletePathsRequest, DeleteRequest, DeleteVersionRequest, DeleteVersionsRequest, DeleteVolumeRequest, DiskInfoRequest, ListDirRequest, ListVolumesRequest, MakeVolumeRequest, MakeVolumesRequest, ReadAllRequest, @@ -28,37 +42,18 @@ use rustfs_protos::proto_gen::node_service::{ StatVolumeRequest, UpdateMetadataRequest, VerifyFileRequest, WriteAllRequest, WriteMetadataRequest, node_service_client::NodeServiceClient, }; -use rustfs_utils::string::parse_bool_with_default; -use tokio::time; -use tokio_util::sync::CancellationToken; -use tracing::{debug, info, warn}; - -use crate::disk::{disk_store::DiskHealthTracker, error::DiskError}; -use crate::{ - disk::error::{Error, Result}, - rpc::build_auth_headers, -}; -use crate::{ - disk::{ - CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskLocation, DiskOption, FileInfoVersions, - ReadMultipleReq, ReadMultipleResp, ReadOptions, RenameDataResp, UpdateMetadataOpts, VolumeInfo, WalkDirOptions, - disk_store::{ - CHECK_EVERY, CHECK_TIMEOUT_DURATION, ENV_RUSTFS_DRIVE_ACTIVE_MONITORING, SKIP_IF_SUCCESS_BEFORE, - get_max_timeout_duration, - }, - endpoint::Endpoint, - }, - rpc::client::gen_tonic_signature_interceptor, -}; -use crate::{ - disk::{FileReader, FileWriter}, - rpc::client::{TonicInterceptor, node_service_time_out_client}, -}; -use rustfs_filemeta::{FileInfo, ObjectPartInfo, RawFileInfo}; -use rustfs_protos::proto_gen::node_service::RenamePartRequest; use rustfs_rio::{HttpReader, HttpWriter}; +use rustfs_utils::string::parse_bool_with_default; +use std::{ + path::PathBuf, + sync::{Arc, atomic::Ordering}, + time::Duration, +}; +use tokio::time; use tokio::{io::AsyncWrite, net::TcpStream, time::timeout}; +use tokio_util::sync::CancellationToken; use tonic::{Request, service::interceptor::InterceptedService, transport::Channel}; +use tracing::{debug, info, warn}; use uuid::Uuid; #[derive(Debug)] diff --git a/crates/ecstore/src/rpc/remote_locker.rs b/crates/ecstore/src/rpc/remote_locker.rs index ea202de3..f7410a0d 100644 --- a/crates/ecstore/src/rpc/remote_locker.rs +++ b/crates/ecstore/src/rpc/remote_locker.rs @@ -14,9 +14,10 @@ use crate::rpc::client::{TonicInterceptor, gen_tonic_signature_interceptor, node_service_time_out_client}; use async_trait::async_trait; -use rustfs_lock::types::{LockId, LockMetadata, LockPriority}; -use rustfs_lock::{LockClient, LockError, LockInfo, LockResponse, LockStats, LockStatus, Result}; -use rustfs_lock::{LockRequest, LockType}; +use rustfs_lock::{ + LockClient, LockError, LockInfo, LockRequest, LockResponse, LockStats, LockStatus, LockType, Result, + types::{LockId, LockMetadata, LockPriority}, +}; use rustfs_protos::proto_gen::node_service::node_service_client::NodeServiceClient; use rustfs_protos::proto_gen::node_service::{GenerallyLockRequest, PingRequest}; use std::collections::HashMap; diff --git a/crates/ecstore/src/sets.rs b/crates/ecstore/src/sets.rs index a2d3769a..8e0c364f 100644 --- a/crates/ecstore/src/sets.rs +++ b/crates/ecstore/src/sets.rs @@ -13,8 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{collections::HashMap, sync::Arc}; - use crate::disk::error_reduce::count_errs; use crate::error::{Error, Result}; use crate::store_api::{ListPartsInfo, ObjectInfoOrErr, WalkOptions}; @@ -44,17 +42,16 @@ use rustfs_common::{ heal_channel::{DriveState, HealItemType}, }; use rustfs_filemeta::FileInfo; - use rustfs_madmin::heal_commands::{HealDriveInfo, HealResultItem}; use rustfs_utils::{crc_hash, path::path_join_buf, sip_hash}; +use std::{collections::HashMap, sync::Arc}; use tokio::sync::RwLock; -use tokio_util::sync::CancellationToken; -use uuid::Uuid; - use tokio::sync::broadcast::{Receiver, Sender}; use tokio::time::Duration; +use tokio_util::sync::CancellationToken; use tracing::warn; use tracing::{error, info}; +use uuid::Uuid; #[derive(Debug, Clone)] pub struct Sets { diff --git a/crates/ecstore/src/store_init.rs b/crates/ecstore/src/store_init.rs index 437b5218..31ea864e 100644 --- a/crates/ecstore/src/store_init.rs +++ b/crates/ecstore/src/store_init.rs @@ -27,7 +27,6 @@ use crate::{ }; use futures::future::join_all; use std::collections::{HashMap, hash_map::Entry}; - use tracing::{info, warn}; use uuid::Uuid; diff --git a/rustfs/src/server/http.rs b/rustfs/src/server/http.rs index 314494fe..f9a524eb 100644 --- a/rustfs/src/server/http.rs +++ b/rustfs/src/server/http.rs @@ -559,7 +559,7 @@ fn process_connection( let remote_addr = match socket.peer_addr() { Ok(addr) => Some(RemoteAddr(addr)), Err(e) => { - tracing::warn!( + warn!( error = %e, "Failed to obtain peer address; policy evaluation may fall back to a default source IP" ); @@ -762,7 +762,7 @@ fn get_listen_backlog() -> i32 { #[cfg(any(target_os = "netbsd", target_os = "macos", target_os = "freebsd"))] let mut name = [libc::CTL_KERN, libc::KERN_IPC, libc::KIPC_SOMAXCONN]; let mut buf = [0; 1]; - let mut buf_len = std::mem::size_of_val(&buf); + let mut buf_len = size_of_val(&buf); if unsafe { libc::sysctl(