Page MenuHomeSoftware Heritage

Add a validation proxy for _add() methods.
ClosedPublic

Authored by vlorentz on Fri, Feb 7, 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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vlorentz created this revision.Fri, Feb 7, 4:35 PM
vlorentz updated this revision to Diff 9443.Fri, Feb 7, 4:59 PM

fix test.

vlorentz edited the summary of this revision. (Show Details)Fri, Feb 7, 4:59 PM

test will fail because of dependency on D2641.

ardumont accepted this revision.Fri, Feb 7, 6:46 PM
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.Fri, Feb 7, 6:46 PM
vlorentz updated this revision to Diff 9455.Mon, Feb 10, 12:04 PM

apply comment

This revision was automatically updated to reflect the committed changes.