Skip to content

Add Archive iterators and prefix search - #294

Open
benoit74 wants to merge 1 commit into
mainfrom
benoit74/support-iterators
Open

benoit74 wants to merge 1 commit into
mainfrom
benoit74/support-iterators

Conversation

@benoit74

Copy link
Copy Markdown
Contributor

Summary

  • Add Archive.iter_by_path(), Archive.iter_by_title() and Archive.iter_efficient() to iterate over all entries in path order, title order, or the most efficient order to read them
  • Add Archive.__iter__() as an alias for iter_efficient(), so for entry in archive: works directly
  • Add Archive.find_by_path(path) and Archive.find_by_title(title) to iterate over entries whose path/title starts with a given prefix

These wrap libzim's Archive::iterByPath/iterByTitle/iterEfficient/findByPath/findByTitle, and remove the need for the get_entry_by_id() + all_entry_count workaround previously used to loop over ZIM content.

Closes #94.

@benoit74 benoit74 self-assigned this Oct 29, 2026
@benoit74
benoit74 force-pushed the benoit74/support-iterators branch from 9399c81 to c050d39 Compare October 29, 2026 13:56
@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.56%. Comparing base (584adac) to head (0078565).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #294      +/-   ##
==========================================
+ Coverage   95.29%   95.56%   +0.26%     
==========================================
  Files           1        1              
  Lines         638      676      +38     
==========================================
+ Hits          608      646      +38     
  Misses         30       30              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@benoit74
benoit74 requested a review from rgaudin October 29, 2026 14:29
@benoit74

Copy link
Copy Markdown
Contributor Author

Just added a usage example in README.md

@rgaudin rgaudin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍

@benoit74
benoit74 force-pushed the benoit74/support-iterators branch 2 times, most recently from ec36dfd to 2b33df1 Compare October 30, 2026 10:11
Add Archive.iter_by_path(), iter_by_title(), iter_efficient(), __iter__()
(alias for iter_efficient()), find_by_path() and find_by_title(), wrapping
libzim's Archive::iterByPath/iterByTitle/iterEfficient/findByPath/findByTitle.

This removes the need to loop over entries via get_entry_by_id() and
all_entry_count, as previously required (fixes #94).
@benoit74
benoit74 force-pushed the benoit74/support-iterators branch from 2b33df1 to 0078565 Compare November 2, 2026 15:06

This branch has not been deployed

No deployments
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.

Support iterators

2 participants