/** * 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; }
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); }