docs: 说明文件重整(README 改使用导向,运维细节移入 docs/worker-management.md)

This commit is contained in:
2026-10-13 17:29:38 +08:00
parent 6d087fa4e3
commit fe96fc9b6c
7 changed files with 512 additions and 845 deletions
+8 -6
View File
@@ -1,11 +1,13 @@
# 多语言插件演进统一规划(Rust 优先)
> **本文是演进规划记录,不是使用指南**。要开发/使用插件请先看:
> [进程插件开发指南(Python)](./process-plugin.md)、
> [Rust 插件编写说明](./rust-plugin.md)、
> [进程插件线协议规范(语言无关)](./plugin-wire-protocol.md)。
> 背景:团队技术栈杂糅,Python 在部分计算密集场景性能有限。
> 目标:在不破坏现有体系的前提下,开放进程插件多语言实现能力,
> **Rust 优先落地**,为后续其他语言(Go / C++ 等)铺路。
>
> 配套文档:[进程插件线协议规范(语言无关)](./plugin-wire-protocol.md)、
> [进程插件开发指南(Python)](./process-plugin.md)
---
@@ -60,7 +62,7 @@ chongming-worker-rs/ # 独立仓库(或 utils/worker-rs/,与 Pyth
│ # 另有 [workers.config] 运行时读写(保留键校验 + 原子落盘)
├── descriptor.rs # 描述符结构体(规范 §2.2 字段表)+ 端点 TOML 解析
├── publisher.rs # RoutePublisher 等价:PUT / DELETE / 10s 重发布
├── serve.rs # worker_serve 等价:liveliness token + Queryable + 生命周期
├── serve.rs # 入口等价:chongming-worker(Python 侧):liveliness token + Queryable + 生命周期
├── runtime.rs # 托管副本模型:ReplicaController(index/epoch/restart/stop/drain)
│ # + WorkerPool(按 target 动态扩缩,优雅排空)
├── admin.rs # __admin__ Queryable:status/restart/stop/drain/get_config/
@@ -159,7 +161,7 @@ Rust 侧用 sqlx 在 `utils/worker-rs` 内提供等价封装(feature `database
SQL 占位符遵循各自方言(SQLite `?`、PostgreSQL `$1`),SDK 不做 SQL 重写。
- **TLS**:默认不启用 TLS 后端;PostgreSQL 走 SSL 时需追加 `tls-rustls-ring` 等 feature。
- **参考实现**:`workers/rsdemo` 的 `db_ping` 端点(写 + 读一表做连通性探测);`gen_plugin --rust` 模板已内置
注释版 `[workers.config.database]` 段与 `database` feature(见 [rsdemo README](../../workers/rsdemo/README.md))。
注释版 `[workers.config.database]` 段与 `database` feature(见 [rsdemo README](../workers/rsdemo/README.md))。
---
@@ -167,7 +169,7 @@ Rust 侧用 sqlx 在 `utils/worker-rs` 内提供等价封装(feature `database
### 4.1 build_plugin 支持非 Python 插件
- 现状:`build_plugin` 产物为 pyproject.toml + start.sh(`uv run worker_serve --type <name>`),纯 Python 链路
- 现状:`build_plugin` 产物为 pyproject.toml + start.sh(`uv run chongming-worker --type <name>`),纯 Python 链路
- 目标:支持声明插件语言/入口,允许打包任意可执行产物 + 自定义 start.sh
(Rust 插件 = 编译产物 + `--type` 参数约定),`--type` 语义跨语言保持一致
- 约束:打包结构(zip 根 = 容器工作目录)不变