org.apache.zookeeper.server
Class DataNode

java.lang.Object
  extended by org.apache.zookeeper.server.DataNode
All Implemented Interfaces:
Record

public class DataNode
extends Object
implements 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
 org.apache.zookeeper.data.StatPersisted stat
          the stat for this node that is persisted to disk.
 
Constructor Summary
DataNode(DataNode parent, byte[] data, Long acl, org.apache.zookeeper.data.StatPersisted stat)
          create a DataNode with parent, data, acls and stat
 
Method Summary
 void copyStat(org.apache.zookeeper.data.Stat to)
           
 void deserialize(InputArchive archive, String tag)
           
 Set<String> getChildren()
          convenience methods to get the children
 void serialize(OutputArchive archive, String tag)
           
 void setChildren(HashSet<String> children)
          convenience method for creating DataNode fully
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stat

public org.apache.zookeeper.data.StatPersisted stat
the stat for this node that is persisted to disk.

Constructor Detail

DataNode

public DataNode(DataNode parent,
                byte[] data,
                Long acl,
                org.apache.zookeeper.data.StatPersisted stat)
create a DataNode with parent, data, acls and stat

Parameters:
parent - the parent of this DataNode
data - the data to be set
acl - the acls for this node
stat - the stat for this node.
Method Detail

setChildren

public void setChildren(HashSet<String> children)
convenience method for creating DataNode fully

Parameters:
children -

getChildren

public Set<String> getChildren()
convenience methods to get the children

Returns:
the children of this datanode

copyStat

public void copyStat(org.apache.zookeeper.data.Stat to)

deserialize

public void deserialize(InputArchive archive,
                        String tag)
                 throws IOException
Specified by:
deserialize in interface Record
Throws:
IOException

serialize

public void serialize(OutputArchive archive,
                      String tag)
               throws IOException
Specified by:
serialize in interface Record
Throws:
IOException