Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add readme, todo, and some config comments

  • Loading branch information...
commit 2a52648b28cf2f7d788a4d913455b8323aa3ec0a 1 parent 2b25b46
Grant Rodgers authored May 31, 2009
9  README
... ...
@@ -0,0 +1,9 @@
  1
+Use Apache ZooKeeper to manage dynamic configuration of distributed systems
  2
+
  3
+GameWarden is a simple JRuby watchdog client that maintains ZK nodes and responds to events on other nodes.  
  4
+
  5
+See config.rb in the example directory for the dsl syntax.
  6
+
  7
+Uses Shane Mingins' zookeeper wrapper for JRuby (http://github.com/smingins/zookeeper)
  8
+
  9
+NOT PRODUCTION READY - FOR EDUCATIONAL PURPOSES ONLY
3  TODO
... ...
@@ -0,0 +1,3 @@
  1
+handle connection loss
  2
+add flapping protection (cycles)
  3
+use prefix everywhere
18  example/config.rb
... ...
@@ -1,21 +1,35 @@
  1
+# configure block has to be first
  2
+# servers is an array of zk servers; required
1 3
 configure do |config|
2 4
   config.servers = ["127.0.0.1:2181"]
3 5
   #config.prefix = "/gamewarden"
4 6
 end
5 7
 
  8
+# register creates a node if it doesn't exist
  9
+# must be before any watch blocks referencing this node
  10
+# params are path, data
6 11
 register "/memcached", "memcached servers"
7 12
 
  13
+# watch a node for events
8 14
 watch "/memcached" do
  15
+
9 16
   on :children_changed do |event|
10 17
     puts "children changed to #{event.nodes.inspect}"
11 18
     # update dna with new child list
12 19
     # run chef
13 20
   end
14  
-end
15 21
 
  22
+  on [:node_deleted, :node_created] do |event|
  23
+    puts "node state changed"
  24
+  end
  25
+end
16 26
 
  27
+# create an ephemeral node
  28
+# sequence optional
  29
+# data is result of block
17 30
 maintain "/memcached/server", :sequence => true do
18 31
   "127.0.0.1:1024"
19 32
 end
20 33
 
21  
-#maintain "/memcached/127.0.0.1:1024"
  34
+# can also pass data as an argument
  35
+#maintain "/memcached/127.0.0.1:1024", "data"

0 notes on commit 2a52648

Please sign in to comment.
Something went wrong with that request. Please try again.