Search in sources :

Example 1 with PrecalculatedDigest

use of org.apache.zookeeper.server.ZooKeeperServer.PrecalculatedDigest in project zookeeper by apache.

the class PrepRequestProcessor method getRecordForPath.

private ChangeRecord getRecordForPath(String path) throws KeeperException.NoNodeException {
    ChangeRecord lastChange = null;
    synchronized (zks.outstandingChanges) {
        lastChange = zks.outstandingChangesForPath.get(path);
        if (lastChange == null) {
            DataNode n = zks.getZKDatabase().getNode(path);
            if (n != null) {
                Set<String> children;
                synchronized (n) {
                    children = n.getChildren();
                }
                lastChange = new ChangeRecord(-1, path, n.stat, children.size(), zks.getZKDatabase().aclForNode(n));
                if (digestEnabled) {
                    lastChange.precalculatedDigest = new PrecalculatedDigest(digestCalculator.calculateDigest(path, n), 0);
                }
                lastChange.data = n.getData();
            }
        }
    }
    if (lastChange == null || lastChange.stat == null) {
        throw new KeeperException.NoNodeException(path);
    }
    return lastChange;
}
Also used : PrecalculatedDigest(org.apache.zookeeper.server.ZooKeeperServer.PrecalculatedDigest) ChangeRecord(org.apache.zookeeper.server.ZooKeeperServer.ChangeRecord)

Aggregations

ChangeRecord (org.apache.zookeeper.server.ZooKeeperServer.ChangeRecord)1 PrecalculatedDigest (org.apache.zookeeper.server.ZooKeeperServer.PrecalculatedDigest)1