@Override public boolean apply(Cell input) { if (!input.isLive(tsMillis)) return false; // Don't do this. getTimeToLive() is a duration divorced from any particular clock. // For instance, if TTL=10 seconds, getTimeToLive() will have value 10 (not 10 + epoch seconds), and // this will always return false. //if (input instanceof ExpiringCell) // return tsSeconds < ((ExpiringCell)input).getTimeToLive(); return true; } }
private boolean isDead(Cell c) { return c == null || !c.isLive(now); }
public boolean apply(Cell c) { // we only care about live columns return c.isLive(now); } });
@Override public boolean apply(Cell input) { if (!input.isLive(tsMillis)) return false; // Don't do this. getTimeToLive() is a duration divorced from any particular clock. // For instance, if TTL=10 seconds, getTimeToLive() will have value 10 (not 10 + epoch seconds), and // this will always return false. //if (input instanceof ExpiringCell) // return tsSeconds < ((ExpiringCell)input).getTimeToLive(); return true; } }
public boolean hasOnlyTombstones(long now) { for (Cell cell : this) if (cell.isLive(now)) return false; return true; }
private boolean hasNextCell() { if (nextCell != null) return true; while (cells.hasNext()) { Cell cell = cells.next(); if (!cell.isLive(now)) continue; nextCell = cell; return true; } return false; }
public void count(Cell cell, DeletionInfo.InOrderTester tester) { // The cell is shadowed by a higher-level deletion, and won't be retained. // For the purposes of this counter, we don't care if it's a tombstone or not. if (tester.isDeleted(cell)) return; if (cell.isLive(timestamp)) live++; else tombstones++; }
private List<Column> thriftifyColumnsAsColumns(Collection<Cell> cells, long now) { List<Column> thriftColumns = new ArrayList<Column>(cells.size()); for (Cell cell : cells) { if (!cell.isLive(now)) continue; thriftColumns.add(thriftifySubColumn(cell)); } return thriftColumns; }
public int getLiveCount(ColumnFamily cf, long now) { // Note: we could use columnCounter() but we save the object allocation as it's simple enough if (countCQL3Rows) return cf.hasOnlyTombstones(now) ? 0 : 1; int count = 0; for (Cell cell : cf) { if (cell.isLive(now)) count++; } return count; }
public boolean appliesTo(ColumnFamily current) { if (current == null) return true; Iterator<Cell> iter = current.iterator(new ColumnSlice[]{ rowPrefix.slice() }); while (iter.hasNext()) if (iter.next().isLive(now)) return false; return true; } }
public boolean appliesTo(ColumnFamily current) { if (current == null) return false; Iterator<Cell> iter = current.iterator(new ColumnSlice[]{ rowPrefix.slice() }); while (iter.hasNext()) if (iter.next().isLive(now)) return true; return false; } }
protected boolean isSatisfiedByValue(ByteBuffer value, Cell c, AbstractType<?> type, Operator operator, long now) throws InvalidRequestException { ByteBuffer columnValue = (c == null || !c.isLive(now)) ? null : c.value(); return compareWithOperator(operator, type, value, columnValue); }
public void deleteForCleanup(ByteBuffer rowKey, Cell cell, OpOrder.Group opGroup) { if (!cell.isLive()) return; DecoratedKey valueKey = getIndexKeyFor(getIndexedValue(rowKey, cell)); int localDeletionTime = (int) (System.currentTimeMillis() / 1000); ColumnFamily cfi = ArrayBackedSortedColumns.factory.create(indexCfs.metadata, false, 1); cfi.addTombstone(makeIndexColumnName(rowKey, cell), localDeletionTime, cell.timestamp()); indexCfs.apply(valueKey, cfi, SecondaryIndexManager.nullUpdater, opGroup, null); if (logger.isDebugEnabled()) logger.debug("removed index entry for cleaned-up value {}:{}", valueKey, cfi); }
public boolean isStale(IndexedEntry entry, ColumnFamily data, long now) { CellName name = data.getComparator().create(entry.indexedEntryPrefix, columnDef, entry.indexValue.getKey()); Cell cell = data.getColumn(name); return cell == null || !cell.isLive(now); } }
public void insert(Cell cell) { if (!cell.isLive()) return; for (SecondaryIndex index : indexFor(cell.name())) if (index instanceof PerColumnSecondaryIndex) ((PerColumnSecondaryIndex) index).insert(key.getKey(), cell, opGroup); }
public void remove(Cell cell) { if (!cell.isLive()) return; for (SecondaryIndex index : indexFor(cell.name())) if (index instanceof PerColumnSecondaryIndex) ((PerColumnSecondaryIndex) index).delete(key.getKey(), cell, opGroup); }
public boolean isIndexEntryStale(ByteBuffer indexedValue, ColumnFamily data, long now) { Cell cell = data.getColumn(data.getComparator().makeCellName(columnDef.name.bytes)); return cell == null || !cell.isLive(now) || columnDef.type.compare(indexedValue, cell.value()) != 0; }
public boolean isStale(IndexedEntry entry, ColumnFamily data, long now) { CellName name = data.getComparator().create(entry.indexedEntryPrefix, columnDef); Cell cell = data.getColumn(name); return cell == null || !cell.isLive(now) || columnDef.type.compare(entry.indexValue.getKey(), cell.value()) != 0; } }
public Cell reconcile(Cell cell) { long ts1 = timestamp(), ts2 = cell.timestamp(); if (ts1 != ts2) return ts1 < ts2 ? cell : this; if (isLive() != cell.isLive()) return isLive() ? cell : this; return value().compareTo(cell.value()) < 0 ? cell : this; }
public boolean isStale(IndexedEntry entry, ColumnFamily data, long now) { CellName name = data.getComparator().create(entry.indexedEntryPrefix, columnDef, entry.indexedEntryCollectionKey); Cell cell = data.getColumn(name); return cell == null || !cell.isLive(now) || ((CollectionType) columnDef.type).valueComparator().compare(entry.indexValue.getKey(), cell.value()) != 0; } }