Skip to content

Instantly share code, notes, and snippets.

@harlowja
Created May 14, 2016 00:41
Show Gist options
  • Save harlowja/1a66550393f899f49106d337546f9afb to your computer and use it in GitHub Desktop.
Save harlowja/1a66550393f899f49106d337546f9afb to your computer and use it in GitHub Desktop.
import delimiter
import contextlib
from oslo_utils import uuidutils
kind = "zookeeper://localhost/testing_%s" % uuidutils.generate_uuid()[0:8]
print kind
engine = delimiter.create_engine(kind)
engine.start()
with contextlib.closing(engine):
limits = engine.read_limits(b"josh")
print limits
engine.create_or_update_limit(b"josh", "disk", 10)
limits = engine.read_limits(b"josh")
print limits
engine.consume(b'josh', "disk", 5)
limits = engine.read_limits(b"josh")
print limits
engine.consume(b'josh', "disk", 10)
limits = engine.read_limits(b"josh")
print limits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment