Revision 8614814c kamaki/clients/pithos.py
b/kamaki/clients/pithos.py | ||
---|---|---|
63 | 63 |
r = self.post(path, params=params, data=data, headers=headers, |
64 | 64 |
success=202) |
65 | 65 |
assert r.text.strip() == hash, 'Local hash does not match server' |
66 |
|
|
66 |
|
|
67 | 67 |
def create_object(self, object, f, size=None, hash_cb=None, |
68 | 68 |
upload_cb=None): |
69 | 69 |
"""Create an object by uploading only the missing blocks |
70 |
|
|
70 |
|
|
71 | 71 |
hash_cb is a generator function taking the total number of blocks to |
72 | 72 |
be hashed as an argument. Its next() will be called every time a block |
73 | 73 |
is hashed. |
74 |
|
|
74 |
|
|
75 | 75 |
upload_cb is a generator function with the same properties that is |
76 | 76 |
called every time a block is uploaded. |
77 | 77 |
""" |
78 | 78 |
self.assert_container() |
79 |
|
|
79 |
|
|
80 | 80 |
meta = self.get_container_meta(self.container) |
81 | 81 |
blocksize = int(meta['block-size']) |
82 | 82 |
blockhash = meta['block-hash'] |
... | ... | |
113 | 113 |
|
114 | 114 |
if r.status_code == 201: |
115 | 115 |
return |
116 |
|
|
116 |
|
|
117 | 117 |
missing = r.json |
118 |
|
|
118 |
|
|
119 | 119 |
if upload_cb: |
120 | 120 |
upload_gen = upload_cb(len(missing)) |
121 | 121 |
upload_gen.next() |
Also available in: Unified diff