Files
churn-v2/crates/churn/src/agent/actions/plugin_task.rs
kjuulh db4cc98643
All checks were successful
continuous-integration/drone/push Build is passing
feat: update with web assembly components
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-12-01 22:21:17 +01:00

31 lines
611 B
Rust

use crate::agent::{plugins::PluginStore, task::Task};
pub struct PluginTask {
plugin: String,
store: PluginStore,
}
impl PluginTask {
pub fn new(plugin: impl Into<String>, store: PluginStore) -> Self {
Self {
plugin: plugin.into(),
store,
}
}
}
#[async_trait::async_trait]
impl Task for PluginTask {
async fn id(&self) -> anyhow::Result<String> {
let id = self.store.id(&self.plugin).await?;
Ok(id)
}
async fn execute(&self) -> anyhow::Result<()> {
self.store.execute(&self.plugin).await?;
Ok(())
}
}