public void deserialize(InputArchive ia, String tag) throws IOException { nodes.clear(); String path = ia.readString("path"); while (!path.equals("/")) { DataNodeV1 node = new DataNodeV1(); ia.readRecord(node, "node"); nodes.put(path, node); int lastSlash = path.lastIndexOf('/'); if (lastSlash == -1) { root = node; } else { String parentPath = path.substring(0, lastSlash); node.parent = nodes.get(parentPath); node.parent.children.add(path.substring(lastSlash + 1)); long eowner = node.stat.getEphemeralOwner(); if (eowner != 0) { HashSet<String> list = ephemerals.get(eowner); if (list == null) { list = new HashSet<String>(); ephemerals.put(eowner, list); } list.add(path); } } path = ia.readString("path"); } nodes.put("/", root); }
parent.children.remove(childName); parent.stat.setCversion(parent.stat.getCversion() + 1); long eowner = node.stat.getEphemeralOwner(); if (eowner != 0) { HashSet<String> nodes = ephemerals.get(eowner);
public void copyStat(Stat to) { to.setAversion(stat.getAversion()); to.setCtime(stat.getCtime()); to.setCversion(stat.getCversion()); to.setCzxid(stat.getCzxid()); to.setMtime(stat.getMtime()); to.setMzxid(stat.getMzxid()); to.setVersion(stat.getVersion()); to.setEphemeralOwner(stat.getEphemeralOwner()); to.setDataLength(data.length); to.setNumChildren(children.size()); }
static public void copyStatPersisted(StatPersistedV1 from, StatPersistedV1 to) { to.setAversion(from.getAversion()); to.setCtime(from.getCtime()); to.setCversion(from.getCversion()); to.setCzxid(from.getCzxid()); to.setMtime(from.getMtime()); to.setMzxid(from.getMzxid()); to.setVersion(from.getVersion()); to.setEphemeralOwner(from.getEphemeralOwner()); }
/** * convert the old stat to new stat * @param oldStat the old stat * @return the new stat */ private StatPersisted convertStat(StatPersistedV1 oldStat) { StatPersisted stat = new StatPersisted(); stat.setAversion(oldStat.getAversion()); stat.setCtime(oldStat.getCtime()); stat.setCversion(oldStat.getCversion()); stat.setCzxid(oldStat.getCzxid()); stat.setEphemeralOwner(oldStat.getEphemeralOwner()); stat.setMtime(oldStat.getMtime()); stat.setMzxid(oldStat.getMzxid()); stat.setVersion(oldStat.getVersion()); return stat; }
public void deserialize(InputArchive ia, String tag) throws IOException { nodes.clear(); String path = ia.readString("path"); while (!path.equals("/")) { DataNodeV1 node = new DataNodeV1(); ia.readRecord(node, "node"); nodes.put(path, node); int lastSlash = path.lastIndexOf('/'); if (lastSlash == -1) { root = node; } else { String parentPath = path.substring(0, lastSlash); node.parent = nodes.get(parentPath); node.parent.children.add(path.substring(lastSlash + 1)); long eowner = node.stat.getEphemeralOwner(); if (eowner != 0) { HashSet<String> list = ephemerals.get(eowner); if (list == null) { list = new HashSet<String>(); ephemerals.put(eowner, list); } list.add(path); } } path = ia.readString("path"); } nodes.put("/", root); }
parent.children.remove(childName); parent.stat.setCversion(parent.stat.getCversion() + 1); long eowner = node.stat.getEphemeralOwner(); if (eowner != 0) { HashSet<String> nodes = ephemerals.get(eowner);
public void copyStat(Stat to) { to.setAversion(stat.getAversion()); to.setCtime(stat.getCtime()); to.setCversion(stat.getCversion()); to.setCzxid(stat.getCzxid()); to.setMtime(stat.getMtime()); to.setMzxid(stat.getMzxid()); to.setVersion(stat.getVersion()); to.setEphemeralOwner(stat.getEphemeralOwner()); to.setDataLength(data.length); to.setNumChildren(children.size()); }
static public void copyStatPersisted(StatPersistedV1 from, StatPersistedV1 to) { to.setAversion(from.getAversion()); to.setCtime(from.getCtime()); to.setCversion(from.getCversion()); to.setCzxid(from.getCzxid()); to.setMtime(from.getMtime()); to.setMzxid(from.getMzxid()); to.setVersion(from.getVersion()); to.setEphemeralOwner(from.getEphemeralOwner()); }
/** * convert the old stat to new stat * @param oldStat the old stat * @return the new stat */ private StatPersisted convertStat(StatPersistedV1 oldStat) { StatPersisted stat = new StatPersisted(); stat.setAversion(oldStat.getAversion()); stat.setCtime(oldStat.getCtime()); stat.setCversion(oldStat.getCversion()); stat.setCzxid(oldStat.getCzxid()); stat.setEphemeralOwner(oldStat.getEphemeralOwner()); stat.setMtime(oldStat.getMtime()); stat.setMzxid(oldStat.getMzxid()); stat.setVersion(oldStat.getVersion()); return stat; }