You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RepositorySimulator: add support for delegated hash bins #1639
Currently repository_tool.py provides an easy way to distribute a large number of target files over multiple delegated roles (hashed bins). A feature described in PEP458 that would be used in warehouse.
The hashed bin delegation code in repository_tool was cleaned up and simplified when the Warehouse work kicked off. See, for example, #1007 and #1012. Specifically:
As a follow-on we refactored some of the helper functions to be public API (see #1058) in repository_lib for use with an early iteration of the metadata API:
Seems like the latest tendency is towards implementing the delegated hash bins functionality in a repository-side and test code at a later stage. For this reason the issue can be re-scoped to include only the needed tests from a client point of view.
Let's use the newly added delegated hash bins example as a reference #1700.
An Updater test needs to include:
on the repository side:
creating one (or a couple of) delegated role(s). Naming does not matter for the client but in order to provide a good example, the rolename should represent the range of hash prefixes it delegates.
setting DelegatedRole.path_hash_prefixes to the list of path hash prefixes the role delegates.
adding a target file by choosing a target path whose hash digest prefix fits in the delegated role range.
Following the chosen prefix length and number of bins in the example:
perform the usual search for target file metadata Updater.get_targetinfo("test_hashed_bins.ext")
verify that the target info was successfully found and the correct delegated metadata file was downloaded
add any other error cases that can come to mind
Currently two PRs add tests for delegated roles and it would be nice if the hashed bins test is included after them in test_delegation_graphs.py#1689, #1711
Activity
lukpueh commentedon Oct 27, 2021
IMO this feature should not be implemented in test code but rather be part of repository tooling (#1136).
jku commentedon Oct 27, 2021
absolutely true as the mid/long term goal but it might still make sense to implement in RepositorySimulator first:
joshuagl commentedon Oct 27, 2021
The hashed bin delegation code in repository_tool was cleaned up and simplified when the Warehouse work kicked off. See, for example, #1007 and #1012. Specifically:
delegate_hashed_bins()add_target_to_bin()remove_target_from_bin()As a follow-on we refactored some of the helper functions to be public API (see #1058) in repository_lib for use with an early iteration of the metadata API:
create_bin_name()get_bin_numbers()find_bin_for_target_hash()get_target_hash()ivanayov commentedon Dec 8, 2021
Can I take this?
sechkova commentedon Dec 8, 2021
Seems like the latest tendency is towards implementing the delegated hash bins functionality in a repository-side and test code at a later stage. For this reason the issue can be re-scoped to include only the needed tests from a client point of view.
Let's use the newly added delegated hash bins example as a reference #1700.
An
Updatertest needs to include:DelegatedRole.path_hash_prefixesto the list of path hash prefixes the role delegates.Following the chosen prefix length and number of bins in the example:
Updater.get_targetinfo("test_hashed_bins.ext")Currently two PRs add tests for delegated roles and it would be nice if the hashed bins test is included after them in
test_delegation_graphs.py#1689, #1711