mod config;
mod metrics;
mod plugin;
mod service;
pub use config::GrpcConfig;
pub use plugin::{GrpcPlugin, build_descriptor_pool, export_descriptors};
pub use service::{GrpcEnvelope, json_to_proto, parse_grpc_timeout, proto_to_json};
use anyhow::Result;
use folk_api::{Plugin, PluginFactory, ServerPluginWrapper};
use serde_json::Value;
struct GrpcPluginFactory;
impl PluginFactory for GrpcPluginFactory {
fn create(&self, config: Value) -> Result<Box<dyn Plugin>> {
let config: GrpcConfig = serde_json::from_value(config)?;
Ok(Box::new(ServerPluginWrapper::new(GrpcPlugin::new(config))))
}
}
pub fn folk_plugin_factory() -> Box<dyn PluginFactory> {
Box::new(GrpcPluginFactory)
}