Package org.apache.zookeeper.server
Class DataNode
- java.lang.Object
-
- org.apache.zookeeper.server.DataNode
-
-
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(byte[] data, 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(String child)
Method that inserts a child into the children setvoid
copyStat(Stat to)
void
deserialize(InputArchive archive, String tag)
Set<String>
getChildren()
convenience methods to get the childrenbyte[]
getData()
long
getDigest()
boolean
isDigestCached()
boolean
removeChild(String child)
Method that removes a child from the children setvoid
serialize(OutputArchive archive, String tag)
void
setChildren(HashSet<String> children)
convenience method for setting the children for this datanodevoid
setDigest(long digest)
void
setDigestCached(boolean digestCached)
-
-
-
Field Detail
-
stat
public StatPersisted stat
the stat for this node that is persisted to disk.
-
-
Constructor Detail
-
DataNode
public DataNode(byte[] data, Long acl, StatPersisted stat)
create a DataNode with parent, data, acls and stat- Parameters:
data
- the data to be setacl
- the acls for this nodestat
- the stat for this node.
-
-
Method Detail
-
addChild
public boolean addChild(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(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(HashSet<String> children)
convenience method for setting the children for this datanode- Parameters:
children
-
-
getChildren
public Set<String> getChildren()
convenience methods to get the children- Returns:
- the children of this datanode. If the datanode has no children, empty set is returned
-
copyStat
public void copyStat(Stat to)
-
deserialize
public void deserialize(InputArchive archive, String tag) throws IOException
- Specified by:
deserialize
in interfaceRecord
- Throws:
IOException
-
serialize
public void serialize(OutputArchive archive, String tag) throws IOException
- Specified by:
serialize
in interfaceRecord
- Throws:
IOException
-
isDigestCached
public boolean isDigestCached()
-
setDigestCached
public void setDigestCached(boolean digestCached)
-
getDigest
public long getDigest()
-
setDigest
public void setDigest(long digest)
-
getData
public byte[] getData()
-
-