Initial commit

This commit is contained in:
aglkm
2024-05-03 14:23:37 +03:00
commit a5ca343c52
25 changed files with 26114 additions and 0 deletions

25
src/worker.rs Normal file
View File

@@ -0,0 +1,25 @@
use std::sync::{Arc, Mutex};
use reqwest::Error;
use crate::data::Dashboard;
use crate::data::Block;
use crate::data::Transactions;
use crate::requests;
// Tokio Runtime Worker.
// Collecting all the data.
pub async fn run(dash: Arc<Mutex<Dashboard>>, blocks: Arc<Mutex<Vec<Block>>>,
txns: Arc<Mutex<Transactions>>) -> Result<(), Error> {
let _ = requests::get_status(dash.clone()).await?;
let _ = requests::get_mempool(dash.clone()).await?;
let _ = requests::get_connected_peers(dash.clone()).await?;
let _ = requests::get_market(dash.clone()).await?;
requests::get_disk_usage(dash.clone())?;
let _ = requests::get_mining_stats(dash.clone()).await?;
let _ = requests::get_recent_blocks(dash.clone(), blocks.clone()).await?;
let _ = requests::get_txn_stats(dash.clone(), txns.clone()).await?;
Ok(())
}