Skip to main content

WasmPluginTable

Struct WasmPluginTable 

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

Lazily activates verified Wasm plugins in explicitly retained slots. 仅在显式保留的槽中懒加载已验证 Wasm 插件。

Implementations§

Source§

impl WasmPluginTable

Source

pub fn new(slots: &'static [WasmPluginSlot]) -> Result<Self, HostError>

Build a table over the default backend, rejecting malformed slot definitions. 在默认后端上建表,并拒绝非法的槽定义。

Source

pub fn with_backend( slots: &'static [WasmPluginSlot], backend: WasmBackend, ) -> Result<Self, HostError>

Build a table with an explicit backend so callers can supply their own limits. 用显式后端建表,便于调用方提供自己的限制。

Source

pub fn install( &self, slot: &str, channel: ValidationChannel, artifact: VerifiedPluginArtifact, ) -> Result<u64, HostError>

Queue verified bytes without compiling or instantiating them. 挂起已验证字节,不在安装阶段编译或实例化。

Source

pub fn call( &self, slot: &str, operation: &str, input: &[u8], ) -> Result<Vec<u8>, HostError>

Activate a pending generation on demand, then invoke it. 首次使用时激活待发布代,再执行调用。

Source

pub fn is_loaded(&self, slot: &str) -> Result<bool, HostError>

Report whether the slot has an active generation and nothing pending. 报告该槽是否已有激活代际且没有待处理代际。

Source

pub fn generation(&self, slot: &str) -> Result<Option<u64>, HostError>

Return the active generation, or None while the slot is not yet activated. 返回激活代际;槽尚未激活时返回 None。

Source

pub fn activation_error(&self, slot: &str) -> Result<Option<String>, HostError>

Report why the last activation attempt failed. 报告上一次激活尝试失败的原因。

None means the last attempt succeeded or no pending generation has been activated yet. The report exists because a failed activation changes nothing a poller can already see: active keeps the previous generation, so is_loaded stays true and generation keeps returning the old number while every later call fails. Silence was the one answer a readiness poll could not act on. None 表示上次尝试成功,或还没有待发布代被激活过。之所以需要这份报告:激活失败不会 改变轮询方已经能看到的东西——active 仍是上一代,因此 is_loaded 保持 true、 generation 继续返回旧编号,而此后每次调用都失败。沉默正是就绪轮询唯一无法据以行动的 回报。

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, 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.