diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 877a46f..f0873be 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -41,3 +41,47 @@ jobs: - name: Run Tests run: cargo test --verbose + + udeps: + name: Unused Dependencies (cargo-udeps) + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set Up Rust (nightly for udeps) + uses: dtolnay/rust-toolchain@nightly + + - name: Cache Cargo Dependencies + uses: Swatinem/rust-cache@v2 + + - name: Install protoc for gRPC server + run: sudo apt-get update && sudo apt-get install -y protobuf-compiler + + - name: Install cargo-udeps + run: cargo +nightly install cargo-udeps --locked + + - name: Run cargo-udeps + run: cargo +nightly udeps --workspace --all-targets --all-features + + taplo: + name: Taplo (TOML formatting) + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set Up Rust (stable for cargo install) + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Cache Cargo Dependencies + uses: Swatinem/rust-cache@v2 + + - name: Install taplo + run: cargo +stable install taplo-cli --version ^0.9 --locked --force + + - name: Check TOML formatting with taplo + run: taplo format --check diff --git a/Cargo.lock b/Cargo.lock index 00dd523..ba5b23b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,15 +32,6 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anyhow" version = "1.0.100" @@ -75,12 +66,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - [[package]] name = "axum" version = "0.8.7" @@ -133,35 +118,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "axum-test" -version = "18.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3290e73c56c5cc4701cdd7d46b9ced1b4bd61c7e9f9c769a9e9e87ff617d75d2" -dependencies = [ - "anyhow", - "axum", - "bytes", - "bytesize", - "cookie", - "expect-json", - "http 1.4.0", - "http-body-util", - "hyper", - "hyper-util", - "mime", - "pretty_assertions", - "reserve-port", - "rust-multipart-rfc7578_2", - "serde", - "serde_json", - "serde_urlencoded", - "smallvec", - "tokio", - "tower", - "url", -] - [[package]] name = "backtrace" version = "0.3.76" @@ -255,12 +211,6 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" -[[package]] -name = "bytesize" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bd91ee7b2422bcb158d90ef4d14f75ef67f340943fc4149891dcce8f8b972a3" - [[package]] name = "bzip2-sys" version = "0.1.13+1.0.8" @@ -313,20 +263,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" -[[package]] -name = "chrono" -version = "0.4.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-link", -] - [[package]] name = "clang-sys" version = "1.8.1" @@ -378,16 +314,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "cookie" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" -dependencies = [ - "time", - "version_check", -] - [[package]] name = "core-foundation" version = "0.9.4" @@ -433,26 +359,10 @@ dependencies = [ name = "defs" version = "0.1.0" dependencies = [ - "bincode", "serde", "uuid", ] -[[package]] -name = "deranged" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "displaydoc" version = "0.2.5" @@ -470,27 +380,12 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - [[package]] name = "either" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" -[[package]] -name = "email_address" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e079f19b08ca6239f47f8ba8509c11cf3ea30095831f7fed61441475edd8c449" -dependencies = [ - "serde", -] - [[package]] name = "encoding_rs" version = "0.8.35" @@ -506,17 +401,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" -[[package]] -name = "erased-serde" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3" -dependencies = [ - "serde", - "serde_core", - "typeid", -] - [[package]] name = "errno" version = "0.3.14" @@ -527,35 +411,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "expect-json" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422e7906e79941e5ac58c64dfd2da03e6ae3de62227f87606fbbe125d91080f9" -dependencies = [ - "chrono", - "email_address", - "expect-json-macros", - "num", - "regex", - "serde", - "serde_json", - "thiserror", - "typetag", - "uuid", -] - -[[package]] -name = "expect-json-macros" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b515b7f10f1e61bfd938522e9884509b82060af2016153f5b3d6f44d6da89c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "eyre" version = "0.6.12" @@ -711,7 +566,6 @@ version = "0.1.0" dependencies = [ "api", "defs", - "dotenv", "index", "prost", "prost-types", @@ -724,7 +578,6 @@ dependencies = [ "tonic-prost", "tonic-prost-build", "tracing", - "tracing-subscriber", "uuid", ] @@ -776,17 +629,13 @@ version = "0.1.0" dependencies = [ "api", "axum", - "axum-test", "defs", - "dotenvy", "index", "serde", "serde_json", "storage", - "tempfile", "tokio", "tracing", - "tracing-subscriber", ] [[package]] @@ -928,30 +777,6 @@ dependencies = [ "windows-registry", ] -[[package]] -name = "iana-time-zone" -version = "0.1.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "log", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "icu_collections" version = "2.1.1" @@ -1078,15 +903,6 @@ dependencies = [ "hashbrown 0.16.1", ] -[[package]] -name = "inventory" -version = "0.3.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" -dependencies = [ - "rustversion", -] - [[package]] name = "ipnet" version = "2.11.0" @@ -1365,85 +1181,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "num" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" -dependencies = [ - "num-bigint", - "num-complex", - "num-integer", - "num-iter", - "num-rational", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - [[package]] name = "object" version = "0.37.3" @@ -1607,31 +1344,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "pretty_assertions" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" -dependencies = [ - "diff", - "yansi", -] - [[package]] name = "prettyplease" version = "0.2.37" @@ -1740,35 +1452,6 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" -[[package]] -name = "rand" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" -dependencies = [ - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" -dependencies = [ - "getrandom 0.3.4", -] - [[package]] name = "ratatui" version = "0.26.3" @@ -1870,15 +1553,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "reserve-port" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21918d6644020c6f6ef1993242989bf6d4952d2e025617744f184c02df51c356" -dependencies = [ - "thiserror", -] - [[package]] name = "ring" version = "0.17.14" @@ -1903,21 +1577,6 @@ dependencies = [ "librocksdb-sys", ] -[[package]] -name = "rust-multipart-rfc7578_2" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c839d037155ebc06a571e305af66ff9fd9063a6e662447051737e1ac75beea41" -dependencies = [ - "bytes", - "futures-core", - "futures-util", - "http 1.4.0", - "mime", - "rand", - "thiserror", -] - [[package]] name = "rustc-demangle" version = "0.1.26" @@ -2217,7 +1876,6 @@ version = "0.1.0" dependencies = [ "bincode", "defs", - "index", "rocksdb", "tempfile", "uuid", @@ -2316,26 +1974,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "thiserror" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "thread_local" version = "1.1.9" @@ -2345,37 +1983,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "time" -version = "0.3.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" - -[[package]] -name = "time-macros" -version = "0.2.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" -dependencies = [ - "num-conv", - "time-core", -] - [[package]] name = "tinystr" version = "0.8.2" @@ -2653,9 +2260,7 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" name = "tui" version = "0.1.0" dependencies = [ - "anyhow", "api", - "chrono", "color-eyre", "crossterm", "defs", @@ -2670,36 +2275,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "typeid" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" - -[[package]] -name = "typetag" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2212c8a9b9bcfca32024de14998494cf9a5dfa59ea1b829de98bac374b86bf" -dependencies = [ - "erased-serde", - "inventory", - "once_cell", - "serde", - "typetag-impl", -] - -[[package]] -name = "typetag-impl" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27a7a9b72ba121f6f1f6c3632b85604cac41aedb5ddc70accbebb6cac83de846" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "unicase" version = "2.8.1" @@ -2783,12 +2358,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - [[package]] name = "want" version = "0.3.1" @@ -2903,41 +2472,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-core" -version = "0.62.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link", - "windows-result", - "windows-strings", -] - -[[package]] -name = "windows-implement" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "windows-interface" -version = "0.59.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "windows-link" version = "0.2.1" @@ -3207,12 +2741,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" -[[package]] -name = "yansi" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" - [[package]] name = "yoke" version = "0.8.1" @@ -3236,26 +2764,6 @@ dependencies = [ "synstructure", ] -[[package]] -name = "zerocopy" -version = "0.8.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "zerofrom" version = "0.1.6" diff --git a/Cargo.toml b/Cargo.toml index 397facf..091c725 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -resolver = "2" # Use the modern feature resolver +resolver = "2" members = [ "crates/defs", "crates/storage", @@ -10,22 +10,44 @@ members = [ "crates/grpc", ] -# You can define shared dependencies for all crates here +[workspace.package] +version = "0.1.0" +edition = "2024" +license = "MIT" + [workspace.dependencies] -tokio = { version = "1.37.0", features = ["full"] } +axum = "0.8" +axum-test = "18.1.0" +bincode = "1.3.3" +chrono = { version = "0.4", features = ["serde"] } +color-eyre = "0.6.5" +crossterm = "0.27" +dotenv = "0.15.0" +dotenvy = "0.15" +prost = "0.14.1" +prost-types = "0.14.1" +ratatui = "0.26" +reqwest = { version = "0.12", features = ["json", "blocking", "multipart"] } +rocksdb = "0.21.0" serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -# thiserror = "1.0" -anyhow = "1.0" -# tracing = "0.1.41" -# Add any other dependencies that multiple crates will use -# For example, if you introduce Axum/Tonic later, they might go here. -# axum = { version = "0.7", features = ["macros"] } -# tonic = "0.11" -# prost = "0.12" +serde_json = "1.0.145" +tempfile = "3.23.0" +tokio = { version = "1.47.1", features = ["full"] } +tokio-stream = "0.1.17" +tonic = "0.14.2" +tonic-build = "0.14.2" +tonic-prost = "0.14.2" +tonic-prost-build = "0.14.2" +tracing = "0.1.41" +tracing-subscriber = "0.3.20" uuid = { version = "1.18.1", features = ["v4", "serde"] } -# # crates/some-crate/Cargo.toml -# [dependencies] -# tokio.workspace = true -# serde.workspace = true +## workspaces members +api = { path = "crates/api" } +defs = { path = "crates/defs" } +grpc = { path = "crates/grpc" } +http = { path = "crates/http" } +index = { path = "crates/index" } +server = { path = "crates/server" } +storage = { path = "crates/storage" } +tui = { path = "crates/tui" } diff --git a/crates/api/Cargo.toml b/crates/api/Cargo.toml index adcf536..8ade9d8 100644 --- a/crates/api/Cargo.toml +++ b/crates/api/Cargo.toml @@ -1,12 +1,14 @@ +# crates/api/Cargo.toml + [package] -name="api" -version = "0.1.0" -edition = "2021" -license = "MIT" +name = "api" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] -defs = { path = "../defs" } -index = { path = "../index" } -storage = { path = "../storage" } -tempfile = "3.20.0" -uuid.workspace = true \ No newline at end of file +defs.workspace = true +index.workspace = true +storage.workspace = true +tempfile.workspace = true +uuid.workspace = true diff --git a/crates/defs/Cargo.toml b/crates/defs/Cargo.toml index eb58c78..600b80c 100644 --- a/crates/defs/Cargo.toml +++ b/crates/defs/Cargo.toml @@ -1,12 +1,11 @@ # crates/defs/Cargo.toml [package] -name="defs" -version = "0.1.0" -edition = "2021" -license = "MIT" +name = "defs" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] -bincode = "1.3.3" -serde = { version = "1.0", features = ["derive"] } +serde.workspace = true uuid.workspace = true diff --git a/crates/grpc/Cargo.toml b/crates/grpc/Cargo.toml index ddb7c79..e0bf61e 100644 --- a/crates/grpc/Cargo.toml +++ b/crates/grpc/Cargo.toml @@ -1,28 +1,27 @@ +# crates/grpc/Cargo.toml + [package] name = "grpc" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] -prost = "0.14.1" -tokio = { version = "1.47.1", features = ["macros", "rt-multi-thread"] } -tonic = "0.14.2" -tonic-prost-build = "0.14.2" - -api = { path = "../api" } -storage = { path = "../storage" } -index = { path = "../index" } -defs = { path = "../defs" } - -tonic-prost = "0.14.2" -prost-types = "0.14.1" -dotenv = "0.15.0" -tempfile = "3.23.0" -tracing = "0.1.41" -tracing-subscriber = "0.3.20" -tokio-stream = "0.1.17" +api.workspace = true +defs.workspace = true +index.workspace = true +prost.workspace = true +prost-types.workspace = true +storage.workspace = true +tempfile.workspace = true +tokio.workspace = true +tokio-stream.workspace = true +tonic.workspace = true +tonic-prost.workspace = true +tonic-prost-build.workspace = true +tracing.workspace = true uuid.workspace = true [build-dependencies] -tonic-build = "0.14.2" -tonic-prost-build = "0.14.2" +tonic-build.workspace = true +tonic-prost-build.workspace = true diff --git a/crates/http/Cargo.toml b/crates/http/Cargo.toml index ce94b9f..4f3595e 100644 --- a/crates/http/Cargo.toml +++ b/crates/http/Cargo.toml @@ -1,23 +1,18 @@ +# crates/http/Cargo.toml + [package] name = "http" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] -tokio = { version = "1", features = ["full"] } -axum = "0.8" -serde = { version = "1.0", features = ["derive"] } -tracing-subscriber = "0.3" # For logging -tracing = "0.1" -dotenvy = "0.15" - -# Add your local crates -# tokio.workspace = true - -api = { path = "../api" } -defs = { path = "../defs" } -index = { path = "../index" } -storage = { path = "../storage" } -tempfile = "3.20.0" -serde_json = "1.0.145" -axum-test = "18.1.0" +api.workspace = true +axum.workspace = true +defs.workspace = true +index.workspace = true +serde.workspace = true +serde_json.workspace = true +storage.workspace = true +tokio.workspace = true +tracing.workspace = true diff --git a/crates/index/Cargo.toml b/crates/index/Cargo.toml index 7643ba3..35f9957 100644 --- a/crates/index/Cargo.toml +++ b/crates/index/Cargo.toml @@ -2,10 +2,10 @@ [package] name = "index" -version = "0.1.0" -edition = "2021" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] - -defs = { path = "../defs" } -uuid.workspace = true \ No newline at end of file +defs.workspace = true +uuid.workspace = true diff --git a/crates/index/src/flat.rs b/crates/index/src/flat.rs index 0739f01..a3a62bf 100644 --- a/crates/index/src/flat.rs +++ b/crates/index/src/flat.rs @@ -1,6 +1,6 @@ use defs::{DbError, DenseVector, DistanceOrderedVector, IndexedVector, PointId, Similarity}; -use crate::{distance, VectorIndex}; +use crate::{VectorIndex, distance}; pub struct FlatIndex { index: Vec, diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 4a91211..7f33898 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -1,42 +1,30 @@ +# crates/server/Cargo.toml + [package] name = "server" -version = "0.1.0" -edition = "2024" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] -# Async runtime -tokio = { version = "1", features = ["full"] } - -# HTTP server (Axum) -axum = "0.8" - -# gRPC server (Tonic) -tonic = "0.14.2" -prost = "0.14.1" - -# Serialization -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" - -# Logging -tracing = "0.1" -tracing-subscriber = "0.3" - -# Config -dotenv = "0.15.0" - -# Local crates -api = { path = "../api" } -defs = { path = "../defs" } -index = { path = "../index" } -storage = { path = "../storage" } -grpc = { path = "../grpc" } -http = { path = "../http" } - -# Other -tempfile = "3.23.0" +api.workspace = true +axum.workspace = true +defs.workspace = true +dotenv.workspace = true +grpc.workspace = true +http.workspace = true +index.workspace = true +prost.workspace = true +serde.workspace = true +serde_json.workspace = true +storage.workspace = true +tempfile.workspace = true +tokio.workspace = true +tokio-stream.workspace = true +tonic.workspace = true +tracing.workspace = true +tracing-subscriber.workspace = true uuid.workspace = true -tokio-stream = "0.1.17" [dev-dependencies] -tonic = "0.14.2" +tonic.workspace = true diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index 70005cb..c786373 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -1,13 +1,14 @@ +# crates/storage/Cargo.toml + [package] name = "storage" -version = "0.1.0" -edition = "2021" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] -bincode = "1.3.3" -rocksdb = "0.21.0" +bincode.workspace = true +defs.workspace = true +rocksdb.workspace = true +tempfile.workspace = true uuid.workspace = true - -defs = { path = "../defs" } -index = { path = "../index" } -tempfile = "3.23.0" diff --git a/crates/storage/src/rocks_db.rs b/crates/storage/src/rocks_db.rs index dbdad6e..f9c80ab 100644 --- a/crates/storage/src/rocks_db.rs +++ b/crates/storage/src/rocks_db.rs @@ -3,7 +3,7 @@ use crate::{StorageEngine, VectorPage}; use bincode::{deserialize, serialize}; use defs::{DbError, DenseVector, Payload, Point, PointId}; -use rocksdb::{Error, Options, DB}; +use rocksdb::{DB, Error, Options}; use std::path::PathBuf; //TODO: Implement RocksDbStorage with necessary fields and implementations diff --git a/crates/tui/Cargo.toml b/crates/tui/Cargo.toml index b745781..b71f2e5 100644 --- a/crates/tui/Cargo.toml +++ b/crates/tui/Cargo.toml @@ -1,21 +1,22 @@ +# crates/tui/Cargo.toml + [package] name = "tui" -version = "0.1.0" -edition = "2021" +version.workspace = true +edition.workspace = true +license.workspace = true [dependencies] -color-eyre = "0.6.5" -ratatui = "0.26" -crossterm = "0.27" -tokio.workspace = true +api.workspace = true +color-eyre.workspace = true +crossterm.workspace = true +defs.workspace = true +dotenv.workspace = true +index.workspace = true +ratatui.workspace = true +reqwest.workspace = true serde.workspace = true -anyhow.workspace = true -uuid.workspace = true -chrono = { version = "0.4", features = ["serde"] } -defs = { path = "../defs" } -storage = { path = "../storage" } -index = { path = "../index" } -api = { path = "../api" } serde_json.workspace = true -reqwest = { version = "0.12", features = ["json", "blocking", "multipart"] } -dotenv = "0.15" \ No newline at end of file +storage.workspace = true +tokio.workspace = true +uuid.workspace = true diff --git a/crates/tui/src/app/database.rs b/crates/tui/src/app/database.rs index 3542b6f..9dc7883 100644 --- a/crates/tui/src/app/database.rs +++ b/crates/tui/src/app/database.rs @@ -1,4 +1,4 @@ -use api::{init_api, DbConfig, VectorDb}; +use api::{DbConfig, VectorDb, init_api}; use index::IndexType; use std::io; use std::path::PathBuf; @@ -97,12 +97,12 @@ impl DatabaseManager { pub fn delete_database(&mut self, path: &PathBuf) -> io::Result<()> { // Close current connection if it's the same database - if let Some(current_path) = &self.current_db_path { - if current_path == path { - self.storage_engine = None; - self.current_db_path = None; - self.api_db = None; - } + if let Some(current_path) = &self.current_db_path + && current_path == path + { + self.storage_engine = None; + self.current_db_path = None; + self.api_db = None; } // Remove from available databases list @@ -128,11 +128,11 @@ impl DatabaseManager { for entry in std::fs::read_dir(&db_dir)? { let entry = entry?; let path = entry.path(); - if path.is_dir() { - if let Some(name) = path.file_name() { - self.available_databases - .push((name.to_string_lossy().to_string(), path)); - } + if path.is_dir() + && let Some(name) = path.file_name() + { + self.available_databases + .push((name.to_string_lossy().to_string(), path)); } } diff --git a/crates/tui/src/app/embeddings.rs b/crates/tui/src/app/embeddings.rs index 9e9e59d..343b422 100644 --- a/crates/tui/src/app/embeddings.rs +++ b/crates/tui/src/app/embeddings.rs @@ -1,7 +1,7 @@ -use reqwest::blocking::{multipart, Client, Response}; use reqwest::StatusCode; -use serde::de::DeserializeOwned; +use reqwest::blocking::{Client, Response, multipart}; use serde::Deserialize; +use serde::de::DeserializeOwned; use std::env; use std::path::Path; use std::time::Duration; diff --git a/crates/tui/src/app/events.rs b/crates/tui/src/app/events.rs index 481f044..e8f373c 100644 --- a/crates/tui/src/app/events.rs +++ b/crates/tui/src/app/events.rs @@ -324,14 +324,14 @@ fn execute_modal_action(app: &mut App) -> io::Result<()> { app.vector_list_selected_index = 0; for id in ids.into_iter() { - if let Some(point) = db.get(id).map_err(to_io)? { - if let Some(vector) = point.vector { - app.vector_list_items.push(VectorListItem { - id: point.id, - vector, - payload: point.payload, - }); - } + if let Some(point) = db.get(id).map_err(to_io)? + && let Some(vector) = point.vector + { + app.vector_list_items.push(VectorListItem { + id: point.id, + vector, + payload: point.payload, + }); } } diff --git a/crates/tui/src/main.rs b/crates/tui/src/main.rs index 3617be4..ebd543f 100644 --- a/crates/tui/src/main.rs +++ b/crates/tui/src/main.rs @@ -6,9 +6,9 @@ use color_eyre::Result; use crossterm::{ event::{self, DisableMouseCapture, EnableMouseCapture}, execute, - terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen}, + terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode}, }; -use ratatui::{backend::CrosstermBackend, Terminal}; +use ratatui::{Terminal, backend::CrosstermBackend}; use std::io; use ui::{ dashboard::render_dashboard, db::render_database, modal::render_modal, diff --git a/crates/tui/src/ui/components.rs b/crates/tui/src/ui/components.rs index 0ff67ef..4fffc6f 100644 --- a/crates/tui/src/ui/components.rs +++ b/crates/tui/src/ui/components.rs @@ -1,9 +1,9 @@ use ratatui::{ + Frame, layout::Alignment, style::{Color, Style}, text::{Line, Span}, widgets::{Block, Borders, List, ListItem, ListState, Paragraph}, - Frame, }; pub struct PageTitle { diff --git a/crates/tui/src/ui/dashboard.rs b/crates/tui/src/ui/dashboard.rs index 62bbf33..71956bc 100644 --- a/crates/tui/src/ui/dashboard.rs +++ b/crates/tui/src/ui/dashboard.rs @@ -1,9 +1,9 @@ use ratatui::{ + Frame, layout::{Alignment, Constraint, Direction, Layout}, style::{Color, Style}, text::{Line, Span}, widgets::{Block, Borders, Paragraph}, - Frame, }; use crate::app::App; diff --git a/crates/tui/src/ui/db.rs b/crates/tui/src/ui/db.rs index 77d0198..3f36b88 100644 --- a/crates/tui/src/ui/db.rs +++ b/crates/tui/src/ui/db.rs @@ -1,11 +1,11 @@ use ratatui::{ + Frame, layout::{Constraint, Direction, Layout}, style::Color, widgets::ListItem, - Frame, }; -use super::components::{common_instructions, create_instructions, OperationsList, PageTitle}; +use super::components::{OperationsList, PageTitle, common_instructions, create_instructions}; use crate::app::App; const DB_OPERATIONS: &[&str] = &["Create New Database", "Select Database", "Delete Database"]; diff --git a/crates/tui/src/ui/vector_operations.rs b/crates/tui/src/ui/vector_operations.rs index ad9ab08..02bc061 100644 --- a/crates/tui/src/ui/vector_operations.rs +++ b/crates/tui/src/ui/vector_operations.rs @@ -1,12 +1,12 @@ use ratatui::{ + Frame, layout::{Constraint, Direction, Layout}, style::{Color, Style}, text::{Line, Span}, widgets::{Block, Borders, ListItem, Paragraph}, - Frame, }; -use super::components::{common_instructions, create_instructions, OperationsList, PageTitle}; +use super::components::{OperationsList, PageTitle, common_instructions, create_instructions}; use crate::app::App; const VECTOR_OPERATIONS: &[&str] = &[ diff --git a/taplo.toml b/taplo.toml new file mode 100644 index 0000000..9c5f923 --- /dev/null +++ b/taplo.toml @@ -0,0 +1,40 @@ +## https://taplo.tamasfe.dev/configuration/file.html + +include = ["**/Cargo.toml"] + +[formatting] +# Align consecutive entries vertically. +align_entries = false +# Append trailing commas for multi-line arrays. +array_trailing_comma = true +# Expand arrays to multiple lines that exceed the maximum column width. +array_auto_expand = true +# Collapse arrays that don't exceed the maximum column width and don't contain comments. +array_auto_collapse = false +# Omit white space padding from single-line arrays +compact_arrays = true +# Omit white space padding from the start and end of inline tables. +compact_inline_tables = false +# Maximum column width in characters, affects array expansion and collapse, this doesn't take whitespace into account. +# Note that this is not set in stone, and works on a best-effort basis. +column_width = 120 +# Indent based on tables and arrays of tables and their subtables, subtables out of order are not indented. +indent_tables = false +# The substring that is used for indentation, should be tabs or spaces (but technically can be anything). +indent_string = ' ' +# Add trailing newline at the end of the file if not present. +trailing_newline = true +# Alphabetically reorder keys that are not separated by empty lines. +reorder_keys = false +# Maximum amount of allowed consecutive blank lines. This does not affect the whitespace at the end of the document, as it is always stripped. +allowed_blank_lines = 1 +# Use CRLF for line endings. +crlf = false + +[[rule]] +keys = ["build-dependencies", "dependencies", "dev-dependencies", "workspace.dependencies"] +formatting = { reorder_keys = true } + +[[rule]] +keys = ["package", "workspace.package"] +formatting = { reorder_keys = false } \ No newline at end of file