aiidateam / disk-objectstore

An implementation of an efficient "object store" (actually, a key-value store) writing files on disk and not requiring a running server
https://disk-objectstore.readthedocs.io
MIT License
16 stars 8 forks source link

Adding methods to just fetch metas without opening streams #62

Closed giovannipizzi closed 4 years ago

giovannipizzi commented 4 years ago

The methods are called get_objects_meta and get_object_meta. The first just return a generator, the second is a standard function. Since they don't open streams, they do not need to be context managers.

I therefore refactored the internal function _get_objects_stream_meta_generator to try to keep the logic in a single place.

Also, I test that this method does not open new files, and I now use this method for has_objects. Results oscillate a lot but seem to be consistently better.

Therefore this fixes #48

codecov[bot] commented 4 years ago

Codecov Report

Merging #62 into develop will increase coverage by 0.00%. The diff coverage is 98.95%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop      #62   +/-   ##
========================================
  Coverage    99.89%   99.89%           
========================================
  Files            7        7           
  Lines          937      959   +22     
========================================
+ Hits           936      958   +22     
  Misses           1        1           
Impacted Files Coverage Δ
disk_objectstore/container.py 99.76% <98.95%> (+0.01%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update df368df...7ca0a30. Read the comment docs.