[pbs-devel] [RFC v2 proxmox-backup 24/36] index: fetch chunk form index by start/end-offset

Dietmar Maurer dietmar at proxmox.com
Tue Mar 12 13:47:53 CET 2024


> +
> +    /// List of chunk indices containing the data from start_offset to end_offset
> +    pub fn indices(
> +        &self,
> +        start_offset: u64,
> +        end_offset: u64,
> +    ) -> Result<(Vec<ReusableDynamicEntry>, u64, u64), Error> {
> +        let end_idx = self.index.len() - 1;
> +        let chunk_end = self.chunk_end(end_idx);
> +        let start = self.binary_search(0, 0, end_idx, chunk_end, start_offset)?;
> +        let end = self.binary_search(0, 0, end_idx, chunk_end, end_offset - 1)?;

Maybe the second search could be optimized, because end must be greater than start?




More information about the pbs-devel mailing list