mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 15:37:02 +00:00
refactor: narrow storage namespace consumers (#3477)
This commit is contained in:
@@ -12,7 +12,6 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use crate::StorageAPI;
|
|
||||||
use crate::cache_value::metacache_set::{ListPathRawOptions, list_path_raw};
|
use crate::cache_value::metacache_set::{ListPathRawOptions, list_path_raw};
|
||||||
use crate::config::com::{read_config_with_metadata, save_config_with_opts};
|
use crate::config::com::{read_config_with_metadata, save_config_with_opts};
|
||||||
use crate::data_movement;
|
use crate::data_movement;
|
||||||
@@ -667,7 +666,7 @@ impl RebalanceMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ECStore {
|
impl ECStore {
|
||||||
async fn save_rebalance_meta_with_merge<S: StorageAPI + NamespaceLocking>(
|
async fn save_rebalance_meta_with_merge<S: ObjectIO + NamespaceLocking>(
|
||||||
&self,
|
&self,
|
||||||
pool: Arc<S>,
|
pool: Arc<S>,
|
||||||
local_snapshot: &RebalanceMeta,
|
local_snapshot: &RebalanceMeta,
|
||||||
|
|||||||
@@ -5,18 +5,16 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
|
|||||||
## Current Context
|
## Current Context
|
||||||
|
|
||||||
- Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660)
|
- Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660)
|
||||||
- Branch: `overtrue/arch-loss-prevention-guards`
|
- Branch: `overtrue/arch-storage-namespace-consumer-cleanup`
|
||||||
- Baseline: `origin/main` at `dd6b4c35ad2c24be432c32645ce17e2d312eac78`
|
- Baseline: `origin/main` at `307d788da1954ddaeac8a55d5040a7ce7d1a213f`
|
||||||
- PR type for this branch: `ci-gate`
|
- PR type for this branch: `consumer-migration`
|
||||||
- Runtime behavior changes: no external behavior change expected.
|
- Runtime behavior changes: no external behavior change expected.
|
||||||
- Rust code changes: split lifecycle transition compensation bucket
|
- Rust code changes: narrow the table catalog object backend and rebalance
|
||||||
reservation from background backfill spawning so the dedupe unit test does
|
metadata merge-save helper from full `StorageAPI` bounds to their actual
|
||||||
not launch an actual compensation task on shared test state.
|
object I/O, object operation, list, and namespace-lock capabilities.
|
||||||
- CI/script changes: extend `scripts/check_architecture_migration_rules.sh` to
|
- CI/script changes: none.
|
||||||
guard public storage-api re-exports, StorageAPI operation-group coverage,
|
- Docs changes: record the current `API-012` consumer cleanup slice and its
|
||||||
NamespaceLocking separation, and ECStore compatibility tests.
|
verification state.
|
||||||
- Docs changes: record `G-006` completion and document the guarded
|
|
||||||
loss-prevention coverage in `crate-boundaries.md`.
|
|
||||||
|
|
||||||
## Phase 0 Tasks
|
## Phase 0 Tasks
|
||||||
|
|
||||||
@@ -461,6 +459,9 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
|
|||||||
namespace locking directly on ECStore storage types, and remove the
|
namespace locking directly on ECStore storage types, and remove the
|
||||||
temporary namespace-lock compatibility method from the full storage trait
|
temporary namespace-lock compatibility method from the full storage trait
|
||||||
and cleanup register entry.
|
and cleanup register entry.
|
||||||
|
- Current cleanup slice: narrow remaining table catalog backend and rebalance
|
||||||
|
metadata helper consumers away from full `StorageAPI` where they only need
|
||||||
|
object I/O, object operations, list operations, and namespace locking.
|
||||||
- Acceptance: table catalog object backend contracts express the actual
|
- Acceptance: table catalog object backend contracts express the actual
|
||||||
object read/write, metadata/delete, list, and namespace-lock capabilities
|
object read/write, metadata/delete, list, and namespace-lock capabilities
|
||||||
they need; namespace-lock consumers depend on `NamespaceLocking` instead of
|
they need; namespace-lock consumers depend on `NamespaceLocking` instead of
|
||||||
@@ -753,43 +754,38 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
|
|||||||
|
|
||||||
| Expert | Status | Notes |
|
| Expert | Status | Notes |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| Quality/architecture | passed | CI-gate slice extends the existing migration rule script instead of adding a parallel guard system. |
|
| Quality/architecture | passed | Trait bounds now express the actual object I/O, object operation, list, and namespace-lock capabilities without adding abstractions or changing method bodies. |
|
||||||
| Migration preservation | passed | Guards fail on public storage-api re-export drift, StorageAPI operation-group drift, NamespaceLocking collapse, or missing ECStore compatibility tests without changing runtime behavior. |
|
| Migration preservation | passed | Lock acquisition, table catalog object paths, optimistic preconditions, pagination, missing-object handling, and rebalance metadata save semantics are unchanged. |
|
||||||
| Testing/verification | passed | Script syntax, migration/layer guards, lifecycle compensation dedupe test, ECStore compatibility test, compile check, formatting, diff hygiene, and full `make pre-commit` passed. |
|
| Testing/verification | passed | Focused table catalog and rebalance tests, compile check, migration/layer guards, formatting, diff hygiene, Rust risk scan, and full `make pre-commit` passed. |
|
||||||
|
|
||||||
## Verification Notes
|
## Verification Notes
|
||||||
|
|
||||||
Passed on `dd6b4c35ad2c24be432c32645ce17e2d312eac78`:
|
Passed on `307d788da1954ddaeac8a55d5040a7ce7d1a213f`:
|
||||||
|
|
||||||
- `bash -n scripts/check_architecture_migration_rules.sh`: passed.
|
- `cargo test -p rustfs table_catalog --no-fail-fast`: passed.
|
||||||
|
- `cargo test -p rustfs-ecstore rebalance --no-fail-fast`: passed.
|
||||||
|
- `cargo check -p rustfs -p rustfs-ecstore`: passed.
|
||||||
- `./scripts/check_architecture_migration_rules.sh`: passed.
|
- `./scripts/check_architecture_migration_rules.sh`: passed.
|
||||||
- `./scripts/check_layer_dependencies.sh`: passed.
|
- `./scripts/check_layer_dependencies.sh`: passed.
|
||||||
- `cargo test -p rustfs-ecstore --test storage_api_compat_test --no-fail-fast`:
|
|
||||||
passed.
|
|
||||||
- `cargo test -p rustfs-ecstore bucket::lifecycle::bucket_lifecycle_ops::tests::reserve_bucket_compensation_deduplicates_same_bucket --no-fail-fast`:
|
|
||||||
passed.
|
|
||||||
- `cargo check -p rustfs-ecstore`: passed.
|
|
||||||
- `cargo fmt --all --check`: passed.
|
- `cargo fmt --all --check`: passed.
|
||||||
- `git diff --check`: passed.
|
- `git diff --check`: passed.
|
||||||
- Rust risk scan: no new production `unwrap`/`expect`, lossy casts, string
|
- Rust risk scan: no new production `unwrap`/`expect`, lossy casts, string
|
||||||
errors, public boxed errors, or production `println`/`eprintln`.
|
errors, public boxed errors, production `println`/`eprintln`, or relaxed
|
||||||
|
atomics in added Rust lines.
|
||||||
- `make pre-commit`: passed.
|
- `make pre-commit`: passed.
|
||||||
- `git rev-list --left-right --count HEAD...origin/main`: returned `1 0`
|
|
||||||
after commit.
|
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
- This slice completes the `G-006` loss-prevention follow-up with script-level
|
- This slice keeps the existing table catalog and rebalance method bodies
|
||||||
checks for the public re-export and storage trait coverage called out in the
|
unchanged while narrowing the generic storage capabilities they require.
|
||||||
migration checklist.
|
- Table catalog storage still depends on object metadata, object writes,
|
||||||
- The script reads existing source/test surfaces and does not introduce a new
|
listing, and namespace locking; rebalance metadata merge-save only needs
|
||||||
runtime behavior path.
|
object I/O plus namespace locking.
|
||||||
- The lifecycle compensation dedupe test now covers reservation directly,
|
- The slice does not remove the full storage facade or move traits across crate
|
||||||
avoiding a spawned backfill task that can inherit shared object-store test
|
boundaries.
|
||||||
state during the full pre-commit run.
|
|
||||||
|
|
||||||
## Handoff Notes
|
## Handoff Notes
|
||||||
|
|
||||||
- G-006 is implemented, locally verified, and current with `origin/main`.
|
- API-012 cleanup is locally verified and current with `origin/main`.
|
||||||
- Larger cleanup slices can now rely on migration rules to catch accidental
|
- Remaining namespace-lock cleanup can continue by migrating other consumers
|
||||||
public storage-api re-export drift and storage trait coverage loss.
|
that no longer need the full storage facade.
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ use rustfs_ecstore::disk::RUSTFS_META_BUCKET;
|
|||||||
use rustfs_ecstore::error::StorageError;
|
use rustfs_ecstore::error::StorageError;
|
||||||
use rustfs_ecstore::{
|
use rustfs_ecstore::{
|
||||||
set_disk::get_lock_acquire_timeout,
|
set_disk::get_lock_acquire_timeout,
|
||||||
store_api::{HTTPPreconditions, NamespaceLocking, ObjectOptions, PutObjReader, StorageAPI},
|
store_api::{HTTPPreconditions, ListOperations, NamespaceLocking, ObjectIO, ObjectOperations, ObjectOptions, PutObjReader},
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
||||||
use time::{Duration, OffsetDateTime};
|
use time::{Duration, OffsetDateTime};
|
||||||
@@ -2688,7 +2688,7 @@ impl<S> Clone for EcStoreTableCatalogObjectBackend<S> {
|
|||||||
|
|
||||||
impl<S> EcStoreTableCatalogObjectBackend<S>
|
impl<S> EcStoreTableCatalogObjectBackend<S>
|
||||||
where
|
where
|
||||||
S: StorageAPI + NamespaceLocking,
|
S: ObjectIO + ObjectOperations + ListOperations + NamespaceLocking,
|
||||||
{
|
{
|
||||||
pub fn new(store: Arc<S>) -> Self {
|
pub fn new(store: Arc<S>) -> Self {
|
||||||
Self { store }
|
Self { store }
|
||||||
@@ -2700,7 +2700,7 @@ pub(crate) type EcStoreTableCatalogStore<S> = ObjectTableCatalogStore<EcStoreTab
|
|||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl<S> TableCatalogObjectBackend for EcStoreTableCatalogObjectBackend<S>
|
impl<S> TableCatalogObjectBackend for EcStoreTableCatalogObjectBackend<S>
|
||||||
where
|
where
|
||||||
S: StorageAPI + NamespaceLocking,
|
S: ObjectIO + ObjectOperations + ListOperations + NamespaceLocking,
|
||||||
{
|
{
|
||||||
async fn read_object(&self, bucket: &str, object: &str) -> TableCatalogStoreResult<Option<TableCatalogObject>> {
|
async fn read_object(&self, bucket: &str, object: &str) -> TableCatalogStoreResult<Option<TableCatalogObject>> {
|
||||||
self.read_object_with_options(bucket, object, ObjectOptions::default()).await
|
self.read_object_with_options(bucket, object, ObjectOptions::default()).await
|
||||||
@@ -2799,7 +2799,7 @@ where
|
|||||||
|
|
||||||
impl<S> EcStoreTableCatalogObjectBackend<S>
|
impl<S> EcStoreTableCatalogObjectBackend<S>
|
||||||
where
|
where
|
||||||
S: StorageAPI + NamespaceLocking,
|
S: ObjectIO + ObjectOperations + ListOperations + NamespaceLocking,
|
||||||
{
|
{
|
||||||
async fn read_object_with_options(
|
async fn read_object_with_options(
|
||||||
&self,
|
&self,
|
||||||
|
|||||||
Reference in New Issue
Block a user