mod client;
mod config;
mod metrics;
#[cfg(feature = "php-ext")]
mod php_ext;
mod plugin;
mod service;
#[cfg(feature = "php-ext")]
pub use php_ext::{folk_grpc_descriptors, register_php_functions};
pub use client::{
BytesCodec, ClientCallEnvelope, ClientRegistry, ClientStreamEnvelope, StreamKind, call_unary,
};
pub use config::{ClientConfig, ClientTlsConfig, GrpcConfig, RetryConfig};
pub use plugin::{GrpcPlugin, build_descriptor_pool, export_descriptors};
pub use service::{
GrpcEnvelope, GrpcState, grpc_handler, 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)
}