Merge pull request #4 from harlowja/singular
Instead of batch create/update just do singular for now
This commit is contained in:
commit
6c11b02d89
|
@ -59,10 +59,9 @@ class ZookeeperQuotaEngine(engine.QuotaEngine):
|
||||||
limits.append((resource, json.loads(blob)))
|
limits.append((resource, json.loads(blob)))
|
||||||
return limits
|
return limits
|
||||||
|
|
||||||
def create_or_update_limits(self, for_who, resources, limits):
|
def create_or_update_limit(self, for_who, resource, limit):
|
||||||
who_path = paths.join(self.uri.path, for_who)
|
who_path = paths.join(self.uri.path, for_who)
|
||||||
self.client.ensure_path(who_path)
|
self.client.ensure_path(who_path)
|
||||||
for resource, limit in zip(resources, limits):
|
|
||||||
resource_path = paths.join(who_path, resource)
|
resource_path = paths.join(who_path, resource)
|
||||||
try:
|
try:
|
||||||
self.client.create(resource_path, json.dumps(limit))
|
self.client.create(resource_path, json.dumps(limit))
|
||||||
|
|
|
@ -36,10 +36,10 @@ class QuotaEngine(object):
|
||||||
"""Reads the limits of some entity."""
|
"""Reads the limits of some entity."""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def create_or_update_limits(self, for_who, resources, limits):
|
def create_or_update_limit(self, for_who, resource, limit):
|
||||||
"""Creates or updates a set of resource limits for some entity.
|
"""Updates or creates a resource limit for some entity.
|
||||||
|
|
||||||
Must operate transactionally; either all created/updated or none.
|
Must operate transactionally; either created/updated or not.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
|
Loading…
Reference in New Issue