add ctime and size function to IndexFile trait
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
parent
d1bee4344d
commit
f0d23e5370
@ -233,6 +233,14 @@ impl IndexFile for DynamicIndexReader {
|
||||
})
|
||||
}
|
||||
|
||||
fn index_ctime(&self) -> i64 {
|
||||
self.ctime
|
||||
}
|
||||
|
||||
fn index_size(&self) -> usize {
|
||||
self.size as usize
|
||||
}
|
||||
|
||||
fn chunk_from_offset(&self, offset: u64) -> Option<(usize, u64)> {
|
||||
let end_idx = self.index.len() - 1;
|
||||
let end = self.chunk_end(end_idx);
|
||||
|
@ -193,6 +193,14 @@ impl IndexFile for FixedIndexReader {
|
||||
})
|
||||
}
|
||||
|
||||
fn index_ctime(&self) -> i64 {
|
||||
self.ctime
|
||||
}
|
||||
|
||||
fn index_size(&self) -> usize {
|
||||
self.size as usize
|
||||
}
|
||||
|
||||
fn compute_csum(&self) -> ([u8; 32], u64) {
|
||||
let mut csum = openssl::sha::Sha256::new();
|
||||
let mut chunk_end = 0;
|
||||
|
@ -22,6 +22,8 @@ pub trait IndexFile {
|
||||
fn index_digest(&self, pos: usize) -> Option<&[u8; 32]>;
|
||||
fn index_bytes(&self) -> u64;
|
||||
fn chunk_info(&self, pos: usize) -> Option<ChunkReadInfo>;
|
||||
fn index_ctime(&self) -> i64;
|
||||
fn index_size(&self) -> usize;
|
||||
|
||||
/// Get the chunk index and the relative offset within it for a byte offset
|
||||
fn chunk_from_offset(&self, offset: u64) -> Option<(usize, u64)>;
|
||||
|
Loading…
Reference in New Issue
Block a user