Class DataTreeV1
- java.lang.Object
-
- org.apache.zookeeper.server.upgrade.DataTreeV1
-
public class DataTreeV1 extends java.lang.ObjectThis class maintains the tree data structure. It doesn't have any networking or client connection code in it so that it can be tested in a stand alone way.The tree maintains two parallel data structures: a hashtable that maps from full paths to DataNodes and a tree of DataNodes. All accesses to a path is through the hashtable. The tree is traversed only when serializing to disk.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDataTreeV1.ProcessTxnResult
-
Field Summary
Fields Modifier and Type Field Description booleaninitializedlonglastProcessedZxid
-
Constructor Summary
Constructors Constructor Description DataTreeV1()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()static voidcopyStat(Stat from, Stat to)static voidcopyStatPersisted(StatPersistedV1 from, StatPersistedV1 to)java.lang.StringcreateNode(java.lang.String path, byte[] data, java.util.List<ACL> acl, long ephemeralOwner, long zxid, long time)voiddeleteNode(java.lang.String path)voiddeserialize(org.apache.jute.InputArchive ia, java.lang.String tag)java.lang.StringdumpEphemerals()java.util.List<ACL>getACL(java.lang.String path, Stat stat)java.util.ArrayList<java.lang.String>getChildren(java.lang.String path, Stat stat, Watcher watcher)byte[]getData(java.lang.String path, Stat stat, Watcher watcher)java.util.HashSet<java.lang.String>getEphemerals(long sessionId)java.util.Map<java.lang.Long,java.util.HashSet<java.lang.String>>getEphemeralsMap()return the ephemerals for this treeDataNodeV1getNode(java.lang.String path)java.util.Collection<java.lang.Long>getSessions()DataTreeV1.ProcessTxnResultprocessTxn(TxnHeader header, org.apache.jute.Record txn)voidremoveCnxn(Watcher watcher)voidserialize(org.apache.jute.OutputArchive oa, java.lang.String tag)StatsetACL(java.lang.String path, java.util.List<ACL> acl, int version)StatsetData(java.lang.String path, byte[] data, int version, long zxid, long time)voidsetEphemeralsMap(java.util.Map<java.lang.Long,java.util.HashSet<java.lang.String>> ephemerals)StatstatNode(java.lang.String path, Watcher watcher)
-
-
-
Method Detail
-
getEphemeralsMap
public java.util.Map<java.lang.Long,java.util.HashSet<java.lang.String>> getEphemeralsMap()
return the ephemerals for this tree- Returns:
- the ephemerals for this tree
-
setEphemeralsMap
public void setEphemeralsMap(java.util.Map<java.lang.Long,java.util.HashSet<java.lang.String>> ephemerals)
-
getEphemerals
public java.util.HashSet<java.lang.String> getEphemerals(long sessionId)
-
getSessions
public java.util.Collection<java.lang.Long> getSessions()
-
getNode
public DataNodeV1 getNode(java.lang.String path)
-
copyStatPersisted
public static void copyStatPersisted(StatPersistedV1 from, StatPersistedV1 to)
-
createNode
public java.lang.String createNode(java.lang.String path, byte[] data, java.util.List<ACL> acl, long ephemeralOwner, long zxid, long time) throws KeeperException.NoNodeException, KeeperException.NodeExistsException- Parameters:
path-data-acl-ephemeralOwner- the session id that owns this node. -1 indicates this is not an ephemeral node.zxid-time-- Returns:
- the patch of the created node
- Throws:
KeeperExceptionKeeperException.NoNodeExceptionKeeperException.NodeExistsException
-
deleteNode
public void deleteNode(java.lang.String path) throws KeeperException.NoNodeException- Throws:
KeeperException.NoNodeException
-
setData
public Stat setData(java.lang.String path, byte[] data, int version, long zxid, long time) throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
-
getData
public byte[] getData(java.lang.String path, Stat stat, Watcher watcher) throws KeeperException.NoNodeException- Throws:
KeeperException.NoNodeException
-
statNode
public Stat statNode(java.lang.String path, Watcher watcher) throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
-
getChildren
public java.util.ArrayList<java.lang.String> getChildren(java.lang.String path, Stat stat, Watcher watcher) throws KeeperException.NoNodeException- Throws:
KeeperException.NoNodeException
-
setACL
public Stat setACL(java.lang.String path, java.util.List<ACL> acl, int version) throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
-
getACL
public java.util.List<ACL> getACL(java.lang.String path, Stat stat) throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
-
processTxn
public DataTreeV1.ProcessTxnResult processTxn(TxnHeader header, org.apache.jute.Record txn)
-
serialize
public void serialize(org.apache.jute.OutputArchive oa, java.lang.String tag) throws java.io.IOException, java.lang.InterruptedException- Throws:
java.io.IOExceptionjava.lang.InterruptedException
-
deserialize
public void deserialize(org.apache.jute.InputArchive ia, java.lang.String tag) throws java.io.IOException- Throws:
java.io.IOException
-
dumpEphemerals
public java.lang.String dumpEphemerals()
-
removeCnxn
public void removeCnxn(Watcher watcher)
-
clear
public void clear()
-
-