| 15 | |
| 16 | #[async_trait] |
| 17 | pub trait Plugin: Send + Sync { |
| 18 | /// Name of the plugin |
| 19 | fn name(&self) -> &'static str; |
| 20 | |
| 21 | /// Setup the plugin environment |
| 22 | async fn setup( |
| 23 | &self, |
| 24 | config: &Arc<RwLock<ClientConfig>>, |
| 25 | opts: &ClientOpts, |
| 26 | command_rx: &mut mpsc::Receiver<Message>, |
| 27 | result_tx: &mpsc::Sender<Message>, |
| 28 | ) -> Result<()>; |
| 29 | |
| 30 | /// Publish a service using this plugin |
| 31 | async fn publish( |
| 32 | &self, |
| 33 | endpoint: &ServerEndpoint, |
| 34 | config: &Arc<RwLock<ClientConfig>>, |
| 35 | opts: &ClientOpts, |
| 36 | result_tx: &mpsc::Sender<Message>, |
| 37 | ) -> Result<SubProcess>; |
| 38 | } |
| 39 | |
| 40 | pub struct PluginHandle { |
| 41 | guid: String, |