some tracing & general restructure

This commit is contained in:
OMGeeky
2024-04-14 02:07:39 +02:00
parent 1228da12d1
commit 76ef182989
13 changed files with 201 additions and 101 deletions

View File

@@ -9,7 +9,7 @@ use tarpc::serde::{Deserialize, Serialize};
type Inode = u64;
const BLOCK_SIZE: u64 = 512;
trait ConvertFileType {
pub trait ConvertFileType {
fn from_ft(kind: FileType) -> Self;
fn into_ft(self) -> FileType;
}

View File

@@ -1,4 +1,3 @@
use std::time;
use gdriver_common::ipc::gdriver_service::{BackendActionRequest, GDriverServiceClient};
@@ -14,14 +13,14 @@ pub async fn start() -> Result<()> {
Ok(())
}
async fn ping(client: &GDriverServiceClient) -> Result<()>{
async fn ping(client: &GDriverServiceClient) -> Result<()> {
let hello = client
.do_something2(tarpc::context::current(), BackendActionRequest::Ping)
.await;
match hello {
Ok(hello) => println!("Yay: {:?}", hello),
Ok(hello) => info!("Yay: {:?}", hello),
Err(e) => {
println!(":( {:?}", (e));
error!(":( {:?}", (e));
dbg!(&e);
return Err(Box::new(e));
}
@@ -40,8 +39,8 @@ async fn run_long_stuff_test(client: &GDriverServiceClient) {
.as_secs();
match hello {
Ok(hello) => println!("Run Long returned after {} seconds: {:?}", seconds, hello),
Err(e) => println!(":( {:?}", (e)),
Ok(hello) => info!("Run Long returned after {} seconds: {:?}", seconds, hello),
Err(e) => error!(":( {:?}", (e)),
}
let start = time::SystemTime::now();
let hello = client
@@ -52,8 +51,8 @@ async fn run_long_stuff_test(client: &GDriverServiceClient) {
.as_secs();
match hello {
Ok(hello) => println!("Start Long returned after {} seconds: {:?}", seconds, hello),
Err(e) => println!(":( {:?}", (e)),
Ok(hello) => info!("Start Long returned after {} seconds: {:?}", seconds, hello),
Err(e) => info!(":( {:?}", (e)),
}
}
@@ -62,7 +61,7 @@ pub async fn create_client(ip: IpAddr, port: u16) -> Result<GDriverServiceClient
let transport = tarpc::serde_transport::tcp::connect(&server_addr, Json::default)
.await
.map_err(|e| {
println!("Could not connect to backend. Please make sure it is started before this app.");
info!("Could not connect to backend. Please make sure it is started before this app.");
e
})?;
let service = GDriverServiceClient::new(client::Config::default(), transport);