add and implement chunk_from_offset for IndexFile
Necessary for byte-wise seeking through chunks in an index. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
2ff4c2cd5f
commit
d0463b67ca
@ -219,6 +219,17 @@ impl IndexFile for FixedIndexReader {
|
||||
|
||||
(csum, chunk_end)
|
||||
}
|
||||
|
||||
fn chunk_from_offset(&self, offset: u64) -> Option<(usize, u64)> {
|
||||
if offset >= self.size {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some((
|
||||
(offset / self.chunk_size as u64) as usize,
|
||||
offset % self.chunk_size as u64
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FixedIndexWriter {
|
||||
|
Reference in New Issue
Block a user