/** Serialize {@link #created} */ private void writeCreated(DataOutput out) throws IOException { final List<INode> created = getCreatedUnmodifiable(); out.writeInt(created.size()); for (INode node : created) { // For INode in created list, we only need to record its local name byte[] name = node.getLocalNameBytes(); out.writeShort(name.length); out.write(name); } }
/** * Replace the given child from the created list. * @return true if the child is replaced; false if the child is not found. */ private boolean replaceCreated(final INode oldChild, final INode newChild) { final List<INode> list = getCreatedUnmodifiable(); final int i = search(list, oldChild.getLocalNameBytes()); if (i < 0 || list.get(i).getId() != oldChild.getId()) { return false; } final INode removed = setCreated(i, newChild); Preconditions.checkState(removed == oldChild); return true; }
final List<INode> clist = diff.getCreatedUnmodifiable(); if (lastIndex == -1 || lastIndex < clist.size()) { ListIterator<INode> iterator = lastIndex != -1 ?
DirectoryDiff priorDiff = this.getDiffs().getDiffById(prior); if (priorDiff != null && priorDiff.getSnapshotId() == prior) { priorCreated = cloneDiffList(priorDiff.diff.getCreatedUnmodifiable()); priorDeleted = cloneDiffList(priorDiff.diff.getDeletedUnmodifiable()); for (INode cNode : priorDiff.diff.getCreatedUnmodifiable()) { if (priorCreated.containsKey(cNode)) { cNode.cleanSubtree(reclaimContext, snapshot, NO_SNAPSHOT_ID);
List<INode> created = diff.getChildrenDiff().getCreatedUnmodifiable(); db.setCreatedListSize(created.size()); List<INode> deleted = diff.getChildrenDiff().getDeletedUnmodifiable();
byte[][] fullPath = new byte[parentPath.length + 1][]; System.arraycopy(parentPath, 0, fullPath, 0, parentPath.length); for (INode cnode : dirDiff.getCreatedUnmodifiable()) { RenameEntry entry = renameMap.get(cnode.getId()); if (entry == null || !entry.isRename()) {
/** Add a dir-diff pair */ void addDirDiff(INodeDirectory dir, byte[][] relativePath, ChildrenDiff diff) { dirDiffMap.put(dir, diff); diffMap.put(dir, relativePath); // detect rename for (INode created : diff.getCreatedUnmodifiable()) { if (created.isReference()) { RenameEntry entry = getEntry(created.getId()); if (entry.getTargetPath() == null) { entry.setTarget(created, relativePath); } } } for (INode deleted : diff.getDeletedUnmodifiable()) { if (deleted instanceof INodeReference.WithName) { RenameEntry entry = getEntry(deleted.getId()); entry.setSource(deleted, relativePath); } } }
/** clear the created list */ private void destroyCreatedList(INode.ReclaimContext reclaimContext, final INodeDirectory currentINode) { for (INode c : getCreatedUnmodifiable()) { c.destroyAndCollectBlocks(reclaimContext); // c should be contained in the children list, remove it currentINode.removeChild(c); } clearCreated(); }