66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/zookeeper/client_methods.rb', line 66
def create(options = {})
assert_open
assert_supported_keys(options, [:path, :data, :acl, :ephemeral, :sequence, :callback, :callback_context])
assert_required_keys(options, [:path])
assert_valid_data_size!(options[:data])
flags = 0
flags |= ZOO_EPHEMERAL if options[:ephemeral]
flags |= ZOO_SEQUENCE if options[:sequence]
options[:acl] ||= ZOO_OPEN_ACL_UNSAFE
req_id = setup_call(:create, options)
rc, newpath = super(req_id, options[:path], options[:data], options[:callback], options[:acl], flags)
rv = { :req_id => req_id, :rc => rc }
options[:callback] ? rv : rv.merge(:path => newpath)
end
|