refactor: 移除独立 hub/proxy/executor/gateway crate,统一为 gateway tunnel 架构

- 删除 aether-hub、aether-proxy 独立项目及其 Dockerfile/配置
- 删除 crates/aether-executor 和 crates/aether-gateway 全部模块
- 新增 apps/ 目录作为应用入口
- 将 hub 概念重构为 gateway tunnel transport
- 将 executor 重构为 execution runtime
- 新增 tunnel.rs 合约定义和 testkit tunnel/execution_runtime 模块
- 更新 Python 服务层和测试适配新架构命名
This commit is contained in:
fawney19
2026-04-03 14:59:58 +08:00
parent ddf18fed9a
commit 8f26e1a31f
983 changed files with 103097 additions and 105836 deletions
@@ -0,0 +1,83 @@
use aether_contracts::{ExecutionPlan, ExecutionResult};
use crate::gateway::constants::TRACE_ID_HEADER;
use crate::gateway::{AppState, GatewayError};
fn build_remote_execution_runtime_request(
state: &AppState,
remote_execution_runtime_base_url: &str,
path: &str,
trace_id: Option<&str>,
plan: &ExecutionPlan,
) -> reqwest::RequestBuilder {
let mut request = state
.client
.post(format!("{remote_execution_runtime_base_url}{path}"))
.json(plan);
if let Some(trace_id) = trace_id.map(str::trim).filter(|value| !value.is_empty()) {
request = request.header(TRACE_ID_HEADER, trace_id);
}
request
}
pub(crate) async fn post_sync_plan_to_remote_execution_runtime(
state: &AppState,
remote_execution_runtime_base_url: &str,
trace_id: Option<&str>,
plan: &ExecutionPlan,
) -> Result<reqwest::Response, GatewayError> {
build_remote_execution_runtime_request(
state,
remote_execution_runtime_base_url,
"/v1/execute/sync",
trace_id,
plan,
)
.send()
.await
.map_err(|err| GatewayError::Internal(err.to_string()))
}
pub(crate) async fn post_stream_plan_to_remote_execution_runtime(
state: &AppState,
remote_execution_runtime_base_url: &str,
trace_id: Option<&str>,
plan: &ExecutionPlan,
) -> Result<reqwest::Response, GatewayError> {
build_remote_execution_runtime_request(
state,
remote_execution_runtime_base_url,
"/v1/execute/stream",
trace_id,
plan,
)
.send()
.await
.map_err(|err| GatewayError::Internal(err.to_string()))
}
pub(crate) async fn execute_sync_plan_via_remote_execution_runtime(
state: &AppState,
remote_execution_runtime_base_url: &str,
trace_id: Option<&str>,
plan: &ExecutionPlan,
) -> Result<ExecutionResult, GatewayError> {
let response = post_sync_plan_to_remote_execution_runtime(
state,
remote_execution_runtime_base_url,
trace_id,
plan,
)
.await?;
if response.status() != http::StatusCode::OK {
return Err(GatewayError::Internal(format!(
"execution runtime returned HTTP {}",
response.status()
)));
}
response
.json::<ExecutionResult>()
.await
.map_err(|err| GatewayError::Internal(err.to_string()))
}