refactor: move heal and namespace contracts (#3560)

This commit is contained in:
安正超
2026-06-18 11:00:21 +08:00
committed by GitHub
parent e5cad7ed20
commit 57403525ee
21 changed files with 224 additions and 86 deletions
+3 -2
View File
@@ -95,12 +95,13 @@ Required `rustfs-storage-api` public re-exports:
- `pub use error::{StorageErrorCode, StorageResult};`
- `pub use multipart::{CompletePart, ListMultipartsInfo, ListPartsInfo, MultipartInfo, MultipartUploadResult, PartInfo};`
- `pub use object::{HTTPPreconditions, HTTPRangeError, HTTPRangeSpec, ObjectLockRetentionOptions};`
- `pub use object::{HealOperations, MultipartOperations, NamespaceLocking, ObjectIO, ObjectOperations};`
- `pub use object::{ListObjectVersionsInfo, ListObjectsInfo, ListObjectsV2Info, ListOperations, ObjectInfoOrErr};`
- `pub use object::{ObjectPreconditionError, ObjectPreconditionPart, ObjectPreconditionState};`
- `pub use object::{VersionMarker, WalkOptions, WalkVersionsSortOrder};`
ECStore must keep compile-time coverage for both `StorageAdminApi` and the
separate `NamespaceLocking` operation group.
ECStore must keep compile-time coverage for `StorageAdminApi`, `HealOperations`,
and the separate `NamespaceLocking` operation group.
The old `StorageAPI` aggregate facade must not reappear in production
`crates/ecstore/src` or `rustfs/src` code after the storage operation groups
+51 -31
View File
@@ -5,19 +5,19 @@ 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-object-operation-contracts`
- Baseline: `main` at `3fb4cb3d65a2e037fc2e5ede32bf81c1f15c9fb7`
after the list operations contract merge.
- Branch: `overtrue/arch-storage-operation-consumer-cleanup`
- Baseline: `main` at `e5cad7ed207265f5312c58d8dac6042e31ba95a3`
after the object and multipart operation contract merge.
- PR type for this branch: `api-extraction`
- Runtime behavior changes: no external behavior change expected.
- Rust code changes: move `ObjectIO`, `ObjectOperations`, and
`MultipartOperations` into `rustfs-storage-api` as generic operation
contracts with associated ECStore-bound types, then keep ECStore's existing
public names as fixed associated-type compatibility subtraits.
- CI/script changes: extend migration guards for the object/multipart operation
public re-exports and ECStore local-method regressions.
- Docs changes: record the object and multipart operation contract extraction
slice.
- Rust code changes: move `HealOperations` and `NamespaceLocking` into
`rustfs-storage-api` as generic operation contracts with associated
ECStore-bound types, then keep ECStore's existing public names as fixed
associated-type compatibility subtraits.
- CI/script changes: extend migration guards for the heal/namespace-lock
operation public re-exports and ECStore local-method regressions.
- Docs changes: record the heal and namespace-lock operation contract
extraction slice.
## Phase 0 Tasks
@@ -709,6 +709,28 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
- Verification: focused storage-api tests, ECStore/RustFS/downstream compile
checks, migration/layer guards, formatting, diff hygiene, Rust risk scan,
full pre-commit, and required three-expert review passed.
- [x] `API-023` Move heal and namespace-lock operation contracts.
- Completed slice: move `HealOperations` and `NamespaceLocking` from ECStore
`store_api/traits.rs` into `rustfs-storage-api` as generic public
operation contracts over ECStore heal result/options, namespace-lock
wrapper, and error associated types; keep ECStore's old public trait names
as fixed associated-type compatibility subtraits.
- Acceptance: `rustfs-storage-api` exports the heal and namespace-lock
operation contracts, ECStore no longer defines local heal/namespace-lock
method signatures, focused consumers use the shared trait for method
resolution, and migration guards reject dropping the public storage-api
re-export or reintroducing local ECStore method definitions.
- Must preserve: heal format/bucket/object behavior, abandoned-part checks,
pool/set lookup behavior, namespace-lock acquisition behavior, ECStore
public compatibility bounds, and all runtime lock/heal implementation
bodies.
- Risk defense: only the trait contracts cross into `rustfs-storage-api`;
ECStore keeps concrete associated type bindings, `HealOpts`,
`HealResultItem`, `NamespaceLockWrapper`, lock implementation, peer heal
behavior, set/pool dispatch, and storage error mapping.
- Verification: focused storage-api/ECStore/RustFS/heal/scanner compile
checks, migration/layer guards, formatting, diff hygiene, Rust risk scan,
full pre-commit, and required three-expert review passed.
## Phase 8 Background Controller Tasks
@@ -986,17 +1008,17 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
| Expert | Status | Notes |
|---|---|---|
| Quality/architecture | passed | Generic object I/O, object operation, and multipart operation traits now live in `rustfs-storage-api`; ECStore still owns concrete type bindings and implementations. |
| Migration preservation | passed | Object read/write, metadata/tag/delete, multipart, and existing ECStore generic bound import paths are preserved through compatibility subtraits. |
| Testing/verification | passed | Focused storage-api tests, downstream compile checks, migration/layer guards, formatting, diff hygiene, Rust risk scan, and full `make pre-commit` passed. |
| Quality/architecture | passed | Generic heal and namespace-lock traits now live in `rustfs-storage-api`; ECStore still owns concrete type bindings and implementations. |
| Migration preservation | passed | Existing ECStore public trait names remain as fixed associated-type compatibility subtraits while method resolution moves to shared traits where needed. |
| Testing/verification | passed | Focused storage-api tests, ECStore compat tests, downstream compile checks, migration/layer guards, formatting, diff hygiene, Rust risk scan, and full `make pre-commit` passed. |
## Verification Notes
Passed before push:
- `cargo test -p rustfs-storage-api`: passed.
- `cargo check --tests -p rustfs-storage-api -p rustfs-ecstore -p rustfs -p rustfs-scanner -p rustfs-protocols`: passed.
- `cargo check --tests -p rustfs-heal -p rustfs-protocols`: passed.
- `cargo test -p rustfs-ecstore --test ecstore_contract_compat_test`: passed.
- `cargo check --tests -p rustfs-storage-api -p rustfs-ecstore -p rustfs -p rustfs-heal -p rustfs-scanner`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed.
- `./scripts/check_layer_dependencies.sh`: passed.
- `cargo fmt --all --check`: passed.
@@ -1004,28 +1026,26 @@ Passed before push:
- Rust risk scan: no new `unwrap`/`expect`, panic/todo markers, `unsafe`,
process-spawning calls, lossy casts, println/eprintln, or relaxed ordering in
added Rust lines.
- `make pre-commit`: passed; nextest reported 6204 tests passed and 111
- `make pre-commit`: passed; nextest reported 6207 tests passed and 111
skipped, and doctests passed.
Notes:
- This slice follows the list operations contract branch and keeps the old
- This slice follows the object and multipart operation contract branch and keeps the old
aggregate facade, bucket DTO, multipart DTO, bucket operation contract, object
helper, range helper, list helper, object precondition, list response, and
walk/list operation contract guards active.
- The shared object and multipart operation contracts are now owned by
walk/list/object/multipart operation contract guards active.
- The shared heal and namespace-lock operation contracts are now owned by
`rustfs-storage-api`; ECStore keeps the concrete associated type bindings,
readers, `ObjectInfo`, `ObjectOptions`, `PutObjReader`, filemeta adaptation,
storage error mapping, lifecycle/replication, rio, compression/encryption,
and implementation behavior.
- The slice does not alter object, list, walk, multipart, bucket, delete,
namespace-lock, reader, or tag/metadata runtime behavior.
`HealOpts`, `HealResultItem`, `NamespaceLockWrapper`, lock implementation,
peer heal behavior, set/pool dispatch, and storage error mapping.
- The slice does not alter heal, namespace-lock, object, list, walk,
multipart, bucket, delete, reader, or tag/metadata runtime behavior.
## Handoff Notes
- Object and multipart operation contract cleanup is stacked on the list
operations contract
branch.
- After this lands, remaining storage work can continue by extracting larger
low-coupling object metadata/option/reader slices or by narrowing remaining
operation-group consumers.
- Heal and namespace-lock operation contract cleanup is based on the merged
object and multipart operation contract branch.
- After this lands, remaining storage work can continue by removing low-value
ECStore compatibility imports or extracting larger low-coupling object
metadata/option/reader slices.