pull/19/head
Niko PLP 6 months ago
parent 41e807a4b4
commit e8420e90b0
  1. 5
      nextgraph/Cargo.toml
  2. 5
      nextgraph/src/local_broker.rs
  3. 5
      ng-oxigraph/Cargo.toml
  4. 1
      ng-oxigraph/src/lib.rs
  5. 2
      ng-oxigraph/src/oxigraph/sparql/mod.rs
  6. 4
      ng-oxigraph/src/oxigraph/storage/backend/mod.rs
  7. 3
      ng-oxigraph/src/oxigraph/store.rs
  8. 4
      ng-repo/src/object.rs
  9. 7
      ng-verifier/Cargo.toml
  10. 11
      ng-verifier/src/verifier.rs

@ -32,9 +32,12 @@ ng-wallet = { path = "../ng-wallet", version = "0.1.0-preview.1" }
ng-client-ws = { path = "../ng-client-ws", version = "0.1.0-preview.1" }
ng-verifier = { path = "../ng-verifier", version = "0.1.0-preview.1" }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
[target.'cfg(all(not(target_arch = "wasm32"),not(doc)))'.dependencies]
ng-storage-rocksdb = { path = "../ng-storage-rocksdb", version = "0.1.0-preview.1" }
[package.metadata.docs.rs]
rustc-args = [ "--cfg" , "doc"]
[[example]]
name = "in_memory"
required-features = []

@ -46,7 +46,7 @@ use ng_wallet::{create_wallet_first_step_v0, create_wallet_second_step_v0, types
use ng_client_ws::remote_ws::ConnectionWebSocket;
#[cfg(target_arch = "wasm32")]
use ng_client_ws::remote_ws_wasm::ConnectionWebSocket;
#[cfg(not(target_arch = "wasm32"))]
#[cfg(all(not(target_family = "wasm"),not(doc)))]
use ng_storage_rocksdb::block_storage::RocksDbBlockStorage;
#[doc(hidden)]
@ -824,6 +824,7 @@ impl LocalBroker {
(VerifierType::Memory, LocalBrokerConfig::BasePath(_)) => {
VerifierConfigType::Memory
}
#[cfg(all(not(target_family = "wasm"),not(doc)))]
(VerifierType::Save, LocalBrokerConfig::BasePath(base)) => {
let mut path = base.clone();
path.push(format!("user{}", config.user_id().to_hash_string()));
@ -910,7 +911,7 @@ impl LocalBroker {
Arc::new(std::sync::RwLock::new(HashMapBlockStorage::new()))
as Arc<std::sync::RwLock<dyn BlockStorage + Send + Sync + 'static>>
} else {
#[cfg(not(target_family = "wasm"))]
#[cfg(all(not(target_family = "wasm"),not(doc)))]
{
let key_material = wallet
.client()

@ -44,7 +44,7 @@ quick-xml = ">=0.29, <0.32"
memchr = "2.5"
peg = "0.8"
[target.'cfg(not(target_family = "wasm"))'.dependencies]
[target.'cfg(all(not(target_family = "wasm"),not(doc)))'.dependencies]
libc = "0.2"
ng-rocksdb = { version = "0.21.0", git = "https://git.nextgraph.org/NextGraph/rust-rocksdb.git", branch = "master", features = [ ] }
@ -56,6 +56,9 @@ js-sys = { version = "0.3.60", optional = true }
codspeed-criterion-compat = "2.3.3"
zstd = ">=0.12, <0.14"
[package.metadata.docs.rs]
rustc-args = [ "--cfg" , "doc"]
[lints.rust]
absolute_paths_not_starting_with_crate = "warn"
elided_lifetimes_in_paths = "warn"

@ -1,4 +1,3 @@
#![doc = include_str!("../README.md")]
#![doc(test(attr(deny(warnings))))]
#![doc(test(attr(allow(deprecated))))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

@ -1,6 +1,6 @@
//! [SPARQL](https://www.w3.org/TR/sparql11-overview/) implementation.
//!
//! Stores execute SPARQL. See [`Store`](crate::store::Store::query()) for an example.
//! Stores execute SPARQL. See [`Store`](crate::oxigraph::store::Store::query()) for an example.
mod algebra;
mod dataset;

@ -1,12 +1,12 @@
//! A storage backend
//! RocksDB is available, if not in memory
#[cfg(any(target_family = "wasm"))]
#[cfg(any(target_family = "wasm", doc))]
pub use fallback::{ColumnFamily, ColumnFamilyDefinition, Db, Iter, Reader, Transaction};
#[cfg(all(not(target_family = "wasm")))]
pub use oxi_rocksdb::{ColumnFamily, ColumnFamilyDefinition, Db, Iter, Reader, Transaction};
#[cfg(any(target_family = "wasm"))]
#[cfg(any(target_family = "wasm", doc))]
mod fallback;
#[cfg(all(not(target_family = "wasm")))]
mod oxi_rocksdb;

@ -99,7 +99,7 @@ impl Store {
///
/// Only one read-write [`Store`] can exist at the same time.
/// If you want to have extra [`Store`] instance opened on a same data
/// use [`Store::open_secondary`] or [`Store::open_read_only`].
/// use [`Store::open_read_only`].
#[cfg(all(not(target_family = "wasm")))]
pub fn open(path: impl AsRef<Path>) -> Result<Self, StorageError> {
Ok(Self {
@ -155,7 +155,6 @@ impl Store {
/// Opens a read-only [`Store`] from disk.
///
/// Opening as read-only while having an other process writing the database is undefined behavior.
/// [`Store::open_secondary`] should be used in this case.
#[cfg(all(not(target_family = "wasm")))]
pub fn open_read_only(
path: impl AsRef<Path>,

@ -426,7 +426,7 @@ impl Object {
/// Load an Object from BlockStorage (taking a reference)
///
/// Returns Ok(Object) or an Err(ObjectParseError::MissingBlocks(Vec<ObjectId>)) of missing BlockIds
/// Returns Ok(Object) or an Err(ObjectParseError::MissingBlocks(Vec of ObjectId)) of missing BlockIds
pub fn load_ref(reference: &ObjectRef, store: &Store) -> Result<Object, ObjectParseError> {
Self::load(reference.id.clone(), Some(reference.key.clone()), store)
}
@ -484,7 +484,7 @@ impl Object {
/// Load an Object from BlockStorage
///
/// Returns Ok(Object) or an Err(ObjectParseError::MissingBlocks(Vec<ObjectId>)) of missing BlockIds
/// Returns Ok(Object) or an Err(ObjectParseError::MissingBlocks(Vec of ObjectId )) of missing BlockIds
pub fn load(
id: ObjectId,
key: Option<SymKey>,

@ -37,9 +37,12 @@ ng-oxigraph = { path = "../ng-oxigraph", version = "0.4.0-alpha.7-ngpreview" }
[target.'cfg(target_arch = "wasm32")'.dependencies]
ng-oxigraph = { path = "../ng-oxigraph", version = "0.4.0-alpha.7-ngpreview", features = ["js"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
[target.'cfg(all(not(target_arch = "wasm32"),not(doc)))'.dependencies]
ng-storage-rocksdb = { path = "../ng-storage-rocksdb", version = "0.1.0-preview.1" }
getrandom = "0.2.7"
[dev-dependencies]
ng-repo = { path = "../ng-repo", version = "0.1.0-preview.1", features = ["testing"] }
ng-repo = { path = "../ng-repo", version = "0.1.0-preview.1", features = ["testing"] }
[package.metadata.docs.rs]
rustc-args = [ "--cfg" , "doc"]

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

Loading…
Cancel
Save