Merge lp://staging/~jderose/filestore/helpers into lp://staging/filestore
Status: | Merged |
---|---|
Merged at revision: | 190 |
Proposed branch: | lp://staging/~jderose/filestore/helpers |
Merge into: | lp://staging/filestore |
Diff against target: |
453 lines (+251/-50) 2 files modified
filestore.py (+95/-42) test_filestore.py (+156/-8) |
To merge this branch: | bzr merge lp://staging/~jderose/filestore/helpers |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
David Jordan | Approve | ||
Review via email: mp+74932@code.staging.launchpad.net |
Description of the change
This merge:
* Adds 3 new highish-level FileStore methods:
FileStore.
FileStore.
FileStore.
* Makes the use of the `Leaf` namedtuple consistent. Experience has shown the code is simpler and more robust if you keep track of the position in the file (leaf_index) a given chunk of leaf_data corresponds to. As of several revisions ago, when a leaf is read by reader() or batch_reader(), the index and data are bundled together right there in a Leaf(index, data) namedtuple. But this merge fixes some inconsistencies higher up:
- Consumers of `Leaf` no longer unpack it into (i, data)
- Consumers of `Leaf` yield/return the exact `Leaf` rather than (i, data)
- Hasher.update() has been renamed to the clearer Hasher.hash_leaf()
- Hasher.hash_leaf() now takes a `Leaf` instead of `bytes`
- Hasher is now more robust as it makes sure the Leaf.index from the readers matches up with its expected leaf_index
Looks a lot simpler. Approved.