Skip to main content

PluginDeclaration

Struct PluginDeclaration 

Source
pub struct PluginDeclaration {
    pub tenant_id: String,
    pub plugin_id: String,
    pub capability_id: String,
    pub grpc_authority: String,
    pub plugin_version: String,
    pub api_version: String,
    pub manifest_sha256: String,
    pub declared_operations: Vec<String>,
    pub labels: HashMap<String, String>,
    pub seat_model: SeatModel,
}
Expand description

插件对 capability 的完整声明。

字段全部必填是刻意的:这些正是注册契约 v2 里「可选、缺失即降级为 unverified」的那些。协议层必须可选(否则核心升级会打死所有旧插件), 但新写的插件没有理由不填 —— 在这里做成必填,漏填就编译不过。

Fields§

§tenant_id: String§plugin_id: String§capability_id: String

本次注册的能力 id。必须出现在 declared_operations 里, 否则 capability 会当场拒绝(清单与注册对不上)。

不限制插件承接的范围 —— 范围由 declared_operations 决定。 这里填一个最好认的入口即可,它主要出现在路由簿与日志里。

§grpc_authority: String

本插件的 gRPC 地址,capability 按它回调。

§plugin_version: String§api_version: String§manifest_sha256: String

插件清单(plugin.json)的 sha256,用于确认部署物与目录一致。

§declared_operations: Vec<String>

本插件能处理的 operation 全集。留空即退化为 unverified

§labels: HashMap<String, String>

附加标签,例如 health_protocol 声明特殊探活协议。

§seat_model: SeatModel

计费/授权单位:SeatModel::Tenant(装了全员可用)或 SeatModel::PerUser(还需逐人授权)。

这是产品决策,平台不替插件决定它怎么卖,所以必填。

Implementations§

Source§

impl PluginDeclaration

Source

pub fn validate(&self) -> Result<(), HostError>

本地自检:把「注册后才发现对不上」提前到调用前。

capability 侧也会校验(那是权威判定),这里重复一遍是为了让插件作者 在自己的进程里就看到错误,而不是去翻 capability 的日志。

Trait Implementations§

Source§

impl Clone for PluginDeclaration

Source§

fn clone(&self) -> PluginDeclaration

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PluginDeclaration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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