public boolean deleteRowIfNotLatest(DecoratedKey decoratedKey, ColumnFamily cf) { if (!cf.getColumnNames().iterator().hasNext()) {//no columns available currentIndex.deleteByKey(decoratedKey); return true; } return false; }
public List<LogEntry> writePending(ConsistencyLevel consistencyLevel, RowMutation rowMutation) throws Throwable { List<String> columnNames = new ArrayList<String>(); for (ColumnFamily cf : rowMutation.getColumnFamilies()) { for (ByteBuffer b : cf.getColumnNames()) { columnNames.add(ByteBufferUtil.string(b)); } } String keyspace = rowMutation.getTable(); ByteBuffer rowKey = rowMutation.key(); List<LogEntry> entries = new ArrayList<LogEntry>(); for (Integer cfId : rowMutation.getColumnFamilyIds()) { ColumnFamily columnFamily = rowMutation.getColumnFamily(cfId); String path = keyspace + ":" + columnFamily.metadata().cfName; List<Trigger> triggers = TriggerStore.getStore().getTriggers().get(path); if (triggers != null && triggers.size() > 0) { String hostName = LogEntryStore.getHostName(); LogEntry entry = new LogEntry(keyspace, columnFamily, rowKey, consistencyLevel, hostName, System.currentTimeMillis(), columnNames); entries.add(entry); write(entry, PENDING_PRIORITY); } } return entries; }
public IDiskAtomFilter readFilter() { return expected == null || expected.isEmpty() ? new SliceQueryFilter(ColumnSlice.ALL_COLUMNS_ARRAY, false, 1) : new NamesQueryFilter(ImmutableSortedSet.copyOf(expected.getComparator(), expected.getColumnNames())); }
public boolean deleteIfNotLatest(DecoratedKey decoratedKey, long timestamp, String pkString, ColumnFamily cf) throws IOException { if (deleteRowIfNotLatest(decoratedKey, cf)) return true; Cell lastColumn = null; for (CellName colKey : cf.getColumnNames()) { String name = colKey.cql3ColumnName(tableMapper.cfMetaData).toString(); com.tuplejump.stargate.lucene.Properties option = options.fields.get(name); //if option was not found then the column is not indexed if (option != null) { lastColumn = cf.getColumn(colKey); } } if (lastColumn != null && lastColumn.timestamp() > timestamp) { currentIndex.delete(decoratedKey, pkString, timestamp); return true; } return false; }