mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-27 00:38:16 +00:00
7ead413599
Phase 5 Slice 12 (backlog#939): move the local disk registry — the path->disk map, the disk-id->endpoint map, and the pool/set/drive layout — out of the three GLOBAL_LOCAL_DISK_* process statics into the per-instance InstanceContext. This is the migration the owned-guard prerequisite (#4501) unblocked. - InstanceContext gains three `Arc<RwLock<..>>` registry fields, constructed eagerly (empty), plus pub(crate) handle accessors. - The three runtime-source handle functions (`local_disk_map_handle` etc.) now return the current instance's registry via `current_ctx()`; every direct `GLOBAL_LOCAL_DISK_*` access in runtime::sources (~15 sites) routes through those handles instead. Accessors that hold a write guard across `.await` (`record_local_disks`, `initialize_local_disk_maps`, `replace_local_disk_id`) bind the handle first, so the same locks are held across the same awaits. - The three statics are removed; the test-reset helper clears the current context's registry. Construction window: the registry is populated during storage startup, before the ECStore exists, via the bootstrap context that `ECStore::new` then adopts — so startup writes and post-construction reads share one registry (no split-brain). Single-instance behavior is byte-for-byte unchanged; the GLOBAL_LOCAL_DISK_* boundary arch guard passes with the statics gone. Verification: cargo test -p rustfs-ecstore (32 disk/instance tests green) and -p rustfs-heal (201 green), cargo clippy -p rustfs-ecstore -p rustfs-heal --all-targets (clean), make pre-commit (pass). Refs: backlog#939 (Phase 5, Slice 12; disk-registry migration)