Skip to content

Instantly share code, notes, and snippets.

@bnagy
Created July 3, 2012 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnagy/3037549 to your computer and use it in GitHub Desktop.
Save bnagy/3037549 to your computer and use it in GitHub Desktop.
require 'zk'
require 'msgpack'
zk = ZK.new
root_node = '/fuzz'
3.times do
my_metadata={'value'=>rand(32)}
me=zk.create(
File.join(root_node,'fuzzer'),
MessagePack.pack(@node_metadata),
mode: :ephemeral_sequential
)
p me
meta=MessagePack.unpack( zk.get(root_node).first )
p meta
meta['required_workers']-=1
zk.set(root_node, MessagePack.pack(meta) )
end
sleep 2
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment