testing rocksdb storage on android

Niko PLP 1 year ago
parent 89ae35835a
commit 5588f43c72
  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]]
name = "librocksdb-sys"
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 = [
"bindgen",
"bzip2-sys",
@ -4009,7 +4009,7 @@ dependencies = [
[[package]]
name = "rocksdb"
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 = [
"libc",
"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")]
async fn test() -> Result<(), ()> {
async fn test(app: tauri::AppHandle) -> Result<(), ()> {
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(())
}

@ -422,14 +422,18 @@ impl<'a> Broker<'a> {
}
#[cfg(not(target_arch = "wasm32"))]
pub fn test_storage(path: PathBuf) {
pub fn test_storage(&self, 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"),
Err(e) => {
log_debug!("storage error {}", e);
}
Ok(_) => {
log_debug!("storage ok");
}
}
}

Loading…
Cancel
Save