Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.Deletion


    @SuppressWarnings({"UnusedDeclaration"})//NOSONAR
    public static void deleteRowToBatchMutation(String rowKey,
                                                String columnFamilyName,
                                                CassandraTemplate template,
                                                BatchMutation<String> batchMutation) {
        Deletion deletion = new Deletion();
        deletion.setTimestamp(template.createTimestamp());
        batchMutation.addDeletion(rowKey, Collections.singletonList(columnFamilyName), deletion);
    }
View Full Code Here


                                                   String columnFamilyName,
                                                   String superColumnName,
                                                   @Nullable String columnName,
                                                   CassandraTemplate template,
                                                   BatchMutation<String> batchMutation) {
        Deletion deletion = new Deletion();
        deletion.setTimestamp(template.createTimestamp());
        if (superColumnName != null) {
            deletion.setSuper_column(bytes(superColumnName));
        }
        if (columnName != null) {
            SlicePredicate slicePredicate = new SlicePredicate();
            slicePredicate.setColumn_names(Collections.singletonList(bytes(columnName)));
            deletion.setPredicate(slicePredicate);
        }
        batchMutation.addDeletion(rowKey, Collections.singletonList(columnFamilyName), deletion);
    }
View Full Code Here

                }
            });
        } else {
            // use a BatchMutation to do multiple column deletions in one go
            BatchMutation<String> batchMutation = new BatchMutation<String>(StringSerializer.get());
            Deletion deletion = new Deletion();
            deletion.setTimestamp(template.createTimestamp());
            if (superColumnName != null) {
                deletion.setSuper_column(bytes(superColumnName));
            }
            SlicePredicate predicate = new SlicePredicate();
            for (String columnName : columnNames) {
                predicate.addToColumn_names(bytes(columnName));
            }
            deletion.setPredicate(predicate);
            batchMutation.addDeletion(rowKey, Collections.singletonList(columnFamilyName), deletion);

            mutate(batchMutation, keyspaceName, template);
        }
    }
View Full Code Here

    @SuppressWarnings({"UnusedDeclaration"})//NOSONAR
    public static void deleteRowToBatchMutation(String rowKey,
                                                String columnFamilyName,
                                                CassandraTemplate template,
                                                BatchMutation<String> batchMutation) {
        Deletion deletion = new Deletion();
        deletion.setTimestamp(template.createTimestamp());
        batchMutation.addDeletion(rowKey, Collections.singletonList(columnFamilyName), deletion);
    }
View Full Code Here

                                                   String columnFamilyName,
                                                   String superColumnName,
                                                   @Nullable String columnName,
                                                   CassandraTemplate template,
                                                   BatchMutation<String> batchMutation) {
        Deletion deletion = new Deletion();
        deletion.setTimestamp(template.createTimestamp());
        if (superColumnName != null) {
            deletion.setSuper_column(bytes(superColumnName));
        }
        if (columnName != null) {
            SlicePredicate slicePredicate = new SlicePredicate();
            slicePredicate.setColumn_names(Collections.singletonList(bytes(columnName)));
            deletion.setPredicate(slicePredicate);
        }
        batchMutation.addDeletion(rowKey, Collections.singletonList(columnFamilyName), deletion);
    }
View Full Code Here

                       column.setTimestamp(System.currentTimeMillis() * 1000);
                       columns.add(column);
                   }
                   if (columns.isEmpty()) // a deletion
                   {
                       mutation.deletion = new Deletion();
                       mutation.deletion.super_column = objToBB(pair.get(0));
                       mutation.deletion.setTimestamp(System.currentTimeMillis() * 1000);
                   }
                   else
                   {
                       sc.columns = columns;
                       mutation.column_or_supercolumn = new ColumnOrSuperColumn();
                       mutation.column_or_supercolumn.super_column = sc;
                   }
               }
               else // assume column since it couldn't be anything else
               {
                   if (pair.get(1) == null)
                   {
                       mutation.deletion = new Deletion();
                       mutation.deletion.predicate = new org.apache.cassandra.thrift.SlicePredicate();
                       mutation.deletion.predicate.column_names = Arrays.asList(objToBB(pair.get(0)));
                       mutation.deletion.setTimestamp(System.currentTimeMillis() * 1000);
                   }
                   else
View Full Code Here

      columnFamilyMutations = new ArrayList<Mutation>();
      keyMutations.put(columnFamily, columnFamilyMutations);
    }

    if (value == null) { // Delete
      Deletion deletion = new Deletion(System.currentTimeMillis());
      if(superColumn!=null) {
        deletion.setSuper_column(superColumn);
      }
      if (column != null) { // Single column delete
        deletion.setPredicate(new SlicePredicate().setColumn_names(Arrays.asList(new byte[][] { column })));
      } // else Delete entire column family or supercolumn
      columnFamilyMutations.add(new Mutation().setDeletion(deletion));
    } else { // Insert/update
      ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();
      if(superColumn!=null) {
View Full Code Here

    @SuppressWarnings({"UnusedDeclaration"})//NOSONAR
    public static void deleteRowToBatchMutation(String rowKey,
                                                String columnFamilyName,
                                                CassandraTemplate template,
                                                BatchMutation<String> batchMutation) {
        Deletion deletion = new Deletion();
        deletion.setTimestamp(template.createTimestamp());
        batchMutation.addDeletion(rowKey, Collections.singletonList(columnFamilyName), deletion);
    }
View Full Code Here

                                                   String columnFamilyName,
                                                   String superColumnName,
                                                   @Nullable String columnName,
                                                   CassandraTemplate template,
                                                   BatchMutation<String> batchMutation) {
        Deletion deletion = new Deletion();
        deletion.setTimestamp(template.createTimestamp());
        if (superColumnName != null) {
            deletion.setSuper_column(bytes(superColumnName));
        }
        if (columnName != null) {
            SlicePredicate slicePredicate = new SlicePredicate();
            slicePredicate.setColumn_names(Collections.singletonList(bytes(columnName)));
            deletion.setPredicate(slicePredicate);
        }
        batchMutation.addDeletion(rowKey, Collections.singletonList(columnFamilyName), deletion);
    }
View Full Code Here

                }
            });
        } else {
            // use a BatchMutation to do multiple column deletions in one go
            BatchMutation<String> batchMutation = new BatchMutation<String>(StringSerializer.get());
            Deletion deletion = new Deletion();
            deletion.setTimestamp(template.createTimestamp());
            if (superColumnName != null) {
                deletion.setSuper_column(bytes(superColumnName));
            }
            SlicePredicate predicate = new SlicePredicate();
            for (String columnName : columnNames) {
                predicate.addToColumn_names(bytes(columnName));
            }
            deletion.setPredicate(predicate);
            batchMutation.addDeletion(rowKey, Collections.singletonList(columnFamilyName), deletion);

            mutate(batchMutation, keyspaceName, template);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.Deletion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.