protected Map<BucketId, Set<NodeKey>> preRemoveChildrenFromBuckets( WorkspaceCache wsCache, EditableDocument parentDoc, Set<NodeKey> removals ) { assert removals != null && !removals.isEmpty(); Integer bucketIdLength = parentDoc.getInteger(BUCKET_ID_LENGTH); assert bucketIdLength != null; long totalRemovals = 0; // figure out the bucket where each removed node belongs Map<BucketId, Set<NodeKey>> removalsPerBucket = new HashMap<>(removals.size()); for (NodeKey removedKey : removals) { Name removedName = wsCache.getNode(removedKey).getName(wsCache); BucketId bucketId = new BucketId(removedName, bucketIdLength); Set<NodeKey> bucketRemovals = removalsPerBucket.get(bucketId); if (bucketRemovals == null) { bucketRemovals = new HashSet<>(); removalsPerBucket.put(bucketId, bucketRemovals); } bucketRemovals.add(removedKey); ++totalRemovals; } Long currentSize = parentDoc.getLong(SIZE); if (totalRemovals > 0 && currentSize != null) { parentDoc.setNumber(SIZE, currentSize - totalRemovals); } return removalsPerBucket; }
protected Map<BucketId, Set<NodeKey>> preRemoveChildrenFromBuckets( WorkspaceCache wsCache, EditableDocument parentDoc, Set<NodeKey> removals ) { assert removals != null && !removals.isEmpty(); Integer bucketIdLength = parentDoc.getInteger(BUCKET_ID_LENGTH); assert bucketIdLength != null; long totalRemovals = 0; // figure out the bucket where each removed node belongs Map<BucketId, Set<NodeKey>> removalsPerBucket = new HashMap<>(removals.size()); for (NodeKey removedKey : removals) { Name removedName = wsCache.getNode(removedKey).getName(wsCache); BucketId bucketId = new BucketId(removedName, bucketIdLength); Set<NodeKey> bucketRemovals = removalsPerBucket.get(bucketId); if (bucketRemovals == null) { bucketRemovals = new HashSet<>(); removalsPerBucket.put(bucketId, bucketRemovals); } bucketRemovals.add(removedKey); ++totalRemovals; } Long currentSize = parentDoc.getLong(SIZE); if (totalRemovals > 0 && currentSize != null) { parentDoc.setNumber(SIZE, currentSize - totalRemovals); } return removalsPerBucket; }
documentStore.localStore().put(key, content); } else { Long countValue = entry.getLong(REFERENCE_COUNT); entry.setNumber(REFERENCE_COUNT, countValue != null ? countValue + 1 : 1L);
Long countValue = sha1Usage.getLong(REFERENCE_COUNT); assert countValue != null;
Long countValue = sha1Usage.getLong(REFERENCE_COUNT); assert countValue != null;
documentStore.localStore().put(key, content); } else { Long countValue = entry.getLong(REFERENCE_COUNT); entry.setNumber(REFERENCE_COUNT, countValue != null ? countValue + 1 : 1L);
Long currentSize = parentDoc.getLong(SIZE); if (currentSize == null) { parentDoc.setNumber(SIZE, totalAdditions);
Long currentSize = parentDoc.getLong(SIZE); if (currentSize == null) { parentDoc.setNumber(SIZE, totalAdditions);