This commit is contained in:
Andrew Phillips
2026-02-19 13:57:39 -04:00
parent a72395fe83
commit fdeb5f7951
82 changed files with 2756 additions and 2018 deletions

View File

@@ -1,5 +1,5 @@
use crate::meta_plugin::{BaseMetaPlugin, MetaPlugin, MetaPluginType};
use std::process;
use crate::meta_plugin::{MetaPlugin, MetaPluginType, BaseMetaPlugin};
#[derive(Debug, Clone, Default)]
pub struct KeepPidMetaPlugin {
@@ -23,17 +23,16 @@ impl KeepPidMetaPlugin {
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
) -> KeepPidMetaPlugin {
let mut base = BaseMetaPlugin::new();
// Set default outputs
let default_outputs = &["keep_pid"];
base.initialize_plugin(default_outputs, &_options, &outputs);
KeepPidMetaPlugin {
is_finalized: false,
base,
}
}
}
impl MetaPlugin for KeepPidMetaPlugin {
@@ -45,7 +44,7 @@ impl MetaPlugin for KeepPidMetaPlugin {
fn is_finalized(&self) -> bool {
self.is_finalized
}
/// Sets the finalized state of the plugin.
///
/// # Arguments
@@ -54,7 +53,7 @@ impl MetaPlugin for KeepPidMetaPlugin {
fn set_finalized(&mut self, finalized: bool) {
self.is_finalized = finalized;
}
/// Finalizes the plugin, processing any remaining data if needed.
///
/// # Returns
@@ -68,10 +67,10 @@ impl MetaPlugin for KeepPidMetaPlugin {
is_finalized: true,
};
}
// Mark as finalized
self.is_finalized = true;
crate::meta_plugin::MetaPluginResponse {
metadata: Vec::new(),
is_finalized: true,
@@ -95,7 +94,7 @@ impl MetaPlugin for KeepPidMetaPlugin {
is_finalized: true,
};
}
crate::meta_plugin::MetaPluginResponse {
metadata: Vec::new(),
is_finalized: false,
@@ -110,7 +109,7 @@ impl MetaPlugin for KeepPidMetaPlugin {
fn meta_type(&self) -> MetaPluginType {
MetaPluginType::KeepPid
}
/// Initializes the plugin and captures the process PID.
///
/// Retrieves the current process ID and adds it to metadata.
@@ -127,28 +126,28 @@ impl MetaPlugin for KeepPidMetaPlugin {
is_finalized: true,
};
}
let mut metadata = Vec::new();
let pid = process::id().to_string();
// Use process_metadata_outputs to handle output mapping
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
"keep_pid",
serde_yaml::Value::String(pid),
self.base.outputs()
"keep_pid",
serde_yaml::Value::String(pid),
self.base.outputs(),
) {
metadata.push(meta_data);
}
// Mark as finalized since this plugin only needs to run once
self.is_finalized = true;
crate::meta_plugin::MetaPluginResponse {
metadata,
is_finalized: true,
}
}
/// Returns a reference to the outputs mapping.
///
/// # Returns
@@ -157,7 +156,7 @@ impl MetaPlugin for KeepPidMetaPlugin {
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
self.base.outputs()
}
/// Returns a mutable reference to the outputs mapping.
///
/// # Returns
@@ -166,7 +165,7 @@ impl MetaPlugin for KeepPidMetaPlugin {
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
self.base.outputs_mut()
}
/// Returns the default output names for this plugin.
///
/// # Returns
@@ -175,7 +174,7 @@ impl MetaPlugin for KeepPidMetaPlugin {
fn default_outputs(&self) -> Vec<String> {
vec!["keep_pid".to_string()]
}
/// Returns a reference to the options mapping.
///
/// # Returns
@@ -184,7 +183,7 @@ impl MetaPlugin for KeepPidMetaPlugin {
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
self.base.options()
}
/// Returns a mutable reference to the options mapping.
///
/// # Returns