project-machine / puzzlefs

Apache License 2.0
380 stars 18 forks source link

Fix missing blob error #33

Closed ariel-miculas closed 1 year ago

ariel-miculas commented 1 year ago

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.

ariel-miculas commented 1 year ago

Formatted the flie with rustfmt.

hallyn commented 1 year ago

Hm, this doesn't build cleanly here - but then neither does the master branch.

ariel-miculas commented 1 year ago

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.