pub mod config;
pub mod metrics;
pub mod plugin;
pub mod supervisor;
use anyhow::{Context, Result};
use folk_api::{Plugin, PluginFactory, ServerPluginWrapper};
use serde_json::Value;
pub use config::ProcessConfig;
pub use plugin::ProcessPlugin;
struct ProcessPluginFactory;
impl PluginFactory for ProcessPluginFactory {
fn create(&self, config: Value) -> Result<Box<dyn Plugin>> {
let config: ProcessConfig =
serde_json::from_value(config).context("invalid [process] configuration")?;
Ok(Box::new(ServerPluginWrapper::new(ProcessPlugin::new(
config,
))))
}
}
pub fn folk_plugin_factory() -> Box<dyn PluginFactory> {
Box::new(ProcessPluginFactory)
}