refactor: change meta_name to immutable reference and add debugging

Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-19 14:12:53 -03:00
parent eb7da379ef
commit 73bfc064ea
7 changed files with 24 additions and 17 deletions

View File

@@ -49,6 +49,7 @@ pub fn generate_status_info(
enabled_meta_plugins: &Vec<MetaPluginType>,
enabled_compression_type: Option<CompressionType>,
) -> 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.

View File

@@ -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>)> {

View File

@@ -105,7 +105,7 @@ impl MetaPlugin for BinaryMetaPlugin {
}
}
fn meta_name(&mut self) -> String {
fn meta_name(&self) -> String {
self.meta_name.clone()
}

View File

@@ -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()
}

View File

@@ -156,7 +156,7 @@ impl MetaPlugin for MagicFileMetaPlugin {
}
}
fn meta_name(&mut self) -> String {
fn meta_name(&self) -> String {
"magic_file".to_string()
}

View File

@@ -160,7 +160,7 @@ impl MetaPlugin for MetaPluginProgram {
}
}
fn meta_name(&mut self) -> String {
fn meta_name(&self) -> String {
self.meta_name.clone()
}

View File

@@ -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()
}