FileStore.stat() + stricter FileStore.__iter__()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
FileStore |
Fix Released
|
High
|
Jason Gerard DeRose |
Bug Description
As we're ramping up for calling dmedia "production ready", I've been thinking more on the constant verification dmedia will do to make sure the metadata reflects the reality on the hard drives.
FileStore.verify() is the only hard-and-true reality check possible... either the exact bits are there or not. However, full verification is time consuming so this puts a limit on how often we can do it.
So I'd like to balance this out with some "softer" reality checks that we can run far more often. The soft verification is to make sure the file exists, has the correct size, and has the expected time-stamp.
So I'm adding a rather strict FileStore.stat() method, and making FileStore.
`id` - the file id
`size` - the file size in bytes
`mtime` - the modification time-stamp
This means list(FileStore) gives you a quick and rather through picture of what is contained in the file-store. For example, you can now get total combined size of all the files in a store like this:
>>> from filestore import FileStore
>>> store = FileStore(
>>> sum(st.size for st in store)
338015276422
Related branches
- Jason Gerard DeRose: Approve
-
Diff: 411 lines (+253/-36)2 files modifiedfilestore.py (+71/-11)
test_filestore.py (+182/-25)
description: | updated |
description: | updated |
Changed in filestore: | |
status: | In Progress → Fix Committed |
Changed in filestore: | |
status: | Fix Committed → Fix Released |