public void add(RangeTombstone tombstone, ClusteringComparator comparator) { if (ranges == null) ranges = new RangeTombstoneList(comparator, 1); ranges.add(tombstone); }
private void addInternal(int i, Composite start, Composite end, long markedAt, int delTime) { assert i >= 0; if (size == capacity()) growToFree(i); else if (i < size) moveElements(i); setInternal(i, start, end, markedAt, delTime); size++; }
if (tombstones.isEmpty()) return; if (isEmpty()) copyArrays(tombstones, this); return; add(tombstones.starts[i], tombstones.ends[i], tombstones.markedAts[i], tombstones.delTimes[i]); insertFrom(i, tombstones.starts[j], tombstones.ends[j], tombstones.markedAts[j], tombstones.delTimes[j]); j++; addInternal(size, tombstones.starts[j], tombstones.ends[j], tombstones.markedAts[j], tombstones.delTimes[j]);
/** * Adds a new range tombstone. * * This method will be faster if the new tombstone sort after all the currently existing ones (this is a common use case), * but it doesn't assume it. */ public void add(Composite start, Composite end, long markedAt, int delTime) { if (isEmpty()) { addInternal(0, start, end, markedAt, delTime); return; } int c = comparator.compare(ends[size-1], start); // Fast path if we add in sorted order if (c < 0) { addInternal(size, start, end, markedAt, delTime); } else { // Note: insertFrom expect i to be the insertion point in term of interval ends int pos = Arrays.binarySearch(ends, 0, size, start, comparator); insertFrom((pos >= 0 ? pos : -pos-1), start, end, markedAt, delTime); } boundaryHeapSize += start.unsharedHeapSize() + end.unsharedHeapSize(); }
private String rangesAsString() { assert !ranges.isEmpty(); StringBuilder sb = new StringBuilder(); CType type = (CType)ranges.comparator(); assert type != null; Iterator<RangeTombstone> iter = rangeIterator(); while (iter.hasNext()) { RangeTombstone i = iter.next(); sb.append("["); sb.append(type.getString(i.min)).append("-"); sb.append(type.getString(i.max)).append(", "); sb.append(i.data); sb.append("]"); } return sb.toString(); }
/** * Combines another DeletionInfo with this one and returns the result. Whichever top-level tombstone * has the higher markedForDeleteAt timestamp will be kept, along with its localDeletionTime. The * range tombstones will be combined. * * @return this object. */ public DeletionInfo add(DeletionInfo newInfo) { add(newInfo.topLevel); if (ranges == null) ranges = newInfo.ranges == null ? null : newInfo.ranges.copy(); else if (newInfo.ranges != null) ranges.addAll(newInfo.ranges); return this; }
if (isEmpty()) return superset; diff = new RangeTombstoneList(comparator, superset.size - i); diff.add(superset.starts[k], superset.ends[k], superset.markedAts[k], superset.delTimes[k]); diff = new RangeTombstoneList(comparator, Math.min(8, superset.size - i)); diff.add(superset.starts[i], superset.ends[i], superset.markedAts[i], superset.delTimes[i]);
addInternal(i, starts[i], newEnd, markedAts[i], delTimes[i]); i++; setInternal(i, start, ends[i], markedAts[i], delTimes[i]); addInternal(i, start, end, markedAt, delTime); return; setInternal(i, start, end, markedAt, delTime); return; setInternal(i, start, starts[i+1].invert(), markedAt, delTime); start = starts[i+1]; i++; addInternal(i, start, end, markedAt, delTime); i++; ClusteringBound newStart = end.invert(); if (!Slice.isEmpty(comparator, newStart, ends[i])) setInternal(i, newStart, ends[i], markedAts[i], delTimes[i]); addInternal(i, start, end, markedAt, delTime); return; addInternal(i, start, newEnd, markedAt, delTime); i++; addInternal(i, start, end, markedAt, delTime);
public RangeTombstoneList copy(AbstractAllocator allocator) { RangeTombstoneList copy = new RangeTombstoneList(comparator, new ClusteringBound[size], new ClusteringBound[size], Arrays.copyOf(markedAts, size), Arrays.copyOf(delTimes, size), boundaryHeapSize, size); for (int i = 0; i < size; i++) { copy.starts[i] = clone(starts[i], allocator); copy.ends[i] = clone(ends[i], allocator); } return copy; }
public MutableDeletionInfo copy(AbstractAllocator allocator) { RangeTombstoneList rangesCopy = null; if (ranges != null) rangesCopy = ranges.copy(allocator); return new MutableDeletionInfo(partitionDeletion, rangesCopy); }
removeInternal(i); continue; addInternal(i, starts[i], start, markedAts[i], delTimes[i]); i++; setInternal(i, start, end, markedAt, delTime); else addInternal(i, start, end, markedAt, delTime); return; setInternal(i, start, end, markedAt, delTime); return; setInternal(i, start, ends[i], markedAt, delTime); if (cmp == 0) return; addInternal(i, start, end, markedAt, delTime); i++; setInternal(i, end, ends[i], markedAts[i], delTimes[i]); return; addInternal(i, start, end, markedAt, delTime); return; addInternal(i, start, starts[i], markedAt, delTime); i++;
public RangeTombstoneList copy() { return new RangeTombstoneList(comparator, Arrays.copyOf(starts, size), Arrays.copyOf(ends, size), Arrays.copyOf(markedAts, size), Arrays.copyOf(delTimes, size), boundaryHeapSize, size); }
public int dataSize() { int size = TypeSizes.NATIVE.sizeof(topLevel.markedForDeleteAt); return size + (ranges == null ? 0 : ranges.dataSize()); }
public void add(RangeTombstone tombstone) { add(tombstone.min, tombstone.max, tombstone.data.markedForDeleteAt, tombstone.data.localDeletionTime); }
if (tombstones.isEmpty()) return; if (isEmpty()) copyArrays(tombstones, this); return; add(tombstones.starts[i], tombstones.ends[i], tombstones.markedAts[i], tombstones.delTimes[i]); insertFrom(i, tombstones.starts[j], tombstones.ends[j], tombstones.markedAts[j], tombstones.delTimes[j]); j++; addInternal(size, tombstones.starts[j], tombstones.ends[j], tombstones.markedAts[j], tombstones.delTimes[j]);
/** * Adds a new range tombstone. * * This method will be faster if the new tombstone sort after all the currently existing ones (this is a common use case), * but it doesn't assume it. */ public void add(ClusteringBound start, ClusteringBound end, long markedAt, int delTime) { if (isEmpty()) { addInternal(0, start, end, markedAt, delTime); return; } int c = comparator.compare(ends[size-1], start); // Fast path if we add in sorted order if (c <= 0) { addInternal(size, start, end, markedAt, delTime); } else { // Note: insertFrom expect i to be the insertion point in term of interval ends int pos = Arrays.binarySearch(ends, 0, size, start, comparator); insertFrom((pos >= 0 ? pos+1 : -pos-1), start, end, markedAt, delTime); } boundaryHeapSize += start.unsharedHeapSize() + end.unsharedHeapSize(); }
private String rangesAsString() { assert !ranges.isEmpty(); StringBuilder sb = new StringBuilder(); ClusteringComparator cc = ranges.comparator(); Iterator<RangeTombstone> iter = rangeIterator(false); while (iter.hasNext()) { RangeTombstone i = iter.next(); sb.append(i.deletedSlice().toString(cc)); sb.append('@'); sb.append(i.deletionTime()); } return sb.toString(); }
/** * Combines another DeletionInfo with this one and returns the result. Whichever top-level tombstone * has the higher markedForDeleteAt timestamp will be kept, along with its localDeletionTime. The * range tombstones will be combined. * * @return this object. */ public DeletionInfo add(DeletionInfo newInfo) { add(newInfo.getPartitionDeletion()); // We know MutableDeletionInfo is the only impelementation and we're not mutating it, it's just to get access to the // RangeTombstoneList directly. assert newInfo instanceof MutableDeletionInfo; RangeTombstoneList newRanges = ((MutableDeletionInfo)newInfo).ranges; if (ranges == null) ranges = newRanges == null ? null : newRanges.copy(); else if (newRanges != null) ranges.addAll(newRanges); return this; }