Skip to content

RepositorySimulator: add support for delegated hash bins #1639

Closed

Description

@sechkova

Description of issue or feature request:

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.

def delegate_hashed_bins(self, list_of_targets, keys_of_hashed_bins,

Having such functionality in RepositorySimulator that uses metadata api will be useful for testing the newer code.

Activity

  1. lukpueh commented on Oct 27, 2021

    @lukpueh
    Member

    IMO this feature should not be implemented in test code but rather be part of repository tooling (#1136).

  2. jku commented on Oct 27, 2021

    @jku
    Member

    IMO this feature should not be implemented in test code but rather be part of repository tooling (#1136).

    absolutely true as the mid/long term goal but it might still make sense to implement in RepositorySimulator first:

    • no need to wait for the library module to be able to test ngclient
    • gives us data about the complexity and what a good API (implemented on top of Metadata API) might look like
  3. added
    backlog
    on Oct 27, 2021
  4. joshuagl commented on Oct 27, 2021

    @joshuagl
    Member

    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:

  5. added this to the Sprint 14 milestone on Dec 8, 2021
  6. ivanayov commented on Dec 8, 2021

    @ivanayov
    Collaborator

    Can I take this?

  7. sechkova commented on Dec 8, 2021

    @sechkova
    ContributorAuthor

    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:

    rolename = "f8-ff"
    path_hash_prefixes = ["f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"]
    `test_hashed_bins.ext` -> fff0838676c1dacb8827b02511e89f85b43814a74dd2c3ffb31d952a1db94311
    • on the client side:
      • 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

  8. modified the milestones: Sprint 14, Sprint 15 on Jan 12, 2022
  9. modified the milestones: Sprint 15, sprint 16 on Jan 26, 2022
  10. modified the milestones: sprint 16, sprint 17 on Feb 9, 2022
  11. modified the milestones: sprint 17, sprint 18 on Feb 23, 2022
  12. modified the milestones: sprint 18, sprint 19 on Mar 9, 2022
  13. modified the milestones: sprint 19, Sprint 20 on Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backlogtesting

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions