From aa00e3f6e204fb5d0322338b703c885a3dfa6135 Mon Sep 17 00:00:00 2001 From: kruserr <46799551+kruserr@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:01:11 +0000 Subject: [PATCH 1/7] build: update to rust 1.76 --- Dockerfile | 2 +- rust-toolchain.toml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 rust-toolchain.toml diff --git a/Dockerfile b/Dockerfile index 2eb3173..c5d3b6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/rust:1.75-slim-bookworm AS builder +FROM docker.io/rust:1.76-slim-bookworm AS builder RUN apt-get update && \ apt-get install -y pkg-config libssl-dev && \ rm -rf /var/lib/apt/lists/* diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..e43fdd6 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.76.0" +# channel = "stable" +# channel = "nightly" From 5806401775b6208f7f32e41b6b737f277de1581f Mon Sep 17 00:00:00 2001 From: kruserr <46799551+kruserr@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:07:08 +0000 Subject: [PATCH 2/7] build: update Cargo.lock --- Cargo.lock | 71 ++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 95469c5..341a35d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,12 +106,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730" [[package]] name = "cfg-if" @@ -315,9 +312,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "http" @@ -389,9 +386,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown", @@ -405,9 +402,9 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "lock_api" @@ -433,9 +430,9 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memmap2" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" dependencies = [ "libc", ] @@ -458,9 +455,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -550,18 +547,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", @@ -683,9 +680,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "scoped-tls" @@ -701,18 +698,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.195" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -721,9 +718,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -795,9 +792,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" dependencies = [ "proc-macro2", "quote", @@ -806,18 +803,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", @@ -841,9 +838,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -999,9 +996,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] From 45d4e2fab1268a5feb56b6e1824ab88c1019a0be Mon Sep 17 00:00:00 2001 From: kruserr <46799551+kruserr@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:07:39 +0000 Subject: [PATCH 3/7] ci: set workspace lints --- Cargo.toml | 6 ++++++ examples/Cargo.toml | 6 ++++++ rapiddb-web/Cargo.toml | 9 ++++++--- rapiddb/Cargo.toml | 9 ++++++--- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0739c3b..3cfc167 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,9 @@ members = [ # Internal "examples", ] + +[workspace.lints.rust] +unused_parens = "allow" + +[workspace.lints.clippy] +needless_return = "allow" diff --git a/examples/Cargo.toml b/examples/Cargo.toml index cbc3189..2535a34 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -4,6 +4,12 @@ version = "0.0.0" publish = false edition = "2021" +[lints] +workspace = true + +# [lib] +#doctest = false + [dependencies] # rapiddb = { path = "../rapiddb" } rapiddb-web = { path = "../rapiddb-web" } diff --git a/rapiddb-web/Cargo.toml b/rapiddb-web/Cargo.toml index 2852931..266a522 100644 --- a/rapiddb-web/Cargo.toml +++ b/rapiddb-web/Cargo.toml @@ -10,6 +10,12 @@ description = "A reasonably fast configurable embedded key-value sensor database keywords = ["database", "embedded-database", "db", "persistence", "key-value"] categories = ["database", "database-implementations", "caching"] +[lints] +workspace = true + +# [lib] +#doctest = false + [dependencies] rapiddb = { version = "0.1", path = "../rapiddb" } @@ -17,6 +23,3 @@ tokio = { version = "1", features = ["full"] } warp = "0.3" serde = "1.0" serde_json = "1.0" - -[lib] -#doctest = false diff --git a/rapiddb/Cargo.toml b/rapiddb/Cargo.toml index 293a031..6107dbe 100644 --- a/rapiddb/Cargo.toml +++ b/rapiddb/Cargo.toml @@ -10,6 +10,12 @@ description = "A reasonably fast configurable embedded key-value sensor database keywords = ["database", "embedded-database", "db", "persistence", "key-value"] categories = ["database", "database-implementations", "caching"] +[lints] +workspace = true + +# [lib] +#doctest = false + [dependencies] tokio = { version = "1", features = ["sync"] } serde = "1.0" @@ -19,6 +25,3 @@ async-trait = "0.1" [dev-dependencies] tokio-test = "0.4" - -[lib] -#doctest = false From 083afa2cfb86c3890b85ccce0895eff6262931be Mon Sep 17 00:00:00 2001 From: kruserr <46799551+kruserr@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:11:43 +0000 Subject: [PATCH 4/7] fix: update only-db example --- Cargo.lock | 1 + examples/Cargo.toml | 8 ++++---- examples/only-db.rs | 10 +++------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 341a35d..203676b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -170,6 +170,7 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" name = "examples" version = "0.0.0" dependencies = [ + "rapiddb", "rapiddb-web", "serde", "serde_json", diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 2535a34..051a51c 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -11,7 +11,7 @@ workspace = true #doctest = false [dependencies] -# rapiddb = { path = "../rapiddb" } +rapiddb = { path = "../rapiddb" } rapiddb-web = { path = "../rapiddb-web" } tokio = { version = "1", features = ["full"] } @@ -27,6 +27,6 @@ path = "init.rs" name = "bench-mmav" path = "bench-mmav.rs" -# [[example]] -# name = "only-db" -# path = "only-db.rs" +[[example]] +name = "only-db" +path = "only-db.rs" diff --git a/examples/only-db.rs b/examples/only-db.rs index 060ff9b..159e9bc 100644 --- a/examples/only-db.rs +++ b/examples/only-db.rs @@ -1,13 +1,9 @@ use rapiddb::traits::IDatabase; pub fn main() { - let db = std::sync::Arc::new( - std::sync::RwLock::new( - rapiddb::db::MMAVDatabase::new() - ) - ); + let mut db = rapiddb::db::MMAVDatabase::new(); let value = b"{\"key\": \"value\"}"; - db.write().unwrap().post("test-0", value); - assert_eq!(db.write().unwrap().get_latest("test-0"), value); + db.post("test-0", value); + assert_eq!(db.get_latest("test-0"), value); } From 754e336d193dc86fdad7ab188b866e82f8bbae62 Mon Sep 17 00:00:00 2001 From: kruserr <46799551+kruserr@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:16:26 +0000 Subject: [PATCH 5/7] docs: remove content-type from curl --- README.md | 2 +- docs/dockerhub.md | 2 +- rapiddb-web/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d7c78fa..e30a17d 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ docker run -dit --rm -p 3030:3030 --name rapiddb kruserr/rapiddb:0.1 ### Use the database with curl Write to database with curl ```bash -curl -X POST localhost:3030/api/v0/test-0 -H 'Content-Type: application/json' -d '{"temp":4.00}' +curl -X POST localhost:3030/api/v0/test-0 -d '{"temp":4.00}' ``` Read from database with curl diff --git a/docs/dockerhub.md b/docs/dockerhub.md index c85383c..149e121 100644 --- a/docs/dockerhub.md +++ b/docs/dockerhub.md @@ -41,7 +41,7 @@ docker run -dit --rm -p 3030:3030 --name rapiddb kruserr/rapiddb:0.1 ### Use the database with curl Write to database with curl ```bash -curl -X POST localhost:3030/api/v0/test-0 -H 'Content-Type: application/json' -d '{"temp":4.00}' +curl -X POST localhost:3030/api/v0/test-0 -d '{"temp":4.00}' ``` Read from database with curl diff --git a/rapiddb-web/src/lib.rs b/rapiddb-web/src/lib.rs index 7223c27..f6bbefa 100644 --- a/rapiddb-web/src/lib.rs +++ b/rapiddb-web/src/lib.rs @@ -48,7 +48,7 @@ //! ### Use the database with curl //! Write to database with curl //! ```bash -//! curl -X POST localhost:3030/api/v0/test-0 -H 'Content-Type: application/json' -d '{"temp":4.00}' +//! curl -X POST localhost:3030/api/v0/test-0 -d '{"temp":4.00}' //! ``` //! //! Read from database with curl From 1f8b899d71fca0f05fa919635350b3729d8ef415 Mon Sep 17 00:00:00 2001 From: kruserr <46799551+kruserr@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:24:59 +0000 Subject: [PATCH 6/7] build: disable toolchain file --- rust-toolchain.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e43fdd6..c05d46f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ -[toolchain] -channel = "1.76.0" +# [toolchain] +# channel = "1.76.0" # channel = "stable" # channel = "nightly" From 28464beaf75acf636bd73bd767ae7c0e5899f647 Mon Sep 17 00:00:00 2001 From: kruserr <46799551+kruserr@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:25:49 +0000 Subject: [PATCH 7/7] build: remove toolchain file --- rust-toolchain.toml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 rust-toolchain.toml diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index c05d46f..0000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,4 +0,0 @@ -# [toolchain] -# channel = "1.76.0" -# channel = "stable" -# channel = "nightly"