fix warnings

pull/19/head
Niko PLP 6 months 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
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]

@ -159,6 +159,10 @@ async fn main() -> std::io::Result<()> {
let error_reason = status[0].3.as_ref().unwrap();
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
user_disconnect(&user_id).await?;

@ -142,6 +142,10 @@ async fn main() -> std::io::Result<()> {
let error_reason = status[0].3.as_ref().unwrap();
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
user_disconnect(&user_id).await?;

@ -41,6 +41,38 @@
//! // initialize the local_broker with in-memory config.
//! // all sessions will be lost when the program exits
//! 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(())
//! }
//! ```

@ -169,7 +169,7 @@ impl RocksDbServerStorage {
pub(crate) fn next_seq_for_peer(&self, peer: &PeerId, seq: u64) -> Result<(), ServerError> {
// for now we don't use the hashmap.
// 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();
filename.push(format!("{}", peer));

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

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

Loading…
Cancel
Save