Extracted all crdt-related code into a named module

This commit is contained in:
Dave Hrycyszyn
2024-06-05 19:49:13 +01:00
parent eb1d3f3527
commit 1cc1119883
5 changed files with 67 additions and 75 deletions

View File

@@ -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);