Module: Zookeeper

Extended by:
Compatibility
Includes:
Constants
Defined in:
lib/zookeeper/compatibility.rb,
lib/zookeeper.rb,
lib/zookeeper.rb,
lib/zookeeper/acls.rb,
lib/zookeeper/stat.rb,
lib/zookeeper/latch.rb,
lib/zookeeper/client.rb,
lib/zookeeper/common.rb,
lib/zookeeper/forked.rb,
lib/zookeeper/logger.rb,
lib/zookeeper/monitor.rb,
lib/zookeeper/version.rb,
lib/zookeeper/callbacks.rb,
lib/zookeeper/constants.rb,
lib/zookeeper/exceptions.rb,
lib/zookeeper/rake_tasks.rb,
lib/zookeeper/continuation.rb,
lib/zookeeper/compatibility.rb,
lib/zookeeper/compatibility.rb,
lib/zookeeper/client_methods.rb,
lib/zookeeper/request_registry.rb,
lib/zookeeper/common/queue_with_pipe.rb,
lib/zookeeper/logger/forwarding_logger.rb,
ext/c_zookeeper.rb,
ext/zookeeper_base.rb,
ext/zkrb.c

Overview

The low-level wrapper-specific methods for the C lib subclassed by the top-level Zookeeper class

Defined Under Namespace

Modules: ACLs, Callbacks, ClientMethods, Common, Compatibility, Constants, Exceptions, Forked, Logger, RakeTasks Classes: CZookeeper, Client, Continuation, Latch, Monitor, RequestRegistry, Stat, ZookeeperBase

Constant Summary collapse

ZOOKEEPER_ROOT =
File.expand_path('../..', __FILE__)
VERSION =
'1.4.2'
DRIVER_VERSION =
'3.3.5'
@@logger =

::Logger.new($stderr).tap { |l| l.level = ENV ? ::Logger::DEBUG : ::Logger::ERROR }

nil

Constants included from Constants

Constants::CONNECTED_EVENT_VALUES, Constants::EVENT_TYPE_NAMES, Constants::STATE_NAMES, Constants::ZAPIERROR, Constants::ZAUTHFAILED, Constants::ZBADARGUMENTS, Constants::ZBADVERSION, Constants::ZCLOSING, Constants::ZCONNECTIONLOSS, Constants::ZDATAINCONSISTENCY, Constants::ZINVALIDACL, Constants::ZINVALIDCALLBACK, Constants::ZINVALIDSTATE, Constants::ZKRB_ASYNC_CONTN_ID, Constants::ZKRB_GLOBAL_CB_REQ, Constants::ZMARSHALLINGERROR, Constants::ZNOAUTH, Constants::ZNOCHILDRENFOREPHEMERALS, Constants::ZNODEEXISTS, Constants::ZNONODE, Constants::ZNOTEMPTY, Constants::ZNOTHING, Constants::ZOK, Constants::ZOO_ASSOCIATING_STATE, Constants::ZOO_AUTH_FAILED_STATE, Constants::ZOO_CHANGED_EVENT, Constants::ZOO_CHILD_EVENT, Constants::ZOO_CLOSED_STATE, Constants::ZOO_CONNECTED_STATE, Constants::ZOO_CONNECTING_STATE, Constants::ZOO_CREATED_EVENT, Constants::ZOO_DELETED_EVENT, Constants::ZOO_EPHEMERAL, Constants::ZOO_EXPIRED_SESSION_STATE, Constants::ZOO_LOG_LEVEL_DEBUG, Constants::ZOO_LOG_LEVEL_ERROR, Constants::ZOO_LOG_LEVEL_INFO, Constants::ZOO_LOG_LEVEL_WARN, Constants::ZOO_NOTWATCHING_EVENT, Constants::ZOO_SEQUENCE, Constants::ZOO_SESSION_EVENT, Constants::ZOPERATIONTIMEOUT, Constants::ZRUNTIMEINCONSISTENCY, Constants::ZSESSIONEXPIRED, Constants::ZSESSIONMOVED, Constants::ZSYSTEMERROR, Constants::ZUNIMPLEMENTED

Constants included from ACLs::Constants

ACLs::Constants::ZOO_ANYONE_ID_UNSAFE, ACLs::Constants::ZOO_AUTH_IDS, ACLs::Constants::ZOO_CREATOR_ALL_ACL, ACLs::Constants::ZOO_OPEN_ACL_UNSAFE, ACLs::Constants::ZOO_PERM_ADMIN, ACLs::Constants::ZOO_PERM_ALL, ACLs::Constants::ZOO_PERM_CREATE, ACLs::Constants::ZOO_PERM_DELETE, ACLs::Constants::ZOO_PERM_READ, ACLs::Constants::ZOO_PERM_WRITE, ACLs::Constants::ZOO_READ_ACL_UNSAFE

Class Method Summary collapse

Methods included from Compatibility

clean_backtrace

Methods included from Constants

#event_by_value, #state_by_value

Class Method Details

.const_missing(sym) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/zookeeper/compatibility.rb', line 118

def self.const_missing(sym)
  candidate =
    case sym.to_s
    when /Callback/
      Zookeeper::Callbacks
    end

  super unless candidate

  if candidate.const_defined?(sym)
    warn "\n#{self.name}::#{sym} is now located in #{candidate}::#{sym}, please update your code!\n#{clean_backtrace}"

    candidate.const_get(sym).tap do |c|
#         self.const_set(sym, c)
    end
  else
    super
  end
end

.deprecation_warning(warning) ⇒ Object



79
80
81
# File 'lib/zookeeper.rb', line 79

def self.deprecation_warning(warning)
  Kernel.warn(warning) if deprecation_warnings?
end

.deprecation_warnings=(v) ⇒ Object

set this to false to mute Zookeeper related deprecation warnings… __AT YOUR PERIL__



74
75
76
# File 'lib/zookeeper.rb', line 74

def self.deprecation_warnings=(v)
  @deprecation_warnings = v
end

.deprecation_warnings?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/zookeeper.rb', line 68

def self.deprecation_warnings?
  @deprecation_warnings = true if @deprecation_warnings.nil?
end

.get_debug_levelObject Also known as: debug_level



94
95
96
97
98
# File 'lib/zookeeper.rb', line 94

def self.get_debug_level
  if defined?(CZookeeper)
    CZookeeper.get_debug_level
  end
end

.loggerObject



59
60
61
# File 'lib/zookeeper.rb', line 59

def self.logger
  @@logger
end

.logger=(logger) ⇒ Object



63
64
65
# File 'lib/zookeeper.rb', line 63

def self.logger=(logger)
  @@logger = logger
end

.new(*a, &b) ⇒ Object



21
22
23
# File 'lib/zookeeper/client.rb', line 21

def self.new(*a, &b)
  Zookeeper::Client.new(*a, &b)
end

.require_lib(*relpaths) ⇒ Object

require a path relative to the lib directory this is to avoid monkeying explicitly with $LOAD_PATH



16
17
18
19
20
# File 'lib/zookeeper.rb', line 16

def self.require_lib(*relpaths)
  relpaths.each do |relpath|
    require File.join(ZOOKEEPER_ROOT, 'lib', relpath)
  end
end

.require_root(*relpaths) ⇒ Object

require a path that’s relative to ZOOKEEPER_ROOT



24
25
26
27
28
# File 'lib/zookeeper.rb', line 24

def self.require_root(*relpaths)
  relpaths.each do |relpath|
    require File.join(ZOOKEEPER_ROOT, relpath)
  end
end

.set_debug_level(val) ⇒ Object Also known as: debug_level=

for expert use only. set the underlying debug level for the C layer, has no effect in java



87
88
89
90
91
# File 'lib/zookeeper.rb', line 87

def self.set_debug_level(val)
  if defined?(CZookeeper)
    CZookeeper.set_debug_level(val.to_i)
  end
end

.warn_about_compatability_once!Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/zookeeper/compatibility.rb', line 3

def self.warn_about_compatability_once!
  return if @warned_about_compatibility
  @warned_about_compatibility = true

  warn <<-EOS

-----------------------------------------------------------------------------

        NOTICE: ZOOKEEPER BACKWARDS COMPATIBILTY EANBLED!! 
      
             THIS WILL NOT BE AUTOMATIC IN 1.1 !!

There was a major change to the organization of the Zookeeper gem between
0.9 and 1.0, breaking backwards compatibility. To ease the transition, 

#{__FILE__}

is automatically required. This will *not* be the case in 1.1.

-----------------------------------------------------------------------------
  EOS
end

.warned_about_compatability?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/zookeeper/compatibility.rb', line 26

def self.warned_about_compatability?
  !!@warned_about_compatability
end