- 构建:
cargo build - 测试:
python3 integration_tests/scripts/run_test.py(运行完整集成测试) - 单元测试:
cargo test(运行所有单元测试) - 单个测试:
cargo test test_name(运行指定测试)
- Rust 2018 edition
- 使用
#![allow(unused_imports)]允许未使用的导入 - Clippy 配置:
uninlined_format_args = "allow"
- 标准库导入优先,然后是第三方库,最后是本地模块
- 使用
use语句按字母顺序组织 - 在 main.rs 中广泛使用
#![allow(unused_imports)]
- 模块名:小写下划线分隔 (如
appdata.rs) - 结构体:PascalCase (如
AppShareData) - 函数和变量:snake_case
- 常量:SCREAMING_SNAKE_CASE
- 使用
anyhow进行错误处理 - 使用
thiserror定义自定义错误类型 - 使用
Result<T, Error>模式
- 基于 tokio 运行时
- 使用
async-trait处理异步特征 - Actix actor 模式用于并发处理
src/主要源码,按功能模块组织 (config, naming, grpc, raft 等)integration_tests/集成测试- 支持工作空间 (workspace) 包含 loadtest 和 rust-client-test
- 环境变量前缀:
RNACOS_ - 默认端口:8848 (HTTP), 9848 (gRPC), 10848 (Console)
- 支持单机和集群部署模式