Revision b3155065 snf-pithos-app/pithos/api/util.py
b/snf-pithos-app/pithos/api/util.py | ||
---|---|---|
761 | 761 |
hashmap.append(request.backend.put_block(('\x00' * bo) + data[:bl])) |
762 | 762 |
return bl # Return ammount of data written. |
763 | 763 |
|
764 |
def hashmap_md5(request, hashmap, size):
|
|
764 |
def hashmap_md5(backend, hashmap, size):
|
|
765 | 765 |
"""Produce the MD5 sum from the data in the hashmap.""" |
766 | 766 |
|
767 | 767 |
# TODO: Search backend for the MD5 of another object with the same hashmap and size... |
768 | 768 |
md5 = hashlib.md5() |
769 |
bs = request.backend.block_size
|
|
769 |
bs = backend.block_size |
|
770 | 770 |
for bi, hash in enumerate(hashmap): |
771 |
data = request.backend.get_block(hash) # Blocks come in padded.
|
|
771 |
data = backend.get_block(hash) # Blocks come in padded. |
|
772 | 772 |
if bi == len(hashmap) - 1: |
773 | 773 |
data = data[:size % bs] |
774 | 774 |
md5.update(data) |
Also available in: Unified diff