Skip to main content

SkillManager

Struct SkillManager 

Source
pub struct SkillManager { /* private fields */ }
Expand description

Skill manager that owns persisted skill enabled/disabled state. 持有技能启用/停用持久状态的技能管理器。

Implementations§

Source§

impl SkillManager

Source

pub fn new(config: SkillManagerConfig) -> Self

Create one skill manager from a shared configuration object. 基于共享配置对象创建一个技能管理器实例。

Source

pub fn ensure_state_layout(&self) -> Result<(), String>

Ensure the skill-state root and its child directories exist. 确保技能状态根目录及其子目录已经存在。

Source

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 并执行根层级平面保护边界。

Source

pub fn is_skill_enabled(&self, skill_id: &str) -> Result<bool, String>

Return whether one skill is currently enabled. 返回单个技能当前是否处于启用状态。

Source

pub fn disable_skill( &self, skill_id: &str, reason: Option<&str>, ) -> Result<(), String>

Persist one disabled-state marker for the specified skill. 为指定技能持久化一份停用状态标记。

Source

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. 在指定操作平面为目标技能持久化一份停用状态标记。

Source

pub fn enable_skill(&self, skill_id: &str) -> Result<(), String>

Remove the disabled-state marker for one skill. 删除单个技能的停用状态标记。

Source

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. 在指定操作平面移除单个技能的停用状态标记。

Source

pub fn disabled_record( &self, skill_id: &str, ) -> Result<Option<DisabledSkillRecord>, String>

Read the disabled-state record for one skill when it exists. 在停用状态记录存在时读取单个技能的停用状态记录。

Source

pub fn uninstall_skill( &self, skill_id: &str, ) -> Result<SkillUninstallResult, String>

Remove one installed skill directory and clear its disabled marker. 删除单个已安装 skill 目录,并清理其停用标记。

Source

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. 在指定操作平面删除单个已安装技能目录,并清理其停用标记。

Source

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. 删除单个已解析物理路径上的技能目录,并清理其停用标记。

Source

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. 预处理单个卸载请求并暂存文件系统变更,但暂不提交状态删除。

Source

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. 预处理单个安装请求并暂存文件系统变更,但暂不提交安装记录。

Source

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. 预处理单个更新请求并暂存文件系统变更,但暂不提交新的安装记录。

Source

pub fn skill_root(&self) -> &Path

Return the configured installed skill root. 返回当前配置中的已安装技能根目录。

Source

pub fn state_root(&self) -> &Path

Return the configured skill-state root. 返回当前配置中的技能状态根目录。

Source

pub fn install_record( &self, skill_id: &str, ) -> Result<Option<InstalledSkillRecord>, String>

Read one managed install record from disk when it exists. 在受管安装记录存在时从磁盘读取该记录。

Source

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. 在运行时重载成功后持久化最终安装记录,并移除过渡备份数据。

Source

pub fn rollback_prepared_skill_apply( &self, prepared: &PreparedSkillApply, ) -> Result<(), String>

Roll back one staged install/update mutation after reload or commit fails. 在重载或提交失败后回滚一次已暂存的安装或更新变更。

Source

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. 在运行时重载成功后持久化最终卸载状态,并移除过渡备份数据。

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more