Java 类org.apache.cassandra.thrift.Deletion 实例源码

项目:Cassandra-Wasef    文件:RowMutation.java   
public void deleteColumnOrSuperColumn(String cfName, Deletion del)
{
    if (del.predicate != null && del.predicate.column_names != null)
    {
        for(ByteBuffer c : del.predicate.column_names)
        {
            if (del.super_column == null && Schema.instance.getColumnFamilyType(table, cfName) == ColumnFamilyType.Super)
                delete(new QueryPath(cfName, c), del.timestamp);
            else
                delete(new QueryPath(cfName, del.super_column, c), del.timestamp);
        }
    }
    else
    {
        delete(new QueryPath(cfName, del.super_column), del.timestamp);
    }
}
项目:wso2-cassandra    文件:RowMutation.java   
public void deleteColumnOrSuperColumn(String cfName, Deletion del)
{
    if (del.predicate != null && del.predicate.column_names != null)
    {
        for(ByteBuffer c : del.predicate.column_names)
        {
            if (del.super_column == null && Schema.instance.getColumnFamilyType(table, cfName) == ColumnFamilyType.Super)
                delete(new QueryPath(cfName, c), del.timestamp);
            else
                delete(new QueryPath(cfName, del.super_column, c), del.timestamp);
        }
    }
    else
    {
        delete(new QueryPath(cfName, del.super_column), del.timestamp);
    }
}
项目:cassandra-1.2.16    文件:RowMutation.java   
public void deleteColumnOrSuperColumn(String cfName, Deletion del)
{
    if (del.predicate != null && del.predicate.column_names != null)
    {
        for(ByteBuffer c : del.predicate.column_names)
        {
            if (del.super_column == null && Schema.instance.getColumnFamilyType(table, cfName) == ColumnFamilyType.Super)
                delete(new QueryPath(cfName, c), del.timestamp);
            else
                delete(new QueryPath(cfName, del.super_column, c), del.timestamp);
        }
    }
    else
    {
        delete(new QueryPath(cfName, del.super_column), del.timestamp);
    }
}
项目:Cassandra-KVPM    文件:RowMutation.java   
public void deleteColumnOrSuperColumn(String cfName, Deletion del)
{
    if (del.predicate != null && del.predicate.column_names != null)
    {
        for(ByteBuffer c : del.predicate.column_names)
        {
            if (del.super_column == null && DatabaseDescriptor.getColumnFamilyType(table_, cfName) == ColumnFamilyType.Super)
                delete(new QueryPath(cfName, c), del.timestamp);
            else
                delete(new QueryPath(cfName, del.super_column, c), del.timestamp);
        }
    }
    else
    {
        delete(new QueryPath(cfName, del.super_column), del.timestamp);
    }
}
项目:openyu-commons    文件:CassandraThriftDMLTest.java   
/**
 * delete
 *
 * @throws Exception
 */
@Test
public void delete() throws Exception {
    String KEYSPACE = "mock";
    client.set_keyspace(KEYSPACE);

    List<Mutation> mutations = new ArrayList<Mutation>();
    // <columnFamily,mutations>
    Map<String, List<Mutation>> columnfamilyMutaions = new HashMap<String, List<Mutation>>();// keyMutations
    // <rowKey,keyMutations>
    Map<ByteBuffer, Map<String, List<Mutation>>> rowKeyMutations = new HashMap<ByteBuffer, Map<String, List<Mutation>>>();
    //
    List<ByteBuffer> columns = new ArrayList<ByteBuffer>();
    // Add as many supercolumns as you want here
    columns.add(ByteBufferHelper.toByteBuffer("grad"));
    columns.add(ByteBufferHelper.toByteBuffer("math"));
    //
    SlicePredicate predicate = new SlicePredicate();
    predicate.setColumn_names(columns);
    // delete
    Deletion deletion = new Deletion();
    deletion.setPredicate(predicate);
    // timestamp in microseconds
    long timestamp = System.nanoTime();
    deletion.setTimestamp(timestamp);

    Mutation mutation = new Mutation();
    mutation.setDeletion(deletion);
    mutations.add(mutation);

    String COLUMN_FAMILY = "student";
    columnfamilyMutaions.put(COLUMN_FAMILY, mutations);

    String ROW_KEY = "Jack";
    rowKeyMutations.put(ByteBufferHelper.toByteBuffer(ROW_KEY),
            columnfamilyMutaions);

    // mutation_map, consistency_level
    client.batch_mutate(rowKeyMutations, ConsistencyLevel.ONE);
}
项目:Doradus    文件:CassandraTransaction.java   
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;
}