refactor: cache inverted index with fixed-size page (#5114)

* feat: cache inverted index by page instead of file

* fix: add unit test and fix bugs

* chore: typo

* chore: ci

* fix: math

* chore: apply review comments

* chore: renames

* test: add unit test for index key calculation

* refactor: use ReadableSize

* feat: add config for inverted index page size

* chore: update config file

* refactor: handle multiple range read and fix some related bugs

* fix: add config

* test: turn to a fs reader to match behaviors of object store
This commit is contained in:
Yohan Wal
2024-12-13 15:34:24 +08:00
committed by Yingwen
parent 8b1484c064
commit fdccf4ff84
18 changed files with 434 additions and 69 deletions

View File

@@ -205,9 +205,7 @@ impl RangeReader for Vec<u8> {
})
}
async fn read(&mut self, mut range: Range<u64>) -> io::Result<Bytes> {
range.end = range.end.min(self.len() as u64);
async fn read(&mut self, range: Range<u64>) -> io::Result<Bytes> {
let bytes = Bytes::copy_from_slice(&self[range.start as usize..range.end as usize]);
Ok(bytes)
}