org.apache.zookeeper.server.upgrade
Class DataTreeV1
java.lang.Object
org.apache.zookeeper.server.upgrade.DataTreeV1
public class DataTreeV1
- extends Object
This 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.
Method Summary |
void |
clear()
|
static void |
copyStat(Stat from,
Stat to)
|
static void |
copyStatPersisted(StatPersistedV1 from,
StatPersistedV1 to)
|
String |
createNode(String path,
byte[] data,
List<ACL> acl,
long ephemeralOwner,
long zxid,
long time)
|
void |
deleteNode(String path)
|
void |
deserialize(org.apache.jute.InputArchive ia,
String tag)
|
String |
dumpEphemerals()
|
List<ACL> |
getACL(String path,
Stat stat)
|
ArrayList<String> |
getChildren(String path,
Stat stat,
Watcher watcher)
|
byte[] |
getData(String path,
Stat stat,
Watcher watcher)
|
HashSet<String> |
getEphemerals(long sessionId)
|
Map<Long,HashSet<String>> |
getEphemeralsMap()
return the ephemerals for this tree |
DataNodeV1 |
getNode(String path)
|
Collection<Long> |
getSessions()
|
DataTreeV1.ProcessTxnResult |
processTxn(TxnHeader header,
org.apache.jute.Record txn)
|
void |
removeCnxn(Watcher watcher)
|
void |
serialize(org.apache.jute.OutputArchive oa,
String tag)
|
Stat |
setACL(String path,
List<ACL> acl,
int version)
|
Stat |
setData(String path,
byte[] data,
int version,
long zxid,
long time)
|
void |
setEphemeralsMap(Map<Long,HashSet<String>> ephemerals)
|
Stat |
statNode(String path,
Watcher watcher)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lastProcessedZxid
public volatile long lastProcessedZxid
initialized
public boolean initialized
DataTreeV1
public DataTreeV1()
getEphemeralsMap
public Map<Long,HashSet<String>> getEphemeralsMap()
- return the ephemerals for this tree
- Returns:
- the ephemerals for this tree
setEphemeralsMap
public void setEphemeralsMap(Map<Long,HashSet<String>> ephemerals)
getEphemerals
public HashSet<String> getEphemerals(long sessionId)
getSessions
public Collection<Long> getSessions()
getNode
public DataNodeV1 getNode(String path)
copyStatPersisted
public static void copyStatPersisted(StatPersistedV1 from,
StatPersistedV1 to)
copyStat
public static void copyStat(Stat from,
Stat to)
createNode
public String createNode(String path,
byte[] data,
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:
KeeperException
KeeperException.NoNodeException
KeeperException.NodeExistsException
deleteNode
public void deleteNode(String path)
throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
setData
public Stat setData(String path,
byte[] data,
int version,
long zxid,
long time)
throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
getData
public byte[] getData(String path,
Stat stat,
Watcher watcher)
throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
statNode
public Stat statNode(String path,
Watcher watcher)
throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
getChildren
public ArrayList<String> getChildren(String path,
Stat stat,
Watcher watcher)
throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
setACL
public Stat setACL(String path,
List<ACL> acl,
int version)
throws KeeperException.NoNodeException
- Throws:
KeeperException.NoNodeException
getACL
public List<ACL> getACL(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,
String tag)
throws IOException,
InterruptedException
- Throws:
IOException
InterruptedException
deserialize
public void deserialize(org.apache.jute.InputArchive ia,
String tag)
throws IOException
- Throws:
IOException
dumpEphemerals
public String dumpEphemerals()
removeCnxn
public void removeCnxn(Watcher watcher)
clear
public void clear()
Copyright © 2012 The Apache Software Foundation