From 4113a997d612a534f20c586bf1cce57d4f537edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 16 May 2021 10:39:22 +0100 Subject: [PATCH] Basic error correction working, but slow --- src/io/error_correcting_encoder.rs | 8 +------- tests/system_tests.rs | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/io/error_correcting_encoder.rs b/src/io/error_correcting_encoder.rs index 33cda87..b502271 100644 --- a/src/io/error_correcting_encoder.rs +++ b/src/io/error_correcting_encoder.rs @@ -4,7 +4,7 @@ use anyhow::*; use reed_solomon::Encoder; use reed_solomon::{Buffer, Decoder}; -const BLOCK_SIZE: usize = 256; +const BLOCK_SIZE: usize = 64; const ECC_LENGTH: usize = 8; // TODO: make the API streaming friendly @@ -18,15 +18,12 @@ pub fn encode(bytes: &[u8]) -> Result> { let mut result = vec![]; - dbg!(encoded_blocks.len()); for buffer in encoded_blocks { - dbg!(buffer.bytes().count()); for byte in buffer.bytes() { result.push(byte?); } } - dbg!(result.len()); Ok(result) } @@ -39,15 +36,12 @@ pub fn decode(bytes: &[u8]) -> Result> { let mut result = vec![]; - dbg!(decoded_blocks.len()); for buffer in decoded_blocks { - dbg!(buffer.bytes().count()); for byte in buffer.data() { result.push(byte.clone()); } } - dbg!(result.len()); Ok(result) } diff --git a/tests/system_tests.rs b/tests/system_tests.rs index ec74e07..fc1090b 100644 --- a/tests/system_tests.rs +++ b/tests/system_tests.rs @@ -13,7 +13,6 @@ mod must { source.write_text_to_file("second", "some contents").unwrap(); source.write_text_to_file("third", "some other contents").unwrap(); - dbg!("setup done"); assert_same_after_restore(source.path()) }