Revision e9195e9d kamaki/clients/pithos/__init__.py
b/kamaki/clients/pithos/__init__.py | ||
---|---|---|
315 | 315 |
hash_gen = hash_cb(nblocks) |
316 | 316 |
hash_gen.next() |
317 | 317 |
|
318 |
for i in range(nblocks): |
|
318 |
for i in xrange(nblocks):
|
|
319 | 319 |
block = readall(fileobj, min(blocksize, size - offset)) |
320 | 320 |
bytes = len(block) |
321 |
if bytes <= 0: |
|
322 |
break |
|
321 | 323 |
hash = _pithos_hash(block, blockhash) |
322 | 324 |
hashes.append(hash) |
323 | 325 |
hmap[hash] = (offset, bytes) |
324 | 326 |
offset += bytes |
325 | 327 |
if hash_cb: |
326 | 328 |
hash_gen.next() |
327 |
msg = ('Failed to calculate uploaded blocks:'
|
|
328 |
' Offset and object size do not match')
|
|
329 |
msg = ('Failed to calculate uploading blocks: '
|
|
330 |
'read bytes(%s) != requested size (%s)' % (offset, size))
|
|
329 | 331 |
assert offset == size, msg |
330 | 332 |
|
331 | 333 |
def _upload_missing_blocks(self, missing, hmap, fileobj, upload_gen=None): |
Also available in: Unified diff