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:
@@ -100,21 +100,28 @@ pub trait MetaPlugin {
|
|||||||
Ok(())
|
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
|
// Save metadata to database using central output handler
|
||||||
fn save_meta(&mut self, conn: &Connection, item_id: i64, internal_name: &str, value: String) -> Result<()> {
|
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
|
// 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(())
|
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> {
|
pub fn get_meta_plugin(meta_plugin_type: MetaPluginType) -> Box<dyn MetaPlugin> {
|
||||||
|
|||||||
@@ -90,23 +90,15 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(outputs) = options.get("outputs") {
|
// Call default implementation for outputs
|
||||||
if let Some(outputs_map) = outputs.as_mapping() {
|
MetaPlugin::configure(self, options)
|
||||||
for (key, value) in outputs_map {
|
|
||||||
if let Some(key_str) = key.as_str() {
|
|
||||||
self.outputs.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,25 +54,12 @@ impl MetaPlugin for DigestSha256MetaPlugin {
|
|||||||
self.meta_name.clone()
|
self.meta_name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,25 +100,12 @@ impl MetaPlugin for ReadTimeMetaPlugin {
|
|||||||
self.meta_name.clone()
|
self.meta_name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,24 +148,11 @@ impl MetaPlugin for ReadRateMetaPlugin {
|
|||||||
self.meta_name.clone()
|
self.meta_name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,31 +130,22 @@ impl MetaPlugin for MagicFileMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(max_buffer_size) = options.get("max_buffer_size") {
|
if let Some(max_buffer_size) = options.get("max_buffer_size") {
|
||||||
if let Some(size) = max_buffer_size.as_u64() {
|
if let Some(size) = max_buffer_size.as_u64() {
|
||||||
self.max_buffer_size = size as usize;
|
self.max_buffer_size = size as usize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
// Call default implementation for outputs
|
||||||
|
MetaPlugin::configure(self, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,24 +152,11 @@ impl MetaPlugin for MetaPluginProgram {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,25 +55,12 @@ impl MetaPlugin for CwdMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,25 +106,12 @@ impl MetaPlugin for UidMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,25 +160,12 @@ impl MetaPlugin for UserMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,25 +211,12 @@ impl MetaPlugin for GidMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,25 +265,12 @@ impl MetaPlugin for GroupMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,25 +319,12 @@ impl MetaPlugin for ShellMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,25 +373,12 @@ impl MetaPlugin for ShellPidMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,25 +424,12 @@ impl MetaPlugin for KeepPidMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,25 +478,12 @@ impl MetaPlugin for HostnameMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,24 +550,11 @@ impl MetaPlugin for FullHostnameMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
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.insert(key_str.to_string(), value.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_outputs(&mut self, outputs: std::collections::HashMap<String, serde_yaml::Value>) {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
self.outputs = outputs;
|
&mut self.outputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,11 +48,9 @@ fn setup_compression_and_plugins(
|
|||||||
let plugin_name = meta_plugin.meta_name();
|
let plugin_name = meta_plugin.meta_name();
|
||||||
if let Some(config) = meta_plugin_configs.iter().find(|c| c.name == plugin_name) {
|
if let Some(config) = meta_plugin_configs.iter().find(|c| c.name == plugin_name) {
|
||||||
// Set outputs first
|
// Set outputs first
|
||||||
let mut outputs = std::collections::HashMap::new();
|
|
||||||
for (key, value) in &config.outputs {
|
for (key, value) in &config.outputs {
|
||||||
outputs.insert(key.clone(), serde_yaml::Value::String(value.clone()));
|
meta_plugin.outputs_mut().insert(key.clone(), serde_yaml::Value::String(value.clone()));
|
||||||
}
|
}
|
||||||
meta_plugin.set_outputs(outputs);
|
|
||||||
|
|
||||||
// Then configure with options
|
// Then configure with options
|
||||||
if let Err(e) = meta_plugin.configure(&config.options) {
|
if let Err(e) = meta_plugin.configure(&config.options) {
|
||||||
|
|||||||
Reference in New Issue
Block a user