Page MenuHomeSoftware Heritage

Add a validation proxy for _add() methods.
ClosedPublic

Authored by vlorentz on Feb 7 2020, 4:35 PM.

Details

Summary

It converts input dictionaries into swh-model objects, which
validates them and raises an appropriate error.

This removes duplicated validation code that is currently present
in all three storage backends.

It also uses well-defined object types instead of loose dicts,
which gives these _add() methods a more strict type.

Depends on D2641.

Diff Detail

Repository
rDSTO Storage manager
Branch
validate-proxy
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 10500
Build 15648: tox-on-jenkinsJenkins
Build 15647: arc lint + arc unit

Event Timeline

test will fail because of dependency on D2641.

ardumont added a subscriber: ardumont.
ardumont added inline comments.
swh/storage/cassandra/storage.py
64

-> Dict

swh/storage/storage.py
266

here the bug i mentioned orally (i was a bit fuzzy and wrong about my description though ;)
we checked 'data' not in content instead of item.

This revision is now accepted and ready to land.Feb 7 2020, 6:46 PM