From 73bfc064ea7a9bde128856c2b6349733749fa396 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Tue, 19 Aug 2025 14:12:53 -0300 Subject: [PATCH] refactor: change meta_name to immutable reference and add debugging Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) --- src/common/status.rs | 7 +++++++ src/meta_plugin.rs | 2 +- src/meta_plugin/binary.rs | 2 +- src/meta_plugin/digest.rs | 6 +++--- src/meta_plugin/magic.rs | 2 +- src/meta_plugin/program.rs | 2 +- src/meta_plugin/system.rs | 20 ++++++++++---------- 7 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/common/status.rs b/src/common/status.rs index 5e72722..5682f39 100644 --- a/src/common/status.rs +++ b/src/common/status.rs @@ -49,6 +49,7 @@ pub fn generate_status_info( enabled_meta_plugins: &Vec, enabled_compression_type: Option, ) -> StatusInfo { + log::debug!("STATUS: Starting status info generation"); let path_info = PathInfo { data: data_path.into_os_string().into_string().expect("Unable to convert data path to string"), database: db_path.into_os_string().into_string().expect("Unable to convert DB path to string"), @@ -98,12 +99,18 @@ pub fn generate_status_info( sorted_meta_plugins.sort_by_key(|meta_plugin_type| meta_plugin_type.to_string()); for meta_plugin_type in sorted_meta_plugins { + log::debug!("STATUS: Processing meta plugin type: {:?}", meta_plugin_type); let mut meta_plugin = meta_plugin::get_meta_plugin(meta_plugin_type.clone()); + log::debug!("STATUS: Created meta plugin instance"); let is_supported = meta_plugin.is_supported(); + log::debug!("STATUS: Checked is_supported: {}", is_supported); let is_enabled = enabled_meta_plugins.contains(&meta_plugin_type); + log::debug!("STATUS: Checked is_enabled: {}", is_enabled); // Get meta name first to avoid borrowing issues + log::debug!("STATUS: Getting meta name..."); let meta_name = meta_plugin.meta_name(); + log::debug!("STATUS: Got meta name: {}", meta_name); // Note: In status mode we don't have access to actual settings, // so we can't configure plugins with their settings here. diff --git a/src/meta_plugin.rs b/src/meta_plugin.rs index f7e5aea..4feb352 100644 --- a/src/meta_plugin.rs +++ b/src/meta_plugin.rs @@ -88,7 +88,7 @@ pub trait MetaPlugin { // Update the meta plugin with new data fn update(&mut self, data: &[u8], conn: &Connection); - fn meta_name(&mut self) -> String; + fn meta_name(&self) -> String; // Get program information for display in status fn program_info(&self) -> Option<(&str, Vec<&str>)> { diff --git a/src/meta_plugin/binary.rs b/src/meta_plugin/binary.rs index 4a601bc..bc95156 100644 --- a/src/meta_plugin/binary.rs +++ b/src/meta_plugin/binary.rs @@ -105,7 +105,7 @@ impl MetaPlugin for BinaryMetaPlugin { } } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } diff --git a/src/meta_plugin/digest.rs b/src/meta_plugin/digest.rs index 4ccf155..83f642b 100644 --- a/src/meta_plugin/digest.rs +++ b/src/meta_plugin/digest.rs @@ -69,7 +69,7 @@ impl MetaPlugin for DigestSha256MetaPlugin { self.hasher.update(data); } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -142,7 +142,7 @@ impl MetaPlugin for ReadTimeMetaPlugin { } } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -217,7 +217,7 @@ impl MetaPlugin for ReadRateMetaPlugin { self.bytes_read += data.len() as u64; } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } diff --git a/src/meta_plugin/magic.rs b/src/meta_plugin/magic.rs index acd8615..f9d9916 100644 --- a/src/meta_plugin/magic.rs +++ b/src/meta_plugin/magic.rs @@ -156,7 +156,7 @@ impl MetaPlugin for MagicFileMetaPlugin { } } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { "magic_file".to_string() } diff --git a/src/meta_plugin/program.rs b/src/meta_plugin/program.rs index 83ec79d..cd1910d 100644 --- a/src/meta_plugin/program.rs +++ b/src/meta_plugin/program.rs @@ -160,7 +160,7 @@ impl MetaPlugin for MetaPluginProgram { } } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } diff --git a/src/meta_plugin/system.rs b/src/meta_plugin/system.rs index 83849e3..83c9b76 100644 --- a/src/meta_plugin/system.rs +++ b/src/meta_plugin/system.rs @@ -59,7 +59,7 @@ impl MetaPlugin for CwdMetaPlugin { // No update needed } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -141,7 +141,7 @@ impl MetaPlugin for UidMetaPlugin { // No update needed } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -219,7 +219,7 @@ impl MetaPlugin for UserMetaPlugin { // No update needed } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -300,7 +300,7 @@ impl MetaPlugin for GidMetaPlugin { // No update needed } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -378,7 +378,7 @@ impl MetaPlugin for GroupMetaPlugin { // No update needed } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -459,7 +459,7 @@ impl MetaPlugin for ShellMetaPlugin { // No update needed } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -540,7 +540,7 @@ impl MetaPlugin for ShellPidMetaPlugin { // No update needed } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -621,7 +621,7 @@ impl MetaPlugin for KeepPidMetaPlugin { // No update needed } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -699,7 +699,7 @@ impl MetaPlugin for HostnameMetaPlugin { // No update needed for hostname } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() } @@ -780,7 +780,7 @@ impl MetaPlugin for FullHostnameMetaPlugin { // No update needed for full hostname } - fn meta_name(&mut self) -> String { + fn meta_name(&self) -> String { self.meta_name.clone() }