pub struct WasmPluginTable { /* private fields */ }Expand description
Lazily activates verified Wasm plugins in explicitly retained slots. 仅在显式保留的槽中懒加载已验证 Wasm 插件。
Implementations§
Source§impl WasmPluginTable
impl WasmPluginTable
Sourcepub fn new(slots: &'static [WasmPluginSlot]) -> Result<Self, HostError>
pub fn new(slots: &'static [WasmPluginSlot]) -> Result<Self, HostError>
Build a table over the default backend, rejecting malformed slot definitions. 在默认后端上建表,并拒绝非法的槽定义。
Sourcepub fn with_backend(
slots: &'static [WasmPluginSlot],
backend: WasmBackend,
) -> Result<Self, HostError>
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. 用显式后端建表,便于调用方提供自己的限制。
Sourcepub fn install(
&self,
slot: &str,
channel: ValidationChannel,
artifact: VerifiedPluginArtifact,
) -> Result<u64, HostError>
pub fn install( &self, slot: &str, channel: ValidationChannel, artifact: VerifiedPluginArtifact, ) -> Result<u64, HostError>
Queue verified bytes without compiling or instantiating them. 挂起已验证字节,不在安装阶段编译或实例化。
Sourcepub fn call(
&self,
slot: &str,
operation: &str,
input: &[u8],
) -> Result<Vec<u8>, HostError>
pub fn call( &self, slot: &str, operation: &str, input: &[u8], ) -> Result<Vec<u8>, HostError>
Activate a pending generation on demand, then invoke it. 首次使用时激活待发布代,再执行调用。
Sourcepub fn is_loaded(&self, slot: &str) -> Result<bool, HostError>
pub fn is_loaded(&self, slot: &str) -> Result<bool, HostError>
Report whether the slot has an active generation and nothing pending. 报告该槽是否已有激活代际且没有待处理代际。
Sourcepub fn generation(&self, slot: &str) -> Result<Option<u64>, HostError>
pub fn generation(&self, slot: &str) -> Result<Option<u64>, HostError>
Return the active generation, or None while the slot is not yet activated.
返回激活代际;槽尚未激活时返回 None。
Sourcepub fn activation_error(&self, slot: &str) -> Result<Option<String>, HostError>
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 继续返回旧编号,而此后每次调用都失败。沉默正是就绪轮询唯一无法据以行动的
回报。