Search in sources :

Example 1 with PendingTransactionMutation

use of org.apache.cassandra.db.transaction.PendingTransactionMutation in project eiger by wlloyd.

the class RowMutation method convertToPending.

@Override
public PendingTransactionMutation convertToPending(long pendingTime, long transactionId) {
    PendingTransactionMutation pendingMutation = new PendingTransactionMutation(this.table_, this.key_, pendingTime, transactionId);
    for (ColumnFamily columnFamily : modifications_.values()) {
        String columnFamilyName = columnFamily.metadata().cfName;
        for (IColumn column : columnFamily.columns) {
            if (column instanceof SuperColumn) {
                if (column.getSubColumns().size() == 0) {
                    //just inserting a new super column
                    QueryPath path = new QueryPath(columnFamilyName, column.name(), null);
                    pendingMutation.makePending(path);
                } else {
                    for (IColumn subcolumn : column.getSubColumns()) {
                        QueryPath path = new QueryPath(columnFamilyName, column.name(), subcolumn.name());
                        pendingMutation.makePending(path);
                    }
                }
            } else if (column instanceof DeletedColumn) {
                assert column.getSubColumns().size() == 0 : "Haven't added support for deleting supercolumn in transactions yet";
                QueryPath path = new QueryPath(columnFamilyName, null, column.name());
                pendingMutation.makePending(path);
            } else {
                assert column instanceof Column;
                QueryPath path = new QueryPath(columnFamilyName, null, column.name());
                pendingMutation.makePending(path);
            }
        }
    }
    return pendingMutation;
}
Also used : QueryPath(org.apache.cassandra.db.filter.QueryPath) PendingTransactionMutation(org.apache.cassandra.db.transaction.PendingTransactionMutation) ColumnOrSuperColumn(org.apache.cassandra.thrift.ColumnOrSuperColumn) ColumnOrSuperColumn(org.apache.cassandra.thrift.ColumnOrSuperColumn)

Aggregations

QueryPath (org.apache.cassandra.db.filter.QueryPath)1 PendingTransactionMutation (org.apache.cassandra.db.transaction.PendingTransactionMutation)1 ColumnOrSuperColumn (org.apache.cassandra.thrift.ColumnOrSuperColumn)1