refactor: replace get_* and set_* methods with direct field access

Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-19 13:15:48 -03:00
parent 58ecbd63cf
commit 38cbf06579
7 changed files with 68 additions and 262 deletions

View File

@@ -100,21 +100,28 @@ pub trait MetaPlugin {
Ok(())
}
// Access to outputs mapping
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value>;
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value>;
// Save metadata to database using central output handler
fn save_meta(&mut self, conn: &Connection, item_id: i64, internal_name: &str, value: String) -> Result<()> {
output_metadata(conn, item_id, internal_name, value, self.get_outputs())
output_metadata(conn, item_id, internal_name, value, self.outputs())
}
// Configure plugin with options and outputs
fn configure(&mut self, _options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
if let Some(outputs) = options.get("outputs") {
if let Some(outputs_map) = outputs.as_mapping() {
for (key, value) in outputs_map {
if let Some(key_str) = key.as_str() {
self.outputs_mut().insert(key_str.to_string(), value.clone());
}
}
}
}
Ok(())
}
// Get outputs mapping
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value>;
// Set outputs mapping
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>);
}
pub fn get_meta_plugin(meta_plugin_type: MetaPluginType) -> Box<dyn MetaPlugin> {