Closed ariel-miculas closed 1 year ago
Formatted the flie with rustfmt.
Hm, this doesn't build cleanly here - but then neither does the master branch.
After https://github.com/anuvu/puzzlefs/pull/37 is merged I will update this branch with a fix for a linter error and the CI actions will run on this branch as well.
The error occurs because the code assumes that all the chunks are generated for all the previous files. This is not the case, since the chunker splits up only the first part of the buffer into chunks and there is a leftover part that will be chunked together with the next files (or if there are no next files, the chunker will be forced to chunk the leftover).
Since the buffer containing the concatenated files will always be bigger than the concatenated generated chunks, the new approach is to iterate through the generated chunks instead of the previous files. Since every generated chunk will have an associated file or a list of files, the code will not run into a similar 'missing previous file' error.