Clean up logging

This commit is contained in:
Olivier 'reivilibre' 2021-07-09 21:12:48 +01:00
parent d0934e12a8
commit 0d50247e5c
5 changed files with 4 additions and 15 deletions

View File

@ -74,13 +74,13 @@ pub fn chunking<R: Read + Send + 'static, W: Write + Send + 'static, RP: RawPile
raw_pile,
);
info!("JH");
info!("Waiting for remote to finish.");
for handle in join_handles {
handle.join().expect("Join handle should not fail");
}
info!("J!");
info!("Remote finished.");
Ok(())
}

View File

@ -107,11 +107,10 @@ pub fn chunking_stdio(path: &PathBuf) -> anyhow::Result<()> {
requester_join_handles
};
info!("Waiting to join DBG.");
info!("Waiting to join.");
for join_handle in requester_join_handles {
join_handle.join().expect("Expected to join handle");
info!("handle");
}
info!("Chunking completed.");

View File

@ -22,8 +22,6 @@ use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use log::debug;
use crate::pile::Keyspace;
pub mod requester;
@ -85,7 +83,6 @@ pub enum ResponseBody {
pub fn read_message<R: Read, D: DeserializeOwned>(read: &mut R) -> anyhow::Result<D> {
let len = read.read_u32::<BigEndian>()?;
debug!("RM {:?}", len);
let mut data_vec = vec![0u8; len as usize];
read.read_exact(&mut data_vec)?;
Ok(serde_bare::from_slice(&data_vec)?)
@ -93,9 +90,7 @@ pub fn read_message<R: Read, D: DeserializeOwned>(read: &mut R) -> anyhow::Resul
pub fn write_message<W: Write, S: Serialize>(write: &mut W, message: &S) -> anyhow::Result<()> {
let data_vec = serde_bare::to_vec(&message)?;
debug!("WM {:?}", data_vec.len());
write.write_u32::<BigEndian>(data_vec.len().try_into()?)?;
write.write_all(&data_vec)?;
write.flush()?;
Ok(())
}

View File

@ -193,7 +193,6 @@ impl Requester {
/// Helper to make a request and wait for the result.
fn request(&self, req: RequestBody) -> anyhow::Result<ResponseBody> {
info!("Req...");
let (sender, receiver) = crossbeam_channel::bounded(0);
self.commands
.send((req, sender))
@ -207,7 +206,6 @@ impl Requester {
impl RawPile for Requester {
fn exists(&self, kind: Keyspace, key: &[u8]) -> anyhow::Result<bool> {
info!("Ex?");
match self.request(RequestBody::CheckExists {
kind,
key: key.to_vec(),
@ -232,7 +230,6 @@ impl RawPile for Requester {
}
}
fn write(&self, kind: Keyspace, key: &[u8], value: &[u8]) -> anyhow::Result<()> {
info!("Wr?");
match self.request(RequestBody::Write {
kind,
key: key.to_vec(),

View File

@ -7,8 +7,7 @@ use std::thread::JoinHandle;
use anyhow::anyhow;
use crossbeam_channel::{Receiver, Sender};
use itertools::Itertools;
use log::error;
use log::{info, warn};
use log::{error, warn};
use crate::pile::RawPile;
use crate::remote::{read_message, write_message, Request, RequestBody, Response, ResponseBody};
@ -79,7 +78,6 @@ impl Responder {
) -> anyhow::Result<()> {
loop {
let request: Request = read_message(&mut read)?;
info!("M!<");
match request.body {
RequestBody::NextBatch { token } => {