use anyhow::Result;
use async_trait::async_trait;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::task::JoinHandle;
use crate::Channel;
pub struct ChannelContext {
pub config: Arc<parking_lot::RwLock<oxios_kernel::OxiosConfig>>,
pub config_path: PathBuf,
}
pub struct ChannelBundle {
pub channel: Box<dyn Channel>,
pub tasks: Vec<JoinHandle<()>>,
}
#[async_trait]
pub trait ChannelPlugin: Send + Sync {
fn name(&self) -> &str;
async fn setup(&self, ctx: ChannelContext) -> Result<ChannelBundle>;
}