pub struct ActorPlugin { /* private fields */ }Expand description
wordval Actor 插件:管理全局 ActorSystem 生命周期。
§示例
use wordval_actor::{ActorConfig, ActorPlugin};
use wordval_core::plugin::PluginManager;
let plugin = ActorPlugin::new().with_config(ActorConfig {
mailbox_capacity: 512,
..Default::default()
});
let mgr = PluginManager::new().add(plugin);
mgr.start_all().await?;Implementations§
Source§impl ActorPlugin
impl ActorPlugin
Sourcepub fn with_config(self, config: ActorConfig) -> Self
pub fn with_config(self, config: ActorConfig) -> Self
指定系统配置(在 start 时生效)。
Sourcepub fn with_mailbox_capacity(self, capacity: usize) -> Self
pub fn with_mailbox_capacity(self, capacity: usize) -> Self
快捷设置控制通道默认容量。
Trait Implementations§
Source§impl Default for ActorPlugin
impl Default for ActorPlugin
Source§impl Plugin for ActorPlugin
impl Plugin for ActorPlugin
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
启动插件:验证连接、初始化资源 Read more
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
关闭插件:释放资源 Read more
Source§fn depends_on(&self) -> &[&str]
fn depends_on(&self) -> &[&str]
依赖的其他插件名称(用于拓扑排序,保证启动顺序) Read more
Source§fn on_degrade<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn on_degrade<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
降级钩子:主动退出重负载状态(如断开下游、停止接受新请求),保留受限服务 Read more
Auto Trait Implementations§
impl Forget for ActorPlugin
impl Freeze for ActorPlugin
impl Move for ActorPlugin
impl RefUnwindSafe for ActorPlugin
impl Send for ActorPlugin
impl Sync for ActorPlugin
impl Unpin for ActorPlugin
impl UnsafeUnpin for ActorPlugin
impl UnwindSafe for ActorPlugin
Blanket Implementations§
impl<T> ActorMsg for Twhere
T: Send + 'static,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more