use of org.apache.cassandra.db.IColumn in project eiger by wlloyd.
the class MigrationManager method makeMigrationMessage.
// other half of transformation is in DefinitionsUpdateResponseVerbHandler.
private static Message makeMigrationMessage(Collection<IColumn> migrations, int version) throws IOException {
FastByteArrayOutputStream bout = new FastByteArrayOutputStream();
DataOutputStream dout = new DataOutputStream(bout);
dout.writeInt(migrations.size());
// problem during upgrades.
for (IColumn col : migrations) {
assert col instanceof Column;
ByteBufferUtil.writeWithLength(col.name(), dout);
ByteBufferUtil.writeWithLength(col.value(), dout);
}
dout.close();
byte[] body = bout.toByteArray();
return new Message(FBUtilities.getBroadcastAddress(), StorageService.Verb.DEFINITIONS_UPDATE, body, version);
}
use of org.apache.cassandra.db.IColumn in project eiger by wlloyd.
the class SSTableUtils method createCF.
public static ColumnFamily createCF(long mfda, int ldt, IColumn... cols) {
ColumnFamily cf = ColumnFamily.create(TABLENAME, CFNAME);
cf.delete(ldt, mfda);
for (IColumn col : cols) cf.addColumn(col);
return cf;
}
use of org.apache.cassandra.db.IColumn in project eiger by wlloyd.
the class SSTableImportTest method testImportSimpleCf.
@Test
public void testImportSimpleCf() throws IOException, URISyntaxException {
// Import JSON to temp SSTable file
String jsonUrl = resourcePath("SimpleCF.json");
File tempSS = tempSSTableFile("Keyspace1", "Standard1");
SSTableImport.importJson(jsonUrl, "Keyspace1", "Standard1", tempSS.getPath());
// Verify results
SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
QueryFilter qf = QueryFilter.getIdentityFilter(Util.dk("rowA"), new QueryPath("Standard1"));
IColumnIterator iter = qf.getSSTableColumnIterator(reader);
ColumnFamily cf = iter.getColumnFamily();
while (iter.hasNext()) cf.addColumn(iter.next());
assert cf.getColumn(ByteBufferUtil.bytes("colAA")).value().equals(hexToBytes("76616c4141"));
assert !(cf.getColumn(ByteBufferUtil.bytes("colAA")) instanceof DeletedColumn);
IColumn expCol = cf.getColumn(ByteBufferUtil.bytes("colAC"));
assert expCol.value().equals(hexToBytes("76616c4143"));
assert expCol instanceof ExpiringColumn;
assert ((ExpiringColumn) expCol).getTimeToLive() == 42 && expCol.getLocalDeletionTime() == 2000000000;
}
use of org.apache.cassandra.db.IColumn in project cassandra-indexing by hmsonline.
the class IndexUtil method getNewRow.
public static Map<String, String> getNewRow(Map<String, String> currentRow, ColumnFamily columnFamily) throws Exception {
Map<String, String> mutation = new HashMap<String, String>();
for (IColumn column : columnFamily.getSortedColumns()) {
String value = column.isMarkedForDelete() ? null : ByteBufferUtil.string(column.value());
mutation.put(ByteBufferUtil.string(column.name()), value);
}
Map<String, String> newRow = new HashMap<String, String>(currentRow);
newRow.putAll(mutation);
return newRow;
}
use of org.apache.cassandra.db.IColumn in project brisk by riptano.
the class TrackerManager method getCurrentJobtrackerLocation.
/**
* Retrieves the current job tracker IP.
*
* @return the current job tracker IP
* @throws TrackerManagerException
*/
public static InetAddress getCurrentJobtrackerLocation() throws TrackerManagerException {
ReadCommand rc = new SliceByNamesReadCommand(BriskSchema.KEYSPACE_NAME, currentJobtrackerKey, cp, Arrays.asList(columnName));
String result;
try {
List<Row> rows = StorageProxy.read(Arrays.asList(rc), ConsistencyLevel.QUORUM);
IColumn col = validateAndGetColumn(rows, columnName);
// ByteBuffer util duplicates for us the value.
result = ByteBufferUtil.string(col.value());
return InetAddress.getByName(result);
} catch (NotFoundException e) {
return null;
} catch (Exception e) {
throw new TrackerManagerException(e);
}
}
Aggregations