Package org.apache.zookeeper.server
Class DataNode
- java.lang.Object
-
- org.apache.zookeeper.server.DataNode
-
- All Implemented Interfaces:
org.apache.jute.Record
public class DataNode extends java.lang.Object implements org.apache.jute.Record
This class contains the data for a node in the data tree.A data node contains a reference to its parent, a byte array as its data, an array of ACLs, a stat object, and a set of its children's paths.
-
-
Field Summary
Fields Modifier and Type Field Description StatPersisted
stat
the stat for this node that is persisted to disk.
-
Constructor Summary
Constructors Constructor Description DataNode(DataNode parent, byte[] data, java.lang.Long acl, StatPersisted stat)
create a DataNode with parent, data, acls and stat
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addChild(java.lang.String child)
Method that inserts a child into the children setvoid
copyStat(Stat to)
void
deserialize(org.apache.jute.InputArchive archive, java.lang.String tag)
java.util.Set<java.lang.String>
getChildren()
convenience methods to get the childrenboolean
removeChild(java.lang.String child)
Method that removes a child from the children setvoid
serialize(org.apache.jute.OutputArchive archive, java.lang.String tag)
void
setChildren(java.util.HashSet<java.lang.String> children)
convenience method for setting the children for this datanode
-
-
-
Field Detail
-
stat
public StatPersisted stat
the stat for this node that is persisted to disk.
-
-
Constructor Detail
-
DataNode
public DataNode(DataNode parent, byte[] data, java.lang.Long acl, StatPersisted stat)
create a DataNode with parent, data, acls and stat- Parameters:
parent
- the parent of this DataNodedata
- the data to be setacl
- the acls for this nodestat
- the stat for this node.
-
-
Method Detail
-
addChild
public boolean addChild(java.lang.String child)
Method that inserts a child into the children set- Parameters:
child
- to be inserted- Returns:
- true if this set did not already contain the specified element
-
removeChild
public boolean removeChild(java.lang.String child)
Method that removes a child from the children set- Parameters:
child
-- Returns:
- true if this set contained the specified element
-
setChildren
public void setChildren(java.util.HashSet<java.lang.String> children)
convenience method for setting the children for this datanode- Parameters:
children
-
-
getChildren
public java.util.Set<java.lang.String> getChildren()
convenience methods to get the children- Returns:
- the children of this datanode
-
copyStat
public void copyStat(Stat to)
-
deserialize
public void deserialize(org.apache.jute.InputArchive archive, java.lang.String tag) throws java.io.IOException
- Specified by:
deserialize
in interfaceorg.apache.jute.Record
- Throws:
java.io.IOException
-
serialize
public void serialize(org.apache.jute.OutputArchive archive, java.lang.String tag) throws java.io.IOException
- Specified by:
serialize
in interfaceorg.apache.jute.Record
- Throws:
java.io.IOException
-
-