Skip to content

Commit f953a7f

Browse files
committed
add fallback logic when we discover the local index cache is outdated
1 parent c93a156 commit f953a7f

File tree

2 files changed

+294
-56
lines changed

2 files changed

+294
-56
lines changed

src/storage/compression.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77
io::{self, Read},
88
};
99
use strum::{Display, EnumIter, EnumString, FromRepr};
10-
use tokio::io::{AsyncRead, AsyncWrite};
10+
use tokio::io::{AsyncBufRead, AsyncRead, AsyncWrite};
1111

1212
pub type CompressionAlgorithms = HashSet<CompressionAlgorithm>;
1313

@@ -129,19 +129,19 @@ where
129129
/// You provide an AsyncRead that gives us the compressed data. With the
130130
/// wrapper we return you can then read decompressed data from the wrapper.
131131
pub fn wrap_reader_for_decompression<'a>(
132-
input: impl AsyncRead + Unpin + Send + 'a,
132+
input: impl AsyncBufRead + Unpin + Send + 'a,
133133
algorithm: CompressionAlgorithm,
134-
) -> Box<dyn AsyncRead + Unpin + Send + 'a> {
134+
) -> Box<dyn AsyncBufRead + Unpin + Send + 'a> {
135135
use async_compression::tokio::bufread;
136136
use tokio::io;
137137

138138
match algorithm {
139139
CompressionAlgorithm::Zstd => {
140-
Box::new(bufread::ZstdDecoder::new(io::BufReader::new(input)))
140+
Box::new(io::BufReader::new(bufread::ZstdDecoder::new(input)))
141141
}
142-
CompressionAlgorithm::Bzip2 => Box::new(bufread::BzDecoder::new(io::BufReader::new(input))),
142+
CompressionAlgorithm::Bzip2 => Box::new(io::BufReader::new(bufread::BzDecoder::new(input))),
143143
CompressionAlgorithm::Gzip => {
144-
Box::new(bufread::GzipDecoder::new(io::BufReader::new(input)))
144+
Box::new(io::BufReader::new(bufread::GzipDecoder::new(input)))
145145
}
146146
}
147147
}

0 commit comments

Comments
 (0)