Permalink
Browse files

document children, and update RELEASES

  • Loading branch information...
1 parent b4c8ea3 commit 6c9f56dee9b6791298b5298065c5ca90c034e512 @slyphon slyphon committed May 9, 2012
Showing with 43 additions and 14 deletions.
  1. +21 −0 RELEASES.markdown
  2. +22 −14 lib/zk/client/base.rb
View
@@ -1,4 +1,25 @@
This file notes feature differences and bugfixes contained between releases.
+### v1.4.0 ###
+
+Added a new `:ignore` option for convenience when you don't care if an operation fails. In the case of a failure, the method will return nil instead of raising an exception.
+
+```
+# so instead of having to do:
+
+begin
+ zk.delete('/some/path')
+rescue ZK::Exceptions;:NoNode
+end
+
+# you can do
+
+zk.delete('/some/path', :ignore => :no_node)
+
+```
+
+This option works for `children`, `create`, `delete`, `get`, `get_acl`, `set`, and `set_acl`. `stat` will ignore the option (because it doesn't care about the state of a node).
+
+
### v1.3.1 ###
* [fix a bug][bug 1.3.1] where a forked client would not have its 'outstanding watches' cleared, so some events would never be delivered
View
@@ -650,11 +650,19 @@ 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 [Zookeeper::Callbacks::StringsCallback] :callback to make this
+ # @hidden_option opts [Zookeeper::Callbacks::StringsCallback] :callback to make this
# call asynchronously
#
- # @option opts [Object] :context an object passed to the `:callback`
+ # @hidden_option opts [Object] :context an object passed to the `:callback`
# given as the `context` param
+ #
+ # @option opts [:no_node] :ignore (nil) Do not raise an error if
+ # one of the given statuses is returned from ZooKeeper. This option
+ # may be given as either a symbol (for a single option) or as an Array
+ # of symbols for multiple ignores.
+ #
+ # * `:no_node`: silences the error case where you try to
+ # set `/foo/bar/baz` but it doesn't exist.
#
# @example get children for path
#
@@ -671,19 +679,19 @@ def exists?(path, opts={})
# zk.children("/path", :watch => true)
# # => ["child_0", "child_1"]
#
+ # @hidden_example
+ #
+ # class ChildrenCallback
+ # def process_result(return_code, path, context, children)
+ # # do processing here
+ # end
+ # end
+ #
+ # callback = ChildrenCallback.new
+ # context = Object.new
+ # zk.children("/path", :callback => callback, :context => context)
+ #
def children(path, opts={})
- # ===== get children asynchronously
- #
- # class ChildrenCallback
- # def process_result(return_code, path, context, children)
- # # do processing here
- # end
- # end
- #
- # callback = ChildrenCallback.new
- # context = Object.new
- # zk.children("/path", :callback => callback, :context => context)
-
h = { :path => path }.merge(opts)

0 comments on commit 6c9f56d

Please sign in to comment.