swh.storage.algos.directory module#

swh.storage.algos.directory.directory_get(storage: StorageInterface, directory_id: bytes) Directory | None[source]#

Get all the entries for a given directory

Parameters:
  • storage – the storage instance

  • directory_id – the directory’s identifier

Returns:

The directory if it could be properly put back together.

swh.storage.algos.directory.directory_get_many(storage: StorageInterface, directory_ids: List[bytes]) Iterable[Directory | None][source]#

Same as directory_get(), but fetches directories slightly more effectively by batching requests to directory_get_raw_manifest.

Parameters:
  • storage – the storage instance

  • directory_ids – the directories’ identifiers

Yields:

The directories which could be properly put back together

swh.storage.algos.directory.directory_get_many_with_possibly_duplicated_entries(storage: StorageInterface, directory_ids: List[bytes]) Iterable[Tuple[bool, Directory] | None][source]#

Same as directory_get_many(), but does not error on directories whose entries may contain duplicated names. See swh.model.model.Directory.from_possibly_duplicated_entries().

Parameters:
  • storage – the storage instance

  • directory_ids – the directories’ identifiers

Yields:

(is_corrupt, directory) where is_corrupt is True iff some entry names were indeed duplicated