ng-verifier preview.6

pull/19/head
Niko PLP 7 months ago
parent b5e380d06a
commit 2e4b12eebe
  1. 2
      nextgraph/Cargo.toml
  2. 7
      ng-verifier/Cargo.toml
  3. 7
      ng-verifier/build.rs
  4. 2
      ng-verifier/src/lib.rs
  5. 16
      ng-verifier/src/verifier.rs

@ -9,7 +9,7 @@ authors.workspace = true
repository.workspace = true
homepage.workspace = true
keywords = [ "crdt","e2ee","local-first","p2p","semantic-web" ]
documentation.workspace = true
documentation = "https://docs.rs/nextgraph"
rust-version.workspace = true
[badges]

@ -1,6 +1,6 @@
[package]
name = "ng-verifier"
version = "0.1.0-preview.5"
version = "0.1.0-preview.6"
description = "Verifier library of NextGraph"
edition.workspace = true
license.workspace = true
@ -10,6 +10,7 @@ homepage.workspace = true
keywords = ["crdt","e2ee","local-first","p2p","eventual-consistency"]
documentation.workspace = true
rust-version.workspace = true
build = "build.rs"
[badges]
maintenance = { status = "actively-developed" }
@ -34,10 +35,10 @@ ng-repo = { path = "../ng-repo", version = "0.1.0-preview.1" }
ng-net = { path = "../ng-net", version = "0.1.0-preview.1" }
ng-oxigraph = { path = "../ng-oxigraph", version = "0.4.0-alpha.7-ngpreview6" }
[target.'cfg(target_arch = "wasm32")'.dependencies]
[target.'cfg(target_family = "wasm")'.dependencies]
ng-oxigraph = { path = "../ng-oxigraph", version = "0.4.0-alpha.7-ngpreview6", features = ["js"] }
[target.'cfg(all(not(target_arch = "wasm32")))'.dependencies]
[target.'cfg(all(not(target_family = "wasm"),not(docsrs)))'.dependencies]
ng-storage-rocksdb = { path = "../ng-storage-rocksdb", version = "0.1.0-preview.6" }
getrandom = "0.2.7"

@ -0,0 +1,7 @@
fn main() {
if std::env::var("DOCS_RS").is_ok() {
println!("cargo:rustc-cfg=docsrs");
}
}

@ -12,5 +12,5 @@ mod commits;
mod request_processor;
#[cfg(all(not(target_family = "wasm")))]
#[cfg(all(not(target_family = "wasm"),not(docsrs)))]
mod rocksdb_user_storage;

@ -13,11 +13,11 @@ use core::fmt;
use std::cmp::max;
use std::collections::BTreeMap;
use std::collections::HashSet;
#[cfg(all(not(target_family = "wasm")))]
#[cfg(all(not(target_family = "wasm"),not(docsrs)))]
use std::fs::create_dir_all;
#[cfg(all(not(target_family = "wasm")))]
#[cfg(all(not(target_family = "wasm"),not(docsrs)))]
use std::fs::{read, File, OpenOptions};
#[cfg(all(not(target_family = "wasm")))]
#[cfg(all(not(target_family = "wasm"),not(docsrs)))]
use std::io::Write;
use std::{collections::HashMap, sync::Arc};
@ -58,7 +58,7 @@ use ng_net::{
};
use crate::commits::*;
#[cfg(all(not(target_family = "wasm")))]
#[cfg(all(not(target_family = "wasm"),not(docsrs)))]
use crate::rocksdb_user_storage::RocksDbUserStorage;
use crate::types::*;
use crate::user_storage::InMemoryUserStorage;
@ -714,7 +714,7 @@ impl Verifier {
}
Ok(res)
}
#[cfg(all(not(target_family = "wasm")))]
#[cfg(all(not(target_family = "wasm"),not(docsrs)))]
VerifierConfigType::RocksDb(path) => {
let mut path = path.clone();
path.push(format!("outbox{}", self.peer_id.to_hash_string()));
@ -794,7 +794,7 @@ impl Verifier {
serde_bare::to_vec(&e)?,
)?;
}
#[cfg(all(not(target_family = "wasm")))]
#[cfg(all(not(target_family = "wasm"),not(docsrs)))]
VerifierConfigType::RocksDb(path) => {
let mut path = path.clone();
std::fs::create_dir_all(path.clone()).unwrap();
@ -1968,7 +1968,7 @@ impl Verifier {
let res = (js.last_seq_function)(self.peer_id, qty)?;
self.max_reserved_seq_num = res + qty as u64;
}
#[cfg(all(not(target_family = "wasm")))]
#[cfg(all(not(target_family = "wasm"),not(docsrs)))]
VerifierConfigType::RocksDb(path) => {
let mut path = path.clone();
std::fs::create_dir_all(path.clone()).unwrap();
@ -2028,7 +2028,7 @@ impl Verifier {
Some(Box::new(InMemoryUserStorage::new()) as Box<dyn UserStorage>),
Some(block_storage),
),
#[cfg(all(not(target_family = "wasm")))]
#[cfg(all(not(target_family = "wasm"),not(docsrs)))]
VerifierConfigType::RocksDb(path) => {
let mut path_oxi = path.clone();
path_oxi.push("graph");

Loading…
Cancel
Save