Extracted all crdt-related code into a named module
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
use crate::types::ListExample;
|
||||
use crate::list_transaction_crdt::{self, ListExample};
|
||||
use bft_json_crdt::json_crdt::SignedOp;
|
||||
use bft_json_crdt::json_crdt::{BaseCrdt, CrdtNode};
|
||||
use bft_json_crdt::keypair::Ed25519KeyPair;
|
||||
use send_transaction::send_a_transaction;
|
||||
use tokio::time;
|
||||
use websockets::WebSocket;
|
||||
|
||||
pub(crate) mod send_transaction;
|
||||
|
||||
/// Starts a websocket and periodically sends a BFT-CRDT message to the websocket server
|
||||
pub(crate) async fn start(
|
||||
keys: Ed25519KeyPair,
|
||||
@@ -19,7 +16,7 @@ pub(crate) async fn start(
|
||||
let mut interval = every_two_seconds();
|
||||
let mut count = 0;
|
||||
loop {
|
||||
let _ = send_a_transaction(count, bft_crdt, &mut ws, &keys).await;
|
||||
let _ = list_transaction_crdt::send(count, bft_crdt, &mut ws, &keys).await;
|
||||
|
||||
let msg = ws.receive().await?;
|
||||
println!("Received: {:?}", msg);
|
||||
|
||||
Reference in New Issue
Block a user