:param public: (bool)
:param container_info_cache: (dict) if given, avoid redundant calls to
- server for container info (block size and hash information)
+ server for container info (block size and hash information)
"""
self._assert_container()
:param public: (bool)
:param container_info_cache: (dict) if given, avoid redundant calls to
- server for container info (block size and hash information)
+ server for container info (block size and hash information)
"""
self._assert_container()
if not content_type:
content_type = 'application/octet-stream'
- num_of_blocks, blockmod = size / blocksize, size % blocksize
- num_of_blocks += (1 if blockmod else 0) if num_of_blocks else blockmod
-
hashes = []
hmap = {}
- for blockid in range(num_of_blocks):
+ for blockid in range(nblocks):
start = blockid * blocksize
block = input_str[start: (start + blocksize)]
hashes.append(_pithos_hash(block, blockhash))
num_of_missing = len(missing)
if upload_cb:
- self.progress_bar_gen = upload_cb(num_of_blocks)
- for i in range(num_of_blocks + 1 - num_of_missing):
+ self.progress_bar_gen = upload_cb(nblocks)
+ for i in range(nblocks + 1 - num_of_missing):
self._cb_next()
tries = 7
'X-Account-Policy-Quota',
exactMatch=True)
- def get_account_versioning(self):
- """
- :returns: (dict)
- """
- return filter_in(
- self.get_account_info(),
- 'X-Account-Policy-Versioning',
- exactMatch=True)
+ #def get_account_versioning(self):
+ # """
+ # :returns: (dict)
+ # """
+ # return filter_in(
+ # self.get_account_info(),
+ # 'X-Account-Policy-Versioning',
+ # exactMatch=True)
def get_account_meta(self, until=None):
"""
- :meta until: (str) formated date
+ :param until: (str) formated date
:returns: (dict)
"""
r = self.account_post(update=True, metadata={metakey: ''})
return r.headers
- """
- def set_account_quota(self, quota):
- ""
- :param quota: (int)
- ""
- self.account_post(update=True, quota=quota)
- """
+ #def set_account_quota(self, quota):
+ # """
+ # :param quota: (int)
+ # """
+ # self.account_post(update=True, quota=quota)
- def set_account_versioning(self, versioning):
- """
- "param versioning: (str)
- """
- r = self.account_post(update=True, versioning=versioning)
- return r.headers
+ #def set_account_versioning(self, versioning):
+ # """
+ # :param versioning: (str)
+ # """
+ # r = self.account_post(update=True, versioning=versioning)
+ # return r.headers
def list_containers(self):
"""
def del_container_meta(self, metakey):
"""
:param metakey: (str) metadatum key
+
+ :returns: (dict) response headers
"""
r = self.container_post(update=True, metadata={metakey: ''})
return r.headers
:param upload_db: progress.bar for uploading
"""
-
self._assert_container()
meta = self.get_container_info()
blocksize = int(meta['x-container-block-size'])
sendlog.info('- - - wait for threads to finish')
for thread in activethreads():
thread.join()
+ finally:
+ from time import sleep
+ sleep(2 * len(activethreads()))
return headers.values()
def truncate_object(self, obj, upto_bytes):