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
15 stars 8 forks source link

Add whence=2 to be used #140

Closed zhubonan closed 1 year ago

zhubonan commented 2 years ago

Addresses #136

For reading packed file as it is, there is no need to restrict whence to be only 0 or 1.

Compressed files are more tricky as it is not possible to freely seek to the end. Instead, the entire files will be decompressed back into a loose file, which will then be opened for reading.

If such file exists already it will be used, so we don't decompress twice. Such "cache" files are deleted during the routine maintainance operations (e.g. pack_all_loose).

However, this does add some coupling between the Decompressor and the Container as the former has to have access to the latter to be able to obtain decompressed stream.

codecov[bot] commented 2 years ago

Codecov Report

Merging #140 (8c11e27) into develop (16e6ff9) will decrease coverage by 1.03%. The diff coverage is 68.51%.

@@             Coverage Diff             @@
##           develop     #140      +/-   ##
===========================================
- Coverage    99.52%   98.48%   -1.04%     
===========================================
  Files            8        8              
  Lines         1676     1718      +42     
===========================================
+ Hits          1668     1692      +24     
- Misses           8       26      +18     
Impacted Files Coverage Δ
disk_objectstore/container.py 97.99% <20.00%> (-1.41%) :arrow_down:
disk_objectstore/utils.py 98.50% <87.17%> (-1.11%) :arrow_down:

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 16e6ff9...8c11e27. Read the comment docs.