Page MenuHomeSoftware Heritage

Add a draft of 'StorageReplayer', a tool that fills a Storage from Kafka.
ClosedPublic

Authored by vlorentz on Apr 1 2019, 5:27 PM.

Diff Detail

Repository
rDJNL Journal infrastructure
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

remove dep on direct writer.

  • Add support for replaying origins and origin_visits.
douardda requested changes to this revision.Apr 2 2019, 2:57 PM
douardda added a subscriber: douardda.
douardda added inline comments.
swh/journal/replay.py
23–40

why not pass the kafka consumer instance as argument of the constructor instead of passing KafkaConsumer init arguments?

44

I find a bit odd to put the enumerate inside the islice iterator. It makes it a bit harder to read this line IMHO.

Also, since you have to initialize num=0 to handle empty look, why not add a num += 1 in the for loop instead of using enumerate?

58

This needs an explanation (comment)

66

This is a bit rough

This revision now requires changes to proceed.Apr 2 2019, 2:57 PM
vlorentz marked 2 inline comments as done.
  • Apply @ddouard's comments.
swh/journal/replay.py
23–40

For consistency with other related classes (eg. KafkaDirectWriter), whose arguments are deserialized directly from a yaml.

44

Indeed, I hesitated between the two approach so I unknowingly did both

66

It can't happen (because of the assertion in the other method), but I don't like my pattern-matchings to be non-exhaustive.

swh/journal/replay.py
66

ok, then raising a RuntimeError (or any suitable exception) would be preferrable IMHO.

swh/journal/replay.py
66

Why? That's what assertions are for

douardda added inline comments.
swh/journal/replay.py
66

well I guess so. Not a huge fan of this usage (but meh).

This revision is now accepted and ready to land.Apr 2 2019, 4:02 PM
This revision was landed with ongoing or failed builds.Apr 3 2019, 10:12 AM
This revision was automatically updated to reflect the committed changes.