feat(flow): 重构流程引擎与任务执行器架构

重构流程引擎核心组件,引入执行器接口Executor替代原有TaskComponent,优化节点配置映射逻辑:
1. 新增mappers模块集中处理节点配置提取
2. 为存储层添加Storage trait抽象
3. 移除对ctx魔法字段的依赖,直接传递节点信息
4. 增加构建器模式支持引擎创建
5. 完善DSL解析的输入校验

同时标记部分未使用代码为allow(dead_code)
This commit is contained in:
2025-09-16 23:58:28 +08:00
parent 65764a2cbc
commit 81757eecf5
13 changed files with 375 additions and 164 deletions

View File

@ -246,7 +246,7 @@ pub async fn run(db: &Db, id: &str, req: RunReq, operator: Option<(i64, String)>
};
let mut ctx = req.input.clone();
// Merge node-scoped configs into ctx under ctx.nodes
let supplement = flow::dsl::ctx_from_design_json(design);
let supplement = flow::mappers::ctx_from_design_json(design);
merge_json(&mut ctx, &supplement);
// 解析 executionMode / execution_mode
let mode_str = design.get("executionMode").and_then(|v| v.as_str())
@ -335,7 +335,7 @@ pub async fn run(db: &Db, id: &str, req: RunReq, operator: Option<(i64, String)>
// 从全局注册中心获取任务(若未初始化则返回默认注册表)
let tasks: flow::task::TaskRegistry = flow::task::get_registry();
let engine = FlowEngine::new(tasks);
let engine = FlowEngine::builder().tasks(tasks).build();
info!(target = "udmin", "flow.run: driving engine id={} nodes={} links={} execution_mode={:?}", id, chain.nodes.len(), chain.links.len(), exec_mode);
// 执行