fix warnings

fix/ng-app/generic-cargo-path
Niko PLP 1 month ago
parent 9e05125f17
commit 85dafec2a9
  1. 2
      README.md
  2. 4
      nextgraph/examples/in_memory.rs
  3. 4
      nextgraph/examples/persistent.rs
  4. 32
      nextgraph/src/lib.rs
  5. 2
      ng-broker/src/rocksdb_server_storage.rs
  6. 2
      ng-repo/src/branch.rs
  7. 2
      ng-sdk-js/prepare-node.js
  8. 6
      ng-verifier/src/verifier.rs

@ -183,7 +183,7 @@ For building the apps, see this [documentation](ng-app/README.md).
#### OpenBSD #### OpenBSD
On OpenBSD, a conflict between the installed LibreSSL library and the reqwest crate, needs a bit of attention. On OpenBSD, a conflict between the installed LibreSSL library and the reqwest crate, needs a bit of attention.
Before compiling the daemon for OpenBSD, please comment out lines 38-39 of `ng-net/Cargo.toml`. This will be solved soon by using `resolver = "2"`. Before compiling the daemon for OpenBSD, please comment out lines 41-42 of `ng-net/Cargo.toml`. This will be solved soon by using `resolver = "2"`.
``` ```
#[target.'cfg(target_arch = "wasm32")'.dependencies] #[target.'cfg(target_arch = "wasm32")'.dependencies]

@ -159,6 +159,10 @@ async fn main() -> std::io::Result<()> {
let error_reason = status[0].3.as_ref().unwrap(); let error_reason = status[0].3.as_ref().unwrap();
assert!(error_reason == "NoiseHandshakeFailed" || error_reason == "ConnectionError"); assert!(error_reason == "NoiseHandshakeFailed" || error_reason == "ConnectionError");
// then you can make some calls to the APP protocol
// with app_request or app_request_stream
// more to be detailed soon.
// Then we should disconnect // Then we should disconnect
user_disconnect(&user_id).await?; user_disconnect(&user_id).await?;

@ -142,6 +142,10 @@ async fn main() -> std::io::Result<()> {
let error_reason = status[0].3.as_ref().unwrap(); let error_reason = status[0].3.as_ref().unwrap();
assert!(error_reason == "NoiseHandshakeFailed" || error_reason == "ConnectionError"); assert!(error_reason == "NoiseHandshakeFailed" || error_reason == "ConnectionError");
// then you can make some calls to the APP protocol
// with app_request or app_request_stream
// more to be detailed soon.
// Then we should disconnect // Then we should disconnect
user_disconnect(&user_id).await?; user_disconnect(&user_id).await?;

@ -41,6 +41,38 @@
//! // initialize the local_broker with in-memory config. //! // initialize the local_broker with in-memory config.
//! // all sessions will be lost when the program exits //! // all sessions will be lost when the program exits
//! init_local_broker(Box::new(|| LocalBrokerConfig::InMemory)).await; //! init_local_broker(Box::new(|| LocalBrokerConfig::InMemory)).await;
//!
//! // see https://git.nextgraph.org/NextGraph/nextgraph-rs/src/branch/master/nextgraph/examples/in_memory.md
//! // for a full example of what the Rust API gives you
//!
//! Ok(())
//! }
//! ```
//!
//! ## Persistent
//!
//! With this config, the encrypted wallet, session information, outbox, and all user data will be saved locally, with encryption at rest.
//!
//! ```
//! use nextgraph::local_broker::{init_local_broker, LocalBrokerConfig};
//!
//! #[async_std::main]
//! async fn main() -> std::io::Result<()> {
//! // initialize the local_broker with in-memory config.
//! // all sessions will be lost when the program exits
//! let mut current_path = current_dir()?;
//! current_path.push(".ng");
//! current_path.push("example");
//! create_dir_all(current_path.clone())?;
//!
//! // initialize the local_broker with config to save to disk in a folder called `.ng/example` in the current directory
//! init_local_broker(Box::new(move || {
//! LocalBrokerConfig::BasePath(current_path.clone())
//! })).await;
//!
//! // see https://git.nextgraph.org/NextGraph/nextgraph-rs/src/branch/master/nextgraph/examples/persistent.md
//! // for a full example of what the Rust API gives you
//!
//! Ok(()) //! Ok(())
//! } //! }
//! ``` //! ```

@ -169,7 +169,7 @@ impl RocksDbServerStorage {
pub(crate) fn next_seq_for_peer(&self, peer: &PeerId, seq: u64) -> Result<(), ServerError> { pub(crate) fn next_seq_for_peer(&self, peer: &PeerId, seq: u64) -> Result<(), ServerError> {
// for now we don't use the hashmap. // for now we don't use the hashmap.
// TODO: let's see if the lock is even needed // TODO: let's see if the lock is even needed
let _ = self.peers_last_seq.lock(); let _peers_last_seq = self.peers_last_seq.lock();
let mut filename = self.peers_last_seq_path.clone(); let mut filename = self.peers_last_seq_path.clone();
filename.push(format!("{}", peer)); filename.push(format!("{}", peer));

@ -48,12 +48,14 @@ impl BranchV0 {
} }
} }
#[allow(dead_code)]
#[derive(Debug)] #[derive(Debug)]
pub struct DagNode { pub struct DagNode {
pub future: HashSet<ObjectId>, pub future: HashSet<ObjectId>,
pub past: HashSet<ObjectId>, pub past: HashSet<ObjectId>,
} }
#[allow(dead_code)]
struct Dag<'a>(&'a HashMap<Digest, DagNode>); struct Dag<'a>(&'a HashMap<Digest, DagNode>);
impl fmt::Display for DagNode { impl fmt::Display for DagNode {

@ -6,7 +6,7 @@ const PATH_README = './pkg-node/README.md';
const pkg_json = fs.readFileSync(PATH); const pkg_json = fs.readFileSync(PATH);
let pkg = JSON.parse(pkg_json) let pkg = JSON.parse(pkg_json)
pkg.name = "nextgraph"; pkg.name = "nextgraph";
pkg.description = "nodejs SDK of NextGraph"; pkg.description = "nodeJS SDK of NextGraph";
fs.writeFileSync(PATH, JSON.stringify(pkg, null, 2), 'utf8'); fs.writeFileSync(PATH, JSON.stringify(pkg, null, 2), 'utf8');
fs.readFile(PATH_README, 'utf8', function (err,data) { fs.readFile(PATH_README, 'utf8', function (err,data) {

@ -354,6 +354,7 @@ impl Verifier {
)) ))
} }
#[allow(dead_code)]
fn get_store_or_load(&mut self, store_repo: &StoreRepo) -> Arc<Store> { fn get_store_or_load(&mut self, store_repo: &StoreRepo) -> Arc<Store> {
let overlay_id = store_repo.overlay_id_for_storage_purpose(); let overlay_id = store_repo.overlay_id_for_storage_purpose();
let block_storage = self let block_storage = self
@ -411,6 +412,7 @@ impl Verifier {
Ok(repo) Ok(repo)
} }
#[allow(dead_code)]
fn complete_site_store_already_inserted( fn complete_site_store_already_inserted(
&mut self, &mut self,
store_repo: StoreRepo, store_repo: StoreRepo,
@ -442,6 +444,7 @@ impl Verifier {
Ok(()) Ok(())
} }
#[allow(dead_code)]
fn get_store(&self, store_repo: &StoreRepo) -> Result<Arc<Store>, VerifierError> { fn get_store(&self, store_repo: &StoreRepo) -> Result<Arc<Store>, VerifierError> {
let overlay_id = store_repo.overlay_id_for_storage_purpose(); let overlay_id = store_repo.overlay_id_for_storage_purpose();
let store = self let store = self
@ -474,6 +477,7 @@ impl Verifier {
repo_ref repo_ref
} }
#[allow(dead_code)]
fn add_store(&mut self, store: Arc<Store>) { fn add_store(&mut self, store: Arc<Store>) {
let overlay_id = store.get_store_repo().overlay_id_for_storage_purpose(); let overlay_id = store.get_store_repo().overlay_id_for_storage_purpose();
if self.stores.contains_key(&overlay_id) { if self.stores.contains_key(&overlay_id) {
@ -515,6 +519,7 @@ impl Verifier {
.await .await
} }
#[allow(dead_code)]
pub(crate) async fn new_event_with_repo( pub(crate) async fn new_event_with_repo(
&mut self, &mut self,
commit: &Commit, commit: &Commit,
@ -2217,6 +2222,7 @@ impl Verifier {
} }
/// returns the Repo and the last seq_num of the peer /// returns the Repo and the last seq_num of the peer
#[allow(dead_code)]
async fn new_repo_default<'a>( async fn new_repo_default<'a>(
&'a mut self, &'a mut self,
creator: &UserId, creator: &UserId,

Loading…
Cancel
Save