From 178a5ebba010e458969b85112383b5ffd47bb345 Mon Sep 17 00:00:00 2001 From: nikoPLP Date: Fri, 17 Mar 2023 11:37:00 +0200 Subject: [PATCH] move broker_store into submod --- ngcli/src/main.rs | 2 +- .../account.rs} | 2 +- .../config.rs} | 0 p2p-broker/src/broker_store/mod.rs | 11 +++++++++++ .../overlay.rs} | 0 .../peer.rs} | 0 .../repostoreinfo.rs} | 0 .../topic.rs} | 0 p2p-broker/src/lib.rs | 12 +----------- p2p-broker/src/server.rs | 18 +++++++++--------- p2p-broker/src/server_ws.rs | 2 +- 11 files changed, 24 insertions(+), 23 deletions(-) rename p2p-broker/src/{broker_store_account.rs => broker_store/account.rs} (99%) rename p2p-broker/src/{broker_store_config.rs => broker_store/config.rs} (100%) create mode 100644 p2p-broker/src/broker_store/mod.rs rename p2p-broker/src/{broker_store_overlay.rs => broker_store/overlay.rs} (100%) rename p2p-broker/src/{broker_store_peer.rs => broker_store/peer.rs} (100%) rename p2p-broker/src/{broker_store_repostoreinfo.rs => broker_store/repostoreinfo.rs} (100%) rename p2p-broker/src/{broker_store_topic.rs => broker_store/topic.rs} (100%) diff --git a/ngcli/src/main.rs b/ngcli/src/main.rs index 2f984fd..499f8e0 100644 --- a/ngcli/src/main.rs +++ b/ngcli/src/main.rs @@ -15,7 +15,7 @@ use fastbloom_rs::{BloomFilter as Filter, FilterBuilder, Membership}; use futures::{future, pin_mut, stream, SinkExt, StreamExt}; use p2p_repo::object::Object; use p2p_repo::store::{store_max_value_size, store_valid_value_size, HashMapRepoStore, RepoStore}; -use p2p_broker::broker_store_config::ConfigMode; +use p2p_broker::broker_store::config::ConfigMode; use p2p_stores_lmdb::broker_store::LmdbBrokerStore; use p2p_stores_lmdb::repo_store::LmdbRepoStore; use rand::rngs::OsRng; diff --git a/p2p-broker/src/broker_store_account.rs b/p2p-broker/src/broker_store/account.rs similarity index 99% rename from p2p-broker/src/broker_store_account.rs rename to p2p-broker/src/broker_store/account.rs index db078dc..1842758 100644 --- a/p2p-broker/src/broker_store_account.rs +++ b/p2p-broker/src/broker_store/account.rs @@ -165,7 +165,7 @@ mod test { use std::fs; use tempfile::Builder; - use crate::broker_store_account::Account; + use crate::broker_store::account::Account; #[test] pub fn test_account() { diff --git a/p2p-broker/src/broker_store_config.rs b/p2p-broker/src/broker_store/config.rs similarity index 100% rename from p2p-broker/src/broker_store_config.rs rename to p2p-broker/src/broker_store/config.rs diff --git a/p2p-broker/src/broker_store/mod.rs b/p2p-broker/src/broker_store/mod.rs new file mode 100644 index 0000000..9897e67 --- /dev/null +++ b/p2p-broker/src/broker_store/mod.rs @@ -0,0 +1,11 @@ +pub mod account; + +pub mod config; + +pub mod overlay; + +pub mod peer; + +pub mod repostoreinfo; + +pub mod topic; \ No newline at end of file diff --git a/p2p-broker/src/broker_store_overlay.rs b/p2p-broker/src/broker_store/overlay.rs similarity index 100% rename from p2p-broker/src/broker_store_overlay.rs rename to p2p-broker/src/broker_store/overlay.rs diff --git a/p2p-broker/src/broker_store_peer.rs b/p2p-broker/src/broker_store/peer.rs similarity index 100% rename from p2p-broker/src/broker_store_peer.rs rename to p2p-broker/src/broker_store/peer.rs diff --git a/p2p-broker/src/broker_store_repostoreinfo.rs b/p2p-broker/src/broker_store/repostoreinfo.rs similarity index 100% rename from p2p-broker/src/broker_store_repostoreinfo.rs rename to p2p-broker/src/broker_store/repostoreinfo.rs diff --git a/p2p-broker/src/broker_store_topic.rs b/p2p-broker/src/broker_store/topic.rs similarity index 100% rename from p2p-broker/src/broker_store_topic.rs rename to p2p-broker/src/broker_store/topic.rs diff --git a/p2p-broker/src/lib.rs b/p2p-broker/src/lib.rs index 64bfe32..6be96f1 100644 --- a/p2p-broker/src/lib.rs +++ b/p2p-broker/src/lib.rs @@ -1,15 +1,5 @@ -// Copyright (c) 2022-2023 Niko Bonnieure, Par le Peuple, NextGraph.org developers -pub mod broker_store_account; -pub mod broker_store_config; - -pub mod broker_store_overlay; - -pub mod broker_store_peer; - -pub mod broker_store_repostoreinfo; - -pub mod broker_store_topic; +pub mod broker_store; pub mod connection_local; diff --git a/p2p-broker/src/server.rs b/p2p-broker/src/server.rs index 827b344..fec9487 100644 --- a/p2p-broker/src/server.rs +++ b/p2p-broker/src/server.rs @@ -15,15 +15,15 @@ use std::pin::Pin; use std::sync::Arc; use std::sync::RwLock; -use crate::broker_store_account::Account; +use crate::broker_store::account::Account; use crate::auth::*; -use crate::broker_store_config::Config; -use crate::broker_store_config::ConfigMode; +use crate::broker_store::config::Config; +use crate::broker_store::config::ConfigMode; use crate::connection_local::BrokerConnectionLocal; -use crate::broker_store_overlay::Overlay; -use crate::broker_store_peer::Peer; -use crate::broker_store_repostoreinfo::RepoStoreId; -use crate::broker_store_repostoreinfo::RepoStoreInfo; +use crate::broker_store::overlay::Overlay; +use crate::broker_store::peer::Peer; +use crate::broker_store::repostoreinfo::RepoStoreId; +use crate::broker_store::repostoreinfo::RepoStoreInfo; use async_std::task; use debug_print::*; use futures::future::BoxFuture; @@ -72,7 +72,7 @@ enum ProtocolType { Auth, Broker, Ext, - P2P, + Core, } pub struct ProtocolHandler { @@ -164,7 +164,7 @@ impl ProtocolHandler { // closing the connection (Err(ProtocolError::InvalidState), OptionFuture::from(None)) } - ProtocolType::P2P => { + ProtocolType::Core => { unimplemented!() } } diff --git a/p2p-broker/src/server_ws.rs b/p2p-broker/src/server_ws.rs index 3392e4c..fe44326 100644 --- a/p2p-broker/src/server_ws.rs +++ b/p2p-broker/src/server_ws.rs @@ -18,7 +18,7 @@ use async_tungstenite::accept_async; use async_tungstenite::tungstenite::protocol::Message; use debug_print::*; use futures::{SinkExt, StreamExt}; -use crate::broker_store_config::ConfigMode; +use crate::broker_store::config::ConfigMode; use crate::server::*; use p2p_stores_lmdb::broker_store::LmdbBrokerStore; use p2p_stores_lmdb::repo_store::LmdbRepoStore;