testing rocksdb storage on android

pull/19/head
Niko PLP 1 year ago
parent ffa25737fa
commit bc928e8454
  1. 4
      Cargo.lock
  2. 9
      ng-app/src-tauri/src/lib.rs
  3. 10
      p2p-net/src/broker.rs

4
Cargo.lock generated

@ -2514,7 +2514,7 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
[[package]] [[package]]
name = "librocksdb-sys" name = "librocksdb-sys"
version = "0.11.0+8.3.2" version = "0.11.0+8.3.2"
source = "git+https://git.nextgraph.org/NextGraph/rust-rocksdb.git?branch=master#9fed72433fd4ca9fc5db48911dcac2a650eb663c" source = "git+https://git.nextgraph.org/NextGraph/rust-rocksdb.git?branch=master#2026e3002eac5f7389697883b36eb1c4090e8c46"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"bzip2-sys", "bzip2-sys",
@ -4009,7 +4009,7 @@ dependencies = [
[[package]] [[package]]
name = "rocksdb" name = "rocksdb"
version = "0.21.0" version = "0.21.0"
source = "git+https://git.nextgraph.org/NextGraph/rust-rocksdb.git?branch=master#9fed72433fd4ca9fc5db48911dcac2a650eb663c" source = "git+https://git.nextgraph.org/NextGraph/rust-rocksdb.git?branch=master#2026e3002eac5f7389697883b36eb1c4090e8c46"
dependencies = [ dependencies = [
"libc", "libc",
"librocksdb-sys", "librocksdb-sys",

@ -34,8 +34,15 @@ pub type SetupHook = Box<dyn FnOnce(&mut App) -> Result<(), Box<dyn std::error::
// } // }
#[tauri::command(rename_all = "snake_case")] #[tauri::command(rename_all = "snake_case")]
async fn test() -> Result<(), ()> { async fn test(app: tauri::AppHandle) -> Result<(), ()> {
log_debug!("test is {}", BROKER.read().await.test()); log_debug!("test is {}", BROKER.read().await.test());
let path = app
.path()
.resolve("storage", BaseDirectory::AppLocalData)
.map_err(|_| ())?;
BROKER.read().await.test_storage(path);
Ok(()) Ok(())
} }

@ -422,14 +422,18 @@ impl<'a> Broker<'a> {
} }
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
pub fn test_storage(path: PathBuf) { pub fn test_storage(&self, path: PathBuf) {
use stores_rocksdb::kcv_store::RocksdbKCVStore; use stores_rocksdb::kcv_store::RocksdbKCVStore;
let key: [u8; 32] = [0; 32]; let key: [u8; 32] = [0; 32];
let test_storage = RocksdbKCVStore::open(&path, key); let test_storage = RocksdbKCVStore::open(&path, key);
match test_storage { match test_storage {
Err(e) => log_debug!("storage error {}", e), Err(e) => {
Ok(_) => log_debug!("storage ok"), log_debug!("storage error {}", e);
}
Ok(_) => {
log_debug!("storage ok");
}
} }
} }

Loading…
Cancel
Save