mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 09:50:21 +08:00
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:
55
crates/aether-testkit/src/execution_runtime.rs
Normal file
55
crates/aether-testkit/src/execution_runtime.rs
Normal file
@@ -0,0 +1,55 @@
|
||||
use aether_gateway::build_execution_runtime_router_with_request_gates;
|
||||
use aether_runtime::DistributedConcurrencyGate;
|
||||
|
||||
use crate::server::SpawnedServer;
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct ExecutionRuntimeHarnessConfig {
|
||||
pub max_in_flight_requests: Option<usize>,
|
||||
pub distributed_request_gate: Option<DistributedConcurrencyGate>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ExecutionRuntimeHarness {
|
||||
server: SpawnedServer,
|
||||
}
|
||||
|
||||
impl ExecutionRuntimeHarness {
|
||||
pub async fn start(config: ExecutionRuntimeHarnessConfig) -> Result<Self, String> {
|
||||
Self::start_with_server(config, None).await
|
||||
}
|
||||
|
||||
pub async fn start_on_port(
|
||||
config: ExecutionRuntimeHarnessConfig,
|
||||
port: u16,
|
||||
) -> Result<Self, String> {
|
||||
Self::start_with_server(config, Some(port)).await
|
||||
}
|
||||
|
||||
async fn start_with_server(
|
||||
config: ExecutionRuntimeHarnessConfig,
|
||||
port: Option<u16>,
|
||||
) -> Result<Self, String> {
|
||||
let router = build_execution_runtime_router_with_request_gates(
|
||||
config.max_in_flight_requests,
|
||||
config.distributed_request_gate,
|
||||
);
|
||||
let server = match port {
|
||||
Some(port) => SpawnedServer::start_on_port(port, router)
|
||||
.await
|
||||
.map_err(|err| format!("failed to start execution runtime harness: {err}"))?,
|
||||
None => SpawnedServer::start(router)
|
||||
.await
|
||||
.map_err(|err| format!("failed to start execution runtime harness: {err}"))?,
|
||||
};
|
||||
Ok(Self { server })
|
||||
}
|
||||
|
||||
pub fn base_url(&self) -> &str {
|
||||
self.server.base_url()
|
||||
}
|
||||
|
||||
pub fn port(&self) -> u16 {
|
||||
self.server.port()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user