to the journal writer, as it already does with other objet types
(instead of dicts).
Details
- Reviewers
ardumont - Group Reviewers
Reviewers - Commits
- rDSTOaa39be1b3b77: storage/writer: refactor JournalWriter.content_add to send model objects
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
Build is green
See https://jenkins.softwareheritage.org/job/DSTO/job/tox/1043/ for more details.
What are the implications of this on the JournalClient side?
I think it's fine.
write_additions knows how to deal with BaseModel objects.
It transforms it into dict for now.
if isinstance(object_, BaseModel): object_ = object_.to_dict()
So the only change on the wire will be that dicts representing contents will have a new 'data': None item. Fine.
My main doubt was whether we stopped explicitly converting model objects to dicts altogether (going through the swh.core model serializer instead). But even in that case contents will still be deserializable (as Content.from_dict(d) still works even when d['data'] is None).
Yes. And now that you've pointed it out, I've remembered that it's the swh.storage RPC layer that adds a hook to support model objects.