Permalink
Browse files

Fix all remaining Zookeeper namespace references

used zookeeper/scripts/upgrade-1.0-sed-alike.rb on the codebase, seems to have worked
  • Loading branch information...
1 parent 1df74d3 commit d2c240c22f3cb93fe2461f6a47f4a21ccf732555 @slyphon slyphon committed May 5, 2012
View
40 lib/zk/client/base.rb
@@ -142,9 +142,9 @@ def close!
# @overload create(path, data, opts={})
# creates a znode at the absolute `path` with given data and options
#
- # @option opts [Integer] :acl defaults to <tt>ZookeeperACLs::ZOO_OPEN_ACL_UNSAFE</tt>,
+ # @option opts [Integer] :acl defaults to <tt>Zookeeper::Constants::ZOO_OPEN_ACL_UNSAFE</tt>,
# otherwise the ACL for the node. Should be a `ZOO_*` constant defined under the
- # ZookeeperACLs module in the zookeeper gem.
+ # Zookeeper::ACLs module in the zookeeper gem.
#
# @option opts [bool] :ephemeral (false) if true, the created node will be ephemeral
#
@@ -153,7 +153,7 @@ def close!
# @option opts [bool] :sequential (false) alias for :sequence option. if both are given
# an ArgumentError is raised
#
- # @option opts [ZookeeperCallbacks::StringCallback] :callback (nil) provide a callback object
+ # @option opts [Zookeeper::Callbacks::StringCallback] :callback (nil) provide a callback object
# that will be called when the znode has been created
#
# @option opts [Object] :context (nil) an object passed to the `:callback`
@@ -309,24 +309,24 @@ def create(path, *args)
# @option opts [bool] :watch (false) set to true if you want your registered
# callbacks for this node to be called on change
#
- # @option opts [ZookeeperCallbacks::DataCallback] :callback to make this call asynchronously
+ # @option opts [Zookeeper::Callbacks::DataCallback] :callback to make this call asynchronously
#
# @option opts [Object] :context an object passed to the `:callback`
# given as the `context` param
#
- # @return [Array] a two-element array of ['node data', #<ZookeeperStat::Stat>]
+ # @return [Array] a two-element array of ['node data', #<Zookeeper::Stat>]
#
# @raise [ZK::Exceptions::NoNode] if no node with the given path exists.
#
# @example get data for path
#
# zk.get("/path")
- # # => ['this is the data', #<ZookeeperStat::Stat>]
+ # # => ['this is the data', #<Zookeeper::Stat>]
#
# @example get data and set watch on node
#
# zk.get("/path", :watch => true)
- # # => ['this is the data', #<ZookeeperStat::Stat>]
+ # # => ['this is the data', #<Zookeeper::Stat>]
#
# @hidden_example get data asynchronously
#
@@ -359,7 +359,7 @@ def get(path, opts={})
# -1, it matches any node's versions). Passing the version allows you to
# perform optimistic locking, in that if someone changes the node's
# data "behind your back", your update will fail. Since #create does not
- # return a ZookeeperStat::Stat object, you should be aware that nodes are
+ # return a Zookeeper::Stat object, you should be aware that nodes are
# created with version == 0.
#
# This operation, if successful, will trigger all the watches on the node
@@ -383,8 +383,8 @@ def get(path, opts={})
# default is used, otherwise acts as an assertion that the znode has the
# supplied version.
#
- # @option opts [ZookeeperCallbacks::StatCallback] :callback will recieve the
- # ZookeeperStat::Stat object asynchronously
+ # @option opts [Zookeeper::Callbacks::StatCallback] :callback will recieve the
+ # Zookeeper::Stat object asynchronously
#
# @option opts [Object] :context an object passed to the `:callback`
# given as the `context` param
@@ -434,13 +434,13 @@ def set(path, data, opts={})
# @option opts [bool] :watch (false) set to true if you want to enable
# registered watches on this node
#
- # @option opts [ZookeeperCallbacks::StatCallback] :callback will recieve the
- # ZookeeperStat::Stat object asynchronously
+ # @option opts [Zookeeper::Callbacks::StatCallback] :callback will recieve the
+ # Zookeeper::Stat object asynchronously
#
# @option opts [Object] :context an object passed to the `:callback`
# given as the `context` param
#
- # @return [ZookeeperStat::Stat] a stat object of the specified node
+ # @return [Zookeeper::Stat] a stat object of the specified node
#
# @example get stat for for path
# >> zk.stat("/path")
@@ -453,7 +453,7 @@ def set(path, data, opts={})
# @example exists for non existent path
#
# >> stat = zk.stat("/non_existent_path")
- # # => #<ZookeeperStat::Stat:0x000001eb54 @exists=false>
+ # # => #<Zookeeper::Stat:0x000001eb54 @exists=false>
# >> stat.exists?
# # => false
#
@@ -518,7 +518,7 @@ def exists?(path, opts={})
# @option opts [bool] :watch (false) set to true if you want your registered
# callbacks for this node to be called on change
#
- # @option opts [ZookeeperCallbacks::StringsCallback] :callback to make this
+ # @option opts [Zookeeper::Callbacks::StringsCallback] :callback to make this
# call asynchronously
#
# @option opts [Object] :context an object passed to the `:callback`
@@ -586,7 +586,7 @@ def children(path, opts={})
# default is used, otherwise acts as an assertion that the znode has the
# supplied version.
#
- # @option opts [ZookeeperCallbacks::VoidCallback] :callback will be called
+ # @option opts [Zookeeper::Callbacks::VoidCallback] :callback will be called
# asynchronously when the operation is complete
#
# @option opts [Object] :context an object passed to the `:callback`
@@ -626,7 +626,7 @@ def delete(path, opts={})
#
# @param [String] path absolute path of the znode
#
- # @option opts [ZookeeperStat::Stat] (nil) provide a Stat object that will
+ # @option opts [Zookeeper::Stat] (nil) provide a Stat object that will
# be set with the Stat information of the node path
#
# @option opts [ZookeeperCallback::AclCallback] (nil) :callback for an
@@ -675,13 +675,13 @@ def get_acl(path, opts={})
#
# @param [String] path absolute path of the znode
#
- # @param [ZookeeperACLs] acls the acls to set on the znode
+ # @param [Zookeeper::ACLs] acls the acls to set on the znode
#
# @option opts [Integer] :version (-1) matches all versions of a node if the
# default is used, otherwise acts as an assertion that the znode has the
# supplied version.
#
- # @option opts [ZookeeperCallbacks::VoidCallback] :callback will be called
+ # @option opts [Zookeeper::Callbacks::VoidCallback] :callback will be called
# asynchronously when the operation is complete
#
# @option opts [Object] :context an object passed to the `:callback`
@@ -873,7 +873,7 @@ def safe_session_id
if cnx and cnx.session_id
'0x%x' % cnx.session_id
end
- rescue ZookeeperExceptions::ZookeeperException, ZK::Exceptions::KeeperException
+ rescue Zookeeper::Exceptions::ZookeeperException, ZK::Exceptions::KeeperException
nil
end
end # Base
View
14 lib/zk/client/unixisms.rb
@@ -1,7 +1,7 @@
module ZK
module Client
module Unixisms
- include ZookeeperConstants
+ include Zookeeper::Constants
include Exceptions
# Creates all parent paths and 'path' in zookeeper as persistent nodes with
@@ -114,15 +114,15 @@ def find(*paths, &block)
# mixes in the InterruptedSession module will be raised, so for convenience,
# users can just rescue {InterruptedSession}.
#
- # @raise [ZookeeperExceptions::ZookeeperException::SessionExpired] raised
+ # @raise [Zookeeper::Exceptions::SessionExpired] raised
# when we receive `ZOO_EXPIRED_SESSION_STATE` while blocking waiting for
# a deleted event. Includes the {InterruptedSession} module.
#
- # @raise [ZookeeperExceptions::ZookeeperException::NotConnected] raised
+ # @raise [Zookeeper::Exceptions::NotConnected] raised
# when we receive `ZOO_CONNECTING_STATE` while blocking waiting for
# a deleted event. Includes the {InterruptedSession} module.
#
- # @raise [ZookeeperExceptions::ZookeeperException::ConnectionClosed] raised
+ # @raise [Zookeeper::Exceptions::ConnectionClosed] raised
# when we receive `ZOO_CLOSED_STATE` while blocking waiting for
# a deleted event. Includes the {InterruptedSession} module.
#
@@ -162,11 +162,11 @@ def block_until_node_deleted(abs_node_path)
when :deleted
true
when ZOO_EXPIRED_SESSION_STATE
- raise ZookeeperExceptions::ZookeeperException::SessionExpired
+ raise Zookeeper::Exceptions::SessionExpired
when ZOO_CONNECTING_STATE
- raise ZookeeperExceptions::ZookeeperException::NotConnected
+ raise Zookeeper::Exceptions::NotConnected
when ZOO_CLOSED_STATE
- raise ZookeeperExceptions::ZookeeperException::ConnectionClosed
+ raise Zookeeper::Exceptions::ConnectionClosed
else
raise "Hit unexpected case in block_until_node_deleted"
end
View
8 lib/zk/event.rb
@@ -1,10 +1,10 @@
module ZK
# Provides most of the functionality ZK uses around events. Base class is actually
- # [ZookeeperCallbacks::WatcherCallback](http://rubydoc.info/gems/slyphon-zookeeper/ZookeeperCallbacks/WatcherCallback),
+ # [Zookeeper::Callbacks::WatcherCallback](http://rubydoc.info/gems/slyphon-zookeeper/Zookeeper::Callbacks/WatcherCallback),
# but this module is mixed in and provides a lot of useful syntactic sugar.
#
module Event
- include ZookeeperConstants
+ include Zookeeper::Constants
# unless defined? apparently messes up yard's ability to see the @private
silence_warnings do
@@ -26,10 +26,10 @@ module Event
EVENT_TYPES = %w[created deleted changed child session notwatching].freeze
end
- # for testing, create a new ZookeeperCallbacks::WatcherCallback and return it
+ # for testing, create a new Zookeeper::Callbacks::WatcherCallback and return it
# @private
def self.new(hash)
- ZookeeperCallbacks::WatcherCallback.new.tap do |wc|
+ Zookeeper::Callbacks::WatcherCallback.new.tap do |wc|
wc.call(hash)
end
end
View
2 lib/zk/event_handler.rb
@@ -265,7 +265,7 @@ def state_key(arg)
int =
case arg
when String, Symbol
- ZookeeperConstants.const_get(:"ZOO_#{arg.to_s.upcase}_STATE")
+ Zookeeper::Constants.const_get(:"ZOO_#{arg.to_s.upcase}_STATE")
when Integer
arg
else
View
2 lib/zk/extensions.rb
@@ -39,7 +39,7 @@ def included(base = nil, &block)
end
-# Include the InterruptedSession module in key ZookeeperExceptions to allow
+# Include the InterruptedSession module in key Zookeeper::Exceptions to allow
# clients to catch a single error type when waiting on a node (for example)
[:ConnectionClosed, :NotConnected, :SessionExpired, :SessionMoved, :ConnectionLoss].each do |class_name|
View
2 lib/zk/stat.rb
@@ -1,5 +1,5 @@
module ZK
- # Included in ZookeeperStat::Stat, extends it with some conveniences for
+ # Included in Zookeeper::Stat, extends it with some conveniences for
# dealing with Stat objects. Also provides docuemntation here for the meaning
# of these values.
#
View
2 spec/informal/close-in-event-thread.rb
@@ -8,7 +8,7 @@
Zookeeper.logger = LOG
class CloseInEventThread
- include ZookeeperConstants
+ include Zookeeper::Constants
def initialize
@zk = ZK.new
View
2 spec/support/logging.rb
@@ -21,7 +21,7 @@ def logger
# sets the log level to FATAL for the duration of the block
def mute_logger
orig_level, ZK.logger.level = ZK.logger.level, Logger::FATAL
- orig_zk_level, Zookeeper.debug_level = Zookeeper.debug_level, ZookeeperConstants::ZOO_LOG_LEVEL_ERROR
+ orig_zk_level, Zookeeper.debug_level = Zookeeper.debug_level, Zookeeper::Constants::ZOO_LOG_LEVEL_ERROR
yield
ensure
ZK.logger.level = orig_level
View
2 spec/watch_spec.rb
@@ -378,7 +378,7 @@ def wait_for_events_to_not_be_delivered(events)
m.should_receive(:zk=).with(any())
m.should_receive(:node_event?).and_return(false)
m.should_receive(:state_event?).and_return(true)
- m.should_receive(:state).and_return(ZookeeperConstants::ZOO_CONNECTED_STATE)
+ m.should_receive(:state).and_return(Zookeeper::Constants::ZOO_CONNECTED_STATE)
end
end
end # registered listeners
View
14 spec/zk/client/locking_and_session_death_spec.rb
@@ -3,7 +3,7 @@
shared_examples_for 'session death' do
def deliver_session_event_to(event_num, zk)
# jeez, Zookeeper callbacks are so frustratingly stupid
- bogus_event = ZookeeperCallbacks::WatcherCallback.new
+ bogus_event = Zookeeper::Callbacks::WatcherCallback.new
bogus_event.initialize_context(:type => -1, :state => event_num, :path => '', :context => 'bogustestevent')
# XXX: this is bad because we're in the wrong thread, but we'll fix this after the next Zookeeper release
zk.event_handler.process(bogus_event)
@@ -51,22 +51,22 @@ def deliver_session_event_to(event_num, zk)
shared_examples_for 'locking and session death' do
describe 'exceptional conditions' do
describe 'ZOO_EXPIRED_SESSION_STATE' do
- let(:zoo_state) { ZookeeperConstants::ZOO_EXPIRED_SESSION_STATE }
- let(:zoo_error_class) { ZookeeperExceptions::ZookeeperException::SessionExpired }
+ let(:zoo_state) { Zookeeper::Constants::ZOO_EXPIRED_SESSION_STATE }
+ let(:zoo_error_class) { Zookeeper::Exceptions::SessionExpired }
it_behaves_like 'session death'
end
describe 'ZOO_CONNECTING_STATE' do
- let(:zoo_state) { ZookeeperConstants::ZOO_CONNECTING_STATE }
- let(:zoo_error_class) { ZookeeperExceptions::ZookeeperException::NotConnected }
+ let(:zoo_state) { Zookeeper::Constants::ZOO_CONNECTING_STATE }
+ let(:zoo_error_class) { Zookeeper::Exceptions::NotConnected }
it_behaves_like 'session death'
end
describe 'ZOO_CLOSED_STATE' do
- let(:zoo_state) { ZookeeperConstants::ZOO_CLOSED_STATE }
- let(:zoo_error_class) { ZookeeperExceptions::ZookeeperException::ConnectionClosed }
+ let(:zoo_state) { Zookeeper::Constants::ZOO_CLOSED_STATE }
+ let(:zoo_error_class) { Zookeeper::Exceptions::ConnectionClosed }
it_behaves_like 'session death'
end

0 comments on commit d2c240c

Please sign in to comment.