Skip to content
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

Be able to open zim archive from several fds. #860

Merged
merged 8 commits into from
Feb 27, 2024
Merged

Be able to open zim archive from several fds. #860

merged 8 commits into from
Feb 27, 2024

Conversation

mgautierfr
Copy link
Collaborator

Fix #841

The tests in this PR need a update of zim-testing-suite (openzim/zim-testing-suite#7)

src/file_part.h Outdated Show resolved Hide resolved
src/fileimpl.cpp Outdated Show resolved Hide resolved
include/zim/zim.h Outdated Show resolved Hide resolved
include/zim/archive.h Outdated Show resolved Hide resolved
src/file_part.h Outdated Show resolved Hide resolved
include/zim/archive.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'd like to confirm that assessment on a clean (rebased-and-fixed-up) version of the PR.

Copy link

codecov bot commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 56.25000% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 57.77%. Comparing base (121e3af) to head (57fa6f1).

Files Patch % Lines
src/file_reader.cpp 40.00% 4 Missing and 5 partials ⚠️
src/file_compound.cpp 55.55% 0 Missing and 4 partials ⚠️
src/fileimpl.cpp 62.50% 0 Missing and 3 partials ⚠️
src/archive.cpp 60.00% 0 Missing and 2 partials ⚠️
src/file_part.h 66.66% 0 Missing and 2 partials ⚠️
src/item.cpp 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #860      +/-   ##
==========================================
+ Coverage   57.63%   57.77%   +0.14%     
==========================================
  Files          99      100       +1     
  Lines        4596     4616      +20     
  Branches     1926     1935       +9     
==========================================
+ Hits         2649     2667      +18     
+ Misses        675      669       -6     
- Partials     1272     1280       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

FilePart don't have to "map" the whole file on the FS.
Only a section of the file may be a part of our archive.
(Think about file parts being stored in a zip)
Has FilePart now have offsets, we can move the "offset concept" out of
FileImpl.

FileImpl always read from "offset" 0 in FileCompound. If it appears that
we have an offset inside a file, it will be FilePart which will handle it.
@mgautierfr
Copy link
Collaborator Author

Ready for a (final) review. Missing coverage is about error handling code, which is difficult to test as we need to generate io errors.

Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of minor suggestions for improvement but nothing bad will happen if the PR is merged as is.

include/zim/zim.h Outdated Show resolved Hide resolved
scripts/download_test_data.py Show resolved Hide resolved
@mgautierfr
Copy link
Collaborator Author

Two suggested improvements have been followed. Directly rebased/fixup.
Will merged once CI is ok.

@mgautierfr mgautierfr merged commit 65bf7a8 into main Feb 27, 2024
29 of 30 checks passed
@mgautierfr mgautierfr deleted the archive_fds branch February 27, 2024 10:33
mgautierfr added a commit that referenced this pull request Mar 8, 2024
Pr #860 removed the constructor from (fd, offset, size).
This is a API break and we don't want that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Been able to load split ZIM file (chunks) by filedescriptor
2 participants