Page MenuHomeSoftware Heritage

journal_writer: use journal writer from swh.journal
ClosedPublic

Authored by douardda on Sep 17 2019, 11:42 AM.

Details

Summary

Move implementation of the InMemoryJournalWriter class and get_journal_writer
function in swh.journal to prevent a dependency loop.

Depends on D1992

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 added a subscriber: vlorentz.

Make sure the tests pass before landing this diff

This revision is now accepted and ready to land.Sep 17 2019, 11:47 AM

also update test_api_client.py

zack added inline comments.
swh/storage/journal_writer.py
0

so, by doing this, we fully embrace an import-time dependency loop between swh-storage and swh-journal, do we really want to go there?

swh/storage/journal_writer.py
0

Not sure what you mean here.

Now, since the journal and the storage are the only swh packages currently using this get_journal_writer function, we probably can get rid of this bw-compat module.

swh/storage/journal_writer.py
0

Not sure what you mean here.

swh-journal has a non-conditional import of swh.journal, and with this change swh-journal will grow a non-conditional import of swh.storage.

Now, since the journal and the storage are the only swh packages currently using this get_journal_writer function, we probably can get rid of this bw-compat module.

It would be great to do so without ever landing the non-conditional import loop mentioned above.

zack requested changes to this revision.Sep 23 2019, 6:52 PM

as discussed f2f, we'll drop the backward compatibility layer as to break the import loop

This revision now requires changes to proceed.Sep 23 2019, 6:52 PM
swh/storage/tests/test_api_client.py
13

swh.journal should also be in the test requirements

swh/storage/tests/test_api_client.py
13

nvm you did it already

zack requested changes to this revision.Sep 27 2019, 11:41 AM
zack added inline comments.
swh/storage/tests/test_api_client.py
13

can you make this import conditional for tests too, as you did for the non-test code?

This revision now requires changes to proceed.Sep 27 2019, 11:41 AM
swh/storage/tests/test_api_client.py
13

I think not, the test dependency being declared in the requirements-test.txt file.

This revision is now accepted and ready to land.Sep 27 2019, 1:27 PM
This revision was landed with ongoing or failed builds.Sep 27 2019, 1:31 PM
This revision was automatically updated to reflect the committed changes.