Skip to main content

Crate aiway_plugin

Crate aiway_plugin 

Source
Expand description

§aiway-plugin

网关插件 SDK,定义插件接口和数据交换类型。

§架构

  • 插件侧:插件开发者依赖此 crate,实现 Plugin trait,使用 export_wasm! 宏导出 WASM
  • 宿主侧plugin-manager crate 提供 wasmtime 运行时,加载并执行 WASM 插件

§数据交换

Host 与 WASM 之间通过 bincode 序列化传递数据,定义在 wasm_types 模块中。

Re-exports§

pub use http;
pub use serde_json;

Modules§

wasm_types
WASM 插件边界序列化类型

Macros§

export_wasm
导出 WASM 插件
log_debug
DEBUG日志
log_error
格式化日志宏(ERROR 级别)
log_info
INFO日志
log_trace
TRACE日志
log_warn
WARN日志

Structs§

Bytes
A cheaply cloneable and sliceable chunk of contiguous memory.
FormPart
Multipart 表单字段
HttpRequest
HTTP 请求参数
HttpRequestBuilder
HTTP 请求构建器
HttpResponse
HTTP 响应结果
PluginInfo
插件信息
Version
SemVer version as defined by https://semver.org.
WasmHttpContext
WASM 侧的插件上下文实现。

Enums§

PluginError
插件错误类型

Constants§

LOG_DEBUG
LOG_ERROR
日志级别常量,与 WASM 侧和 Host 侧保持一致
LOG_INFO
LOG_TRACE
LOG_WARN

Traits§

Plugin
插件接口 trait
PluginContext
插件上下文接口

Functions§

block_on
简易 block_on,用于在同步上下文(WASM 内部)中执行 async 函数。

Attribute Macros§

async_trait