if (isBranchCommit || pendingLastRev) {
// write back _lastRev with background thread
unsaved.put(path, rev);
}
if (isNew) {
CacheValue key = childNodeCacheKey(path, rev, null);
DocumentNodeState.Children c = new DocumentNodeState.Children();
Set<String> set = Sets.newTreeSet(added);
set.removeAll(removed);
for (String p : added) {
set.add(Utils.unshareString(p));
}
c.children.addAll(set);
nodeChildrenCache.put(key, c);
} else if (!isDelete) {
// update diff cache for modified nodes
PathRev key = diffCacheKey(path, before, rev);
JsopWriter w = new JsopStream();
for (String p : added) {
w.tag('+').key(p).object().endObject().newline();
}
for (String p : removed) {
w.tag('-').value(p).newline();
}
for (String p : changed) {
w.tag('^').key(p).object().endObject().newline();
}
diffCache.put(key, new StringValue(w.toString()));
}
// update docChildrenCache
if (!added.isEmpty()) {
CacheValue docChildrenKey = new StringValue(path);
NodeDocument.Children docChildren = docChildrenCache.getIfPresent(docChildrenKey);
if (docChildren != null) {
int currentSize = docChildren.childNames.size();
NavigableSet<String> names = Sets.newTreeSet(docChildren.childNames);
// incomplete cache entries must not be updated with