From dcaaec40e823011b3ea1364988799788409f9a66 Mon Sep 17 00:00:00 2001 From: Niko PLP Date: Thu, 17 Aug 2023 19:07:31 +0300 Subject: [PATCH] fix list-users --- ngcli/src/main.rs | 7 ++++--- p2p-broker/src/broker_store/account.rs | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ngcli/src/main.rs b/ngcli/src/main.rs index 5dcd4e3..1d4c9bb 100644 --- a/ngcli/src/main.rs +++ b/ngcli/src/main.rs @@ -116,7 +116,8 @@ async fn main() -> Result<(), ProtocolError> { .arg( arg!( -s --server "Server to connect to. IP can be IpV4 or IPv6, followed by a - comma and port as u16 and another comma and PEER_ID should be a base64-url encoded serde serialization of a [u8; 32]" + comma and port as u16 and another comma and PEER_ID + should be a base64-url encoded serde serialization of a [u8; 32]" ) .required(false) .env("NG_CLIENT_SERVER"), @@ -320,7 +321,7 @@ async fn main() -> Result<(), ProtocolError> { ProtocolError::InvalidValue })?; if config.is_some() { - log_warn!("Overwriting the config found in file with new server parameters provided on command line!"); + log_warn!("Overriding the config found in file with new server parameters provided on command line!"); let CliConfig::V0(c) = config.as_mut().unwrap(); c.ip = ip; c.port = port; @@ -349,7 +350,7 @@ async fn main() -> Result<(), ProtocolError> { if config.is_some() { let CliConfig::V0(c) = config.as_mut().unwrap(); if c.user.is_some() { - log_warn!("Overwriting the config found in file with new user parameter provided on command line!"); + log_warn!("Overriding the config found in file with new user parameter provided on command line!"); } c.user = Some(privkey); } else { diff --git a/p2p-broker/src/broker_store/account.rs b/p2p-broker/src/broker_store/account.rs index 97dee2c..36415be 100644 --- a/p2p-broker/src/broker_store/account.rs +++ b/p2p-broker/src/broker_store/account.rs @@ -16,6 +16,7 @@ use std::time::SystemTime; use p2p_net::types::*; use p2p_repo::kcv_store::KCVStore; +use p2p_repo::log::*; use p2p_repo::store::*; use p2p_repo::types::Timestamp; use serde_bare::{from_slice, to_vec}; @@ -71,7 +72,7 @@ impl<'a> Account<'a> { for user in store.get_all_keys_and_values(Self::PREFIX_ACCOUNT, size, vec![], None)? { let admin: bool = from_slice(&user.1)?; if admin == admins { - let id: UserId = from_slice(&user.0[1..user.0.len() - 1])?; + let id: UserId = from_slice(&user.0[1..user.0.len()])?; res.push(id); } } @@ -226,7 +227,7 @@ mod test { use p2p_repo::types::*; use p2p_repo::utils::*; use std::fs; - use stores_lmdb::kcv_store::LmdbKCVStore; + use stores_rocksdb::kcv_store::RocksdbKCVStore; use tempfile::Builder; use crate::broker_store::account::Account; @@ -238,7 +239,7 @@ mod test { let key: [u8; 32] = [0; 32]; fs::create_dir_all(root.path()).unwrap(); println!("{}", root.path().to_str().unwrap()); - let mut store = LmdbKCVStore::open(root.path(), key).unwrap(); + let mut store = RocksdbKCVStore::open(root.path(), key).unwrap(); let user_id = PubKey::Ed25519PubKey([1; 32]);