Page MenuHomeSoftware Heritage

Adapt cassandra backend to validating model types
ClosedPublic

Authored by douardda on Mar 27 2020, 4:12 PM.

Details

Reviewers
vlorentz
Group Reviewers
Reviewers
Summary

This is required to be able to activate type validation in the model (in
swh.model.model).

It requires to replace the "distorded" usage that was done of model entities
to build objects compatible with CqlRunner's object addition logic.
Since we cannot create invalid model entities any more in this context,
we add a new CassObject type (just a dict with getattr=getitem)
and use it as object passed to the CqlRunner for entity types that need
special care (namely Revision and Release).

This should still work with swh.model v0.0.62 (without type validation) as well
as the (next) v0.0.63 which will come with type valdation.

Depends on D2915.

Diff Detail

Repository
rDSTO Storage manager
Branch
valid2
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 11429
Build 17313: tox-on-jenkinsJenkins
Build 17312: arc lint + arc unit

Event Timeline

vlorentz added a subscriber: vlorentz.

This is going in the right direction, but I don't like the CassObject thing. I think you made it because you are conflating two uses of my "Frankenstein's model objects":

  1. Reads, where you can use the row directly (it's a namedtuple, so attr access)
  2. Writes, where a dict would do (item access)
This revision now requires changes to proceed.Mar 27 2020, 4:59 PM

This is going in the right direction, but I don't like the CassObject thing. I think you made it because you are conflating two uses of my "Frankenstein's model objects":

  1. Reads, where you can use the row directly (it's a namedtuple, so attr access)
  2. Writes, where a dict would do (item access)

I may be conflating these 2 uses, but there nothing "on purpose" here, TBH I just wanted these f*g tests to pass with the "strongly" typed model (after following a few unnecessary side tracks)...

Note sure what to do from there.

ok then, I'll fix it after you land it

This revision is now accepted and ready to land.Apr 1 2020, 2:17 PM

closed by df3207a6b753b254e945db492227b3bb9bbac7d6