diff --git a/crates/ecstore/src/config/com.rs b/crates/ecstore/src/config/com.rs index 259c34f65..3b2729b8b 100644 --- a/crates/ecstore/src/config/com.rs +++ b/crates/ecstore/src/config/com.rs @@ -46,7 +46,6 @@ use rustfs_config::{ SCANNER_SUB_SYS, }; use rustfs_filemeta::FileInfo; -use rustfs_utils::path::SLASH_SEPARATOR; use serde_json::{Map, Value}; use std::collections::{HashMap, HashSet}; use std::sync::LazyLock; @@ -200,8 +199,6 @@ pub const STORAGE_CLASS_SUB_SYS: &str = "storage_class"; pub const COMMA_SEPARATED_LISTS: &[&str] = &[rustfs_config::oidc::OIDC_SCOPES, rustfs_config::oidc::OIDC_OTHER_AUDIENCES]; -static CONFIG_BUCKET: LazyLock = LazyLock::new(|| format!("{RUSTFS_META_BUCKET}{SLASH_SEPARATOR}{CONFIG_PREFIX}")); - type ServerConfigDecryptFn = crate::bucket::migration::LegacyBlobDecryptFn; static SERVER_CONFIG_DECRYPT_FN: LazyLock>> = LazyLock::new(|| RwLock::new(None)); diff --git a/crates/ecstore/src/config/mod.rs b/crates/ecstore/src/config/mod.rs index f1fe35811..5e6e3a3e3 100644 --- a/crates/ecstore/src/config/mod.rs +++ b/crates/ecstore/src/config/mod.rs @@ -13,7 +13,6 @@ // limitations under the License. // #730: configuration migration keeps legacy subsystem definitions available behind this module. -#![allow(dead_code)] mod audit; pub mod com; diff --git a/crates/ecstore/src/config/storageclass.rs b/crates/ecstore/src/config/storageclass.rs index 8f3a25055..043bf508e 100644 --- a/crates/ecstore/src/config/storageclass.rs +++ b/crates/ecstore/src/config/storageclass.rs @@ -189,6 +189,10 @@ impl Config { /// A topology-bound lookup fails closed for unknown drive counts and for /// deserialized legacy configurations that have no pool topology. Legacy /// callers retain scalar compatibility through [`Self::get_parity_for_sc`]. + #[allow( + dead_code, + reason = "per-set parity resolution asserted by this file's tests (backlog#1823)" + )] pub(crate) fn parity_for_sc(&self, sc: &str, drives_per_set: usize) -> Option { if !self.initialized { return None; diff --git a/crates/ecstore/src/core/mod.rs b/crates/ecstore/src/core/mod.rs index c232ed96f..9b9e52f69 100644 --- a/crates/ecstore/src/core/mod.rs +++ b/crates/ecstore/src/core/mod.rs @@ -13,7 +13,6 @@ // limitations under the License. // #730: pool coordination helpers are being migrated behind runtime owners. -#![allow(dead_code)] pub(crate) mod pools; pub(crate) mod sets; diff --git a/crates/ecstore/src/core/pools.rs b/crates/ecstore/src/core/pools.rs index 70aa73bde..f35017760 100644 --- a/crates/ecstore/src/core/pools.rs +++ b/crates/ecstore/src/core/pools.rs @@ -226,6 +226,7 @@ fn ensure_decommission_start_rebalance_meta_allowed(meta: Option<&RebalanceMeta> ensure_decommission_not_rebalancing(meta.is_some_and(is_rebalance_conflicting_with_decommission)) } +#[allow(dead_code, reason = "leader precondition asserted by this file's tests (backlog#1823)")] fn ensure_local_decommission_pool_leaders(endpoints: &EndpointServerPools, indices: &[usize]) -> Result<()> { for idx in indices { ensure_local_decommission_pool_leader(endpoints, *idx)?; @@ -1058,11 +1059,19 @@ fn should_cleanup_decommission_source_entry(decommissioned: usize, total_version } #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[allow( + dead_code, + reason = "terminal-state classification asserted by this file's tests (backlog#1823)" +)] enum DecommissionTerminalState { Completed, Failed, } +#[allow( + dead_code, + reason = "terminal-state classification asserted by this file's tests (backlog#1823)" +)] fn classify_decommission_terminal_state(failed_items_present: bool) -> DecommissionTerminalState { if failed_items_present { DecommissionTerminalState::Failed diff --git a/crates/ecstore/src/data_movement/mod.rs b/crates/ecstore/src/data_movement/mod.rs index a5f631579..8f7d63580 100644 --- a/crates/ecstore/src/data_movement/mod.rs +++ b/crates/ecstore/src/data_movement/mod.rs @@ -13,7 +13,6 @@ // limitations under the License. // #730: data-movement migration keeps staged cleanup helpers until copy paths converge. -#![allow(dead_code)] pub(crate) mod backpressure; @@ -1019,6 +1018,10 @@ struct SourceCleanupDeleteBarrierState { } #[cfg(test)] +#[allow( + dead_code, + reason = "installed by set_disk object tests behind `--features test-util` (backlog#1823)" +)] pub(crate) struct SourceCleanupDeleteBarrier { state: Arc, } @@ -1028,6 +1031,10 @@ static SOURCE_CLEANUP_DELETE_BARRIER: std::sync::OnceLock Self { let state = Arc::new(SourceCleanupDeleteBarrierState { @@ -1166,6 +1173,7 @@ async fn find_data_movement_target_info( } } +#[allow(dead_code, reason = "resume adjudication asserted by this file's tests (backlog#1823)")] fn resolve_data_movement_overwrite_resume_result( err: &Error, target_result: Result>, diff --git a/crates/ecstore/src/event/mod.rs b/crates/ecstore/src/event/mod.rs index ff60c662e..8a8e576ef 100644 --- a/crates/ecstore/src/event/mod.rs +++ b/crates/ecstore/src/event/mod.rs @@ -13,8 +13,6 @@ // limitations under the License. // #730: event target types are retained for notification owner migration. -#![allow(dead_code)] pub mod name; -pub mod targetid; pub mod targetlist; diff --git a/crates/ecstore/src/event/targetid.rs b/crates/ecstore/src/event/targetid.rs deleted file mode 100644 index d41f1e956..000000000 --- a/crates/ecstore/src/event/targetid.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![allow(clippy::all)] -// 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 struct TargetID { - id: String, - name: String, -} - -impl TargetID { - fn to_string(&self) -> String { - format!("{}:{}", self.id, self.name) - } -} diff --git a/crates/ecstore/src/event/targetlist.rs b/crates/ecstore/src/event/targetlist.rs index 29927b068..b63b786ef 100644 --- a/crates/ecstore/src/event/targetlist.rs +++ b/crates/ecstore/src/event/targetlist.rs @@ -12,18 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::event::targetid::TargetID; use std::sync::atomic::AtomicI64; +/// Placeholder notification target list held by `EventNotifier`. +/// +/// The working notification stack lives in `rustfs-notify` / `rustfs-targets`; +/// this type never grew past its counter. `total_events` is read by the +/// notifier's log line but nothing increments it, so that field reports zero. #[derive(Default)] pub struct TargetList { - pub current_send_calls: AtomicI64, pub total_events: AtomicI64, - pub events_skipped: AtomicI64, - pub events_errors_total: AtomicI64, - //pub targets: HashMap, - //pub queue: AsyncEvent, - //pub targetStats: HashMap, } impl TargetList { @@ -31,14 +29,3 @@ impl TargetList { TargetList::default() } } - -struct TargetStat { - current_send_calls: i64, - total_events: i64, - failed_events: i64, -} - -struct TargetIDResult { - id: TargetID, - err: std::io::Error, -} diff --git a/crates/ecstore/src/object_api/mod.rs b/crates/ecstore/src/object_api/mod.rs index e3ed89d93..41c4ff403 100644 --- a/crates/ecstore/src/object_api/mod.rs +++ b/crates/ecstore/src/object_api/mod.rs @@ -13,7 +13,6 @@ // limitations under the License. // #730: object API readers keep staged compatibility paths during facade migration. -#![allow(dead_code)] use crate::bucket::metadata_sys::get_versioning_config; use crate::bucket::replication::{ diff --git a/crates/ecstore/src/object_api/readers.rs b/crates/ecstore/src/object_api/readers.rs index 27178c17d..cc3a1986a 100644 --- a/crates/ecstore/src/object_api/readers.rs +++ b/crates/ecstore/src/object_api/readers.rs @@ -449,10 +449,16 @@ impl GetObjectReader { } enum ReadTransform { - Plain { - visible_offset: usize, - visible_length: i64, - }, + // Written but never read by production code: the enclosing struct already + // carries the same pair as `storage_offset`/`storage_length`. They survive + // as the read plan's test-visible record — four tests assert them by + // literal pattern (`Plain { visible_offset: 6, visible_length: 4 }`), which + // rustc does not count as a read. + #[allow( + dead_code, + reason = "asserted by literal pattern in this file's read-plan tests (backlog#1823)" + )] + Plain { visible_offset: usize, visible_length: i64 }, Compressed { algorithm: CompressionAlgorithm, backend: crate::io_support::rio::ReadCompressionBackend, @@ -1205,20 +1211,7 @@ impl AsyncRead for StreamConsumer { impl Drop for StreamConsumer { fn drop(&mut self) { - if self.consumer_task.is_none() && self.inner.is_some() { - let mut inner = self.inner.take().unwrap(); - let task = tokio::spawn(async move { - let mut buf = [0u8; 8192]; - loop { - match inner.read(&mut buf).await { - Ok(0) => break, // EOF - Ok(_) => continue, // Keep consuming - Err(_) => break, // Error, stop consuming - } - } - }); - self.consumer_task = Some(task); - } + self.ensure_consumer_started(); } } diff --git a/crates/ecstore/src/object_api/types.rs b/crates/ecstore/src/object_api/types.rs index ec79567c8..291b9039a 100644 --- a/crates/ecstore/src/object_api/types.rs +++ b/crates/ecstore/src/object_api/types.rs @@ -172,6 +172,7 @@ impl ObjectLockConfigSnapshot { } } + #[allow(dead_code, reason = "snapshot-scope predicate asserted by this file's tests (backlog#1823)")] pub(crate) fn is_for_store_bucket( &self, store_id: Uuid, diff --git a/crates/ecstore/src/store/init.rs b/crates/ecstore/src/store/init.rs index 2d35b551b..077caf714 100644 --- a/crates/ecstore/src/store/init.rs +++ b/crates/ecstore/src/store/init.rs @@ -13,7 +13,7 @@ // limitations under the License. use super::*; -use crate::core::pools::local_decommission_queue_prefix; +use crate::core::pools::{local_decommission_queue_prefix, pool_meta_has_active_decommission}; use crate::error::is_err_decommission_running; use crate::runtime::instance::InstanceContext; use crate::runtime::sources as runtime_sources; @@ -109,14 +109,6 @@ fn should_auto_start_rebalance_after_init(decommission_running: bool, rebalance_ rebalance_meta_loaded && !decommission_running } -fn pool_meta_has_active_decommission(meta: &PoolMeta) -> bool { - meta.pools.iter().any(|pool| { - pool.decommission - .as_ref() - .is_some_and(|info| info.has_decommission_state() && !info.complete && !info.failed && !info.canceled) - }) -} - async fn wait_for_local_decommission_resume_delay(rx: &CancellationToken, delay: Duration) -> bool { tokio::select! { _ = rx.cancelled() => false,