zk 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -9,3 +9,4 @@ html
9
9
  Gemfile.*
10
10
  wiki
11
11
  zookeeper
12
+ coverage/
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "releaseops"]
2
+ path = releaseops
3
+ url = git://github.com/slyphon/releaseops.git
data/.travis.yml CHANGED
@@ -6,6 +6,10 @@ notifications:
6
6
  env:
7
7
  - SPAWN_ZOOKEEPER='true'
8
8
 
9
+ # pull in releaseops submodule
10
+ before_install:
11
+ - git submodule update --init --recursive
12
+
9
13
  rvm:
10
14
  - 1.9.3
11
15
  - 1.9.2
@@ -16,5 +20,5 @@ rvm:
16
20
  # - jruby-18mode
17
21
  # - jruby-19mode
18
22
 
19
- bundler_args: --without development docs
23
+ bundler_args: --without development docs coverage
20
24
 
data/.yardopts CHANGED
@@ -1,4 +1,3 @@
1
- --protected
2
1
  --no-private
3
2
  --tag hidden_example:Hidden
4
3
  --hide-tag hidden_example
data/Gemfile CHANGED
@@ -2,6 +2,17 @@ source :rubygems
2
2
 
3
3
  # gem 'slyphon-zookeeper', :path => '~/zookeeper'
4
4
 
5
+ # gem 'zookeeper', :path => "~/zookeeper"
6
+
7
+ # this is the last known commit that we tested against and is passing.
8
+ # keep closer track of this stuff to make bisecting easier and travis more
9
+ # accurate
10
+ #
11
+ # git 'git://github.com/slyphon/zookeeper.git', :ref => 'e8b181a37ee' do
12
+ # gem 'zookeeper', '>= 1.0.0.beta.1'
13
+ # end
14
+
15
+
5
16
  gem 'rake', :group => [:development, :test]
6
17
  gem 'pry', :group => [:development]
7
18
 
@@ -13,6 +24,10 @@ group :docs do
13
24
  end
14
25
  end
15
26
 
27
+ platform :mri_19 do
28
+ gem 'simplecov', :group => :coverage, :require => false
29
+ end
30
+
16
31
  group :test do
17
32
  gem 'rspec', '~> 2.8.0'
18
33
  gem 'flexmock', '~> 0.8.10'
data/README.markdown CHANGED
@@ -1,8 +1,8 @@
1
- # ZK
1
+ # ZK #
2
2
 
3
3
  [![Build Status (master)](https://secure.travis-ci.org/slyphon/zk.png?branch=master)](http://travis-ci.org/slyphon/zk)
4
4
 
5
- ZK is a high-level interface to the Apache [ZooKeeper][] server. It is based on the [zookeeper gem][] which is a multi-Ruby low-level driver. Currently MRI 1.8.7, 1.9.2, 1.9.3, and JRuby are supported, rubinius 2.0.testing is supported-ish (it's expected to work, but upstream is unstable, so YMMV).
5
+ ZK is an application programmer's interface to the Apache [ZooKeeper][] server. It is based on the [zookeeper gem][] which is a multi-Ruby low-level driver. Currently MRI 1.8.7, 1.9.2, 1.9.3, REE, and JRuby are supported. Rubinius 2.0.testing is supported-ish (it's expected to work, but upstream is unstable, so YMMV).
6
6
 
7
7
  ZK is licensed under the [MIT][] license.
8
8
 
@@ -18,91 +18,26 @@ Development is sponsored by [Snapfish][] and has been generously released to the
18
18
  [MIT]: http://www.gnu.org/licenses/license-list.html#Expat "MIT (Expat) License"
19
19
  [Snapfish]: http://www.snapfish.com/ "Snapfish"
20
20
 
21
- ## Contacting the author
22
-
23
- * I'm usually hanging out in IRC on freenode.net in the BRAND NEW #zk-gem channel.
24
- * if you really want to, you can also reach me via twitter [@slyphon][]
25
-
26
- [@slyphon]: https://twitter.com/#!/slyphon
27
-
28
- ## New in 1.1 !! ##
29
-
30
- * NEW! Thread-per-Callback event delivery model! [Read all about it!](https://github.com/slyphon/zk/wiki/EventDeliveryModel). Provides a simple, sane way to increase the concurrency in your ZK-based app while maintaining the ordering guarantees ZooKeeper makes. Each callback can perform whatever work it needs to without blocking other callbacks from receiving events. Inspired by [Celluloid's](https://github.com/celluloid/celluloid) actor model.
31
-
32
- * Use the [zk-server](https://github.com/slyphon/zk-server) gem to run a standalone ZooKeeper server for tests (`rake SPAWN_ZOOKEEPER=1`). Makes live-fire testing of any project that uses ZK easy to run anywhere!
33
-
34
- ## New in 1.0 ##
35
-
36
- * Threaded client (the default one) will now automatically reconnect (i.e. `reopen()`) if a `SESSION_EXPIRED` or `AUTH_FAILED` event is received. Thanks to @eric for pointing out the _nose-on-your-face obviousness_ and importance of this. If users want to handle these events themselves, and not automatically reopen, you can pass `:reconnect => false` to the constructor.
37
-
38
- * allow for both :sequence and :sequential arguments to create, because I always forget which one is the "right one"
39
-
40
- * add zk.register(:all) to recevie node updates for all nodes (i.e. not filtered on path)
41
-
42
- * add 'interest' feature to zk.register, now you can indicate what kind of events should be delivered to the given block (previously you had to do that filtering inside the block). The default behavior is still the same, if no 'interest' is given, then all event types for the given path will be delivered to that block.
43
-
44
- ```ruby
45
- zk.register('/path', :created) do |event|
46
- # event.node_created? will always be true
47
- end
48
-
49
- # or multiple kinds of events
50
-
51
- zk.register('/path', [:created, :changed]) do |event|
52
- # (event.node_created? or event.node_changed?) will always be true
53
- end
54
-
55
- # this will, however, be changed in 1.1 to (backwards compatible, with a deprecation warning)
56
-
57
- zk.register('/path', :only => :created) do |event|
58
- end
59
-
60
- ```
61
-
62
- * create now allows you to pass a path and options, instead of requiring the blank string
63
-
64
- ```ruby
65
- zk.create('/path', '', :sequential => true)
66
-
67
- # now also
68
-
69
- zk.create('/path', :sequential => true)
70
- ```
71
-
72
- * fix for shutdown: close! called from threadpool will do the right thing
73
-
74
- * Chroot users rejoice! By default, ZK.new will create a chrooted path for you.
75
-
76
- ```ruby
77
- ZK.new('localhost:2181/path', :chroot => :create) # the default, create the path before returning connection
78
-
79
- ZK.new('localhost:2181/path', :chroot => :check) # make sure the chroot exists, raise if not
80
-
81
- ZK.new('localhost:2181/path', :chroot => :do_nothing) # old default behavior
82
-
83
- # and, just for kicks
84
-
85
- ZK.new('localhost:2181', :chroot => '/path') # equivalent to 'localhost:2181/path', :chroot => :create
86
- ```
87
-
88
- * Most of the event functionality used is now in a ZK::Event module. This is still mixed into the underlying slyphon-zookeeper class, but now all of the important and relevant methods are documented, and Event appears as a first-class citizen.
89
-
90
- * Support for 1.8.7 WILL BE *DROPPED* in v1.1. You've been warned.
91
-
92
- ## What is ZooKeeper good for?
21
+ ## What is ZooKeeper? ##
93
22
 
94
23
  ZooKeeper is a multi-purpose tool that is designed to allow you to write code that coordinates many nodes in a cluster. It can be used as a directory service, a configuration database, and can provide cross-cluster [locking][], [leader election][], and [group membership][] (to name a few). It presents to the user what looks like a distributed file system, with a few important differences: every node can have children _and_ data, and there is a 1MB limit on data size for any given node. ZooKeeper provides atomic semantics and a simple API for manipulating data in the heirarchy.
95
24
 
96
- One of the most useful aspects of ZooKeeper is the ability to set "[watches][]" on nodes. This allows one to be notified when a node has been deleted, created, has had a child modified, or had its data modified. The asynchronous nature of these watches enables you to write code that can _react_ to changes in your environment.
25
+ One of the most useful aspects of ZooKeeper is the ability to set "[watches][]" on nodes. This allows one to be notified when a node has been deleted, created, changd, or has had its list of child znodes modified. The asynchronous nature of these watches enables you to write code that can _react_ to changes in your environment without polling and busy-waiting.
97
26
 
98
- ZooKeeper is also (relatively) easy to deploy in a [Highly Available][ha-config] configuration, and the clients natively understand the clustering and how to resume a session transparently when one of the cluster nodes goes away.
27
+ Znodes can be _ephemeral_, which means that when the connection that created them goes away, they're automatically cleaned up, and all the clients that were watching them are notified of the deletion. This is an incredibly useful mechanism for providing _presence_ in a cluster ("which of my thingamabobers are up?). If you've ever run across a stale pid file or lock, you can imagine how useful this feature can be.
99
28
 
29
+ Znodes can also be created as _sequence_ nodes, which means that beneath a given path, a node can be created with a given prefix and assigned a unique integer. This, along with the _ephemeral_ property, provide the basis for most of the coordination classes such as [groups][] and [locks][].
30
+
31
+ ZooKeeper is easy to deploy in a [Highly Available][ha-config] configuration, and the clients natively understand the clustering and how to resume a session transparently when one of the cluster nodes goes away.
100
32
 
101
33
  [watches]: http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ch_zkWatches
102
34
  [locking]: http://zookeeper.apache.org/doc/current/recipes.html#sc_recipes_Locks
103
35
  [leader election]: http://zookeeper.apache.org/doc/current/recipes.html#sc_leaderElection
104
36
  [group membership]: http://zookeeper.apache.org/doc/current/recipes.html#sc_outOfTheBox
105
37
  [ha-config]: http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_CrossMachineRequirements "HA config"
38
+ [groups]: https://github.com/slyphon/zk-group
39
+ [locks]: http://rubydoc.info/gems/zk/ZK/Locker
40
+
106
41
 
107
42
  ## What does ZK do that the zookeeper gem doesn't?
108
43
 
@@ -126,6 +61,34 @@ In addition to all of that, I would like to think that the public API the ZK::Cl
126
61
  [EventMachine]: https://github.com/eventmachine/eventmachine
127
62
  [zk-eventmachine]: https://github.com/slyphon/zk-eventmachine
128
63
 
64
+ ## NEWS ##
65
+
66
+ ### v1.2.0 ###
67
+
68
+ You are __STRONGLY ENCOURAGED__ to go and look at the [CHANGELOG](http://git.io/tPbNBw) from the zookeeper 1.0.0 release
69
+
70
+ * NOTICE: This release uses the 1.0 release of the zookeeper gem, which has had a MAJOR REFACTORING of its namespaces. Included in that zookeeper release is a compatibility layer that should ease the transition, but any references to Zookeeper\* heirarchy should be changed.
71
+
72
+ * Refactoring related to the zokeeper gem, use all the new names internally now.
73
+
74
+ * Create a new Subscription class that will be used as the basis for all subscription-type things.
75
+
76
+ * Add new Locker features!
77
+ * `LockerBase#assert!` - will raise an exception if the lock is not held. This check is not only for local in-memory "are we locked?" state, but will check the connection state and re-run the algorithmic tests that determine if a given Locker implementation actually has the lock.
78
+ * `LockerBase#acquirable?` - an advisory method that checks if any condition would prevent the receiver from acquiring the lock.
79
+
80
+ * Deprecation of the `lock!` and `unlock!` methods. These may change to be exception-raising in a future relase, so document and refactor that `lock` and `unlock` are the way to go.
81
+
82
+ * Fixed a race condition in `event_catcher_spec.rb` that would cause 100% cpu usage and hang.
83
+
84
+
85
+ ### v1.1.0 ###
86
+
87
+ * NEW! Thread-per-Callback event delivery model! [Read all about it!](https://github.com/slyphon/zk/wiki/EventDeliveryModel). Provides a simple, sane way to increase the concurrency in your ZK-based app while maintaining the ordering guarantees ZooKeeper makes. Each callback can perform whatever work it needs to without blocking other callbacks from receiving events. Inspired by [Celluloid's](https://github.com/celluloid/celluloid) actor model.
88
+
89
+ * Use the [zk-server](https://github.com/slyphon/zk-server) gem to run a standalone ZooKeeper server for tests (`rake SPAWN_ZOOKEEPER=1`). Makes live-fire testing of any project that uses ZK easy to run anywhere!
90
+
91
+
129
92
  ## Caveats
130
93
 
131
94
  ZK strives to be a complete, correct, and convenient way of interacting with ZooKeeper. There are a few things to be aware of:
@@ -168,4 +131,11 @@ ZK strives to be a complete, correct, and convenient way of interacting with Zoo
168
131
  [szk-jar-gem]: https://rubygems.org/gems/slyphon-zookeeper_jar
169
132
  [szk-jar-repo]: https://github.com/slyphon/zookeeper_jar
170
133
 
134
+ ## Contacting the author
135
+
136
+ * I'm usually hanging out in IRC on freenode.net in the BRAND NEW #zk-gem channel.
137
+ * if you really want to, you can also reach me via twitter [@slyphon][]
138
+
139
+ [@slyphon]: https://twitter.com/#!/slyphon
140
+
171
141
 
data/RELEASES.markdown CHANGED
@@ -1,4 +1,22 @@
1
1
  This file notes feature differences and bugfixes contained between releases.
2
+ ### v1.2.0 ###
3
+
4
+ You are __STRONGLY ENCOURAGED__ to go and look at the [CHANGELOG](http://git.io/tPbNBw) from the zookeeper 1.0.0 release
5
+
6
+ * NOTICE: This release uses the 1.0 release of the zookeeper gem, which has had a MAJOR REFACTORING of its namespaces. Included in that zookeeper release is a compatibility layer that should ease the transition, but any references to Zookeeper\* heirarchy should be changed.
7
+
8
+ * Refactoring related to the zokeeper gem, use all the new names internally now.
9
+
10
+ * Create a new Subscription class that will be used as the basis for all subscription-type things.
11
+
12
+ * Add new Locker features!
13
+ * `LockerBase#assert!` - will raise an exception if the lock is not held. This check is not only for local in-memory "are we locked?" state, but will check the connection state and re-run the algorithmic tests that determine if a given Locker implementation actually has the lock.
14
+ * `LockerBase#acquirable?` - an advisory method that checks if any condition would prevent the receiver from acquiring the lock.
15
+
16
+ * Deprecation of the `lock!` and `unlock!` methods. These may change to be exception-raising in a future relase, so document and refactor that `lock` and `unlock` are the way to go.
17
+
18
+ * Fixed a race condition in `event_catcher_spec.rb` that would cause 100% cpu usage and hang.
19
+
2
20
  ### v1.1.1 ###
3
21
 
4
22
  * Documentation for Locker and ilk
data/Rakefile CHANGED
@@ -1,87 +1,68 @@
1
- gemset_name = 'zk'
1
+ release_ops_path = File.expand_path('../releaseops/lib', __FILE__)
2
2
 
3
- # this nonsense with the Gemfile symlinks is a bundler optimization
3
+ # if the special submodule is availabe, use it
4
+ # we use a submodule because it doesn't depend on anything else (*cough* bundler)
5
+ # and can be shared across projects
6
+ #
7
+ if File.exists?(release_ops_path)
8
+ require File.join(release_ops_path, 'releaseops')
4
9
 
5
- GEMSPEC_NAME = 'zk.gemspec'
10
+ # sets up the multi-ruby zk:test_all rake tasks
11
+ ReleaseOps::TestTasks.define_for(*%w[1.8.7 1.9.2 jruby rbx ree 1.9.3])
6
12
 
7
- %w[1.8.7 1.9.2 jruby rbx ree 1.9.3].each do |ns_name|
8
- rvm_ruby = (ns_name == 'rbx') ? "rbx-2.0.testing" : ns_name
13
+ # sets up the task :default => 'spec:run' and defines a simple
14
+ # "run the specs with the current rvm profile" task
15
+ ReleaseOps::TestTasks.define_simple_default_for_travis
9
16
 
10
- ruby_with_gemset = "#{rvm_ruby}@#{gemset_name}"
11
- create_gemset_task_name = "mb:#{ns_name}:create_gemset"
12
- bundle_task_name = "mb:#{ns_name}:bundle_install"
13
- rspec_task_name = "mb:#{ns_name}:run_rspec"
17
+ # Define a task to run code coverage tests
18
+ ReleaseOps::TestTasks.define_simplecov_tasks
14
19
 
15
- phony_gemfile_link_name = "Gemfile.#{ns_name}"
16
- phony_gemfile_lock_name = "#{phony_gemfile_link_name}.lock"
20
+ # set up yard:server, yard:gems, and yard:clean tasks
21
+ # for doing documentation stuff
22
+ ReleaseOps::YardTasks.define
17
23
 
18
- file phony_gemfile_link_name do
19
- # apparently, rake doesn't deal with symlinks intelligently :P
20
- ln_s('Gemfile', phony_gemfile_link_name) unless File.symlink?(phony_gemfile_link_name)
21
- end
24
+ namespace :zk do
25
+ namespace :gems do
26
+ task :build do
27
+ require 'tmpdir'
22
28
 
23
- task :clean do
24
- rm_rf [phony_gemfile_lock_name, phony_gemfile_lock_name]
25
- end
29
+ raise "You must specify a TAG" unless ENV['TAG']
26
30
 
27
- task create_gemset_task_name do
28
- sh "rvm #{rvm_ruby} do rvm gemset create #{gemset_name}"
29
- end
31
+ ReleaseOps.with_tmpdir(:prefix => 'zk') do |tmpdir|
32
+ tag = ENV['TAG']
30
33
 
31
- task bundle_task_name => [phony_gemfile_link_name, create_gemset_task_name] do
32
- sh "rvm #{ruby_with_gemset} do bundle install --gemfile #{phony_gemfile_link_name}"
33
- end
34
+ sh "git clone . #{tmpdir}"
34
35
 
35
- task rspec_task_name => bundle_task_name do
36
- sh "rvm #{ruby_with_gemset} do env JRUBY_OPTS='--1.9' BUNDLE_GEMFILE=#{phony_gemfile_link_name} bundle exec rspec spec --fail-fast"
37
- end
36
+ orig_dir = Dir.getwd
38
37
 
39
- task "mb:#{ns_name}" => rspec_task_name
38
+ cd tmpdir do
39
+ sh "git co #{tag} && git reset --hard && git clean -fdx"
40
40
 
41
- task "mb:test_all_rubies" => rspec_task_name
42
- end
41
+ sh "rvm 1.8.7 do gem build zk.gemspec"
43
42
 
44
- task 'mb:test_all' do
45
- require 'benchmark'
46
- tm = Benchmark.realtime do
47
- Rake::Task['mb:test_all_rubies'].invoke
48
- end
43
+ mv FileList['*.gem'], orig_dir
44
+ end
45
+ end
46
+ end
49
47
 
50
- $stderr.puts "Test run took: #{tm}"
51
- end
48
+ task :push do
49
+ gems = FileList['*.gem']
50
+ raise "No gemfiles to push!" if gems.empty?
52
51
 
52
+ gems.each do |gem|
53
+ sh "gem push #{gem}"
54
+ end
55
+ end
53
56
 
54
- namespace :yard do
55
- task :clean do
56
- rm_rf '.yardoc'
57
- end
57
+ task :clean do
58
+ rm_rf FileList['*.gem']
59
+ end
58
60
 
59
- task :server => :clean do
60
- sh "yard server --reload"
61
- end
62
-
63
- task :gems do
64
- sh 'yard server --gems --port=8809'
65
- end
66
- end
67
-
68
- task :clean => 'yard:clean'
69
-
70
- namespace :spec do
71
- task :define do
72
- require 'rubygems'
73
- require 'bundler/setup'
74
- require 'rspec/core/rake_task'
75
-
76
- RSpec::Core::RakeTask.new('spec:runner') do |t|
77
- t.rspec_opts = '-f d' if ENV['TRAVIS']
61
+ task :all => [:build, :push, :clean]
78
62
  end
79
63
  end
80
64
 
81
- task :run => :define do
82
- Rake::Task['spec:runner'].invoke
83
- end
84
- end
85
65
 
86
- task :default => 'spec:run'
66
+ task :clean => 'yard:clean'
67
+ end
87
68
 
data/lib/zk.rb CHANGED
@@ -2,6 +2,10 @@ require 'rubygems'
2
2
 
3
3
  require 'logger'
4
4
  require 'zookeeper'
5
+
6
+ # XXX: after 1.0 we'll need this
7
+ # require 'zookeeper/compatibility'
8
+
5
9
  require 'forwardable'
6
10
  require 'thread'
7
11
  require 'monitor'
@@ -15,6 +19,7 @@ require 'zk/exceptions'
15
19
  require 'zk/extensions'
16
20
  require 'zk/event'
17
21
  require 'zk/stat'
22
+ require 'zk/subscription'
18
23
  require 'zk/threadpool'
19
24
  require 'zk/threaded_callback'
20
25
  require 'zk/event_handler_subscription'
@@ -28,6 +28,19 @@ module ZK
28
28
  #
29
29
  # # connection is automatically closed
30
30
  #
31
+ # @example How to handle a fork()
32
+ #
33
+ # zk = ZK.new
34
+ #
35
+ # fork do
36
+ # zk.reopen() # <-- reopen is the important thing
37
+ #
38
+ # zk.create('/child/pid', $$.to_s, :ephemeral => true) # for example.
39
+ #
40
+ # # etc.
41
+ # end
42
+ #
43
+ #
31
44
  class Base
32
45
  # The Eventhandler is used by client code to register callbacks to handle
33
46
  # events triggerd for given paths.
@@ -142,9 +155,9 @@ module ZK
142
155
  # @overload create(path, data, opts={})
143
156
  # creates a znode at the absolute `path` with given data and options
144
157
  #
145
- # @option opts [Integer] :acl defaults to <tt>ZookeeperACLs::ZOO_OPEN_ACL_UNSAFE</tt>,
158
+ # @option opts [Integer] :acl defaults to <tt>Zookeeper::Constants::ZOO_OPEN_ACL_UNSAFE</tt>,
146
159
  # otherwise the ACL for the node. Should be a `ZOO_*` constant defined under the
147
- # ZookeeperACLs module in the zookeeper gem.
160
+ # Zookeeper::ACLs module in the zookeeper gem.
148
161
  #
149
162
  # @option opts [bool] :ephemeral (false) if true, the created node will be ephemeral
150
163
  #
@@ -153,7 +166,7 @@ module ZK
153
166
  # @option opts [bool] :sequential (false) alias for :sequence option. if both are given
154
167
  # an ArgumentError is raised
155
168
  #
156
- # @option opts [ZookeeperCallbacks::StringCallback] :callback (nil) provide a callback object
169
+ # @option opts [Zookeeper::Callbacks::StringCallback] :callback (nil) provide a callback object
157
170
  # that will be called when the znode has been created
158
171
  #
159
172
  # @option opts [Object] :context (nil) an object passed to the `:callback`
@@ -309,24 +322,24 @@ module ZK
309
322
  # @option opts [bool] :watch (false) set to true if you want your registered
310
323
  # callbacks for this node to be called on change
311
324
  #
312
- # @option opts [ZookeeperCallbacks::DataCallback] :callback to make this call asynchronously
325
+ # @option opts [Zookeeper::Callbacks::DataCallback] :callback to make this call asynchronously
313
326
  #
314
327
  # @option opts [Object] :context an object passed to the `:callback`
315
328
  # given as the `context` param
316
329
  #
317
- # @return [Array] a two-element array of ['node data', #<ZookeeperStat::Stat>]
330
+ # @return [Array] a two-element array of ['node data', #<Zookeeper::Stat>]
318
331
  #
319
332
  # @raise [ZK::Exceptions::NoNode] if no node with the given path exists.
320
333
  #
321
334
  # @example get data for path
322
335
  #
323
336
  # zk.get("/path")
324
- # # => ['this is the data', #<ZookeeperStat::Stat>]
337
+ # # => ['this is the data', #<Zookeeper::Stat>]
325
338
  #
326
339
  # @example get data and set watch on node
327
340
  #
328
341
  # zk.get("/path", :watch => true)
329
- # # => ['this is the data', #<ZookeeperStat::Stat>]
342
+ # # => ['this is the data', #<Zookeeper::Stat>]
330
343
  #
331
344
  # @hidden_example get data asynchronously
332
345
  #
@@ -359,7 +372,7 @@ module ZK
359
372
  # -1, it matches any node's versions). Passing the version allows you to
360
373
  # perform optimistic locking, in that if someone changes the node's
361
374
  # data "behind your back", your update will fail. Since #create does not
362
- # return a ZookeeperStat::Stat object, you should be aware that nodes are
375
+ # return a Zookeeper::Stat object, you should be aware that nodes are
363
376
  # created with version == 0.
364
377
  #
365
378
  # This operation, if successful, will trigger all the watches on the node
@@ -383,8 +396,8 @@ module ZK
383
396
  # default is used, otherwise acts as an assertion that the znode has the
384
397
  # supplied version.
385
398
  #
386
- # @option opts [ZookeeperCallbacks::StatCallback] :callback will recieve the
387
- # ZookeeperStat::Stat object asynchronously
399
+ # @option opts [Zookeeper::Callbacks::StatCallback] :callback will recieve the
400
+ # Zookeeper::Stat object asynchronously
388
401
  #
389
402
  # @option opts [Object] :context an object passed to the `:callback`
390
403
  # given as the `context` param
@@ -434,13 +447,13 @@ module ZK
434
447
  # @option opts [bool] :watch (false) set to true if you want to enable
435
448
  # registered watches on this node
436
449
  #
437
- # @option opts [ZookeeperCallbacks::StatCallback] :callback will recieve the
438
- # ZookeeperStat::Stat object asynchronously
450
+ # @option opts [Zookeeper::Callbacks::StatCallback] :callback will recieve the
451
+ # Zookeeper::Stat object asynchronously
439
452
  #
440
453
  # @option opts [Object] :context an object passed to the `:callback`
441
454
  # given as the `context` param
442
455
  #
443
- # @return [ZookeeperStat::Stat] a stat object of the specified node
456
+ # @return [Zookeeper::Stat] a stat object of the specified node
444
457
  #
445
458
  # @example get stat for for path
446
459
  # >> zk.stat("/path")
@@ -453,7 +466,7 @@ module ZK
453
466
  # @example exists for non existent path
454
467
  #
455
468
  # >> stat = zk.stat("/non_existent_path")
456
- # # => #<ZookeeperStat::Stat:0x000001eb54 @exists=false>
469
+ # # => #<Zookeeper::Stat:0x000001eb54 @exists=false>
457
470
  # >> stat.exists?
458
471
  # # => false
459
472
  #
@@ -518,7 +531,7 @@ module ZK
518
531
  # @option opts [bool] :watch (false) set to true if you want your registered
519
532
  # callbacks for this node to be called on change
520
533
  #
521
- # @option opts [ZookeeperCallbacks::StringsCallback] :callback to make this
534
+ # @option opts [Zookeeper::Callbacks::StringsCallback] :callback to make this
522
535
  # call asynchronously
523
536
  #
524
537
  # @option opts [Object] :context an object passed to the `:callback`
@@ -586,7 +599,7 @@ module ZK
586
599
  # default is used, otherwise acts as an assertion that the znode has the
587
600
  # supplied version.
588
601
  #
589
- # @option opts [ZookeeperCallbacks::VoidCallback] :callback will be called
602
+ # @option opts [Zookeeper::Callbacks::VoidCallback] :callback will be called
590
603
  # asynchronously when the operation is complete
591
604
  #
592
605
  # @option opts [Object] :context an object passed to the `:callback`
@@ -626,7 +639,7 @@ module ZK
626
639
  #
627
640
  # @param [String] path absolute path of the znode
628
641
  #
629
- # @option opts [ZookeeperStat::Stat] (nil) provide a Stat object that will
642
+ # @option opts [Zookeeper::Stat] (nil) provide a Stat object that will
630
643
  # be set with the Stat information of the node path
631
644
  #
632
645
  # @option opts [ZookeeperCallback::AclCallback] (nil) :callback for an
@@ -675,13 +688,13 @@ module ZK
675
688
  #
676
689
  # @param [String] path absolute path of the znode
677
690
  #
678
- # @param [ZookeeperACLs] acls the acls to set on the znode
691
+ # @param [Zookeeper::ACLs] acls the acls to set on the znode
679
692
  #
680
693
  # @option opts [Integer] :version (-1) matches all versions of a node if the
681
694
  # default is used, otherwise acts as an assertion that the znode has the
682
695
  # supplied version.
683
696
  #
684
- # @option opts [ZookeeperCallbacks::VoidCallback] :callback will be called
697
+ # @option opts [Zookeeper::Callbacks::VoidCallback] :callback will be called
685
698
  # asynchronously when the operation is complete
686
699
  #
687
700
  # @option opts [Object] :context an object passed to the `:callback`
@@ -873,7 +886,7 @@ module ZK
873
886
  if cnx and cnx.session_id
874
887
  '0x%x' % cnx.session_id
875
888
  end
876
- rescue ZookeeperExceptions::ZookeeperException, ZK::Exceptions::KeeperException
889
+ rescue Zookeeper::Exceptions::ZookeeperException, ZK::Exceptions::KeeperException
877
890
  nil
878
891
  end
879
892
  end # Base