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 4042
Build 5305: tox-on-jenkinsJenkins
Build 5304: arc lint + arc unit

Event Timeline

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–848

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

844

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

1117

same remark as above: else block could be removed

1144

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–1245

origin_id seems a better variable name here

swh/storage/tests/test_storage.py
1001

s/id/origin_id/

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

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