Page MenuHomeSoftware Heritage

add methods to storage for searching origins whose urls contain a string pattern or match a regular expression
ClosedPublic

Authored by anlambert on Nov 20 2017, 11:58 AM.

Details

Reviewers
olasd
ardumont
Group Reviewers
Reviewers
Summary

add methods to storage for searching origins whose urls contain a string pattern or match a regular expression (related T848)

This diff add methods 'origin_search' and 'origin_regex_search' in Storage class in order
to search origins whose urls contain a string pattern or match a regular expression.

Diff Detail

Repository
rDSTO Storage manager
Branch
search-origins
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 1114
Build 1458: arc lint + arc unit

Event Timeline

zack added inline comments.
swh/storage/api/client.py
109–118

do we really want two endpoints for this rather than, say, a single one with an optional mode={pattern,regexp} parameter?

(i'm totally fine with two separate backend implementation, i just wonder if we want to expose that as public REST API methods)

swh/storage/api/client.py
109–118

Yes I was also not really confident about that separation of end points as it duplicates some code.

I think the best option is to have a single endpoint /origin/search that will
search using the pattern method by default. We could then use a boolean query parameter
'regexp' to specify that we want to search origins with the regular expression method.

What do you think ?

swh/storage/api/client.py
109–118

What do you think ?

👍

Updating D270: add methods to storage for searching origins whose urls contain a string pattern or match a regular expression

merge storage.origin_regexp_search into storage.origin_search (now use a parameter, default to False, to activate search by regular expression)

Updating D270: add methods to storage for searching origins whose urls contain a string pattern or match a regular expression

final diff with some code factorization

This revision is now accepted and ready to land.Dec 5 2017, 11:46 AM