mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-06-03 09:00:42 +00:00
fix read_block_async
This commit is contained in:
@@ -307,6 +307,7 @@ impl StoreReader {
|
||||
///
|
||||
/// Loads and decompresses a block asynchronously.
|
||||
async fn read_block_async(&self, checkpoint: &Checkpoint) -> crate::AsyncIoResult<Block> {
|
||||
let cache_key = checkpoint.byte_range.start;
|
||||
if let Some(block) = self.cache.get_from_cache(checkpoint.byte_range.start) {
|
||||
return Ok(block.clone());
|
||||
}
|
||||
@@ -316,8 +317,12 @@ impl StoreReader {
|
||||
.slice(checkpoint.byte_range.clone())
|
||||
.read_bytes_async()
|
||||
.await?;
|
||||
let block = self.decompress_block(compressed_block, checkpoint.byte_range.start)?;
|
||||
Ok(block)
|
||||
|
||||
let decompressed_block = OwnedBytes::new(self.compressor.decompress(compressed_block.as_ref())?);
|
||||
|
||||
self.cache.put_into_cache(cache_key, decompressed_block.clone());
|
||||
|
||||
Ok(decompressed_block)
|
||||
}
|
||||
|
||||
/// Fetches a document asynchronously.
|
||||
|
||||
Reference in New Issue
Block a user