Skip to content

Commit

Permalink
Issue buckyos#201: Temporarily remove fixer when chunk reader got has…
Browse files Browse the repository at this point in the history
…h error
  • Loading branch information
lurenpluto authored and streetycat committed May 12, 2023
1 parent e55d98e commit 46af7db
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/component/cyfs-bdt-ext/src/cache/reader/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl ChunkStoreReader {
chunk: &ChunkId,
path: &Path,
offset: u64,
fixer: Box<dyn ChunkHashErrorHandler>,
// fixer: Box<dyn ChunkHashErrorHandler>,
) -> BuckyResult<Box<dyn AsyncReadWithSeek + Unpin + Send + Sync>> {
debug!(
"begin read chunk from file, chunk={}, offset={}, len={}, path={}",
Expand Down Expand Up @@ -130,7 +130,7 @@ impl ChunkStoreReader {
path.to_string_lossy().to_string(),
chunk.to_owned(),
limit_reader,
Some(fixer),
None,
);

Ok(Box::new(hash_reader))
Expand Down Expand Up @@ -159,16 +159,16 @@ impl ChunkStoreReader {
//FIXME
TrackerPostion::File(path) => {
info!("will read chunk from file: chunk={}, file={}", chunk, path);
let fixer = ChunkTrackerPosFixer::new(self.tracker.clone(), c.pos.clone());
Self::read_chunk(chunk, Path::new(path), 0, fixer).await
// let fixer = ChunkTrackerPosFixer::new(self.tracker.clone(), c.pos.clone());
Self::read_chunk(chunk, Path::new(path), 0).await
}
TrackerPostion::FileRange(fr) => {
info!(
"will read chunk from file range: chunk={}, file={}, range={}:{}",
chunk, fr.path, fr.range_begin, fr.range_end
);
let fixer = ChunkTrackerPosFixer::new(self.tracker.clone(), c.pos.clone());
Self::read_chunk(chunk, Path::new(fr.path.as_str()), fr.range_begin, fixer)
// let fixer = ChunkTrackerPosFixer::new(self.tracker.clone(), c.pos.clone());
Self::read_chunk(chunk, Path::new(fr.path.as_str()), fr.range_begin)
.await
}
TrackerPostion::ChunkManager => {
Expand Down Expand Up @@ -368,7 +368,7 @@ mod tests {
let file = PathBuf::from("C:\\cyfs\\data\\test\\2KGw87zzn4.txt");
let chunk_id = ChunkId::from_str("7C8WW21osqTTTMyRLhUN8jDbYiRdBDNEMHMiHPdDEdBB").unwrap();

let _reader = ChunkStoreReader::read_chunk(&chunk_id, &file, 8388608, None).await;
let _reader = ChunkStoreReader::read_chunk(&chunk_id, &file, 8388608).await;
//let buf = std::fs::read(file).unwrap();
//let real_id = ChunkId::calculate_sync(&buf).unwrap();
//assert_eq!(real_id, chunk_id);
Expand Down

0 comments on commit 46af7db

Please sign in to comment.