Page MenuHomeSoftware Heritage

Make Storage.origin_get support a list of origins, like other Storage.*_get methods.
ClosedPublic

Authored by vlorentz on Feb 6 2019, 4:45 PM.

Diff Detail

Repository
rDSTO Storage manager
Branch
origin_get-uniformity
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 4043
Build 5307: tox-on-jenkinsJenkins
Build 5306: arc lint + arc unit

Event Timeline

vlorentz created this revision.Feb 6 2019, 4:45 PM
vlorentz updated this revision to Diff 3416.Feb 6 2019, 4:45 PM
  • Fix typo.
anlambert accepted this revision.Feb 6 2019, 5:39 PM
anlambert added a subscriber: anlambert.

Apart a couple of nitpicks, looks good to me.

I think once this is landed, we should create a task to track the calls of origin_get using the old API in all swh modules and port them to the new one.
Once it is done, the return_single switches should be removed from the origin_get method implementation.

swh/storage/in_memory.py
782

The method description should be updated to inform that multiple origins can be passed as parameter now.

813

That else block could be removed by initializing return_single to False before the dict check

845

I think that test can be removed, None will be returned with or without it

swh/storage/storage.py
1085

Method description needs update here too

1118

same remark as above: else block could be removed

1145

I know None is returned by default when return is not called but I think that expression is clearer

return results[0] if results[0]['id'] is not None else None
1242

origin_id seems a better variable name here

swh/storage/tests/test_storage.py
1002

s/id/origin_id/

This revision is now accepted and ready to land.Feb 6 2019, 5:39 PM
vlorentz updated this revision to Diff 3454.Feb 7 2019, 3:38 PM
vlorentz marked 7 inline comments as done.
This revision was automatically updated to reflect the committed changes.
vlorentz added inline comments.Feb 7 2019, 3:38 PM
swh/storage/in_memory.py
845

Indeed, that was from an earlier iteration of my code.