コード例 #1
0
ファイル: Util.java プロジェクト: hobinyoon/mutants-cassandra
  /**
   * Writes out a bunch of mutations for a single column family.
   *
   * @param mutations A group of Mutations for the same keyspace and column family.
   * @return The ColumnFamilyStore that was used.
   */
  public static ColumnFamilyStore writeColumnFamily(List<Mutation> mutations) {
    IMutation first = mutations.get(0);
    String keyspaceName = first.getKeyspaceName();
    UUID cfid = first.getColumnFamilyIds().iterator().next();

    for (Mutation rm : mutations) rm.applyUnsafe();

    ColumnFamilyStore store = Keyspace.open(keyspaceName).getColumnFamilyStore(cfid);
    store.forceBlockingFlush();
    return store;
  }
コード例 #2
0
ファイル: Util.java プロジェクト: hobinyoon/mutants-cassandra
 public static void addMutation(
     Mutation rm,
     String columnFamilyName,
     String superColumnName,
     long columnName,
     String value,
     long timestamp) {
   CellName cname =
       superColumnName == null
           ? CellNames.simpleDense(getBytes(columnName))
           : CellNames.compositeDense(ByteBufferUtil.bytes(superColumnName), getBytes(columnName));
   rm.add(columnFamilyName, cname, ByteBufferUtil.bytes(value), timestamp);
 }
コード例 #3
0
 private void insert(String key) {
   Mutation rm;
   rm = new Mutation(KEYSPACE, ByteBufferUtil.bytes(key));
   rm.add(CF, Util.cellname("column"), ByteBufferUtil.bytes("asdf"), 0);
   rm.apply();
 }