Skip to content

Commit

Permalink
Transfers: implement source selection strategies
Browse files Browse the repository at this point in the history
Try to be more generic in the source filtering and selection code.
Introduce a SourceRankingStrategy class, which has an `apply` method
to actually apply the strategy to a source and decide what to do with
a source. Some strategies are filter-only: i.e. they only decide if
a source has to be ignored or not. Others are also ranking strategies:
they can return an integer which defines the cost of the source
according to this strategy. The order of ranking strategies is
important: it defines the order in which the costs will be compared to
sort the sources.

This change will definitely introduce some computational and memory
overhead, but I hope it will be low. Instead of hard-coded `filter()`
calls which are done once per request, now we have multiple object
traversals and function calls for each source of each request.
  • Loading branch information
Radu Carpa committed Nov 9, 2023
1 parent 4380d02 commit 5b7e812
Showing 1 changed file with 254 additions and 146 deletions.
Loading

0 comments on commit 5b7e812

Please sign in to comment.