From ddb4af74575c656f470dbc3d9eb39ef5bacbe5b5 Mon Sep 17 00:00:00 2001 From: Niko PLP Date: Mon, 14 Aug 2023 16:49:25 +0300 Subject: [PATCH] testing store rocksdb on android --- Cargo.lock | 5 +++-- ng-app/src/App.svelte | 1 + p2p-net/Cargo.toml | 1 + p2p-net/src/broker.rs | 13 +++++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 219e812..dee0cad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2514,7 +2514,7 @@ 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#7acbf4389bc0f910dbabf8fef1cca8dad052d203" +source = "git+https://git.nextgraph.org/NextGraph/rust-rocksdb.git?branch=master#48c0a29f92364c4cd65a5b375765db0b5d7636ab" dependencies = [ "bindgen", "bzip2-sys", @@ -3279,6 +3279,7 @@ dependencies = [ "serde", "serde_bare", "serde_bytes", + "stores-rocksdb", "unique_id", "url", "wasm-bindgen", @@ -4008,7 +4009,7 @@ dependencies = [ [[package]] name = "rocksdb" version = "0.21.0" -source = "git+https://git.nextgraph.org/NextGraph/rust-rocksdb.git?branch=master#7acbf4389bc0f910dbabf8fef1cca8dad052d203" +source = "git+https://git.nextgraph.org/NextGraph/rust-rocksdb.git?branch=master#48c0a29f92364c4cd65a5b375765db0b5d7636ab" dependencies = [ "libc", "librocksdb-sys", diff --git a/ng-app/src/App.svelte b/ng-app/src/App.svelte index 26b2419..d33555c 100644 --- a/ng-app/src/App.svelte +++ b/ng-app/src/App.svelte @@ -51,6 +51,7 @@ onMount(async () => { let tauri_platform = import.meta.env.TAURI_PLATFORM; if (tauri_platform) { + console.log(await ng.test()); let walls = await ng.get_wallets_from_localstorage(); wallets.set(walls); diff --git a/p2p-net/Cargo.toml b/p2p-net/Cargo.toml index f75f014..863deba 100644 --- a/p2p-net/Cargo.toml +++ b/p2p-net/Cargo.toml @@ -39,3 +39,4 @@ features = ["js"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies] getrandom = "0.2.7" default-net = { git = "https://git.nextgraph.org/NextGraph/default-net.git" } +stores-rocksdb = { path = "../stores-rocksdb" } diff --git a/p2p-net/src/broker.rs b/p2p-net/src/broker.rs index 552ecef..0b9b548 100644 --- a/p2p-net/src/broker.rs +++ b/p2p-net/src/broker.rs @@ -36,6 +36,7 @@ use std::ops::Deref; use std::io::BufReader; use std::io::Read; +use std::path::PathBuf; #[derive(Debug)] pub enum PeerConnection { @@ -420,6 +421,18 @@ impl<'a> Broker<'a> { self.test } + #[cfg(not(target_arch = "wasm32"))] + pub fn test_storage(path: PathBuf) { + use stores_rocksdb::kcv_store::RocksdbKCVStore; + + let key: [u8; 32] = [0; 32]; + let test_storage = RocksdbKCVStore::open(&path, key); + match test_storage { + Err(e) => log_debug!("storage error {}", e), + Ok(_) => log_debug!("storage ok"), + } + } + pub fn new() -> Self { let (shutdown_sender, shutdown_receiver) = mpsc::unbounded::(); let mut random_buf = [0u8; 4];