Skip to main content

AgentPlugin

Trait AgentPlugin 

Source
pub trait AgentPlugin: Send + Sync {
Show 17 methods // Required methods fn metadata(&self) -> &PluginMetadata; fn state(&self) -> PluginState; fn load<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn init_plugin<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn unload<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn execute<'life0, 'async_trait>( &'life0 mut self, input: String, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn as_any(&self) -> &(dyn Any + 'static); fn as_any_mut(&mut self) -> &mut (dyn Any + 'static); fn into_any(self: Box<Self>) -> Box<dyn Any>; // Provided methods fn plugin_id(&self) -> &str { ... } fn plugin_type(&self) -> PluginType { ... } fn pause<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn resume<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... } fn stats(&self) -> HashMap<String, Value> { ... }
}
Expand description

核心插件 trait

Required Methods§

Source

fn metadata(&self) -> &PluginMetadata

获取插件元数据

Source

fn state(&self) -> PluginState

获取插件状态

Source

fn load<'life0, 'life1, 'async_trait>( &'life0 mut self, ctx: &'life1 PluginContext, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

插件加载(分配资源)

Source

fn init_plugin<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

插件初始化(配置初始化)

Source

fn start<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

插件启动

Source

fn stop<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

插件停止

Source

fn unload<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

插件卸载(释放资源)

Source

fn execute<'life0, 'async_trait>( &'life0 mut self, input: String, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

执行插件功能

Source

fn as_any(&self) -> &(dyn Any + 'static)

转换为 Any(用于向下转型)

Source

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

转换为可变 Any

Source

fn into_any(self: Box<Self>) -> Box<dyn Any>

消费并转换为 Any(用于提取具体的插件类型)

Provided Methods§

Source

fn plugin_id(&self) -> &str

获取插件 ID(便捷方法)

Source

fn plugin_type(&self) -> PluginType

获取插件类型

Source

fn pause<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

插件暂停

Source

fn resume<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

插件恢复

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

健康检查

Source

fn stats(&self) -> HashMap<String, Value>

获取插件统计信息

Trait Implementations§

Source§

impl From<NetworkAttackResponsePlugin> for Box<dyn AgentPlugin>

Source§

fn from(plugin: NetworkAttackResponsePlugin) -> Box<dyn AgentPlugin>

Converts to this type from the input type.
Source§

impl From<ServerFaultResponsePlugin> for Box<dyn AgentPlugin>

Source§

fn from(plugin: ServerFaultResponsePlugin) -> Box<dyn AgentPlugin>

Converts to this type from the input type.

Implementors§