d.setTimestamp(commitTime.getDeletionTime(times)); org.apache.cassandra.thrift.Mutation m = new org.apache.cassandra.thrift.Mutation(); m.setDeletion(d); thriftMutation.add(m);
/** * Add a deletion request to the batch mutation. */ public BatchMutation<K> addDeletion(K key, List<String> columnFamilies, Deletion deletion) { Mutation mutation = new Mutation(); mutation.setDeletion(deletion); addMutation(key, columnFamilies, mutation); return this; }
del.setTimestamp(deleteTimestampGetter.applyAsLong(ts)); Mutation mutation = new Mutation(); mutation.setDeletion(del);
public static Mutation rangeTombstoneForColumn( byte[] columnName, long maxAtlasTimestampExclusive, long timestampForRangeTombstone) { Deletion deletion = new Deletion() .setTimestamp(timestampForRangeTombstone) .setPredicate(SlicePredicates.rangeTombstoneForColumn(columnName, maxAtlasTimestampExclusive)); return new Mutation().setDeletion(deletion); }
public static Mutation rangeTombstoneIncludingSentinelForColumn( byte[] columnName, long maxAtlasTimestampExclusive, long timestampForRangeTombstone) { Deletion deletion = new Deletion() .setTimestamp(timestampForRangeTombstone) .setPredicate(SlicePredicates .rangeTombstoneIncludingSentinelForColumn(columnName, maxAtlasTimestampExclusive)); return new Mutation().setDeletion(deletion); }
@Test public void getSizeForMutationWithDeletionContainingSuperColumn() { long nonEmptyDeletionSize = Long.BYTES + TEST_NAME.getBytes().length + NULL_SIZE; assertThat(ThriftObjectSizeUtils.getMutationSize(new Mutation() .setDeletion(new Deletion().setSuper_column(TEST_NAME.getBytes())))) .isEqualTo(NULL_SIZE + nonEmptyDeletionSize); }
@Test public void getSizeForMutationWithEmptyDeletion() { long emptyDeletionSize = Long.BYTES + 2 * NULL_SIZE; assertThat(ThriftObjectSizeUtils.getMutationSize(new Mutation() .setDeletion(new Deletion()))) .isEqualTo(NULL_SIZE + emptyDeletionSize); }
@Test public void getSizeForMutationWithDeletionContainingNonEmptySlicePredicate() { long deletionSize = (Long.BYTES) + NULL_SIZE + (TEST_NAME.getBytes().length + NULL_SIZE); assertThat(ThriftObjectSizeUtils .getMutationSize(new Mutation() .setDeletion(new Deletion() .setPredicate(new SlicePredicate() .setColumn_names(ImmutableList.of(ByteBuffer.wrap(TEST_NAME.getBytes()))))))) .isEqualTo(NULL_SIZE + deletionSize); }
@Test public void getSizeForMutationWithColumnOrSuperColumnAndDeletion() { long emptyDeletionSize = Long.BYTES + 2 * NULL_SIZE; assertThat(ThriftObjectSizeUtils.getMutationSize(new Mutation() .setColumn_or_supercolumn(EMPTY_COLUMN_OR_SUPERCOLUMN) .setDeletion(new Deletion()))) .isEqualTo(EMPTY_COLUMN_OR_SUPERCOLUMN_SIZE + emptyDeletionSize); }
@Test public void getSizeForMutationWithDeletionContainingEmptySlicePredicate() { long deletionSize = Long.BYTES + NULL_SIZE + NULL_SIZE * 2; assertThat(ThriftObjectSizeUtils.getMutationSize(new Mutation() .setDeletion(new Deletion().setPredicate(new SlicePredicate())))) .isEqualTo(NULL_SIZE + deletionSize); }
Deletion deletion = new Deletion().setTimestamp(connectionManager.createClock()); deletion.setPredicate(slicePredicate); mutation.setDeletion(deletion); mutations.add(mutation);
/** * Add a deletion request to the batch mutation. */ public BatchMutation<K> addDeletion(K key, List<String> columnFamilies, Deletion deletion) { Mutation mutation = new Mutation(); mutation.setDeletion(deletion); addMutation(key, columnFamilies, mutation); return this; }
@Override public ColumnListMutation<C> delete() { // Delete the entire row Deletion d = new Deletion().setTimestamp(timestamp); mutationList.add(new Mutation().setDeletion(d)); // Increment the timestamp by 1 so subsequent puts on this column may be // written timestamp++; return this; }
@Override public ColumnListMutation<C> delete() { // Delete the entire row Deletion d = new Deletion().setTimestamp(timestamp); mutationList.add(new Mutation().setDeletion(d)); // Increment the timestamp by 1 so subsequent puts on this column may be // written timestamp++; return this; }
@Override public ColumnListMutation<C> delete() { // Delete the entire super column Deletion d = new Deletion().setSuper_column(path.get(0)).setTimestamp(timestamp); mutationList.add(new Mutation().setDeletion(d)); timestamp++; return this; }
@Override public ColumnListMutation<C> delete() { // Delete the entire super column Deletion d = new Deletion().setSuper_column(path.get(0)).setTimestamp(timestamp); mutationList.add(new Mutation().setDeletion(d)); timestamp++; return this; }
@Override public ColumnListMutation<C> delete() { Deletion d = new Deletion(); d.setSuper_column(path.get(0)); d.setTimestamp(timestamp); mutationList.add(new Mutation().setDeletion(d)); timestamp++; return this; }
@Override public ColumnListMutation<C> delete() { Deletion d = new Deletion(); d.setSuper_column(path.get(0)); d.setTimestamp(timestamp); mutationList.add(new Mutation().setDeletion(d)); timestamp++; return this; }
private static Mutation createDeleteColumnMutation(byte[] colName, long timestamp) { SlicePredicate slicePred = new SlicePredicate(); slicePred.addToColumn_names(ByteBuffer.wrap(colName)); Deletion deletion = new Deletion(); deletion.setPredicate(slicePred); deletion.setTimestamp(timestamp); Mutation mutation = new Mutation(); mutation.setDeletion(deletion); return mutation; }
@Override public ColumnListMutation<C> deleteColumn(C columnName) { if (deletionPredicate == null) { deletionPredicate = new SlicePredicate(); Deletion d = new Deletion().setTimestamp(timestamp).setSuper_column(path.get(0)) .setPredicate(deletionPredicate); mutationList.add(new Mutation().setDeletion(d)); } deletionPredicate.addToColumn_names(path.getSerializer().toByteBuffer(columnName)); return this; }