Package org.apache.zookeeper
Class Op
java.lang.Object
org.apache.zookeeper.Op
- Direct Known Subclasses:
Op.Check
,Op.Create
,Op.Delete
,Op.GetChildren
,Op.GetData
,Op.SetData
Represents a single operation in a multi-operation transaction. Each operation can be a create, update,
delete, a version check or just read operations like getChildren or getData.
Sub-classes of Op each represent each detailed type but should not normally be referenced except via
the provided factory methods.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
static enum
static class
-
Method Summary
Modifier and TypeMethodDescriptionstatic Op
Constructs an version check operation.static Op
Constructs a create operation.static Op
Constructs a create operation.static Op
create
(String path, byte[] data, List<ACL> acl, CreateMode createMode) Constructs a create operation.static Op
create
(String path, byte[] data, List<ACL> acl, CreateMode createMode, long ttl) Constructs a create operation.static Op
create
(String path, byte[] data, CreateOptions options) Constructs a create operation which usesZooDefs.OpCode.create2
if no one is inferred from create mode.static Op
Constructs a delete operation.static Op
getChildren
(String path) static Op
getKind()
Gets the kind of an Op.getPath()
Gets the path for an Op.int
getType()
Gets the integer type code for an Op.static Op
Constructs an update operation.abstract Record
Encodes an op for wire transmission.
-
Method Details
-
create
Constructs a create operation. Arguments are as for the ZooKeeper method of the same name.- Parameters:
path
- the path for the nodedata
- the initial data for the nodeacl
- the acl for the nodeflags
- specifying whether the node to be created is ephemeral and/or sequential but using the integer encoding.- See Also:
-
create
Constructs a create operation. Arguments are as for the ZooKeeper method of the same name but adding an optional ttl- Parameters:
path
- the path for the nodedata
- the initial data for the nodeacl
- the acl for the nodeflags
- specifying whether the node to be created is ephemeral and/or sequential but using the integer encoding.ttl
- optional ttl or 0 (flags must imply a TTL creation mode)- See Also:
-
create
Constructs a create operation. Arguments are as for the ZooKeeper method of the same name.- Parameters:
path
- the path for the nodedata
- the initial data for the nodeacl
- the acl for the nodecreateMode
- specifying whether the node to be created is ephemeral and/or sequential- See Also:
-
create
Constructs a create operation. Arguments are as for the ZooKeeper method of the same name but adding an optional ttl- Parameters:
path
- the path for the nodedata
- the initial data for the nodeacl
- the acl for the nodecreateMode
- specifying whether the node to be created is ephemeral and/or sequentialttl
- optional ttl or 0 (createMode must imply a TTL)- See Also:
-
create
Constructs a create operation which usesZooDefs.OpCode.create2
if no one is inferred from create mode.The corresponding
OpResult.CreateResult.getStat()
could be null if connected to server without this patch.- Parameters:
path
- the path for the nodedata
- the initial data for the nodeoptions
- options for creating znode
-
delete
Constructs a delete operation. Arguments are as for the ZooKeeper method of the same name.- Parameters:
path
- the path of the node to be deleted.version
- the expected node version.- See Also:
-
setData
Constructs an update operation. Arguments are as for the ZooKeeper method of the same name.- Parameters:
path
- the path of the nodedata
- the data to setversion
- the expected matching version- See Also:
-
check
Constructs an version check operation. Arguments are as for the ZooKeeper.setData method except that no data is provided since no update is intended. The purpose for this is to allow read-modify-write operations that apply to multiple znodes, but where some of the znodes are involved only in the read, not the write. A similar effect could be achieved by writing the same data back, but that leads to way more version updates than are necessary and more writing in general.- Parameters:
path
- the path of the nodeversion
- the expected matching version
-
getChildren
-
getData
-
getType
public int getType()Gets the integer type code for an Op. This code should be as from ZooDefs.OpCode- Returns:
- The type code.
- See Also:
-
getPath
Gets the path for an Op.- Returns:
- The path.
-
getKind
Gets the kind of an Op.- Returns:
- The OpKind value.
-
toRequestRecord
Encodes an op for wire transmission.- Returns:
- An appropriate Record structure.
-