pub struct SkillManager { /* private fields */ }Expand description
Skill manager that owns persisted skill enabled/disabled state. 持有技能启用/停用持久状态的技能管理器。
Implementations§
Source§impl SkillManager
impl SkillManager
Sourcepub fn new(config: SkillManagerConfig) -> Self
pub fn new(config: SkillManagerConfig) -> Self
Create one skill manager from a shared configuration object. 基于共享配置对象创建一个技能管理器实例。
Sourcepub fn ensure_state_layout(&self) -> Result<(), String>
pub fn ensure_state_layout(&self) -> Result<(), String>
Ensure the skill-state root and its child directories exist. 确保技能状态根目录及其子目录已经存在。
Sourcepub fn guard_operation(
&self,
plane: SkillOperationPlane,
action: SkillLifecycleAction,
skill_id: &str,
) -> Result<(), String>
pub fn guard_operation( &self, plane: SkillOperationPlane, action: SkillLifecycleAction, skill_id: &str, ) -> Result<(), String>
Validate one skill id and enforce the root-plane protection boundary. 校验单个 skill id 并执行根层级平面保护边界。
Sourcepub fn is_skill_enabled(&self, skill_id: &str) -> Result<bool, String>
pub fn is_skill_enabled(&self, skill_id: &str) -> Result<bool, String>
Return whether one skill is currently enabled. 返回单个技能当前是否处于启用状态。
Sourcepub fn disable_skill(
&self,
skill_id: &str,
reason: Option<&str>,
) -> Result<(), String>
pub fn disable_skill( &self, skill_id: &str, reason: Option<&str>, ) -> Result<(), String>
Persist one disabled-state marker for the specified skill. 为指定技能持久化一份停用状态标记。
Sourcepub fn disable_skill_in_plane(
&self,
plane: SkillOperationPlane,
skill_id: &str,
reason: Option<&str>,
) -> Result<(), String>
pub fn disable_skill_in_plane( &self, plane: SkillOperationPlane, skill_id: &str, reason: Option<&str>, ) -> Result<(), String>
Persist one disabled-state marker for the specified skill in the requested operation plane. 在指定操作平面为目标技能持久化一份停用状态标记。
Sourcepub fn enable_skill(&self, skill_id: &str) -> Result<(), String>
pub fn enable_skill(&self, skill_id: &str) -> Result<(), String>
Remove the disabled-state marker for one skill. 删除单个技能的停用状态标记。
Sourcepub fn enable_skill_in_plane(
&self,
plane: SkillOperationPlane,
skill_id: &str,
) -> Result<(), String>
pub fn enable_skill_in_plane( &self, plane: SkillOperationPlane, skill_id: &str, ) -> Result<(), String>
Remove the disabled-state marker for one skill in the requested operation plane. 在指定操作平面移除单个技能的停用状态标记。
Sourcepub fn disabled_record(
&self,
skill_id: &str,
) -> Result<Option<DisabledSkillRecord>, String>
pub fn disabled_record( &self, skill_id: &str, ) -> Result<Option<DisabledSkillRecord>, String>
Read the disabled-state record for one skill when it exists. 在停用状态记录存在时读取单个技能的停用状态记录。
Sourcepub fn uninstall_skill(
&self,
skill_id: &str,
) -> Result<SkillUninstallResult, String>
pub fn uninstall_skill( &self, skill_id: &str, ) -> Result<SkillUninstallResult, String>
Remove one installed skill directory and clear its disabled marker. 删除单个已安装 skill 目录,并清理其停用标记。
Sourcepub fn uninstall_skill_in_plane(
&self,
plane: SkillOperationPlane,
skill_id: &str,
) -> Result<SkillUninstallResult, String>
pub fn uninstall_skill_in_plane( &self, plane: SkillOperationPlane, skill_id: &str, ) -> Result<SkillUninstallResult, String>
Remove one installed skill directory and clear its disabled marker in the requested operation plane. 在指定操作平面删除单个已安装技能目录,并清理其停用标记。
Sourcepub fn uninstall_skill_at_path_in_plane(
&self,
plane: SkillOperationPlane,
skill_id: &str,
skill_dir: &Path,
) -> Result<SkillUninstallResult, String>
pub fn uninstall_skill_at_path_in_plane( &self, plane: SkillOperationPlane, skill_id: &str, skill_dir: &Path, ) -> Result<SkillUninstallResult, String>
Remove one installed skill directory at an explicitly resolved path and clear its disabled marker. 删除单个已解析物理路径上的技能目录,并清理其停用标记。
Sourcepub fn prepare_uninstall_skill_at_path_in_plane(
&self,
plane: SkillOperationPlane,
skill_id: &str,
skill_dir: &Path,
) -> Result<PreparedSkillUninstall, String>
pub fn prepare_uninstall_skill_at_path_in_plane( &self, plane: SkillOperationPlane, skill_id: &str, skill_dir: &Path, ) -> Result<PreparedSkillUninstall, String>
Prepare one uninstall request and stage filesystem changes without committing state deletions yet. 预处理单个卸载请求并暂存文件系统变更,但暂不提交状态删除。
Sourcepub fn prepare_install_skill(
&self,
plane: SkillOperationPlane,
skill_roots: &[RuntimeSkillRoot],
request: &SkillInstallRequest,
) -> Result<PreparedSkillApply, String>
pub fn prepare_install_skill( &self, plane: SkillOperationPlane, skill_roots: &[RuntimeSkillRoot], request: &SkillInstallRequest, ) -> Result<PreparedSkillApply, String>
Prepare one install request and stage filesystem changes without committing the install record yet. 预处理单个安装请求并暂存文件系统变更,但暂不提交安装记录。
Sourcepub fn prepare_update_skill(
&self,
plane: SkillOperationPlane,
skill_roots: &[RuntimeSkillRoot],
request: &SkillInstallRequest,
) -> Result<PreparedSkillApply, String>
pub fn prepare_update_skill( &self, plane: SkillOperationPlane, skill_roots: &[RuntimeSkillRoot], request: &SkillInstallRequest, ) -> Result<PreparedSkillApply, String>
Prepare one update request and stage filesystem changes without committing the new install record yet. 预处理单个更新请求并暂存文件系统变更,但暂不提交新的安装记录。
Sourcepub fn skill_root(&self) -> &Path
pub fn skill_root(&self) -> &Path
Return the configured installed skill root. 返回当前配置中的已安装技能根目录。
Sourcepub fn state_root(&self) -> &Path
pub fn state_root(&self) -> &Path
Return the configured skill-state root. 返回当前配置中的技能状态根目录。
Sourcepub fn install_record(
&self,
skill_id: &str,
) -> Result<Option<InstalledSkillRecord>, String>
pub fn install_record( &self, skill_id: &str, ) -> Result<Option<InstalledSkillRecord>, String>
Read one managed install record from disk when it exists. 在受管安装记录存在时从磁盘读取该记录。
Sourcepub fn commit_prepared_skill_apply(
&self,
prepared: &PreparedSkillApply,
) -> Result<SkillApplyResult, String>
pub fn commit_prepared_skill_apply( &self, prepared: &PreparedSkillApply, ) -> Result<SkillApplyResult, String>
Persist the final install record and remove transitional backup data after runtime reload succeeds. 在运行时重载成功后持久化最终安装记录,并移除过渡备份数据。
Sourcepub fn rollback_prepared_skill_apply(
&self,
prepared: &PreparedSkillApply,
) -> Result<(), String>
pub fn rollback_prepared_skill_apply( &self, prepared: &PreparedSkillApply, ) -> Result<(), String>
Roll back one staged install/update mutation after reload or commit fails. 在重载或提交失败后回滚一次已暂存的安装或更新变更。
Sourcepub fn commit_prepared_skill_uninstall(
&self,
prepared: &PreparedSkillUninstall,
) -> Result<SkillUninstallResult, String>
pub fn commit_prepared_skill_uninstall( &self, prepared: &PreparedSkillUninstall, ) -> Result<SkillUninstallResult, String>
Persist the final uninstall state and remove transitional backup data after runtime reload succeeds. 在运行时重载成功后持久化最终卸载状态,并移除过渡备份数据。
Sourcepub fn rollback_prepared_skill_uninstall(
&self,
prepared: &PreparedSkillUninstall,
) -> Result<(), String>
pub fn rollback_prepared_skill_uninstall( &self, prepared: &PreparedSkillUninstall, ) -> Result<(), String>
Roll back one staged uninstall mutation after reload or commit fails. 在重载或提交失败后回滚一次已暂存的卸载变更。
Auto Trait Implementations§
impl Freeze for SkillManager
impl RefUnwindSafe for SkillManager
impl Send for SkillManager
impl Sync for SkillManager
impl Unpin for SkillManager
impl UnsafeUnpin for SkillManager
impl UnwindSafe for SkillManager
Blanket Implementations§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request