From 5a699af94d5845730568beb9413588f35c76d6e0 Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 8 Aug 2026 20:09:47 -0400 Subject: [PATCH] crates per tutorial step --- Cargo.lock | 31 ++++++++++++++++++- Cargo.toml | 20 ++++++------ moots-1-simple/Cargo.toml | 34 +++++++++++++++++++++ moots-1-simple/src/main.rs | 7 +++++ moots-2-read-optimized/Cargo.toml | 34 +++++++++++++++++++++ {src => moots-2-read-optimized/src}/main.rs | 2 +- 6 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 moots-1-simple/Cargo.toml create mode 100644 moots-1-simple/src/main.rs create mode 100644 moots-2-read-optimized/Cargo.toml rename {src => moots-2-read-optimized/src}/main.rs (82%) diff --git a/Cargo.lock b/Cargo.lock index 5670f84..867c804 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2844,7 +2844,36 @@ dependencies = [ ] [[package]] -name = "moots" +name = "moots-1-simple" +version = "0.1.0" +dependencies = [ + "axum", + "clap", + "color-eyre", + "hubble-sync", + "hubble-sync-axum", + "hubble-sync-rocksdb", + "jacquard-axum", + "jacquard-lexicon", + "metrics", + "metrics-exporter-prometheus", + "miette", + "rlimit", + "rocksdb", + "serde", + "serde_json", + "thiserror 2.0.19", + "tikv-jemallocator", + "tokio", + "tokio-util", + "tower-http", + "tracing", + "tracing-error", + "tracing-subscriber", +] + +[[package]] +name = "moots-2-read-optimized" version = "0.1.0" dependencies = [ "axum", diff --git a/Cargo.toml b/Cargo.toml index 68b0b53..22b2d12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,12 @@ -[package] -name = "moots" +[workspace] +resolver = "3" +members = ["moots-1-simple", "moots-2-read-optimized"] + +[workspace.package] version = "0.1.0" edition = "2024" -[dependencies] +[workspace.dependencies] axum = "0.8" clap = { version = "4.6", features = ["env", "derive"] } color-eyre = "0.6" @@ -18,6 +21,7 @@ rlimit = "0.10" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "2.0" +tikv-jemallocator = "0.6" # to match rust-rocksdb, bump to 0.7 when rocks does tokio = { version = "1.51", features = ["full", "tracing"] } tokio-util = { version = "0.7", features = ["io"] } tower-http = { version = "0.6", features = ["cors"] } @@ -25,18 +29,12 @@ tracing = "0.1" tracing-error = "0.2" tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } -[target.'cfg(not(target_env = "msvc"))'.dependencies.tikv-jemallocator] -version = "0.6" # to match rust-rocksdb, bump to 0.7 when rocks does - -[dependencies.metrics-exporter-prometheus] +[workspace.dependencies.metrics-exporter-prometheus] version = "0.18" default-features = false features = ["http-listener"] -[dependencies.rocksdb] +[workspace.dependencies.rocksdb] version = "0.24" default-features = false features = ["bindgen-runtime", "jemalloc", "lz4", "zstd"] - -[dev-dependencies] -jacquard-lexicon = { version = "0.12", features = ["codegen"] } diff --git a/moots-1-simple/Cargo.toml b/moots-1-simple/Cargo.toml new file mode 100644 index 0000000..55113c5 --- /dev/null +++ b/moots-1-simple/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "moots-1-simple" +version.workspace = true +edition.workspace = true + +[dependencies] +axum.workspace = true +clap.workspace = true +color-eyre.workspace = true +hubble-sync.workspace = true +hubble-sync-axum.workspace = true +hubble-sync-rocksdb.workspace = true +jacquard-axum.workspace = true +jacquard-lexicon.workspace = true +metrics.workspace = true +metrics-exporter-prometheus.workspace = true +miette.workspace = true +rlimit.workspace = true +rocksdb.workspace = true +serde.workspace = true +serde_json.workspace = true +thiserror.workspace = true +tokio.workspace = true +tokio-util.workspace = true +tower-http.workspace = true +tracing.workspace = true +tracing-error.workspace = true +tracing-subscriber.workspace = true + +[target.'cfg(not(target_env = "msvc"))'.dependencies] +tikv-jemallocator.workspace = true + +[dev-dependencies] +jacquard-lexicon = { workspace = true, features = ["codegen"] } diff --git a/moots-1-simple/src/main.rs b/moots-1-simple/src/main.rs new file mode 100644 index 0000000..f5f5868 --- /dev/null +++ b/moots-1-simple/src/main.rs @@ -0,0 +1,7 @@ +#[cfg(not(target_env = "msvc"))] +#[global_allocator] +static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; + +fn main() { + println!("hello fast version"); +} diff --git a/moots-2-read-optimized/Cargo.toml b/moots-2-read-optimized/Cargo.toml new file mode 100644 index 0000000..3376034 --- /dev/null +++ b/moots-2-read-optimized/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "moots-2-read-optimized" +version.workspace = true +edition.workspace = true + +[dependencies] +axum.workspace = true +clap.workspace = true +color-eyre.workspace = true +hubble-sync.workspace = true +hubble-sync-axum.workspace = true +hubble-sync-rocksdb.workspace = true +jacquard-axum.workspace = true +jacquard-lexicon.workspace = true +metrics.workspace = true +metrics-exporter-prometheus.workspace = true +miette.workspace = true +rlimit.workspace = true +rocksdb.workspace = true +serde.workspace = true +serde_json.workspace = true +thiserror.workspace = true +tokio.workspace = true +tokio-util.workspace = true +tower-http.workspace = true +tracing.workspace = true +tracing-error.workspace = true +tracing-subscriber.workspace = true + +[target.'cfg(not(target_env = "msvc"))'.dependencies] +tikv-jemallocator.workspace = true + +[dev-dependencies] +jacquard-lexicon = { workspace = true, features = ["codegen"] } diff --git a/src/main.rs b/moots-2-read-optimized/src/main.rs similarity index 82% rename from src/main.rs rename to moots-2-read-optimized/src/main.rs index 0ed43d5..08d45bc 100644 --- a/src/main.rs +++ b/moots-2-read-optimized/src/main.rs @@ -3,5 +3,5 @@ static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; fn main() { - println!("Hello, world!"); + println!("hello part 2"); } -- 2.51.2