From 13d1f6986b8725f811cfeddbadb5eb8e6a24b487 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Wed, 7 Feb 2024 12:11:54 +0100 Subject: [PATCH] feat: use low level API to configure the API Fixes the following error [2024-02-07T11:12:37Z ERROR sled::config] cache capacity is limited to the cgroup memory limit: 964485120 bytes Signed-off-by: Vincenzo Palazzo --- Cargo.lock | 54 +++++++++++++++++----------------- coffee_storage/src/nosql_db.rs | 4 ++- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a39a0d83..1bed8235 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1165,9 +1165,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git2" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" +checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd" dependencies = [ "bitflags 2.4.2", "libc", @@ -1412,9 +1412,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -1456,9 +1456,9 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libgit2-sys" -version = "0.16.1+1.7.1" +version = "0.16.2+1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2a2bb3680b094add03bb3732ec520ece34da31a8cd2d633d1389d0f0fb60d0c" +checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" dependencies = [ "cc", "libc", @@ -1626,12 +1626,12 @@ dependencies = [ [[package]] name = "nosql_db" version = "0.0.2" -source = "git+https://github.com/vincenzopalazzo/nosql-db.git#ef25626f214b9587a552b6a8c34e43b823292405" +source = "git+https://github.com/vincenzopalazzo/nosql-db.git#8bb2c557cfcd23d159895e0408318c1b12ece143" [[package]] name = "nosql_sled" version = "0.1.0" -source = "git+https://github.com/vincenzopalazzo/nosql-db.git#ef25626f214b9587a552b6a8c34e43b823292405" +source = "git+https://github.com/vincenzopalazzo/nosql-db.git#8bb2c557cfcd23d159895e0408318c1b12ece143" dependencies = [ "nosql_db", "sled", @@ -1987,7 +1987,7 @@ dependencies = [ [[package]] name = "radicle-term" version = "0.1.0" -source = "git+https://github.com/radicle-dev/heartwood.git#8928c5ee2628e0b4d738289b5030fc3e2a918e5e" +source = "git+https://github.com/radicle-dev/heartwood.git#fe55de181d4320a0cd7a6ebd2820764280ae9adc" dependencies = [ "anstyle-query", "anyhow", @@ -2750,9 +2750,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" @@ -2822,9 +2822,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2832,9 +2832,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", @@ -2847,9 +2847,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -2859,9 +2859,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2869,9 +2869,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", @@ -2882,15 +2882,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", @@ -3061,9 +3061,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.37" +version = "0.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" +checksum = "5389a154b01683d28c77f8f68f49dea75f0a4da32557a58f68ee51ebba472d29" dependencies = [ "memchr", ] diff --git a/coffee_storage/src/nosql_db.rs b/coffee_storage/src/nosql_db.rs index d14c7f93..1edd4dbb 100644 --- a/coffee_storage/src/nosql_db.rs +++ b/coffee_storage/src/nosql_db.rs @@ -1,6 +1,7 @@ use async_trait::async_trait; use coffee_lib::utils::check_dir_or_make_if_missing; use nosql_db::NoSQL; +use nosql_sled::sled; use nosql_sled::SledDB; use coffee_lib::error; @@ -17,7 +18,8 @@ impl NoSQlStorage { pub async fn new(path: &str) -> Result { let path = format!("{path}/storage"); check_dir_or_make_if_missing(path.clone()).await?; - let db = SledDB::new(&path).map_err(|err| error!("{err}"))?; + let config = sled::Config::new().path(path).cache_capacity(1_000_000); + let db = SledDB::try_from(config).map_err(|err| error!("{err}"))?; Ok(Self { inner: db }) } }