Browse Source

Clean up logging

develop
Olivier 'reivilibre' 2 months ago
parent
commit
0d50247e5c
  1. 4
      datman/src/remote/backup_source_requester.rs
  2. 3
      datman/src/remote/backup_source_responder.rs
  3. 5
      yama/src/remote.rs
  4. 3
      yama/src/remote/requester.rs
  5. 4
      yama/src/remote/responder.rs

4
datman/src/remote/backup_source_requester.rs

@ -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(())
}

3
datman/src/remote/backup_source_responder.rs

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

5
yama/src/remote.rs

@ -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(())
}

3
yama/src/remote/requester.rs

@ -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(),

4
yama/src/remote/responder.rs

@ -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 } => {

Loading…
Cancel
Save