安装
系统要求
- Rust 1.75+(edition 2021)
- 操作系统 Linux / macOS / Windows
- 内存 建议 ≥ 512 MB
- 磁盘 SSD 推荐(LSM-Tree 写入密集型)
从源码构建
bash
git clone https://github.com/darkmice/talon.git
cd talon
cargo build --release构建产物:
target/release/libtalon.rlib— Rust 嵌入式库target/release/talon-server— 独立服务端二进制
作为 Rust 依赖使用
toml
[dependencies]
talon = { git = "https://github.com/darkmice/talon.git" }功能开关(Feature Flags)
toml
[dependencies]
talon = { git = "https://github.com/darkmice/talon.git", features = ["server"] }| Feature | 说明 |
|---|---|
default | 嵌入式模式,包含所有 9 引擎 |
server | 启用 HTTP + TCP + Redis 服务端 |
cluster | 启用 Primary-Replica 集群 |
配置
rust
use talon::{Talon, StorageConfig};
let config = StorageConfig {
cache_size: 256 * 1024 * 1024, // 256 MB 块缓存
..Default::default()
};
let db = Talon::open_with_config("./data", config)?;配置参数
| 参数 | 默认值 | 说明 |
|---|---|---|
cache_size | 64 MB | LSM-Tree 块缓存大小 |
max_write_buffer_size | 64 MB | 写入缓冲区上限 |
compaction_style | Leveled | 压缩策略 |
验证安装
rust
use talon::Talon;
let db = Talon::open("./test-data")?;
db.run_sql("SELECT 1 + 1")?;
println!("Talon 安装成功!");