Class: ZooKeeper::Transaction
- Inherits:
-
Object
- Object
- ZooKeeper::Transaction
- Includes:
- Operations
- Defined in:
- lib/zkruby/client.rb
Overview
Constant Summary
Constants included from Operations
Instance Method Summary collapse
-
#check(path, version, &callback) ⇒ Object
Check Version.
-
#commit(&callback) ⇒ Object
Commit the transaction.
-
#create(path, data, acl, *modeopts, &callback) ⇒ Object
Create a node @param [String] path the base name of the path to create @param [String] data the content to store at path @param [Data::ACL] acl the access control list to apply to the new node @param [Symbol,…] modeopts combination of :sequential, :emphemeral @yieldparam [String] path the created path.
-
#delete(path, version, &callback) ⇒ Object
Delete path @param [String] path @param [FixNum] version the expected version to be deleted (-1 to match any version) @yield [] callback invoked if delete is successful.
-
#initialize(client, session) ⇒ Transaction
constructor
:nodoc.
-
#set(path, data, version, &callback) ⇒ Object
Set Data @param [String] path @param [String] data content to set at path @param [Fixnum] version expected current version at path or -1 for any version @yieldparam [Data::Stat] stat new stat of path.
Constructor Details
#initialize(client, session) ⇒ Transaction
:nodoc
544 545 546 547 548 |
# File 'lib/zkruby/client.rb', line 544 def initialize(client,session) @client = client @session = session @ops = [] end |
Instance Method Details
#check(path, version, &callback) ⇒ Object
Check Version
579 580 581 |
# File 'lib/zkruby/client.rb', line 579 def check(path,version,&callback) op_check(path,version,&callback) end |
#commit ⇒ Object #commit { ... } ⇒ AsyncOp
Commit the transaction
590 591 592 |
# File 'lib/zkruby/client.rb', line 590 def commit(&callback) op = client.multi(ops,&callback) end |
#create(path, data, acl, *modeopts, &callback) ⇒ Object
Create a node
@param [String] path the base name of the path to create
@param [String] data the content to store at path
@param [Data::ACL] acl the access control list to apply to the new node
@param [Symbol,...] modeopts combination of :sequential, :emphemeral
@yieldparam [String] path the created path
557 558 559 |
# File 'lib/zkruby/client.rb', line 557 def create(path,data,acl,*modeopts,&callback) op_create(path,data,acl,*modeopts,&callback) end |
#delete(path, version, &callback) ⇒ Object
Delete path
@param [String] path
@param [FixNum] version the expected version to be deleted (-1 to match any version)
@yield [] callback invoked if delete is successful
565 566 567 |
# File 'lib/zkruby/client.rb', line 565 def delete(path,version,&callback) op_delete(path,version,&callback) end |
#set(path, data, version, &callback) ⇒ Object
Set Data
@param [String] path
@param [String] data content to set at path
@param [Fixnum] version expected current version at path or -1 for any version
@yieldparam [Data::Stat] stat new stat of path
574 575 576 |
# File 'lib/zkruby/client.rb', line 574 def set(path,data,version,&callback) op_set(path,data,version,&callback) end |