diff --git a/crates/e2e_test/src/ecstore_test_compat.rs b/crates/e2e_test/src/ecstore_test_compat.rs deleted file mode 100644 index f115fc9a7..000000000 --- a/crates/e2e_test/src/ecstore_test_compat.rs +++ /dev/null @@ -1,12 +0,0 @@ -#[cfg(test)] -pub(crate) use rustfs_ecstore::api::bucket::bucket_target_sys::BucketTargetSys as E2eBucketTargetSys; -#[cfg(test)] -pub(crate) use rustfs_ecstore::api::disk::{VolumeInfo as E2eVolumeInfo, WalkDirOptions as E2eWalkDirOptions}; -pub(crate) use rustfs_ecstore::api::rpc::{ - TonicInterceptor as E2eTonicInterceptor, node_service_time_out_client_no_auth as e2e_node_service_time_out_client_no_auth, -}; -#[cfg(test)] -pub(crate) use rustfs_ecstore::api::rpc::{ - gen_tonic_signature_interceptor as gen_e2e_tonic_signature_interceptor, - node_service_time_out_client as e2e_node_service_time_out_client, -}; diff --git a/crates/e2e_test/src/lib.rs b/crates/e2e_test/src/lib.rs index 65a9c02e0..2259b63b7 100644 --- a/crates/e2e_test/src/lib.rs +++ b/crates/e2e_test/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -mod ecstore_test_compat; mod reliant; // Common utilities for all E2E tests diff --git a/crates/e2e_test/src/reliant/grpc_lock_client.rs b/crates/e2e_test/src/reliant/grpc_lock_client.rs index 6442dedb2..400829ff3 100644 --- a/crates/e2e_test/src/reliant/grpc_lock_client.rs +++ b/crates/e2e_test/src/reliant/grpc_lock_client.rs @@ -15,10 +15,8 @@ // Used by test_distributed_lock_4_nodes_grpc in lock.rs #![allow(dead_code)] -use crate::ecstore_test_compat::{ - E2eTonicInterceptor as TonicInterceptor, e2e_node_service_time_out_client_no_auth as node_service_time_out_client_no_auth, -}; use async_trait::async_trait; +use rustfs_ecstore::api::rpc::{TonicInterceptor, node_service_time_out_client_no_auth}; use rustfs_lock::{ LockClient, LockError, LockId, LockInfo, LockRequest, LockResponse, LockStats, LockStatus, LockType, Result, types::{LockMetadata, LockPriority}, diff --git a/crates/e2e_test/src/reliant/node_interact_test.rs b/crates/e2e_test/src/reliant/node_interact_test.rs index eee3c8b0a..04256692b 100644 --- a/crates/e2e_test/src/reliant/node_interact_test.rs +++ b/crates/e2e_test/src/reliant/node_interact_test.rs @@ -14,13 +14,10 @@ // limitations under the License. use crate::common::workspace_root; -use crate::ecstore_test_compat::{ - E2eTonicInterceptor as TonicInterceptor, E2eVolumeInfo as VolumeInfo, E2eWalkDirOptions as WalkDirOptions, - e2e_node_service_time_out_client as node_service_time_out_client, - gen_e2e_tonic_signature_interceptor as gen_tonic_signature_interceptor, -}; use futures::future::join_all; use rmp_serde::{Deserializer, Serializer}; +use rustfs_ecstore::api::disk::{VolumeInfo, WalkDirOptions}; +use rustfs_ecstore::api::rpc::{TonicInterceptor, gen_tonic_signature_interceptor, node_service_time_out_client}; use rustfs_filemeta::{MetaCacheEntry, MetacacheReader, MetacacheWriter}; use rustfs_protos::proto_gen::node_service::WalkDirRequest; use rustfs_protos::{ diff --git a/crates/e2e_test/src/replication_extension_test.rs b/crates/e2e_test/src/replication_extension_test.rs index 27db8b121..5a4d2d220 100644 --- a/crates/e2e_test/src/replication_extension_test.rs +++ b/crates/e2e_test/src/replication_extension_test.rs @@ -15,7 +15,6 @@ use crate::common::{ RustFSTestEnvironment, awscurl_available, awscurl_post_sts_form_urlencoded, init_logging, local_http_client, }; -use crate::ecstore_test_compat::E2eBucketTargetSys as BucketTargetSys; use aws_sdk_s3::config::{Credentials, Region}; use aws_sdk_s3::error::ProvideErrorMetadata; use aws_sdk_s3::primitives::ByteStream; @@ -23,6 +22,7 @@ use aws_sdk_s3::types::{BucketVersioningStatus, VersioningConfiguration}; use aws_sdk_s3::{Client, Config}; use http::header::{CONTENT_TYPE, HOST}; use reqwest::StatusCode; +use rustfs_ecstore::api::bucket::bucket_target_sys::BucketTargetSys; use rustfs_madmin::{ AddServiceAccountReq, ListServiceAccountsResp, PeerInfo, PeerSite, ReplicateAddStatus, ReplicateEditStatus, ReplicateRemoveStatus, SRRemoveReq, SRResyncOpStatus, SRStatusInfo, SiteReplicationInfo, SyncStatus, diff --git a/crates/heal/src/heal/ecstore_compat.rs b/crates/heal/src/heal/ecstore_compat.rs deleted file mode 100644 index 0f2a5a6b2..000000000 --- a/crates/heal/src/heal/ecstore_compat.rs +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -pub(crate) use rustfs_ecstore::api::data_usage::DATA_USAGE_CACHE_NAME as ECSTORE_DATA_USAGE_CACHE_NAME; -pub(crate) use rustfs_ecstore::api::disk::endpoint::Endpoint as EcstoreEndpoint; -pub(crate) use rustfs_ecstore::api::disk::error::{DiskError as EcstoreDiskError, Result as EcstoreDiskResult}; -pub(crate) use rustfs_ecstore::api::disk::{ - BUCKET_META_PREFIX as ECSTORE_BUCKET_META_PREFIX, Bytes as EcstoreDiskBytes, DeleteOptions as EcstoreDeleteOptions, - DiskAPI as EcstoreDiskAPI, DiskStore as EcstoreDiskStore, RUSTFS_META_BUCKET as ECSTORE_RUSTFS_META_BUCKET, -}; -#[cfg(test)] -pub(crate) use rustfs_ecstore::api::disk::{DiskOption as EcstoreDiskOption, new_disk as ecstore_new_disk}; -pub(crate) use rustfs_ecstore::api::error::{Error as EcstoreErrorType, StorageError as EcstoreStorageError}; -pub(crate) use rustfs_ecstore::api::global::GLOBAL_LOCAL_DISK_MAP as ECSTORE_GLOBAL_LOCAL_DISK_MAP; -pub(crate) use rustfs_ecstore::api::storage::ECStore as EcstoreStore; diff --git a/crates/heal/src/heal/mod.rs b/crates/heal/src/heal/mod.rs index 00e04b078..639db2706 100644 --- a/crates/heal/src/heal/mod.rs +++ b/crates/heal/src/heal/mod.rs @@ -22,15 +22,19 @@ pub mod storage; pub mod task; pub mod utils; -use ecstore_compat::{ - ECSTORE_BUCKET_META_PREFIX, ECSTORE_DATA_USAGE_CACHE_NAME, ECSTORE_GLOBAL_LOCAL_DISK_MAP, ECSTORE_RUSTFS_META_BUCKET, - EcstoreDeleteOptions, EcstoreDiskAPI, EcstoreDiskBytes, EcstoreDiskError, EcstoreDiskResult, EcstoreDiskStore, - EcstoreEndpoint, EcstoreErrorType, EcstoreStorageError, EcstoreStore, +use rustfs_ecstore::api::data_usage::DATA_USAGE_CACHE_NAME as ECSTORE_DATA_USAGE_CACHE_NAME; +use rustfs_ecstore::api::disk::endpoint::Endpoint as EcstoreEndpoint; +use rustfs_ecstore::api::disk::error::{DiskError as EcstoreDiskError, Result as EcstoreDiskResult}; +use rustfs_ecstore::api::disk::{ + BUCKET_META_PREFIX as ECSTORE_BUCKET_META_PREFIX, Bytes as EcstoreDiskBytes, DeleteOptions as EcstoreDeleteOptions, + DiskAPI as EcstoreDiskAPI, DiskStore as EcstoreDiskStore, RUSTFS_META_BUCKET as ECSTORE_RUSTFS_META_BUCKET, }; #[cfg(test)] -use ecstore_compat::{EcstoreDiskOption, ecstore_new_disk}; +use rustfs_ecstore::api::disk::{DiskOption as EcstoreDiskOption, new_disk as ecstore_new_disk}; +use rustfs_ecstore::api::error::{Error as EcstoreErrorType, StorageError as EcstoreStorageError}; +use rustfs_ecstore::api::global::GLOBAL_LOCAL_DISK_MAP as ECSTORE_GLOBAL_LOCAL_DISK_MAP; +use rustfs_ecstore::api::storage::ECStore as EcstoreStore; -mod ecstore_compat; pub use erasure_healer::ErasureSetHealer; pub use manager::{HealManager, HealOperationsSnapshot, HealPriorityCounts, HealSourceCounts}; pub use resume::{CheckpointManager, ResumeCheckpoint, ResumeManager, ResumeState, ResumeUtils}; diff --git a/crates/heal/tests/ecstore_test_compat/mod.rs b/crates/heal/tests/ecstore_test_compat/mod.rs deleted file mode 100644 index 632d86281..000000000 --- a/crates/heal/tests/ecstore_test_compat/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![allow(unused_imports)] - -pub(crate) use rustfs_ecstore::api::bucket::metadata_sys::init_bucket_metadata_sys; -pub(crate) use rustfs_ecstore::api::disk::DiskStore; -pub(crate) use rustfs_ecstore::api::disk::endpoint::Endpoint; -pub(crate) use rustfs_ecstore::api::layout::{EndpointServerPools, Endpoints, PoolEndpoints}; -pub(crate) use rustfs_ecstore::api::storage::{ECStore, init_local_disks}; diff --git a/crates/heal/tests/endpoint_index_test.rs b/crates/heal/tests/endpoint_index_test.rs index fc642494d..ecec7fc11 100644 --- a/crates/heal/tests/endpoint_index_test.rs +++ b/crates/heal/tests/endpoint_index_test.rs @@ -14,9 +14,9 @@ //! test endpoint index settings -mod ecstore_test_compat; - -use ecstore_test_compat::{ECStore, Endpoint, EndpointServerPools, Endpoints, PoolEndpoints, init_local_disks}; +use rustfs_ecstore::api::disk::endpoint::Endpoint; +use rustfs_ecstore::api::layout::{EndpointServerPools, Endpoints, PoolEndpoints}; +use rustfs_ecstore::api::storage::{ECStore, init_local_disks}; use std::net::SocketAddr; use tempfile::TempDir; use tokio_util::sync::CancellationToken; diff --git a/crates/heal/tests/heal_bug_fixes_test.rs b/crates/heal/tests/heal_bug_fixes_test.rs index 4df1b1ed0..25142623d 100644 --- a/crates/heal/tests/heal_bug_fixes_test.rs +++ b/crates/heal/tests/heal_bug_fixes_test.rs @@ -12,9 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -mod ecstore_test_compat; - -use ecstore_test_compat::{DiskStore, Endpoint}; +use rustfs_ecstore::api::disk::{DiskStore, endpoint::Endpoint}; use rustfs_heal::heal::{ event::{HealEvent, Severity}, task::{HealPriority, HealType}, diff --git a/crates/heal/tests/heal_integration_test.rs b/crates/heal/tests/heal_integration_test.rs index 35cb4daac..11d9f8153 100644 --- a/crates/heal/tests/heal_integration_test.rs +++ b/crates/heal/tests/heal_integration_test.rs @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -mod ecstore_test_compat; - -use ecstore_test_compat::{ - ECStore, Endpoint, EndpointServerPools, Endpoints, PoolEndpoints, init_bucket_metadata_sys, init_local_disks, -}; use http::HeaderMap; use rustfs_common::heal_channel::{HealOpts, HealScanMode}; +use rustfs_ecstore::api::bucket::metadata_sys::init_bucket_metadata_sys; +use rustfs_ecstore::api::disk::endpoint::Endpoint; +use rustfs_ecstore::api::layout::{EndpointServerPools, Endpoints, PoolEndpoints}; +use rustfs_ecstore::api::storage::{ECStore, init_local_disks}; use rustfs_heal::heal::{ manager::{HealConfig, HealManager}, storage::{ECStoreHealStorage, HealObjectOptions as ObjectOptions, HealPutObjReader as PutObjReader, HealStorageAPI}, diff --git a/crates/iam/src/ecstore_compat.rs b/crates/iam/src/ecstore_compat.rs deleted file mode 100644 index a6f950feb..000000000 --- a/crates/iam/src/ecstore_compat.rs +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -pub(crate) use rustfs_ecstore::api::config::RUSTFS_CONFIG_PREFIX as ECSTORE_RUSTFS_CONFIG_PREFIX; -pub(crate) use rustfs_ecstore::api::config::com::{ - delete_config as ecstore_delete_config, read_config_no_lock as ecstore_read_config_no_lock, - read_config_with_metadata as ecstore_read_config_with_metadata, save_config as ecstore_save_config, - save_config_with_opts as ecstore_save_config_with_opts, -}; -pub(crate) use rustfs_ecstore::api::error::{ - Error as EcstoreErrorType, Result as EcstoreResultType, StorageError as EcstoreStorageError, - classify_system_path_failure_reason as ecstore_classify_system_path_failure_reason, -}; -pub(crate) use rustfs_ecstore::api::global::is_first_cluster_node_local as ecstore_is_first_cluster_node_local; -pub(crate) use rustfs_ecstore::api::notification::{ - NotificationPeerErr as EcstoreNotificationPeerErr, get_global_notification_sys as ecstore_get_global_notification_sys, -}; -pub(crate) use rustfs_ecstore::api::storage::ECStore as EcstoreStore; diff --git a/crates/iam/src/lib.rs b/crates/iam/src/lib.rs index 0084dee4c..7d93f6af7 100644 --- a/crates/iam/src/lib.rs +++ b/crates/iam/src/lib.rs @@ -13,14 +13,23 @@ // limitations under the License. use crate::error::{Error, Result}; -use ecstore_compat::{ - ECSTORE_RUSTFS_CONFIG_PREFIX, EcstoreErrorType, EcstoreNotificationPeerErr, EcstoreResultType, EcstoreStorageError, - EcstoreStore, ecstore_classify_system_path_failure_reason, ecstore_delete_config, ecstore_get_global_notification_sys, - ecstore_is_first_cluster_node_local, ecstore_read_config_no_lock, ecstore_read_config_with_metadata, ecstore_save_config, - ecstore_save_config_with_opts, -}; use manager::IamCache; use oidc::OidcSys; +use rustfs_ecstore::api::config::RUSTFS_CONFIG_PREFIX as ECSTORE_RUSTFS_CONFIG_PREFIX; +use rustfs_ecstore::api::config::com::{ + delete_config as ecstore_delete_config, read_config_no_lock as ecstore_read_config_no_lock, + read_config_with_metadata as ecstore_read_config_with_metadata, save_config as ecstore_save_config, + save_config_with_opts as ecstore_save_config_with_opts, +}; +use rustfs_ecstore::api::error::{ + Error as EcstoreErrorType, Result as EcstoreResultType, StorageError as EcstoreStorageError, + classify_system_path_failure_reason as ecstore_classify_system_path_failure_reason, +}; +use rustfs_ecstore::api::global::is_first_cluster_node_local as ecstore_is_first_cluster_node_local; +use rustfs_ecstore::api::notification::{ + NotificationPeerErr as EcstoreNotificationPeerErr, get_global_notification_sys as ecstore_get_global_notification_sys, +}; +use rustfs_ecstore::api::storage::ECStore as EcstoreStore; use std::sync::{Arc, OnceLock}; use store::object::ObjectStore; use sys::IamSys; @@ -33,7 +42,6 @@ const EVENT_IAM_STATE: &str = "iam_state"; const EVENT_OIDC_STATE: &str = "oidc_state"; pub mod cache; -mod ecstore_compat; pub mod error; pub mod keyring; pub mod manager; diff --git a/crates/scanner/src/ecstore_compat.rs b/crates/scanner/src/ecstore_compat.rs deleted file mode 100644 index e555d0908..000000000 --- a/crates/scanner/src/ecstore_compat.rs +++ /dev/null @@ -1,74 +0,0 @@ -// 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. - -pub(crate) use rustfs_ecstore::api::bucket::bucket_target_sys::BucketTargetSys as EcstoreBucketTargetSys; -pub(crate) use rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_audit::LcEventSrc as EcstoreLcEventSrc; -pub(crate) use rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_ops::{ - GLOBAL_ExpiryState as ECSTORE_GLOBAL_EXPIRY_STATE, apply_expiry_rule as ecstore_apply_expiry_rule, - apply_transition_rule as ecstore_apply_transition_rule, -}; -pub(crate) use rustfs_ecstore::api::bucket::lifecycle::evaluator::Evaluator as EcstoreEvaluator; -pub(crate) use rustfs_ecstore::api::bucket::lifecycle::lifecycle::{ - Event as EcstoreEvent, Lifecycle as EcstoreLifecycle, ObjectOpts as EcstoreObjectOpts, - TRANSITION_COMPLETE as ECSTORE_TRANSITION_COMPLETE, -}; -pub(crate) use rustfs_ecstore::api::bucket::metadata_sys::{ - get_lifecycle_config as ecstore_get_lifecycle_config, get_object_lock_config as ecstore_get_object_lock_config, - get_replication_config as ecstore_get_replication_config, -}; -pub(crate) use rustfs_ecstore::api::bucket::replication::{ - ReplicationConfig as EcstoreReplicationConfig, ReplicationConfigurationExt as EcstoreReplicationConfigurationExt, - ReplicationHealQueueResult as EcstoreReplicationHealQueueResult, - ReplicationQueueAdmission as EcstoreReplicationQueueAdmission, - queue_replication_heal_internal as ecstore_queue_replication_heal_internal, -}; -pub(crate) use rustfs_ecstore::api::bucket::versioning::VersioningApi as EcstoreVersioningApi; -pub(crate) use rustfs_ecstore::api::bucket::versioning_sys::BucketVersioningSys as EcstoreBucketVersioningSys; -pub(crate) use rustfs_ecstore::api::cache::{ - ListPathRawOptions as EcstoreListPathRawOptions, list_path_raw as ecstore_list_path_raw, -}; -pub(crate) use rustfs_ecstore::api::capacity::{ - is_reserved_or_invalid_bucket as ecstore_is_reserved_or_invalid_bucket, path2_bucket_object as ecstore_path2_bucket_object, - path2_bucket_object_with_base_path as ecstore_path2_bucket_object_with_base_path, -}; -pub(crate) use rustfs_ecstore::api::config::com::{read_config as ecstore_read_config, save_config as ecstore_save_config}; -#[cfg(test)] -pub(crate) use rustfs_ecstore::api::config::init as ecstore_config_init; -pub(crate) use rustfs_ecstore::api::config::storageclass::{ - RRS as ECSTORE_STORAGECLASS_RRS, STANDARD as ECSTORE_STORAGECLASS_STANDARD, -}; -pub(crate) use rustfs_ecstore::api::data_usage::replace_bucket_usage_memory_from_info as ecstore_replace_bucket_usage_memory_from_info; -#[cfg(test)] -pub(crate) use rustfs_ecstore::api::disk::endpoint::Endpoint as EcstoreEndpoint; -pub(crate) use rustfs_ecstore::api::disk::error::{DiskError as EcstoreDiskError, Result as EcstoreDiskResult}; -pub(crate) use rustfs_ecstore::api::disk::{ - BUCKET_META_PREFIX as ECSTORE_BUCKET_META_PREFIX, Bytes as EcstoreDiskBytes, Disk as EcstoreDisk, DiskAPI as EcstoreDiskAPI, - DiskInfo as EcstoreDiskInfo, DiskInfoOptions as EcstoreDiskInfoOptions, DiskLocation as EcstoreDiskLocation, - RUSTFS_META_BUCKET as ECSTORE_RUSTFS_META_BUCKET, STORAGE_FORMAT_FILE as ECSTORE_STORAGE_FORMAT_FILE, - ScanGuard as EcstoreScanGuard, -}; -#[cfg(test)] -pub(crate) use rustfs_ecstore::api::disk::{ - DiskOption as EcstoreDiskOption, DiskStore as EcstoreDiskStore, new_disk as ecstore_new_disk, -}; -pub(crate) use rustfs_ecstore::api::error::{ - Error as EcstoreErrorType, Result as EcstoreResultType, StorageError as EcstoreStorageError, -}; -pub(crate) use rustfs_ecstore::api::global::{ - GLOBAL_TierConfigMgr as ECSTORE_GLOBAL_TIER_CONFIG_MGR, is_erasure as ecstore_is_erasure, - is_erasure_sd as ecstore_is_erasure_sd, resolve_object_store_handle as ecstore_resolve_object_store_handle, -}; -pub(crate) use rustfs_ecstore::api::set_disk::SetDisks as EcstoreSetDisks; -pub(crate) use rustfs_ecstore::api::storage::ECStore as EcstoreStore; -pub(crate) use rustfs_ecstore::api::tier::tier_config::TierConfig as EcstoreTierConfig; diff --git a/crates/scanner/src/lib.rs b/crates/scanner/src/lib.rs index 87fb8eb95..13012476e 100644 --- a/crates/scanner/src/lib.rs +++ b/crates/scanner/src/lib.rs @@ -20,25 +20,59 @@ rust_2018_idioms )] -mod ecstore_compat; - -use ecstore_compat::{ - ECSTORE_BUCKET_META_PREFIX, ECSTORE_GLOBAL_EXPIRY_STATE, ECSTORE_GLOBAL_TIER_CONFIG_MGR, ECSTORE_RUSTFS_META_BUCKET, - ECSTORE_STORAGE_FORMAT_FILE, ECSTORE_STORAGECLASS_RRS, ECSTORE_STORAGECLASS_STANDARD, ECSTORE_TRANSITION_COMPLETE, - EcstoreBucketTargetSys, EcstoreBucketVersioningSys, EcstoreDisk, EcstoreDiskAPI, EcstoreDiskBytes, EcstoreDiskError, - EcstoreDiskInfo, EcstoreDiskInfoOptions, EcstoreDiskLocation, EcstoreDiskResult, EcstoreErrorType, EcstoreEvaluator, - EcstoreEvent, EcstoreLcEventSrc, EcstoreLifecycle, EcstoreListPathRawOptions, EcstoreObjectOpts, EcstoreReplicationConfig, - EcstoreReplicationConfigurationExt, EcstoreReplicationHealQueueResult, EcstoreReplicationQueueAdmission, EcstoreResultType, - EcstoreScanGuard, EcstoreSetDisks, EcstoreStorageError, EcstoreStore, EcstoreTierConfig, EcstoreVersioningApi, - ecstore_apply_expiry_rule, ecstore_apply_transition_rule, ecstore_get_lifecycle_config, ecstore_get_object_lock_config, - ecstore_get_replication_config, ecstore_is_erasure, ecstore_is_erasure_sd, ecstore_is_reserved_or_invalid_bucket, - ecstore_list_path_raw, ecstore_path2_bucket_object, ecstore_path2_bucket_object_with_base_path, - ecstore_queue_replication_heal_internal, ecstore_read_config, ecstore_replace_bucket_usage_memory_from_info, - ecstore_resolve_object_store_handle, ecstore_save_config, +use http::HeaderMap; +use rustfs_ecstore::api::bucket::bucket_target_sys::BucketTargetSys as EcstoreBucketTargetSys; +use rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_audit::LcEventSrc as EcstoreLcEventSrc; +use rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_ops::{ + GLOBAL_ExpiryState as ECSTORE_GLOBAL_EXPIRY_STATE, apply_expiry_rule as ecstore_apply_expiry_rule, + apply_transition_rule as ecstore_apply_transition_rule, +}; +use rustfs_ecstore::api::bucket::lifecycle::evaluator::Evaluator as EcstoreEvaluator; +use rustfs_ecstore::api::bucket::lifecycle::lifecycle::{ + Event as EcstoreEvent, Lifecycle as EcstoreLifecycle, ObjectOpts as EcstoreObjectOpts, + TRANSITION_COMPLETE as ECSTORE_TRANSITION_COMPLETE, +}; +use rustfs_ecstore::api::bucket::metadata_sys::{ + get_lifecycle_config as ecstore_get_lifecycle_config, get_object_lock_config as ecstore_get_object_lock_config, + get_replication_config as ecstore_get_replication_config, +}; +use rustfs_ecstore::api::bucket::replication::{ + ReplicationConfig as EcstoreReplicationConfig, ReplicationConfigurationExt as EcstoreReplicationConfigurationExt, + ReplicationHealQueueResult as EcstoreReplicationHealQueueResult, + ReplicationQueueAdmission as EcstoreReplicationQueueAdmission, + queue_replication_heal_internal as ecstore_queue_replication_heal_internal, +}; +use rustfs_ecstore::api::bucket::versioning::VersioningApi as EcstoreVersioningApi; +use rustfs_ecstore::api::bucket::versioning_sys::BucketVersioningSys as EcstoreBucketVersioningSys; +use rustfs_ecstore::api::cache::{ListPathRawOptions as EcstoreListPathRawOptions, list_path_raw as ecstore_list_path_raw}; +use rustfs_ecstore::api::capacity::{ + is_reserved_or_invalid_bucket as ecstore_is_reserved_or_invalid_bucket, path2_bucket_object as ecstore_path2_bucket_object, + path2_bucket_object_with_base_path as ecstore_path2_bucket_object_with_base_path, +}; +use rustfs_ecstore::api::config::com::{read_config as ecstore_read_config, save_config as ecstore_save_config}; +#[cfg(test)] +use rustfs_ecstore::api::config::init as ecstore_config_init; +use rustfs_ecstore::api::config::storageclass::{RRS as ECSTORE_STORAGECLASS_RRS, STANDARD as ECSTORE_STORAGECLASS_STANDARD}; +use rustfs_ecstore::api::data_usage::replace_bucket_usage_memory_from_info as ecstore_replace_bucket_usage_memory_from_info; +#[cfg(test)] +use rustfs_ecstore::api::disk::endpoint::Endpoint as EcstoreEndpoint; +use rustfs_ecstore::api::disk::error::{DiskError as EcstoreDiskError, Result as EcstoreDiskResult}; +use rustfs_ecstore::api::disk::{ + BUCKET_META_PREFIX as ECSTORE_BUCKET_META_PREFIX, Bytes as EcstoreDiskBytes, Disk as EcstoreDisk, DiskAPI as EcstoreDiskAPI, + DiskInfo as EcstoreDiskInfo, DiskInfoOptions as EcstoreDiskInfoOptions, DiskLocation as EcstoreDiskLocation, + RUSTFS_META_BUCKET as ECSTORE_RUSTFS_META_BUCKET, STORAGE_FORMAT_FILE as ECSTORE_STORAGE_FORMAT_FILE, + ScanGuard as EcstoreScanGuard, }; #[cfg(test)] -use ecstore_compat::{EcstoreDiskOption, EcstoreDiskStore, EcstoreEndpoint, ecstore_config_init, ecstore_new_disk}; -use http::HeaderMap; +use rustfs_ecstore::api::disk::{DiskOption as EcstoreDiskOption, DiskStore as EcstoreDiskStore, new_disk as ecstore_new_disk}; +use rustfs_ecstore::api::error::{Error as EcstoreErrorType, Result as EcstoreResultType, StorageError as EcstoreStorageError}; +use rustfs_ecstore::api::global::{ + GLOBAL_TierConfigMgr as ECSTORE_GLOBAL_TIER_CONFIG_MGR, is_erasure as ecstore_is_erasure, + is_erasure_sd as ecstore_is_erasure_sd, resolve_object_store_handle as ecstore_resolve_object_store_handle, +}; +use rustfs_ecstore::api::set_disk::SetDisks as EcstoreSetDisks; +use rustfs_ecstore::api::storage::ECStore as EcstoreStore; +use rustfs_ecstore::api::tier::tier_config::TierConfig as EcstoreTierConfig; use rustfs_storage_api::{HTTPRangeSpec, ObjectIO, ObjectToDelete}; use std::path::PathBuf; use std::sync::Arc; diff --git a/crates/scanner/tests/ecstore_test_compat/mod.rs b/crates/scanner/tests/ecstore_test_compat/mod.rs deleted file mode 100644 index 5fb2681f6..000000000 --- a/crates/scanner/tests/ecstore_test_compat/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -pub(crate) use rustfs_ecstore::api::bucket::lifecycle::bucket_lifecycle_ops::{ - enqueue_transition_for_existing_objects, init_background_expiry, -}; -pub(crate) use rustfs_ecstore::api::bucket::lifecycle::lifecycle::TransitionOptions; -pub(crate) use rustfs_ecstore::api::bucket::metadata::BUCKET_LIFECYCLE_CONFIG; -pub(crate) use rustfs_ecstore::api::bucket::metadata_sys::{ - get as get_bucket_metadata, init_bucket_metadata_sys, update as update_bucket_metadata, -}; -pub(crate) use rustfs_ecstore::api::bucket::versioning_sys::BucketVersioningSys; -pub(crate) use rustfs_ecstore::api::capacity::path2_bucket_object_with_base_path; -pub(crate) use rustfs_ecstore::api::client::transition_api::{ReadCloser, ReaderImpl}; -pub(crate) use rustfs_ecstore::api::disk::endpoint::Endpoint; -pub(crate) use rustfs_ecstore::api::disk::{DiskAPI, DiskOption, STORAGE_FORMAT_FILE, new_disk}; -pub(crate) use rustfs_ecstore::api::global::GLOBAL_TierConfigMgr; -pub(crate) use rustfs_ecstore::api::layout::{EndpointServerPools, Endpoints, PoolEndpoints}; -pub(crate) use rustfs_ecstore::api::storage::{ECStore, init_local_disks}; -pub(crate) use rustfs_ecstore::api::tier::tier_config::{TierConfig, TierMinIO, TierType}; -pub(crate) use rustfs_ecstore::api::tier::warm_backend::{ - WarmBackend as ScannerWarmBackend, WarmBackendGetOpts, build_transition_put_options, -}; diff --git a/crates/scanner/tests/lifecycle_integration_test.rs b/crates/scanner/tests/lifecycle_integration_test.rs index ae6dc0e8f..7e68fbe33 100644 --- a/crates/scanner/tests/lifecycle_integration_test.rs +++ b/crates/scanner/tests/lifecycle_integration_test.rs @@ -12,17 +12,27 @@ // See the License for the specific language governing permissions and // limitations under the License. -mod ecstore_test_compat; - -use ecstore_test_compat::{ - BUCKET_LIFECYCLE_CONFIG, BucketVersioningSys, DiskAPI as _, DiskOption, ECStore, Endpoint, EndpointServerPools, Endpoints, - GLOBAL_TierConfigMgr, PoolEndpoints, ReadCloser, ReaderImpl, STORAGE_FORMAT_FILE, ScannerWarmBackend, TierConfig, TierMinIO, - TierType, TransitionOptions, WarmBackendGetOpts, build_transition_put_options, enqueue_transition_for_existing_objects, - get_bucket_metadata, init_background_expiry, init_bucket_metadata_sys, init_local_disks, new_disk, - path2_bucket_object_with_base_path, update_bucket_metadata, -}; use futures::FutureExt; use rustfs_config::ENV_TEST_FORCE_IMMEDIATE_TRANSITION_ENQUEUE_TIMEOUT; +use rustfs_ecstore::api::bucket::lifecycle::{ + bucket_lifecycle_ops::{enqueue_transition_for_existing_objects, init_background_expiry}, + lifecycle::TransitionOptions, +}; +use rustfs_ecstore::api::bucket::metadata::BUCKET_LIFECYCLE_CONFIG; +use rustfs_ecstore::api::bucket::metadata_sys::{ + get as get_bucket_metadata, init_bucket_metadata_sys, update as update_bucket_metadata, +}; +use rustfs_ecstore::api::bucket::versioning_sys::BucketVersioningSys; +use rustfs_ecstore::api::capacity::path2_bucket_object_with_base_path; +use rustfs_ecstore::api::client::transition_api::{ReadCloser, ReaderImpl}; +use rustfs_ecstore::api::disk::{DiskAPI as _, DiskOption, STORAGE_FORMAT_FILE, endpoint::Endpoint, new_disk}; +use rustfs_ecstore::api::global::GLOBAL_TierConfigMgr; +use rustfs_ecstore::api::layout::{EndpointServerPools, Endpoints, PoolEndpoints}; +use rustfs_ecstore::api::storage::{ECStore, init_local_disks}; +use rustfs_ecstore::api::tier::tier_config::{TierConfig, TierMinIO, TierType}; +use rustfs_ecstore::api::tier::warm_backend::{ + WarmBackend as ScannerWarmBackend, WarmBackendGetOpts, build_transition_put_options, +}; use rustfs_filemeta::FileMeta; use rustfs_scanner::scanner_folder::ScannerItem; use rustfs_scanner::scanner_io::ScannerIODisk; diff --git a/docs/architecture/migration-progress.md b/docs/architecture/migration-progress.md index f9c08e78c..a315feae1 100644 --- a/docs/architecture/migration-progress.md +++ b/docs/architecture/migration-progress.md @@ -5,20 +5,20 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block ## Current Context - Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660) -- Branch: `overtrue/arch-runtime-crate-ecstore-thin-bridges` -- Baseline: completed `C-011/C-012/C-013/API-055/API-059/API-079/API-080/API-081/API-082/API-083/API-084/API-085/API-086/API-087/API-088/API-089/API-090/API-091/API-092/API-093/API-094/API-095/API-096/API-097/API-098/API-099/API-100/API-101/API-102/API-103/API-104/API-105/API-106/API-107/API-108/API-109/API-110/API-111/API-112/API-113/API-114/API-115/API-116/API-117/API-118/API-119/API-120/API-121/API-122/API-123/API-124/API-125/API-126/API-127/API-128/API-129/API-130/API-131/API-132/API-133/API-134/API-135/API-136/API-137/API-138/API-139/API-140/API-141/API-142/API-143/API-144/API-145/API-146/API-147/API-148/API-149/API-150`. -- Based on: API-150 stacked slice. +- Branch: `overtrue/arch-storage-owner-ecstore-root-imports` +- Baseline: completed `C-011/C-012/C-013/API-055/API-059/API-079/API-080/API-081/API-082/API-083/API-084/API-085/API-086/API-087/API-088/API-089/API-090/API-091/API-092/API-093/API-094/API-095/API-096/API-097/API-098/API-099/API-100/API-101/API-102/API-103/API-104/API-105/API-106/API-107/API-108/API-109/API-110/API-111/API-112/API-113/API-114/API-115/API-116/API-117/API-118/API-119/API-120/API-121/API-122/API-123/API-124/API-125/API-126/API-127/API-128/API-129/API-130/API-131/API-132/API-133/API-134/API-135/API-136/API-137/API-138/API-139/API-140/API-141/API-142/API-143/API-144/API-145/API-146/API-147/API-148/API-149/API-150/API-151/API-152/API-153`. +- Based on: `overtrue/arch-owner-ecstore-final-bridges` after API-153. - PR type for this branch: `pure-move` - Runtime behavior changes: none. -- Rust code changes: remove the thin notify/obs/swift/s3select ECStore - compatibility bridge files and keep their ECStore source imports at each - owner root. +- Rust code changes: remove the final storage owner ECStore compatibility + bridge file and keep its ECStore source imports in the storage owner root. - CI/script changes: lock completed owner and test/fuzz boundaries against bare/glob imports, scattered raw ECStore facade subpaths, and startup runtime/root-server/table/S3/app shared/app bucket/app ECStore/admin facade regressions, plus external runtime, test, fuzz, and storage-owner module - ECStore compatibility bypasses, plus runtime crate thin bridge regressions. -- Docs changes: record the API-136/API-137/API-138/API-139/API-140/API-141/API-142/API-143/API-144/API-145/API-146/API-147/API-148/API-149/API-150/API-151 owner facade cleanup. + ECStore compatibility bypasses, plus runtime crate, owner crate, test/fuzz, + and storage owner thin bridge regressions. +- Docs changes: record the API-136/API-137/API-138/API-139/API-140/API-141/API-142/API-143/API-144/API-145/API-146/API-147/API-148/API-149/API-150/API-151/API-152/API-153/API-154 owner facade cleanup. ## Phase 0 Tasks @@ -4191,6 +4191,45 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block shell syntax check, formatting, diff hygiene, Rust risk scan, branch freshness check, pre-commit, and three-expert review. +- [x] `API-152` Collapse thin test and fuzz ECStore compatibility bridges. + - Do: remove the thin e2e, heal, scanner, and fuzz ECStore compatibility + bridge modules, moving their aliases and wrappers into the owner test/fuzz + files that consume them. + - Acceptance: those tests and fuzz targets no longer declare local + `ecstore_test_compat` or `ecstore_fuzz_compat` modules, while the same + ECStore API symbols remain available to the existing test and fuzz logic. + - Must preserve: e2e replication and reliant gRPC clients, heal endpoint and + integration fixtures, scanner lifecycle fixtures, bucket validation fuzzing, + and path containment fuzzing. + - Verification: focused test/fuzz compile coverage, migration guard, shell + syntax check, formatting, diff hygiene, Rust risk scan, branch freshness + check, pre-commit, and three-expert review. + +- [x] `API-153` Collapse thin owner ECStore compatibility bridges. + - Do: remove the thin IAM, heal, and scanner `ecstore_compat.rs` modules, + moving their aliases and wrappers into the owner root modules. + - Acceptance: those owner crates no longer declare local `ecstore_compat` + modules, while their owner-root aliases and wrapper functions keep the same + call paths for downstream modules. + - Must preserve: IAM config/notification helpers, heal disk/local-map + contracts, scanner lifecycle/replication/data-usage helpers, and owner-root + storage aliases. + - Verification: focused owner crate compile coverage, migration guard, shell + syntax check, formatting, diff hygiene, Rust risk scan, branch freshness + check, pre-commit, and three-expert review. + +- [x] `API-154` Collapse storage owner ECStore compatibility bridge. + - Do: remove `rustfs/src/storage/ecstore_compat.rs`, moving its `ecstore_*` + source modules into `rustfs/src/storage/mod.rs`. + - Acceptance: no storage owner `ecstore_compat` bridge file remains, while + existing downstream `crate::storage::ecstore_*` paths keep the same shape. + - Must preserve: storage owner type aliases, constants, wrapper functions, + disk RPC extension traits, bucket metadata helpers, runtime globals, and + startup storage wiring. + - Verification: RustFS compile coverage, migration guard, shell syntax check, + formatting, diff hygiene, Rust risk scan, branch freshness check, + pre-commit, and three-expert review. + ## Next PRs 1. `pure-move`: continue pruning remaining facade compatibility and owner boundaries. @@ -4199,16 +4238,35 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block | Expert | Status | Notes | |---|---|---| -| Quality/architecture | pass | API-151 removes thin runtime crate ECStore bridge files and keeps the remaining source imports at owner roots. | -| Migration preservation | pass | Notify, obs metrics, Swift, and S3 Select keep the same owner-root aliases and wrappers for existing consumers. | -| Testing/verification | pass | Focused runtime crate compile, formatting, migration guard, shell syntax, diff hygiene, Rust risk scan, and pre-commit passed for API-151. | +| Quality/architecture | pass | API-152 removes thin test/fuzz ECStore bridge files and keeps direct imports in owner test/fuzz files. | +| Migration preservation | pass | E2E, heal, scanner, and fuzz consumers keep the same ECStore API symbols and call paths. | +| Testing/verification | pass | Focused test/fuzz compile, formatting, migration guard, shell syntax, diff hygiene, Rust risk scan, and pre-commit passed for API-152. | +| Quality/architecture | pass | API-153 removes thin owner ECStore bridge files and keeps direct imports at owner roots. | +| Migration preservation | pass | IAM, heal, and scanner owner-root aliases and wrapper functions keep the same call paths. | +| Testing/verification | pass | Focused owner crate compile, formatting, migration guard, shell syntax, diff hygiene, Rust risk scan, and pre-commit passed for API-153. | +| Quality/architecture | pass | API-154 removes the final storage owner ECStore bridge file and keeps direct imports at the storage owner root. | +| Migration preservation | pass | Existing `crate::storage::ecstore_*` modules, constants, wrappers, and downstream call paths keep the same shape. | +| Testing/verification | pass | RustFS focused compile, formatting, migration guard, shell syntax, diff hygiene, bridge scan, Rust risk scan, and pre-commit passed for API-154. | ## Verification Notes Passed before push: -- Issue #660 API-151 current slice: - - `cargo check -p rustfs-notify -p rustfs-obs -p rustfs-s3select-api -p rustfs-protocols`: +- Issue #660 API-154 current slice: + - `cargo check --tests -p rustfs`: passed. + - `cargo fmt --all`: passed. + - `cargo fmt --all --check`: passed. + - `git diff --check`: passed. + - `bash -n scripts/check_architecture_migration_rules.sh`: passed. + - `./scripts/check_architecture_migration_rules.sh`: passed. + - `make pre-commit`: passed. + - Storage ECStore thin bridge scan: passed; no `ecstore_compat.rs` files + remain outside `crates/ecstore`. + - Rust risk scan: no new production unwrap/expect, panic/todo/unsafe, or + cast risks added; changes only move storage owner import boundaries. + +- Issue #660 API-153 current slice: + - `cargo check --tests -p rustfs-heal -p rustfs-scanner -p rustfs-iam`: passed. - `cargo fmt --all`: passed. - `cargo fmt --all --check`: passed. @@ -4216,10 +4274,28 @@ Passed before push: - `bash -n scripts/check_architecture_migration_rules.sh`: passed. - `./scripts/check_architecture_migration_rules.sh`: passed. - `make pre-commit`: passed. - - Runtime thin bridge scan: passed; notify, obs metrics, Swift, and S3 - Select no longer declare local `ecstore_compat` modules. + - Owner ECStore thin bridge scan: passed; IAM, heal, and scanner no longer + declare local `ecstore_compat` modules. + - Rust risk scan: no new production unwrap/expect, panic/todo/unsafe, or + cast risks added; changes only move owner-root import boundaries. + +- Issue #660 API-152 current slice: + - `cargo check --tests -p rustfs-heal -p rustfs-scanner -p e2e_test`: + passed. + - `cargo check --manifest-path fuzz/Cargo.toml --bins`: passed. + - `cargo fmt --all`: passed. + - `cargo fmt --all --manifest-path fuzz/Cargo.toml`: passed. + - `cargo fmt --all --check`: passed. + - `cargo fmt --all --check --manifest-path fuzz/Cargo.toml`: passed. + - `git diff --check`: passed. + - `bash -n scripts/check_architecture_migration_rules.sh`: passed. + - `./scripts/check_architecture_migration_rules.sh`: passed. + - `make pre-commit`: passed. + - Test/fuzz thin bridge scan: passed; e2e, heal, scanner, and fuzz targets no + longer declare local `ecstore_test_compat` or `ecstore_fuzz_compat` + modules. - Rust risk scan: no new production unwrap/expect, casts, panic/todo/unsafe, - or error-type risks added; changes only move import/source boundaries. + or error-type risks added; changes only move test/fuzz import boundaries. - Issue #660 API-140 current slice: - `cargo check --tests -p rustfs`: passed. diff --git a/fuzz/fuzz_targets/bucket_validation.rs b/fuzz/fuzz_targets/bucket_validation.rs index a857afbe4..46009b0a0 100644 --- a/fuzz/fuzz_targets/bucket_validation.rs +++ b/fuzz/fuzz_targets/bucket_validation.rs @@ -1,8 +1,7 @@ #![no_main] use libfuzzer_sys::fuzz_target; -mod ecstore_fuzz_compat; -use ecstore_fuzz_compat::{ +use rustfs_ecstore::api::bucket::utils::{ check_bucket_and_object_names, check_list_objs_args, check_valid_bucket_name_strict, is_meta_bucketname, }; diff --git a/fuzz/fuzz_targets/ecstore_fuzz_compat.rs b/fuzz/fuzz_targets/ecstore_fuzz_compat.rs deleted file mode 100644 index 75d5e015a..000000000 --- a/fuzz/fuzz_targets/ecstore_fuzz_compat.rs +++ /dev/null @@ -1,32 +0,0 @@ -#![allow(dead_code)] - -use rustfs_ecstore::api::bucket as ecstore_bucket; -use rustfs_ecstore::api::error as ecstore_error; - -pub(crate) fn check_bucket_and_object_names(bucket: &str, object: &str) -> ecstore_error::Result<()> { - ecstore_bucket::utils::check_bucket_and_object_names(bucket, object) -} - -pub(crate) fn check_list_objs_args(bucket: &str, prefix: &str, marker: &Option) -> ecstore_error::Result<()> { - ecstore_bucket::utils::check_list_objs_args(bucket, prefix, marker) -} - -pub(crate) fn check_object_name_for_length_and_slash(bucket: &str, object: &str) -> ecstore_error::Result<()> { - ecstore_bucket::utils::check_object_name_for_length_and_slash(bucket, object) -} - -pub(crate) fn check_valid_bucket_name_strict(bucket: &str) -> ecstore_error::Result<()> { - ecstore_bucket::utils::check_valid_bucket_name_strict(bucket) -} - -pub(crate) fn has_bad_path_component(object: &str) -> bool { - ecstore_bucket::utils::has_bad_path_component(object) -} - -pub(crate) fn is_meta_bucketname(bucket: &str) -> bool { - ecstore_bucket::utils::is_meta_bucketname(bucket) -} - -pub(crate) fn is_valid_object_prefix(object: &str) -> bool { - ecstore_bucket::utils::is_valid_object_prefix(object) -} diff --git a/fuzz/fuzz_targets/path_containment.rs b/fuzz/fuzz_targets/path_containment.rs index 406066408..2bba67086 100644 --- a/fuzz/fuzz_targets/path_containment.rs +++ b/fuzz/fuzz_targets/path_containment.rs @@ -1,8 +1,9 @@ #![no_main] use libfuzzer_sys::fuzz_target; -mod ecstore_fuzz_compat; -use ecstore_fuzz_compat::{check_object_name_for_length_and_slash, has_bad_path_component, is_valid_object_prefix}; +use rustfs_ecstore::api::bucket::utils::{ + check_object_name_for_length_and_slash, has_bad_path_component, is_valid_object_prefix, +}; use rustfs_utils::path::{clean, path_join}; use std::path::{Path, PathBuf}; diff --git a/rustfs/src/storage/ecstore_compat.rs b/rustfs/src/storage/ecstore_compat.rs deleted file mode 100644 index 5edf6e573..000000000 --- a/rustfs/src/storage/ecstore_compat.rs +++ /dev/null @@ -1,142 +0,0 @@ -// 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. - -pub(crate) mod ecstore_admin { - pub(crate) use rustfs_ecstore::api::admin::{get_local_server_property, get_server_info}; -} - -pub(crate) mod ecstore_bucket { - pub(crate) use rustfs_ecstore::api::bucket::{ - bandwidth, bucket_target_sys, lifecycle, metadata, metadata_sys, migration, object_lock, policy_sys, replication, - tagging, target, utils, - }; - pub(crate) use rustfs_ecstore::api::bucket::{quota, versioning, versioning_sys}; -} - -pub(crate) mod ecstore_capacity { - pub(crate) use rustfs_ecstore::api::capacity::{ - PoolDecommissionInfo, PoolStatus, get_total_usable_capacity, get_total_usable_capacity_free, - is_reserved_or_invalid_bucket, - }; -} - -pub(crate) mod ecstore_client { - pub(crate) use rustfs_ecstore::api::client::{admin_handler_utils, object_api_utils, transition_api}; -} - -pub(crate) mod ecstore_compression { - pub(crate) use rustfs_ecstore::api::compression::{MIN_DISK_COMPRESSIBLE_SIZE, is_disk_compressible}; -} - -pub(crate) mod ecstore_cluster { - pub(crate) use rustfs_ecstore::api::cluster::topology_snapshot_from_endpoint_pools_with_capabilities; -} - -pub(crate) mod ecstore_config { - pub(crate) use rustfs_ecstore::api::config::{ - com, init, init_global_config_sys, set_global_storage_class, storageclass, try_migrate_server_config, - }; -} - -pub(crate) mod ecstore_data_usage { - pub(crate) use rustfs_ecstore::api::data_usage::{ - apply_bucket_usage_memory_overlay, load_data_usage_from_backend, record_bucket_object_delete_memory, - record_bucket_object_write_memory, - }; -} - -#[allow(unused_imports)] -pub(crate) mod ecstore_disk { - pub(crate) use rustfs_ecstore::api::disk::{ - CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskStore, FileInfoVersions, FileReader, FileWriter, - RUSTFS_META_BUCKET, ReadMultipleReq, ReadMultipleResp, ReadOptions, RenameDataResp, UpdateMetadataOpts, VolumeInfo, - WalkDirOptions, - }; - pub(crate) use rustfs_ecstore::api::disk::{endpoint, error, error_reduce}; -} - -pub(crate) mod ecstore_error { - pub(crate) use rustfs_ecstore::api::error::{ - Error, Result, StorageError, is_err_bucket_not_found, is_err_object_not_found, is_err_version_not_found, - }; -} - -pub(crate) mod ecstore_event { - pub(crate) use rustfs_ecstore::api::event::{EventArgs, register_event_dispatch_hook}; -} - -pub(crate) mod ecstore_global { - pub(crate) use rustfs_ecstore::api::global::{ - GLOBAL_BOOT_TIME, GLOBAL_TierConfigMgr, get_global_bucket_monitor, get_global_deployment_id, get_global_endpoints_opt, - get_global_lock_client, get_global_lock_clients, get_global_region, get_global_tier_config_mgr, global_rustfs_port, - is_dist_erasure, new_object_layer_fn, resolve_object_store_handle, set_global_endpoints, set_global_region, - set_global_rustfs_port, set_object_store_resolver, shutdown_background_services, update_erasure_type, - }; -} - -#[allow(unused_imports)] -pub(crate) mod ecstore_layout { - pub(crate) use rustfs_ecstore::api::layout::{DisksLayout, EndpointServerPools, Endpoints, PoolEndpoints, SetupType}; -} - -pub(crate) mod ecstore_metrics { - pub(crate) use rustfs_ecstore::api::metrics::{CollectMetricsOpts, MetricType, collect_local_metrics}; -} - -#[allow(unused_imports)] -pub(crate) mod ecstore_notification { - pub(crate) use rustfs_ecstore::api::notification::{ - NotificationSys, get_global_notification_sys, new_global_notification_sys, - }; -} - -#[allow(unused_imports)] -pub(crate) mod ecstore_rebalance { - pub(crate) use rustfs_ecstore::api::rebalance::{ - DiskStat, RebalSaveOpt, RebalStatus, RebalanceCleanupWarningEntry, RebalanceCleanupWarnings, RebalanceInfo, - RebalanceMeta, RebalanceStats, RebalanceStopPropagationRecord, decode_rebalance_stop_propagation_record, - encode_rebalance_stop_propagation_record, - }; -} - -pub(crate) mod ecstore_rio { - #[cfg(test)] - pub(crate) use rustfs_ecstore::api::rio::{DecryptReader, EncryptReader, HardLimitReader, Reader, boxed_reader}; - pub(crate) use rustfs_ecstore::api::rio::{ - DynReader, HashReader, ReadStream, WriteEncryption, WritePlan, compression_metadata_value, wrap_reader, - }; -} - -pub(crate) mod ecstore_rpc { - pub(crate) use rustfs_ecstore::api::rpc::{ - LocalPeerS3Client, PEER_RESTSIGNAL, PEER_RESTSUB_SYS, PeerRestClient, PeerS3Client, SERVICE_SIGNAL_REFRESH_CONFIG, - SERVICE_SIGNAL_RELOAD_DYNAMIC, TONIC_RPC_PREFIX, verify_rpc_signature, - }; -} - -pub(crate) mod ecstore_set_disk { - pub(crate) use rustfs_ecstore::api::set_disk::{DEFAULT_READ_BUFFER_SIZE, get_lock_acquire_timeout, is_valid_storage_class}; -} - -pub(crate) mod ecstore_storage { - pub(crate) use rustfs_ecstore::api::storage::{ - ECStore, all_local_disk, all_local_disk_path, find_local_disk_by_ref, init_local_disks, init_lock_clients, - prewarm_local_disk_id_map, - }; -} - -pub(crate) mod ecstore_tier { - pub(crate) use rustfs_ecstore::api::tier::tier::TierConfigMgr; - pub(crate) use rustfs_ecstore::api::tier::{tier, tier_admin, tier_config, tier_handlers, warm_backend}; -} diff --git a/rustfs/src/storage/mod.rs b/rustfs/src/storage/mod.rs index b8a7002c1..2b3dc618c 100644 --- a/rustfs/src/storage/mod.rs +++ b/rustfs/src/storage/mod.rs @@ -56,8 +56,134 @@ pub(crate) use sse::{ use std::sync::Arc; -pub(crate) mod ecstore_compat; -pub(crate) use ecstore_compat::*; +pub(crate) mod ecstore_admin { + pub(crate) use rustfs_ecstore::api::admin::{get_local_server_property, get_server_info}; +} + +pub(crate) mod ecstore_bucket { + pub(crate) use rustfs_ecstore::api::bucket::{ + bandwidth, bucket_target_sys, lifecycle, metadata, metadata_sys, migration, object_lock, policy_sys, replication, + tagging, target, utils, + }; + pub(crate) use rustfs_ecstore::api::bucket::{quota, versioning, versioning_sys}; +} + +pub(crate) mod ecstore_capacity { + pub(crate) use rustfs_ecstore::api::capacity::{ + PoolDecommissionInfo, PoolStatus, get_total_usable_capacity, get_total_usable_capacity_free, + is_reserved_or_invalid_bucket, + }; +} + +pub(crate) mod ecstore_client { + pub(crate) use rustfs_ecstore::api::client::{admin_handler_utils, object_api_utils, transition_api}; +} + +pub(crate) mod ecstore_compression { + pub(crate) use rustfs_ecstore::api::compression::{MIN_DISK_COMPRESSIBLE_SIZE, is_disk_compressible}; +} + +pub(crate) mod ecstore_cluster { + pub(crate) use rustfs_ecstore::api::cluster::topology_snapshot_from_endpoint_pools_with_capabilities; +} + +pub(crate) mod ecstore_config { + pub(crate) use rustfs_ecstore::api::config::{ + com, init, init_global_config_sys, set_global_storage_class, storageclass, try_migrate_server_config, + }; +} + +pub(crate) mod ecstore_data_usage { + pub(crate) use rustfs_ecstore::api::data_usage::{ + apply_bucket_usage_memory_overlay, load_data_usage_from_backend, record_bucket_object_delete_memory, + record_bucket_object_write_memory, + }; +} + +#[allow(unused_imports)] +pub(crate) mod ecstore_disk { + pub(crate) use rustfs_ecstore::api::disk::{ + CheckPartsResp, DeleteOptions, DiskAPI, DiskInfo, DiskInfoOptions, DiskStore, FileInfoVersions, FileReader, FileWriter, + RUSTFS_META_BUCKET, ReadMultipleReq, ReadMultipleResp, ReadOptions, RenameDataResp, UpdateMetadataOpts, VolumeInfo, + WalkDirOptions, + }; + pub(crate) use rustfs_ecstore::api::disk::{endpoint, error, error_reduce}; +} + +pub(crate) mod ecstore_error { + pub(crate) use rustfs_ecstore::api::error::{ + Error, Result, StorageError, is_err_bucket_not_found, is_err_object_not_found, is_err_version_not_found, + }; +} + +pub(crate) mod ecstore_event { + pub(crate) use rustfs_ecstore::api::event::{EventArgs, register_event_dispatch_hook}; +} + +pub(crate) mod ecstore_global { + pub(crate) use rustfs_ecstore::api::global::{ + GLOBAL_BOOT_TIME, GLOBAL_TierConfigMgr, get_global_bucket_monitor, get_global_deployment_id, get_global_endpoints_opt, + get_global_lock_client, get_global_lock_clients, get_global_region, get_global_tier_config_mgr, global_rustfs_port, + is_dist_erasure, new_object_layer_fn, resolve_object_store_handle, set_global_endpoints, set_global_region, + set_global_rustfs_port, set_object_store_resolver, shutdown_background_services, update_erasure_type, + }; +} + +#[allow(unused_imports)] +pub(crate) mod ecstore_layout { + pub(crate) use rustfs_ecstore::api::layout::{DisksLayout, EndpointServerPools, Endpoints, PoolEndpoints, SetupType}; +} + +pub(crate) mod ecstore_metrics { + pub(crate) use rustfs_ecstore::api::metrics::{CollectMetricsOpts, MetricType, collect_local_metrics}; +} + +#[allow(unused_imports)] +pub(crate) mod ecstore_notification { + pub(crate) use rustfs_ecstore::api::notification::{ + NotificationSys, get_global_notification_sys, new_global_notification_sys, + }; +} + +#[allow(unused_imports)] +pub(crate) mod ecstore_rebalance { + pub(crate) use rustfs_ecstore::api::rebalance::{ + DiskStat, RebalSaveOpt, RebalStatus, RebalanceCleanupWarningEntry, RebalanceCleanupWarnings, RebalanceInfo, + RebalanceMeta, RebalanceStats, RebalanceStopPropagationRecord, decode_rebalance_stop_propagation_record, + encode_rebalance_stop_propagation_record, + }; +} + +pub(crate) mod ecstore_rio { + #[cfg(test)] + pub(crate) use rustfs_ecstore::api::rio::{DecryptReader, EncryptReader, HardLimitReader, Reader, boxed_reader}; + pub(crate) use rustfs_ecstore::api::rio::{ + DynReader, HashReader, ReadStream, WriteEncryption, WritePlan, compression_metadata_value, wrap_reader, + }; +} + +pub(crate) mod ecstore_rpc { + pub(crate) use rustfs_ecstore::api::rpc::{ + LocalPeerS3Client, PEER_RESTSIGNAL, PEER_RESTSUB_SYS, PeerRestClient, PeerS3Client, SERVICE_SIGNAL_REFRESH_CONFIG, + SERVICE_SIGNAL_RELOAD_DYNAMIC, TONIC_RPC_PREFIX, verify_rpc_signature, + }; +} + +pub(crate) mod ecstore_set_disk { + pub(crate) use rustfs_ecstore::api::set_disk::{DEFAULT_READ_BUFFER_SIZE, get_lock_acquire_timeout, is_valid_storage_class}; +} + +pub(crate) mod ecstore_storage { + pub(crate) use rustfs_ecstore::api::storage::{ + ECStore, all_local_disk, all_local_disk_path, find_local_disk_by_ref, init_local_disks, init_lock_clients, + prewarm_local_disk_id_map, + }; +} + +pub(crate) mod ecstore_tier { + pub(crate) use rustfs_ecstore::api::tier::tier::TierConfigMgr; + pub(crate) use rustfs_ecstore::api::tier::{tier, tier_admin, tier_config, tier_handlers, warm_backend}; +} pub(crate) const BUCKET_ACCELERATE_CONFIG: &str = ecstore_bucket::metadata::BUCKET_ACCELERATE_CONFIG; pub(crate) const BUCKET_LOGGING_CONFIG: &str = ecstore_bucket::metadata::BUCKET_LOGGING_CONFIG; diff --git a/scripts/check_architecture_migration_rules.sh b/scripts/check_architecture_migration_rules.sh index 80a554e0d..c29df942e 100755 --- a/scripts/check_architecture_migration_rules.sh +++ b/scripts/check_architecture_migration_rules.sh @@ -736,7 +736,7 @@ fi --glob '!**/ecstore_test_compat/**' \ --glob '!**/ecstore_fuzz_compat.rs' \ --glob '!target/**' \ - | rg -v '^(rustfs/src/(admin/mod|app/mod)\.rs|crates/e2e_test/src/(replication_extension_test|reliant/(grpc_lock_client|node_interact_test))\.rs|crates/heal/src/heal/mod\.rs|crates/heal/tests/(endpoint_index_test|heal_bug_fixes_test|heal_integration_test)\.rs|crates/iam/src/lib\.rs|crates/notify/src/lib\.rs|crates/obs/src/metrics/mod\.rs|crates/protocols/src/swift/mod\.rs|crates/s3select-api/src/lib\.rs|crates/scanner/src/lib\.rs|crates/scanner/tests/lifecycle_integration_test\.rs|fuzz/fuzz_targets/(bucket_validation|path_containment)\.rs):' || true + | rg -v '^(rustfs/src/(admin/mod|app/mod|storage/mod)\.rs|crates/e2e_test/src/(replication_extension_test|reliant/(grpc_lock_client|node_interact_test))\.rs|crates/heal/src/heal/mod\.rs|crates/heal/tests/(endpoint_index_test|heal_bug_fixes_test|heal_integration_test)\.rs|crates/iam/src/lib\.rs|crates/notify/src/lib\.rs|crates/obs/src/metrics/mod\.rs|crates/protocols/src/swift/mod\.rs|crates/s3select-api/src/lib\.rs|crates/scanner/src/lib\.rs|crates/scanner/tests/lifecycle_integration_test\.rs|fuzz/fuzz_targets/(bucket_validation|path_containment)\.rs):' || true ) | cat >"$DIRECT_ECSTORE_IMPORT_HITS_FILE" @@ -1085,7 +1085,7 @@ fi --glob '!**/ecstore_compat.rs' \ --glob '!**/ecstore_test_compat.rs' \ --glob '!**/ecstore_test_compat/**' | - rg -v '^(fuzz/fuzz_targets/bucket_validation\.rs|fuzz/fuzz_targets/path_containment\.rs|crates/e2e_test/src/reliant/grpc_lock_client\.rs|crates/e2e_test/src/reliant/node_interact_test\.rs|crates/e2e_test/src/replication_extension_test\.rs|crates/heal/src/heal/mod\.rs|crates/heal/tests/endpoint_index_test\.rs|crates/heal/tests/heal_bug_fixes_test\.rs|crates/heal/tests/heal_integration_test\.rs|crates/iam/src/lib\.rs|crates/notify/src/lib\.rs|crates/obs/src/metrics/mod\.rs|crates/protocols/src/swift/mod\.rs|crates/s3select-api/src/lib\.rs|crates/scanner/src/lib\.rs|crates/scanner/tests/lifecycle_integration_test\.rs|rustfs/src/admin/mod\.rs|rustfs/src/app/mod\.rs):' || true + rg -v '^(fuzz/fuzz_targets/bucket_validation\.rs|fuzz/fuzz_targets/path_containment\.rs|crates/e2e_test/src/reliant/grpc_lock_client\.rs|crates/e2e_test/src/reliant/node_interact_test\.rs|crates/e2e_test/src/replication_extension_test\.rs|crates/heal/src/heal/mod\.rs|crates/heal/tests/endpoint_index_test\.rs|crates/heal/tests/heal_bug_fixes_test\.rs|crates/heal/tests/heal_integration_test\.rs|crates/iam/src/lib\.rs|crates/notify/src/lib\.rs|crates/obs/src/metrics/mod\.rs|crates/protocols/src/swift/mod\.rs|crates/s3select-api/src/lib\.rs|crates/scanner/src/lib\.rs|crates/scanner/tests/lifecycle_integration_test\.rs|rustfs/src/admin/mod\.rs|rustfs/src/app/mod\.rs|rustfs/src/storage/mod\.rs):' || true ) >"$ALL_ECSTORE_API_RAW_SUBPATH_HITS_FILE" if [[ -s "$ALL_ECSTORE_API_RAW_SUBPATH_HITS_FILE" ]]; then @@ -1285,7 +1285,7 @@ fi crates/scanner/src \ --glob '*.rs' \ --glob '!**/ecstore_compat.rs' | - rg -v '^(crates/notify/src/lib.rs|crates/obs/src/metrics/mod.rs|crates/protocols/src/swift/mod.rs|crates/s3select-api/src/lib.rs):' || true + rg -v '^(crates/heal/src/heal/mod.rs|crates/iam/src/lib.rs|crates/notify/src/lib.rs|crates/obs/src/metrics/mod.rs|crates/protocols/src/swift/mod.rs|crates/s3select-api/src/lib.rs|crates/scanner/src/lib.rs):' || true ) >"$EXTERNAL_RUNTIME_ECSTORE_COMPAT_BYPASS_HITS_FILE" if [[ -s "$EXTERNAL_RUNTIME_ECSTORE_COMPAT_BYPASS_HITS_FILE" ]]; then @@ -1299,24 +1299,23 @@ fi crates/scanner/tests \ crates/e2e_test/src \ --glob '*.rs' \ - --glob '!**/ecstore_test_compat.rs' \ - --glob '!**/ecstore_test_compat/**' || true + | rg -v '^(crates/e2e_test/src/(replication_extension_test|reliant/(grpc_lock_client|node_interact_test))\.rs|crates/heal/tests/(endpoint_index_test|heal_bug_fixes_test|heal_integration_test)\.rs|crates/scanner/tests/lifecycle_integration_test\.rs):' || true ) >"$EXTERNAL_TEST_ECSTORE_COMPAT_BYPASS_HITS_FILE" if [[ -s "$EXTERNAL_TEST_ECSTORE_COMPAT_BYPASS_HITS_FILE" ]]; then - report_failure "external test crates must source ECStore API symbols through their ecstore_test_compat boundary: $(paste -sd '; ' "$EXTERNAL_TEST_ECSTORE_COMPAT_BYPASS_HITS_FILE")" + report_failure "external test ECStore API imports must stay in owner test files: $(paste -sd '; ' "$EXTERNAL_TEST_ECSTORE_COMPAT_BYPASS_HITS_FILE")" fi ( cd "$ROOT_DIR" rg -n --with-filename 'rustfs_ecstore::api::' \ fuzz/fuzz_targets \ - --glob '*.rs' \ - --glob '!**/ecstore_fuzz_compat.rs' || true + --glob '*.rs' | + rg -v '^fuzz/fuzz_targets/(bucket_validation|path_containment)\.rs:' || true ) >"$FUZZ_ECSTORE_COMPAT_BYPASS_HITS_FILE" if [[ -s "$FUZZ_ECSTORE_COMPAT_BYPASS_HITS_FILE" ]]; then - report_failure "fuzz targets must source ECStore API symbols through ecstore_fuzz_compat: $(paste -sd '; ' "$FUZZ_ECSTORE_COMPAT_BYPASS_HITS_FILE")" + report_failure "fuzz ECStore API imports must stay in owner fuzz targets: $(paste -sd '; ' "$FUZZ_ECSTORE_COMPAT_BYPASS_HITS_FILE")" fi ( @@ -1585,13 +1584,18 @@ fi for file in \ crates/heal/tests/common/storage_compat.rs \ crates/scanner/tests/common/storage_compat.rs \ + crates/e2e_test/src/ecstore_test_compat.rs \ + crates/heal/tests/ecstore_test_compat/mod.rs \ + crates/scanner/tests/ecstore_test_compat/mod.rs \ + fuzz/fuzz_targets/ecstore_fuzz_compat.rs \ fuzz/fuzz_targets/bucket_validation/storage_compat.rs \ fuzz/fuzz_targets/path_containment/storage_compat.rs; do [[ -e "$file" ]] && printf '%s:1:test/fuzz bridge file exists\n' "$file" done - rg -n --with-filename 'common::storage_compat|storage_compat::|\bmod\s+storage_compat|#\[path\s*=\s*"[^"]*storage_compat\.rs"\]' \ + rg -n --with-filename 'common::storage_compat|storage_compat::|\bmod\s+storage_compat|#\[path\s*=\s*"[^"]*storage_compat\.rs"\]|ecstore_test_compat|ecstore_fuzz_compat' \ + crates/e2e_test/src \ crates/heal/tests \ - crates/scanner/tests/lifecycle_integration_test.rs \ + crates/scanner/tests \ fuzz/fuzz_targets/bucket_validation.rs \ fuzz/fuzz_targets/path_containment.rs \ -g '*.rs' || true @@ -1599,7 +1603,7 @@ fi ) >"$TEST_FUZZ_COMPAT_BRIDGE_HITS_FILE" if [[ -s "$TEST_FUZZ_COMPAT_BRIDGE_HITS_FILE" ]]; then - report_failure "heal/scanner test and fuzz targets must import ECStore owner APIs directly instead of local storage compatibility bridges: $(paste -sd '; ' "$TEST_FUZZ_COMPAT_BRIDGE_HITS_FILE")" + report_failure "test and fuzz targets must import ECStore owner APIs directly instead of local compatibility bridges: $(paste -sd '; ' "$TEST_FUZZ_COMPAT_BRIDGE_HITS_FILE")" fi ( @@ -1607,6 +1611,9 @@ fi { for file in \ crates/e2e_test/src/storage_compat.rs \ + rustfs/src/storage/ecstore_compat.rs \ + crates/heal/src/heal/ecstore_compat.rs \ + crates/iam/src/ecstore_compat.rs \ crates/iam/src/store/storage_compat.rs \ crates/notify/src/ecstore_compat.rs \ crates/notify/src/storage_compat.rs \ @@ -1614,6 +1621,7 @@ fi crates/obs/src/storage_compat.rs \ crates/protocols/src/swift/ecstore_compat.rs \ crates/protocols/src/swift/storage_compat.rs \ + crates/scanner/src/ecstore_compat.rs \ crates/s3select-api/src/ecstore_compat.rs \ crates/s3select-api/src/storage_compat.rs; do [[ -e "$file" ]] && printf '%s:1:standalone thin bridge file exists\n' "$file" @@ -1626,9 +1634,13 @@ fi crates/s3select-api/src \ -g '*.rs' || true rg -n --with-filename 'ecstore_compat' \ + rustfs/src/storage \ + crates/heal/src/heal \ + crates/iam/src \ crates/notify/src \ crates/obs/src/metrics \ crates/protocols/src/swift \ + crates/scanner/src \ crates/s3select-api/src \ -g '*.rs' || true rg -n --with-filename '^\s*use\s+super::storage_compat|store::storage_compat|\bmod\s+storage_compat' \ @@ -1638,7 +1650,7 @@ fi ) >"$STANDALONE_THIN_COMPAT_BRIDGE_HITS_FILE" if [[ -s "$STANDALONE_THIN_COMPAT_BRIDGE_HITS_FILE" ]]; then - report_failure "standalone e2e/IAM-store/notify/obs/swift/s3select consumers must import owner APIs directly instead of local thin compatibility bridges: $(paste -sd '; ' "$STANDALONE_THIN_COMPAT_BRIDGE_HITS_FILE")" + report_failure "storage owner and standalone e2e/IAM/heal/scanner/notify/obs/swift/s3select consumers must import owner APIs directly instead of local thin compatibility bridges: $(paste -sd '; ' "$STANDALONE_THIN_COMPAT_BRIDGE_HITS_FILE")" fi (