From 08371a6e09d6193cc9d2979b8611ead71447f359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Thu, 18 Jun 2026 18:31:14 +0800 Subject: [PATCH] refactor: narrow storage compatibility exports (#3576) --- crates/e2e_test/src/storage_compat.rs | 6 ++- crates/heal/tests/common/storage_compat.rs | 6 ++- crates/iam/src/storage_compat.rs | 6 ++- crates/notify/src/storage_compat.rs | 6 ++- crates/obs/src/storage_compat.rs | 6 ++- crates/s3select-api/src/storage_compat.rs | 6 ++- crates/scanner/tests/common/storage_compat.rs | 6 ++- docs/architecture/migration-progress.md | 41 +++++++++++++------ fuzz/fuzz_targets/storage_compat.rs | 6 ++- rustfs/src/admin/storage_compat.rs | 9 +++- rustfs/src/app/storage_compat.rs | 9 +++- rustfs/src/storage/storage_compat.rs | 9 +++- rustfs/src/storage_compat.rs | 9 +++- 13 files changed, 100 insertions(+), 25 deletions(-) diff --git a/crates/e2e_test/src/storage_compat.rs b/crates/e2e_test/src/storage_compat.rs index 686c7ff06..60866f84d 100644 --- a/crates/e2e_test/src/storage_compat.rs +++ b/crates/e2e_test/src/storage_compat.rs @@ -12,4 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{bucket, disk, rpc}; +} diff --git a/crates/heal/tests/common/storage_compat.rs b/crates/heal/tests/common/storage_compat.rs index 686c7ff06..ed44e47e2 100644 --- a/crates/heal/tests/common/storage_compat.rs +++ b/crates/heal/tests/common/storage_compat.rs @@ -12,4 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{bucket, disk, endpoints, store}; +} diff --git a/crates/iam/src/storage_compat.rs b/crates/iam/src/storage_compat.rs index 686c7ff06..cd80ec2bd 100644 --- a/crates/iam/src/storage_compat.rs +++ b/crates/iam/src/storage_compat.rs @@ -12,4 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{config, error, global, notification_sys, store}; +} diff --git a/crates/notify/src/storage_compat.rs b/crates/notify/src/storage_compat.rs index 29fadaf90..508075f54 100644 --- a/crates/notify/src/storage_compat.rs +++ b/crates/notify/src/storage_compat.rs @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{config, global, store_api}; +} pub type NotifyObjectInfo = ecstore::store_api::ObjectInfo; diff --git a/crates/obs/src/storage_compat.rs b/crates/obs/src/storage_compat.rs index 686c7ff06..d9f4782a4 100644 --- a/crates/obs/src/storage_compat.rs +++ b/crates/obs/src/storage_compat.rs @@ -12,4 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{bucket, data_usage, global, pools, resolve_object_store_handle}; +} diff --git a/crates/s3select-api/src/storage_compat.rs b/crates/s3select-api/src/storage_compat.rs index bba85acfc..d0a4acb82 100644 --- a/crates/s3select-api/src/storage_compat.rs +++ b/crates/s3select-api/src/storage_compat.rs @@ -12,7 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{error, resolve_object_store_handle, set_disk, store, store_api}; +} use ecstore::store_api::{ GetObjectReader as EcstoreGetObjectReader, ObjectInfo as EcstoreObjectInfo, ObjectOptions as EcstoreObjectOptions, diff --git a/crates/scanner/tests/common/storage_compat.rs b/crates/scanner/tests/common/storage_compat.rs index 686c7ff06..f33da8e08 100644 --- a/crates/scanner/tests/common/storage_compat.rs +++ b/crates/scanner/tests/common/storage_compat.rs @@ -12,4 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{bucket, client, disk, endpoints, global, pools, store, tier}; +} diff --git a/docs/architecture/migration-progress.md b/docs/architecture/migration-progress.md index be345243c..bcdc714cc 100644 --- a/docs/architecture/migration-progress.md +++ b/docs/architecture/migration-progress.md @@ -5,21 +5,17 @@ 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-test-harness-fuzz-storage-boundaries` -- Baseline: `origin/main` after `rustfs/rustfs#3572` merged as - `8313767f75f694cb8cf1fb47e5c0f44dfc5bf2b8`. +- Branch: `overtrue/arch-narrow-storage-compat-exports` +- Baseline: `origin/main` after `rustfs/rustfs#3573` merged as + `c098184c67a80ed9c8e31ac7fd2587fddfa1799e`. - PR type for this branch: `consumer-migration` -- Runtime behavior changes: no migration behavior change expected; CI follow-up - preserves empty-object erasure recovery by avoiding zero-byte SIMD decode. -- Rust code changes: add RustFS root, observability, IAM, test harness, and - fuzz ECStore compatibility boundaries; extend notify and S3 Select - boundaries; route runtime, server, startup, capacity, table catalog, obs, - notify, S3 Select, IAM, scanner/heal integration tests, e2e helpers, and - fuzz direct ECStore imports through local boundaries. ECStore-owned - definitions and runtime behavior stay in ECStore. +- Runtime behavior changes: no migration behavior change expected. +- Rust code changes: narrow RustFS, obs, notify, S3 Select, IAM, scanner/heal + test, e2e, and fuzz ECStore compatibility boundary modules from whole-crate + aliases to explicit re-export surfaces. ECStore-owned definitions and runtime + behavior stay in ECStore. - CI/script changes: none. -- Docs changes: record the larger runtime/observability/select/IAM plus test - harness/fuzz boundary cleanup slice. +- Docs changes: record the compatibility export surface cleanup slice. ## Phase 0 Tasks @@ -924,6 +920,25 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block migration/layer guards, formatting check, diff hygiene, direct import scan, risk scan, full pre-commit, and required three-expert review passed. +- [x] `API-033` Narrow ECStore compatibility export surfaces. + - Current branch: `overtrue/arch-narrow-storage-compat-exports`. + - Completed slice: replace local whole-crate ECStore compatibility aliases + with explicit re-export modules for RustFS runtime/app/admin/storage, obs, + notify, S3 Select, IAM, scanner/heal integration tests, e2e helpers, and + fuzz targets. + - Acceptance: local ECStore compatibility boundaries expose only the ECStore + modules/functions required by their consumers; direct `rustfs_ecstore` + references remain limited to compatibility boundary modules. + - Must preserve: all runtime, admin, storage, observability, notification, S3 + Select, IAM, scanner/heal test, e2e helper, and fuzz behavior from + API-031/API-032. + - Risk defense: this slice changes compatibility re-export ownership only; it + does not move ECStore definitions, alter runtime control flow, mutate + metadata formats, change test setup semantics, or adjust fuzz inputs. + - Verification: focused compile, fuzz target compile, migration/layer guards, + formatting check, diff hygiene, direct import scan, risk scan, full + pre-commit, and required three-expert review passed. + ## Phase 8 Background Controller Tasks - [x] `BGC-001` Inventory background services. diff --git a/fuzz/fuzz_targets/storage_compat.rs b/fuzz/fuzz_targets/storage_compat.rs index 686c7ff06..f1cc4063d 100644 --- a/fuzz/fuzz_targets/storage_compat.rs +++ b/fuzz/fuzz_targets/storage_compat.rs @@ -12,4 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::bucket; +} diff --git a/rustfs/src/admin/storage_compat.rs b/rustfs/src/admin/storage_compat.rs index 686c7ff06..32da669e2 100644 --- a/rustfs/src/admin/storage_compat.rs +++ b/rustfs/src/admin/storage_compat.rs @@ -12,4 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{ + bucket, client, config, data_usage, disk, endpoints, error, global, metrics_realtime, notification_sys, rebalance, rpc, + store, store_utils, tier, + }; +} diff --git a/rustfs/src/app/storage_compat.rs b/rustfs/src/app/storage_compat.rs index 686c7ff06..eae74e7e5 100644 --- a/rustfs/src/app/storage_compat.rs +++ b/rustfs/src/app/storage_compat.rs @@ -12,4 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{ + admin_server_info, bucket, client, compress, config, data_usage, disk, endpoints, error, global, new_object_layer_fn, + notification_sys, pools, rio, set_disk, set_object_store_resolver, store, tier, + }; +} diff --git a/rustfs/src/storage/storage_compat.rs b/rustfs/src/storage/storage_compat.rs index 686c7ff06..ee9469fb2 100644 --- a/rustfs/src/storage/storage_compat.rs +++ b/rustfs/src/storage/storage_compat.rs @@ -12,4 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{ + admin_server_info, bucket, client, config, disk, error, get_global_lock_client, global, metrics_realtime, + resolve_object_store_handle, rio, rpc, set_disk, store, store_api, + }; +} diff --git a/rustfs/src/storage_compat.rs b/rustfs/src/storage_compat.rs index 686c7ff06..bac20d8e5 100644 --- a/rustfs/src/storage_compat.rs +++ b/rustfs/src/storage_compat.rs @@ -12,4 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub(crate) use rustfs_ecstore as ecstore; +pub(crate) mod ecstore { + #![allow(unused_imports)] + + pub(crate) use rustfs_ecstore::{ + bucket, config, data_usage, disk, disks_layout, endpoints, error, event_notification, global, notification_sys, pools, + resolve_object_store_handle, rpc, set_disk, set_global_endpoints, store, update_erasure_type, + }; +}