Skip to content

storage.algos.dir_iterators: Fixes and improvements

Some fixes and improvements regarding recursive directory iteration implemented in the storage.algos.dir_iterators sub-module.

  • _empty_dir_hash variable did not have correct type (str instead of bytes) so empty directory test based on hash comparison was always failing

  • in the step method of DirectoryIterator, no need to push a new frame for an empty directory as this will stop the iteration

  • add Python iterator protocol support in the DirectoryIterator class in order to easily visit in a recursive way any directory stored in the archive.

  • add convenient function dir_iterator wrapping the instantiation of the DirectoryIterator class

  • add tests

Those changes are needed to use client-side iteration in the directory cooker from the vault.

Related swh-vault#1177 (closed)


Migrated from D444 (view on Phabricator)

Merge request reports