Minor refactors
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use bft_crdt::websocket;
|
||||
use bft_crdt::TransactionList;
|
||||
use bft_json_crdt::json_crdt::{BaseCrdt, SignedOp};
|
||||
use cli::{parse_args, Commands};
|
||||
use cli::Commands;
|
||||
use node::SideNode;
|
||||
use tokio::{sync::mpsc, task};
|
||||
|
||||
@@ -13,7 +13,7 @@ pub mod utils;
|
||||
|
||||
#[tokio::main]
|
||||
pub async fn run() {
|
||||
let args = parse_args();
|
||||
let args = cli::parse_args();
|
||||
|
||||
match &args.command {
|
||||
Some(Commands::Init { name }) => {
|
||||
@@ -33,9 +33,9 @@ pub async fn run() {
|
||||
|
||||
/// Wire everything up outside the application so that we can test more easily later
|
||||
async fn setup(name: &String) -> SideNode {
|
||||
// First, load up the keys and create a bft-bft-crdt
|
||||
let side_dir = utils::home(name);
|
||||
let bft_crdt_keys = bft_crdt::keys::load_from_file(&side_dir);
|
||||
// First, load up the keys and create a bft-crdt node
|
||||
let home_dir = utils::home(name);
|
||||
let bft_crdt_keys = bft_crdt::keys::load_from_file(&home_dir);
|
||||
let crdt = BaseCrdt::<TransactionList>::new(&bft_crdt_keys);
|
||||
|
||||
// Channels for internal communication, and a tokio task for stdin input
|
||||
@@ -45,8 +45,9 @@ async fn setup(name: &String) -> SideNode {
|
||||
bft_crdt::stdin::input(stdin_sender);
|
||||
});
|
||||
|
||||
// Finally, create the node and return it
|
||||
// Wire the websocket client to the incoming channel
|
||||
let handle = websocket::Client::new(incoming_sender).await;
|
||||
// Finally, create the node and return it
|
||||
let node = SideNode::new(
|
||||
crdt,
|
||||
bft_crdt_keys,
|
||||
|
||||
Reference in New Issue
Block a user