Compare commits
2 Commits
b933f8d6fc
...
c528160d34
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c528160d34 | ||
|
|
0126614dd3 |
@@ -6,8 +6,6 @@ use bft_json_crdt::{
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub mod keys;
|
pub mod keys;
|
||||||
pub mod stdin;
|
|
||||||
pub mod websocket;
|
|
||||||
|
|
||||||
#[add_crdt_fields]
|
#[add_crdt_fields]
|
||||||
#[derive(Clone, CrdtNode, Serialize, Deserialize, Debug)]
|
#[derive(Clone, CrdtNode, Serialize, Deserialize, Debug)]
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
use bft_crdt::websocket;
|
|
||||||
use bft_crdt::TransactionList;
|
use bft_crdt::TransactionList;
|
||||||
use bft_json_crdt::json_crdt::{BaseCrdt, SignedOp};
|
use bft_json_crdt::json_crdt::{BaseCrdt, SignedOp};
|
||||||
use cli::Commands;
|
use cli::Commands;
|
||||||
@@ -9,7 +8,9 @@ pub mod bft_crdt;
|
|||||||
pub(crate) mod cli;
|
pub(crate) mod cli;
|
||||||
pub(crate) mod init;
|
pub(crate) mod init;
|
||||||
pub mod node;
|
pub mod node;
|
||||||
|
mod stdin;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
pub mod websocket;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
pub async fn run() {
|
pub async fn run() {
|
||||||
@@ -42,7 +43,7 @@ async fn setup(name: &String) -> SideNode {
|
|||||||
let (incoming_sender, incoming_receiver) = mpsc::channel::<SignedOp>(32);
|
let (incoming_sender, incoming_receiver) = mpsc::channel::<SignedOp>(32);
|
||||||
let (stdin_sender, stdin_receiver) = std::sync::mpsc::channel();
|
let (stdin_sender, stdin_receiver) = std::sync::mpsc::channel();
|
||||||
task::spawn(async move {
|
task::spawn(async move {
|
||||||
bft_crdt::stdin::input(stdin_sender);
|
stdin::input(stdin_sender);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Wire the websocket client to the incoming channel
|
// Wire the websocket client to the incoming channel
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use bft_json_crdt::json_crdt::{BaseCrdt, SignedOp};
|
|||||||
use fastcrypto::ed25519::Ed25519KeyPair;
|
use fastcrypto::ed25519::Ed25519KeyPair;
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
|
|
||||||
use crate::{bft_crdt::websocket::Client, bft_crdt::TransactionList, utils};
|
use crate::{bft_crdt::TransactionList, utils, websocket::Client};
|
||||||
|
|
||||||
pub struct SideNode {
|
pub struct SideNode {
|
||||||
crdt: BaseCrdt<TransactionList>,
|
crdt: BaseCrdt<TransactionList>,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use bft_json_crdt::{
|
|||||||
json_crdt::{BaseCrdt, SignedOp},
|
json_crdt::{BaseCrdt, SignedOp},
|
||||||
keypair::make_keypair,
|
keypair::make_keypair,
|
||||||
};
|
};
|
||||||
use crdt_node::{bft_crdt::websocket::Client, bft_crdt::TransactionList, node::SideNode, utils};
|
use crdt_node::{bft_crdt::TransactionList, node::SideNode, utils, websocket};
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@@ -42,7 +42,7 @@ async fn setup(_: &str) -> SideNode {
|
|||||||
let (_, stdin_receiver) = std::sync::mpsc::channel();
|
let (_, stdin_receiver) = std::sync::mpsc::channel();
|
||||||
|
|
||||||
// Finally, create the node and return it
|
// Finally, create the node and return it
|
||||||
let handle = Client::new(incoming_sender).await;
|
let handle = websocket::Client::new(incoming_sender).await;
|
||||||
let node = SideNode::new(
|
let node = SideNode::new(
|
||||||
crdt,
|
crdt,
|
||||||
bft_crdt_keys,
|
bft_crdt_keys,
|
||||||
|
|||||||
Reference in New Issue
Block a user