Page MenuHomeSoftware Heritage

storage.in_memory: Use in-memory objstorage to store contents
ClosedPublic

Authored by anlambert on Dec 11 2018, 10:58 AM.

Details

Summary

In order to be more compliant with the swh stack and ease the
writing of tests, use the in-memory objstorage for storing contents
in the in-memory storage implementation.

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

anlambert created this revision.Dec 11 2018, 10:58 AM
ardumont accepted this revision.Dec 11 2018, 2:40 PM
ardumont added a subscriber: ardumont.

cool

This revision is now accepted and ready to land.Dec 11 2018, 2:40 PM
This revision was automatically updated to reflect the committed changes.
vlorentz added inline comments.Dec 11 2018, 3:13 PM
swh/storage/in_memory.py
49

It would make more sense to use a config dict here, like the pg storage.

123–125

Instead of continue, put the yield in an else clause (try blocks accept an else close that runs if no exception was raised).

Sorry @vlorentz, I merged that diff before seeing your comments.

It would make more sense to use a config dict here, like the pg storage.

We can still add it when we will have a use case to use a non-memory objstorage
with a in-memory storage.

Instead of continue, put the yield in an else clause (try blocks accept an else close that runs if no exception was raised).

In fact I reused the implementation from storage.py so this should also be changed in it.

ardumont added inline comments.Dec 11 2018, 3:44 PM
swh/storage/in_memory.py
123–125

ah yes, that'd be more readable.