def next(self): if self._highest_bucket_value < self._max_bucket_value: self._highest_bucket_value += 1 return compute_reserved_collection_name( self._username, _bucket_name_template % (self._highest_bucket_value, )) if len(self._deleted_bucket_names) > 0: return self._deleted_bucket_names.pop() return None
def next(self): if self._highest_bucket_value < self._max_bucket_value: self._highest_bucket_value += 1 return compute_reserved_collection_name( self._username, _bucket_name_template % (self._highest_bucket_value,) ) if len(self._deleted_bucket_names) > 0: return self._deleted_bucket_names.pop() return None
def create_unique_bucket(self, access_control=None): """ create a nimbus.io collection, similar to an s3 bucket this bucket will have a unique name, not duplicating any existing bucket The bucket name is be based on the current time. This will fail if called within a short time. See the documentation for ``create_bucket`` for more detail """ current_time = datetime.utcnow() time_string = current_time.strftime("%Y%m%d%H%M%S%f") bucket_name = compute_reserved_collection_name( self._identity.user_name, time_string) return self.create_bucket(bucket_name, access_control)
def create_unique_bucket(self, access_control=None): """ create a nimbus.io collection, similar to an s3 bucket this bucket will have a unique name, not duplicating any existing bucket The bucket name is be based on the current time. This will fail if called within a short time. See the documentation for ``create_bucket`` for more detail """ current_time = datetime.utcnow() time_string = current_time.strftime("%Y%m%d%H%M%S%f") bucket_name = compute_reserved_collection_name(self._identity.user_name, time_string) return self.create_bucket(bucket_name, access_control)
def __init__(self, username, max_bucket_value): self._username = username self._bucket_prefix = compute_reserved_collection_name(username, "") self._max_bucket_value = max_bucket_value self._highest_bucket_value = 0 self._deleted_bucket_names = list()