连接 Host 与 Ingress
链接 Endpoint 实现、发布 Catalog Binding,并配置 Web Ingress Instance。
Host 链接 Endpoint Provider,并且 Resolved App 把它绑定到 Ingress 后,Route 才能被访问。
1. 链接 Plugin Crate
#[lenso::plugin] 与 #[endpoint] 已生成 Descriptor、Capability lowering 和
Linked Factory。Crate 根只需要编译 Endpoint 模块:
mod http;
Host 把该 Crate 作为依赖链接后,NativePluginRegistry::with_linked_factories()
会发现生成的 Factory。NativePluginFactory 属于 Host/Adapter 扩展 Seam,不是普通
Web Plugin 的作者 API;NativeModuleFactory 已淘汰。
2. 发布 Catalog 关系
在 Host Catalog 中发布 Endpoint Plugin 与 Web Ingress 两个实现。Catalog 必须 允许以下 Binding:
lenso.web-ingress/web
requires many lenso.http.endpoint@1
-> company.greetings-http/api
Registration 让实现可用。Host Catalog 持有 Default、Root Slot 与准确实现策略;
App Owner 只在 plugins/ 中配置或禁用最终 Instance。
3. 配置 Ingress
Patch Host 已声明的 Ingress Instance:
bind_address = "127.0.0.1:8080"
max_request_body_bytes = 1048576
max_request_head_bytes = 16384
max_concurrent_requests = 128
request_timeout_millis = 30000
检查 Resolved 结果:
lenso plugins list --root ./my-app
lenso app show --root ./my-app
lenso app check --root ./my-app
app show 必须包含 Ingress Instance、Greetings Endpoint Instance,以及两者之间
的 many lenso.http.endpoint@1 Binding。TOML 无法创建 Host Catalog 没有发布的
关系。
app check 成功,并且 Resolved App 显示准确 Instance 与 Binding Identity 时,
本步骤完成。继续 证明 HTTP 后端。