Revision 188f23b9 kamaki/clients/pithos.py
b/kamaki/clients/pithos.py | ||
---|---|---|
57 | 57 |
success=202) |
58 | 58 |
assert r.text.strip() == hash, 'Local hash does not match server' |
59 | 59 |
|
60 |
def create_object(self, object, f, hash_cb=None, upload_cb=None): |
|
60 |
def create_object(self, object, f, size=None, hash_cb=None, |
|
61 |
upload_cb=None): |
|
61 | 62 |
"""Create an object by uploading only the missing blocks |
62 | 63 |
|
63 | 64 |
hash_cb is a generator function taking the total number of blocks to |
... | ... | |
73 | 74 |
blocksize = int(meta['block-size']) |
74 | 75 |
blockhash = meta['block-hash'] |
75 | 76 |
|
76 |
file_size = os.fstat(f.fileno()).st_size |
|
77 |
file_size = size if size is not None else os.fstat(f.fileno()).st_size
|
|
77 | 78 |
nblocks = 1 + (file_size - 1) // blocksize |
78 | 79 |
hashes = OrderedDict() |
79 | 80 |
|
Also available in: Unified diff