-
-
Notifications
You must be signed in to change notification settings - Fork 767
Chunker refactor #8883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ThomasWaldmann
merged 16 commits into
borgbackup:master
from
ThomasWaldmann:chunker-refactor2
Jun 3, 2025
Merged
Chunker refactor #8883
ThomasWaldmann
merged 16 commits into
borgbackup:master
from
ThomasWaldmann:chunker-refactor2
Jun 3, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8883 +/- ##
==========================================
- Coverage 82.48% 82.02% -0.47%
==========================================
Files 74 74
Lines 13367 13367
Branches 1977 1977
==========================================
- Hits 11026 10964 -62
- Misses 1682 1745 +63
+ Partials 659 658 -1 ☔ View full report in Codecov by Sentry. |
Replaced `ChunkerFixed`'s block-reading functionality with a new `FileReader` class to streamline code and improve separation of concerns. Adjusted `ChunkerFixed` to delegate file reading to `FileReader` while focusing on chunk assembly. `FileReader` is intended to be useful for other chunkers also, so they can easily implement sparse file reading / fmap support.
`FileFMAPReader` deals with sparse files (data vs holes) or fmap and yields blocks of some specific read_size using a generator. `FileReader` uses the `FileFMAPReader` to fill an internal buffer and lets users use its `read` method to read arbitrary sized chunks from the buffer. For both classes, instances now only deal with a single file.
The `header_size` parameter and related logic have been removed from file readers, simplifying their implementation. This change eliminates unnecessary complexity while maintaining all functional capabilities via `read_size` and `fmap`.
Simplified and improved handling of mixed types of chunks during reading. The allocation type of resulting chunks is now determined based on contributing chunks.
Includes cases for simple reads, multiple reads, and mock chunk scenarios to verify behavior with mixed allocation types. Also: change Chunk type for empty read result for better consistency.
Includes unit tests for basic functionality, handling of custom file maps, allocation types, sparse file support, and `_build_fmap` method.
Replaced inline file reading logic with `FileReader` to standardize handling across chunkers. Improved buffer updates and allocation handling for sparse files and optimized read operations.
8c978f5
to
5445a52
Compare
Could happen at EOF when remaining data is insufficient and no new data can be added.
22b0f90
to
a235cff
Compare
633f09a
to
8fb5951
Compare
8fb5951
to
439c193
Compare
it tends to hang, not only on cygwin.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
transform buzhash chunker C code to Cython
split concerns into FileFMAPReader, FileReader, Chunker:
.read(size)
method so they can read arbitrarily sized pieces of the data.more tests