borgbackup / borg

Deduplicating archiver with compression and authenticated encryption.
https://www.borgbackup.org/
Other
11.24k stars 744 forks source link

seen_chunk: do not use .refcount #8512

Closed ThomasWaldmann closed 2 weeks ago

ThomasWaldmann commented 2 weeks ago

If we have an entry for a chunk id in the ChunkIndex, it means that this chunk exists in the repository.

The code was a bit over-complicated and used entry.refcount only to detect whether .get(id, default) actually got something from the ChunkIndex or used the provided default value.

The code does the same now, but in a simpler way. Additionally, it checks for size consistency if a size is provided by the caller and a size is already present in the entry.

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.72%. Comparing base (1ec66ed) to head (de1b7e0). Report is 17 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #8512 +/- ## ========================================== + Coverage 81.43% 81.72% +0.29% ========================================== Files 73 73 Lines 13108 13109 +1 Branches 1924 1924 ========================================== + Hits 10674 10713 +39 + Misses 1769 1740 -29 + Partials 665 656 -9 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.