From 54722e1f763df765c2977b69fc7e3311a3fdaee2 Mon Sep 17 00:00:00 2001 From: Niko PLP Date: Tue, 8 Aug 2023 21:10:05 +0300 Subject: [PATCH] switching to rocksdb as storage backend --- Cargo.lock | 155 +++- Cargo.toml | 1 + ng-app/src/App.svelte | 2 +- ng-app/src/lib/Home.svelte | 8 +- ng-app/src/lib/Install.svelte | 198 +++++ ng-app/src/routes/Home.svelte | 3 +- ng-app/src/routes/Install.svelte | 205 +---- ngone/.gitignore | 1 + ngone/Cargo.toml | 2 +- ngone/data/lock.mdb | Bin 8128 -> 0 bytes ngone/src/main.rs | 10 +- ngone/web/src/App.svelte | 2 +- ngone/web/src/routes/Install.svelte | 28 + p2p-broker/src/broker_store/account.rs | 83 +- p2p-broker/src/broker_store/invitation.rs | 2 +- p2p-repo/src/kcv_store.rs | 6 + p2p-repo/src/store.rs | 1 + stores-lmdb/src/kcv_store.rs | 12 +- stores-rocksdb/Cargo.toml | 20 + stores-rocksdb/src/kcv_store.rs | 424 +++++++++ stores-rocksdb/src/lib.rs | 5 + stores-rocksdb/src/repo_store.rs | 992 ++++++++++++++++++++++ 22 files changed, 1911 insertions(+), 249 deletions(-) create mode 100644 ng-app/src/lib/Install.svelte create mode 100644 ngone/.gitignore delete mode 100644 ngone/data/lock.mdb create mode 100644 ngone/web/src/routes/Install.svelte create mode 100644 stores-rocksdb/Cargo.toml create mode 100644 stores-rocksdb/src/kcv_store.rs create mode 100644 stores-rocksdb/src/lib.rs create mode 100644 stores-rocksdb/src/repo_store.rs diff --git a/Cargo.lock b/Cargo.lock index 54fdbd0..d72c277 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -477,6 +477,27 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.65.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.18", +] + [[package]] name = "bit_field" version = "0.10.2" @@ -621,6 +642,17 @@ dependencies = [ "serde", ] +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "cairo-rs" version = "0.16.7" @@ -661,6 +693,9 @@ name = "cc" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +dependencies = [ + "jobserver", +] [[package]] name = "cesu8" @@ -668,6 +703,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfb" version = "0.7.3" @@ -746,6 +790,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "clang-sys" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "4.3.5" @@ -2370,6 +2425,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +[[package]] +name = "jobserver" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +dependencies = [ + "libc", +] + [[package]] name = "jpeg-decoder" version = "0.3.0" @@ -2427,6 +2491,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "lebe" version = "0.5.2" @@ -2439,12 +2509,46 @@ version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + [[package]] name = "libm" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" +[[package]] +name = "librocksdb-sys" +version = "0.11.0+8.3.2" +source = "git+https://git.nextgraph.org/NextGraph/rust-rocksdb.git?branch=master#520e09b1ada58e90075d0d462876afd3b3f9f6a9" +dependencies = [ + "bindgen", + "bzip2-sys", + "cc", + "glob", + "libc", + "libz-sys", +] + +[[package]] +name = "libz-sys" +version = "1.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "line-wrap" version = "0.1.1" @@ -2912,7 +3016,7 @@ dependencies = [ "serde_bytes", "serde_json", "slice_as_array", - "stores-lmdb", + "stores-rocksdb", "tokio", "warp", "warp-embed", @@ -3339,6 +3443,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "percent-encoding" version = "2.3.0" @@ -3603,6 +3713,16 @@ dependencies = [ "termtree", ] +[[package]] +name = "prettyplease" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9825a04601d60621feed79c4e6b56d65db77cdca55cef43b46b0de1096d1c282" +dependencies = [ + "proc-macro2", + "syn 2.0.18", +] + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -3925,6 +4045,15 @@ dependencies = [ "uuid 0.8.2", ] +[[package]] +name = "rocksdb" +version = "0.21.0" +source = "git+https://git.nextgraph.org/NextGraph/rust-rocksdb.git?branch=master#520e09b1ada58e90075d0d462876afd3b3f9f6a9" +dependencies = [ + "libc", + "librocksdb-sys", +] + [[package]] name = "rust-embed" version = "6.7.0" @@ -3970,6 +4099,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -4328,6 +4463,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" + [[package]] name = "signal-hook" version = "0.3.15" @@ -4460,6 +4601,18 @@ dependencies = [ "tempfile", ] +[[package]] +name = "stores-rocksdb" +version = "0.1.0" +dependencies = [ + "hex", + "p2p-repo", + "rocksdb", + "serde", + "serde_bare", + "tempfile", +] + [[package]] name = "string_cache" version = "0.8.7" diff --git a/Cargo.toml b/Cargo.toml index 56d8f5d..7cc0513 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ members = [ "p2p-client-ws", "p2p-verifier", "stores-lmdb", + "stores-rocksdb", "ngcli", "ngd", "ngone", diff --git a/ng-app/src/App.svelte b/ng-app/src/App.svelte index 56ae93b..26b2419 100644 --- a/ng-app/src/App.svelte +++ b/ng-app/src/App.svelte @@ -29,7 +29,7 @@ import WalletCreate from "./routes/WalletCreate.svelte"; import WalletLogin from "./routes/WalletLogin.svelte"; import UserRegistered from "./routes/UserRegistered.svelte"; - import Install from "./routes/Install.svelte"; + import Install from "./lib/Install.svelte"; import ng from "./api"; diff --git a/ng-app/src/lib/Home.svelte b/ng-app/src/lib/Home.svelte index 7811417..2e3f463 100644 --- a/ng-app/src/lib/Home.svelte +++ b/ng-app/src/lib/Home.svelte @@ -14,14 +14,12 @@ import { link } from "svelte-spa-router"; // @ts-ignore import Logo from "../assets/nextgraph.svg?component"; - import Test from "./Test.svelte"; - import { has_wallets, active_wallet } from "../store"; import { onMount } from "svelte"; export let display_login_create = false; -{#if !$has_wallets || !$active_wallet || display_login_create} +{#if display_login_create}