def __init__(self, parent_inode, inodes, api, num_retries, collection_record=None, explicit_collection=None): super(CollectionDirectory, self).__init__(parent_inode, inodes, None) self.api = api self.num_retries = num_retries self.collection_record_file = None self.collection_record = None self._poll = True try: self._poll_time = ( api._rootDesc.get('blobSignatureTtl', 60 * 60 * 2) / 2) except: _logger.debug( "Error getting blobSignatureTtl from discovery document: %s", sys.exc_info()[0]) self._poll_time = 60 * 60 if isinstance(collection_record, dict): self.collection_locator = collection_record['uuid'] self._mtime = convertTime(collection_record.get('modified_at')) else: self.collection_locator = collection_record self._mtime = 0 self._manifest_size = 0 if self.collection_locator: self._writable = (uuid_pattern.match(self.collection_locator) is not None) self._updating_lock = threading.Lock()
def update(self, obj=None): if obj is None: # TODO: retrieve the current record for self.object_uuid # from the server. For now, at least don't crash when # someone tells us it's a good time to update but doesn't # pass us a fresh obj. See #8345 return self._mtime = convertTime(obj['modified_at']) if 'modified_at' in obj else 0 self.contents = json.dumps(obj, indent=4, sort_keys=True) + "\n"
def new_collection(self, new_collection_record, coll_reader): if self.inode: self.clear() self.collection_record = new_collection_record if self.collection_record: self._mtime = convertTime(self.collection_record.get('modified_at')) self.collection_locator = self.collection_record["uuid"] if self.collection_record_file is not None: self.collection_record_file.update(self.collection_record) self.collection = coll_reader self.populate(self.mtime())
def __init__(self, parent_inode, inodes, api, num_retries, collection_record=None, explicit_collection=None): super(CollectionDirectory, self).__init__(parent_inode, inodes, None) self.api = api self.num_retries = num_retries self.collection_record_file = None self.collection_record = None if isinstance(collection_record, dict): self.collection_locator = collection_record['uuid'] self._mtime = convertTime(collection_record.get('modified_at')) else: self.collection_locator = collection_record self._mtime = 0 self._manifest_size = 0 if self.collection_locator: self._writable = (uuid_pattern.match(self.collection_locator) is not None) self._updating_lock = threading.Lock()
def __init__(self, parent_inode, inodes, api, num_retries, collection_record=None, explicit_collection=None): super(CollectionDirectory, self).__init__(parent_inode, inodes, None) self.api = api self.num_retries = num_retries self.collection_record_file = None self.collection_record = None self._poll = True try: self._poll_time = (api._rootDesc.get('blobSignatureTtl', 60*60*2)/2) except: _logger.debug("Error getting blobSignatureTtl from discovery document: %s", sys.exc_info()[0]) self._poll_time = 60*60 if isinstance(collection_record, dict): self.collection_locator = collection_record['uuid'] self._mtime = convertTime(collection_record.get('modified_at')) else: self.collection_locator = collection_record self._mtime = 0 self._manifest_size = 0 if self.collection_locator: self._writable = (uuid_pattern.match(self.collection_locator) is not None) self._updating_lock = threading.Lock()
def update(self, obj=None): self._mtime = convertTime(obj['modified_at']) if 'modified_at' in obj else 0 self.contents = json.dumps(obj, indent=4, sort_keys=True) + "\n"
def update(self, obj=None): self._mtime = convertTime( obj['modified_at']) if 'modified_at' in obj else 0 self.contents = json.dumps(obj, indent=4, sort_keys=True) + "\n"