feat(rpc): add search type handler

This commit introduces a PackageSearch-derivative class: `RPCSearch`.
This derivative modifies callback behavior of PackageSearch to
suit RPC searches, including [make|check|opt]depends `by` types.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-10-30 16:39:20 -07:00
parent ece25e0499
commit af2f3694e7
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
5 changed files with 245 additions and 37 deletions

View file

@ -9,6 +9,9 @@ PP = 50
# A whitelist of valid PP values
PP_WHITELIST = {50, 100, 250}
# Default `by` parameter for RPC search.
RPC_SEARCH_BY = "name-desc"
def fallback_pp(per_page: int) -> int:
""" If `per_page` is a valid value in PP_WHITELIST, return it.