Search in sources :

Example 1 with MutationMap

use of com.palantir.atlasdb.keyvalue.cassandra.thrift.MutationMap in project atlasdb by palantir.

the class CassandraKeyValueServiceImpl method insertRangeTombstones.

private void insertRangeTombstones(CassandraClient client, Map<Cell, Long> maxTimestampExclusiveByCell, TableReference tableRef) throws TException {
    MutationMap mutationMap = new MutationMap();
    maxTimestampExclusiveByCell.forEach((cell, maxTimestampExclusive) -> {
        Mutation mutation = Mutations.rangeTombstoneForColumn(cell.getColumnName(), maxTimestampExclusive);
        mutationMap.addMutationForCell(cell, tableRef, mutation);
    });
    wrappingQueryRunner.batchMutate("deleteAllTimestamps", client, ImmutableSet.of(tableRef), mutationMap, deleteConsistency);
}
Also used : Mutation(org.apache.cassandra.thrift.Mutation) MutationMap(com.palantir.atlasdb.keyvalue.cassandra.thrift.MutationMap)

Example 2 with MutationMap

use of com.palantir.atlasdb.keyvalue.cassandra.thrift.MutationMap in project atlasdb by palantir.

the class CassandraKeyValueServiceImpl method convertToMutations.

private MutationMap convertToMutations(List<TableCellAndValue> batch, long timestamp) {
    MutationMap mutationMap = new MutationMap();
    for (TableCellAndValue tableCellAndValue : batch) {
        Cell cell = tableCellAndValue.cell;
        Column col = CassandraKeyValueServices.createColumn(cell, Value.create(tableCellAndValue.value, timestamp));
        ColumnOrSuperColumn colOrSup = new ColumnOrSuperColumn();
        colOrSup.setColumn(col);
        Mutation mutation = new Mutation();
        mutation.setColumn_or_supercolumn(colOrSup);
        mutationMap.addMutationForCell(cell, tableCellAndValue.tableRef, mutation);
    }
    return mutationMap;
}
Also used : ColumnOrSuperColumn(org.apache.cassandra.thrift.ColumnOrSuperColumn) Column(org.apache.cassandra.thrift.Column) ColumnOrSuperColumn(org.apache.cassandra.thrift.ColumnOrSuperColumn) Mutation(org.apache.cassandra.thrift.Mutation) Cell(com.palantir.atlasdb.keyvalue.api.Cell) MutationMap(com.palantir.atlasdb.keyvalue.cassandra.thrift.MutationMap)

Aggregations

MutationMap (com.palantir.atlasdb.keyvalue.cassandra.thrift.MutationMap)2 Mutation (org.apache.cassandra.thrift.Mutation)2 Cell (com.palantir.atlasdb.keyvalue.api.Cell)1 Column (org.apache.cassandra.thrift.Column)1 ColumnOrSuperColumn (org.apache.cassandra.thrift.ColumnOrSuperColumn)1