Class: ZK::ZKEventMachine::Callback::StatCallback

Inherits:
Base
  • Object
show all
Defined in:
lib/z_k/z_k_event_machine/callback.rb

Overview

used with Client#stat and Client#exists?

Direct Known Subclasses

ExistsCallback

Instance Attribute Summary

Attributes inherited from Base

#context, #req_id

Instance Method Summary collapse

Methods inherited from Base

async_result_keys, #async_result_keys, #call, #check_async_rc, #deferred_style_result, #exception_for, #initialize, #node_style_result, #on_result

Constructor Details

This class inherits a constructor from ZK::ZKEventMachine::Callback::Base

Instance Method Details

#success?(hash) ⇒ Boolean

stat has a different concept of ‘success’, stat on a node that doesn’t exist is not an exception, it’s a certain kind of stat (like a null stat).

Returns:

  • (Boolean)


162
163
164
165
# File 'lib/z_k/z_k_event_machine/callback.rb', line 162

def success?(hash)
  rc = hash[:rc] 
  (rc == Zookeeper::ZOK) || (rc == Zookeeper::ZNONODE)
end