Revision b349b84b kamaki/clients/pithos/__init__.py
b/kamaki/clients/pithos/__init__.py | ||
---|---|---|
198 | 198 |
nblocks = 1 + (size - 1) // blocksize |
199 | 199 |
return (blocksize, blockhash, size, nblocks) |
200 | 200 |
|
201 |
def _get_missing_hashes( |
|
201 |
def _create_or_get_missing_hashes(
|
|
202 | 202 |
self, obj, json, |
203 | 203 |
size=None, |
204 | 204 |
format='json', |
205 | 205 |
hashmap=True, |
206 | 206 |
content_type=None, |
207 |
if_etag_match=None, |
|
208 |
if_etag_not_match=None, |
|
207 | 209 |
content_encoding=None, |
208 | 210 |
content_disposition=None, |
209 | 211 |
permissions=None, |
... | ... | |
215 | 217 |
hashmap=True, |
216 | 218 |
content_type=content_type, |
217 | 219 |
json=json, |
220 |
if_etag_match=if_etag_match, |
|
221 |
if_etag_not_match=if_etag_not_match, |
|
218 | 222 |
content_encoding=content_encoding, |
219 | 223 |
content_disposition=content_disposition, |
220 | 224 |
permissions=permissions, |
... | ... | |
222 | 226 |
success=success) |
223 | 227 |
return None if r.status_code == 201 else r.json |
224 | 228 |
|
225 |
def _culculate_blocks_for_upload(
|
|
229 |
def _calculate_blocks_for_upload(
|
|
226 | 230 |
self, blocksize, blockhash, size, nblocks, hashes, hmap, fileobj, |
227 | 231 |
hash_cb=None): |
228 | 232 |
offset = 0 |
... | ... | |
338 | 342 |
if not content_type: |
339 | 343 |
content_type = 'application/octet-stream' |
340 | 344 |
|
341 |
self._culculate_blocks_for_upload(
|
|
345 |
self._calculate_blocks_for_upload(
|
|
342 | 346 |
*block_info, |
343 | 347 |
hashes=hashes, |
344 | 348 |
hmap=hmap, |
... | ... | |
346 | 350 |
hash_cb=hash_cb) |
347 | 351 |
|
348 | 352 |
hashmap = dict(bytes=size, hashes=hashes) |
349 |
missing = self._get_missing_hashes( |
|
353 |
missing = self.create_or_get_missing_hashes(
|
|
350 | 354 |
obj, hashmap, |
351 | 355 |
content_type=content_type, |
352 | 356 |
size=size, |
357 |
if_etag_match=if_etag_match, |
|
358 |
if_etag_not_match='*' if if_not_exist else None, |
|
353 | 359 |
content_encoding=content_encoding, |
354 | 360 |
content_disposition=content_disposition, |
355 | 361 |
permissions=sharing, |
Also available in: Unified diff