Skip to content

Commit 872024f

Browse files
committed
Add the FDB async driver.
- Adds all the machinery to run FDB. - Update the connection options to be able to select drivers. - Update code to use the Driver interface depending on driver. - Update testing harness to be able to read a ServerConfig file.
1 parent e2b7c99 commit 872024f

24 files changed

+1081
-291
lines changed

Cargo.lock

Lines changed: 117 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/Cargo.toml

Lines changed: 45 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,88 +7,81 @@ license = "Apache-2.0"
77
build = "build.rs"
88
resolver = "2"
99

10-
# [lib]
11-
# name = "indexify_server"
12-
# path = "src/lib.rs"
13-
1410
[features]
1511
default = []
1612
migrations = []
1713
console-subscriber = ["dep:console-subscriber"]
1814

1915
[dependencies]
20-
async-stream = "0.3.6"
21-
serde = { version = "1.0.228", features = ["derive"] }
22-
serde_json = "1.0.145"
2316
anyhow = "1.0.100"
24-
figment = { version = "0.10.19", features = ["yaml"] }
25-
clap = { version = "4.5.50", features = ["derive"] }
26-
tracing = "0.1.41"
17+
async-stream = "0.3.6"
18+
async-trait = "0.1.89"
2719
axum = { version = "0.8.6", features = ["multipart", "macros", "tokio"] }
28-
tokio = { version = "1.48.0", features = ["full"] }
2920
axum-server = "0.7.2"
30-
futures = "0.3.31"
31-
tracing-subscriber = { version = "0.3.20", features = ["env-filter", "json"] }
32-
utoipa = { version = "5.4.0", features = ["axum_extras", "yaml"] }
33-
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
34-
sha2 = "0.10.9"
35-
nanoid = "0.4.0"
36-
object_store = { version = "0.12.4", features = ["aws"] }
37-
uuid = { version = "1.18.1", features = ["v4"] }
38-
tower-http = { version = "0.6.6", default-features = false, features = ["cors", "trace"] }
21+
axum-tracing-opentelemetry = { version = "0.32.1", features = ["tracing_level_info"] }
22+
base64 = "0.22.1"
3923
bytes = { version = "1.10.1", features = ["serde"] }
24+
chrono = "0.4.42"
4025
ciborium = "0.2.2"
41-
rand = "0.9.2"
26+
clap = { version = "4.5.50", features = ["derive"] }
27+
console-subscriber = { version = "0.5.0", optional = true }
28+
derive_builder = "0.20.2"
29+
figment = { version = "0.10.19", features = ["yaml"] }
30+
foundationdb = { version = "0.10.0", features = ["embedded-fdb-include", "fdb-7_4", "num-bigint", "serde", "serde_bytes", "serde_json"] }
31+
futures = "0.3.31"
4232
hyper = "1.7.0"
43-
url = "2.5.6"
33+
im = { version = "15.1.0" }
34+
json-subscriber = "0.2.6"
35+
nanoid = "0.4.0"
36+
object_store = { version = "0.12.4", features = ["aws"] }
37+
omniqueue = { git = "https://github.com/tensorlakeai/omniqueue-rs", branch = "main", features = ["sqs"], default-features = false }
4438
opentelemetry = { version = "0.31.0", features = ["metrics", "trace"] }
45-
opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio", "metrics", "trace"] }
4639
opentelemetry-otlp = { version = "0.31.0", features = ["tokio", "metrics", "trace", "grpc-tonic", "zstd-tonic"] }
47-
axum-tracing-opentelemetry = { version = "0.32.1", features = ["tracing_level_info"] }
48-
base64 = "0.22.1"
49-
tonic = "0.14.2"
50-
prost = "0.14.1"
51-
tonic-prost = "0.14.2"
52-
tonic-reflection = "0.14.2"
53-
tokio-stream = { version = "0.1.17", features = ["sync"] }
54-
priority-queue = "2.6.0"
55-
slatedb = { version = "0.8.2" }
56-
rust-embed = { version = "8.8.0", features = ["mime-guess"] }
57-
pin-project-lite = "0.2.16"
40+
opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio", "metrics", "trace"] }
41+
opentelemetry-stdout = { version = "0.31.0", default-features = false, features = ["trace"] }
5842
pin-project = "1.1.10"
59-
im = { version = "15.1.0" }
60-
async-trait = "0.1.89"
43+
pin-project-lite = "0.2.16"
44+
priority-queue = "2.6.0"
45+
prost = "0.14.1"
46+
prost-types = "0.14.1"
47+
rand = "0.9.2"
6148
rocksdb = { version = "0.24.0" }
49+
rust-embed = { version = "8.8.0", features = ["mime-guess"] }
50+
serde = { version = "1.0.228", features = ["derive"] }
51+
serde_json = "1.0.145"
52+
sha2 = "0.10.9"
53+
slatedb = { version = "0.8.2" }
6254
strum = { version = "0.27.2", features = ["derive"] }
63-
derive_builder = "0.20.2"
6455
tempfile = "3.23.0"
6556
thiserror = "2.0.17"
66-
json-subscriber = "0.2.6"
67-
omniqueue = { git = "https://github.com/tensorlakeai/omniqueue-rs", branch = "main", features = ["sqs"], default-features = false }
68-
chrono = "0.4.42"
69-
prost-types = "0.14.1"
57+
tokio = { version = "1.48.0", features = ["full"] }
58+
tokio-stream = { version = "0.1.17", features = ["sync"] }
59+
tonic = "0.14.2"
60+
tonic-prost = "0.14.2"
61+
tonic-reflection = "0.14.2"
62+
tower-http = { version = "0.6.6", default-features = false, features = ["cors", "trace"] }
63+
tracing = "0.1.41"
7064
tracing-opentelemetry = "0.32.0"
71-
opentelemetry-stdout = { version = "0.31.0", default-features = false, features = ["trace"] }
72-
console-subscriber = { version = "0.5.0", optional = true }
65+
tracing-subscriber = { version = "0.3.20", features = ["env-filter", "json"] }
66+
url = "2.5.6"
67+
utoipa = { version = "5.4.0", features = ["axum_extras", "yaml"] }
68+
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
69+
uuid = { version = "1.18.1", features = ["v4"] }
7370

7471

7572
[dev-dependencies]
76-
tempfile = "3.20.0"
77-
strum = { version = "0.27.1", features = ["derive"] }
73+
criterion = { version = "0.5", features = ["html_reports"] }
74+
mock_instant = "0.6.0"
7875
rocksdb = { version = "0.24.0" }
76+
strum = { version = "0.27.1", features = ["derive"] }
77+
tempfile = "3.20.0"
7978
tokio = { version = "1.45.1", features = ["full", "test-util"] }
80-
mock_instant = "0.6.0"
81-
criterion = { version = "0.5", features = ["html_reports"] }
82-
83-
# [[bench]]
84-
# name = "state_store"
85-
# harness = false
8679

8780
[build-dependencies]
8881
anyhow = "1.0.98"
82+
tonic-prost-build = "0.14.2"
8983
# All features enabled
9084
vergen = { version = "9.0.6", features = ["build", "cargo", "rustc", "si"] }
91-
tonic-prost-build = "0.14.2"
9285

9386
[package.metadata.deb]
9487
maintainer = "Diptanu Gon Choudhury <[email protected]>"

server/src/config.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{
2-
env,
32
fmt::{Debug, Display},
43
net::SocketAddr,
4+
path::Path,
55
time::Duration,
66
};
77

@@ -13,7 +13,7 @@ use figment::{
1313
use serde::{Deserialize, Serialize};
1414
use uuid::Uuid;
1515

16-
use crate::{blob_store::BlobStorageConfig, state_store::driver::rocksdb::RocksDBConfig};
16+
use crate::{blob_store::BlobStorageConfig, state_store::driver::ConnectionOptions};
1717

1818
const LOCAL_ENV: &str = "local";
1919

@@ -59,8 +59,7 @@ impl Display for ExecutorCatalogEntry {
5959
#[derive(Debug, Clone, Serialize, Deserialize)]
6060
pub struct ServerConfig {
6161
pub env: String,
62-
pub state_store_path: String,
63-
pub rocksdb_config: RocksDBConfig,
62+
pub driver_config: ConnectionOptions,
6463
pub listen_addr: String,
6564
pub listen_addr_grpc: String,
6665
pub blob_storage: BlobStorageConfig,
@@ -73,11 +72,9 @@ pub struct ServerConfig {
7372

7473
impl Default for ServerConfig {
7574
fn default() -> Self {
76-
let state_store_path = env::current_dir().unwrap().join("indexify_storage/state");
7775
ServerConfig {
7876
env: LOCAL_ENV.to_string(),
79-
state_store_path: state_store_path.to_str().unwrap().to_string(),
80-
rocksdb_config: RocksDBConfig::default(),
77+
driver_config: ConnectionOptions::default(),
8178
listen_addr: "0.0.0.0:8900".to_string(),
8279
listen_addr_grpc: "0.0.0.0:8901".to_string(),
8380
blob_storage: Default::default(),
@@ -91,8 +88,8 @@ impl Default for ServerConfig {
9188
}
9289

9390
impl ServerConfig {
94-
pub fn from_path(path: &str) -> Result<ServerConfig> {
95-
let config_str = std::fs::read_to_string(path)?;
91+
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<ServerConfig> {
92+
let config_str = std::fs::read_to_string(path.as_ref())?;
9693
let figment = Figment::from(Serialized::defaults(ServerConfig::default()));
9794

9895
let config: ServerConfig = figment.merge(Yaml::string(&config_str)).extract()?;

server/src/gc_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ mod tests {
1515
},
1616
service::Service,
1717
state_store::{
18-
driver::Writer,
1918
requests::{
2019
CreateOrUpdateApplicationRequest,
2120
DeleteApplicationRequest,

server/src/integration_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod tests {
2727
executors::EXECUTOR_TIMEOUT,
2828
service::Service,
2929
state_store::{
30-
driver::{IterOptions, Reader, rocksdb::RocksDBDriver},
30+
driver::{Driver, IterOptions},
3131
requests::{
3232
CreateOrUpdateApplicationRequest,
3333
DeleteApplicationRequest,
@@ -44,7 +44,7 @@ mod tests {
4444
const TEST_FN_MAX_RETRIES: u32 = 3;
4545

4646
async fn assert_cf_counts(
47-
db: Arc<RocksDBDriver>,
47+
db: Arc<dyn Driver>,
4848
mut asserts: HashMap<String, usize>,
4949
) -> Result<()> {
5050
if !asserts.contains_key(IndexifyObjectsColumns::StateMachineMetadata.as_ref()) {

server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct Cli {
5252
async fn main() -> anyhow::Result<()> {
5353
let cli = Cli::parse();
5454
let config = match cli.config {
55-
Some(path) => config::ServerConfig::from_path(path.to_str().unwrap()).unwrap(),
55+
Some(path) => config::ServerConfig::from_path(&path)?,
5656
None => config::ServerConfig::default(),
5757
};
5858

0 commit comments

Comments
 (0)