use of org.apache.metron.hbase.ColumnList in project metron by apache.
the class ProfileWriter method write.
/**
* Write a ProfileMeasurement.
* @param m The ProfileMeasurement to write.
*/
private void write(ProfileMeasurement m) {
byte[] rowKey = rowKeyBuilder.rowKey(m);
ColumnList cols = columnBuilder.columns(m);
hbaseClient.addMutation(rowKey, cols, Durability.SKIP_WAL);
hbaseClient.mutate();
}
use of org.apache.metron.hbase.ColumnList in project metron by apache.
the class HBaseBolt method save.
/**
* Saves an operation for later.
* @param tuple Contains the data elements that need written to HBase.
*/
private void save(Tuple tuple) {
byte[] rowKey = mapper.rowKey(tuple);
ColumnList cols = mapper.columns(tuple);
Durability durability = writeToWAL ? Durability.SYNC_WAL : Durability.SKIP_WAL;
Optional<Long> ttl = mapper.getTTL(tuple);
if (ttl.isPresent()) {
hbaseClient.addMutation(rowKey, cols, durability, ttl.get());
} else {
hbaseClient.addMutation(rowKey, cols, durability);
}
batchHelper.addBatch(tuple);
LOG.debug("Added mutation to the batch; size={}", batchHelper.getBatchSize());
}
use of org.apache.metron.hbase.ColumnList in project metron by apache.
the class ValueOnlyColumnBuilder method columns.
@Override
public ColumnList columns(ProfileMeasurement measurement) {
ColumnList cols = new ColumnList();
cols.addColumn(columnFamilyBytes, getColumnQualifier("value"), SerDeUtils.toBytes(measurement.getProfileValue()));
return cols;
}
use of org.apache.metron.hbase.ColumnList in project metron by apache.
the class HBaseClientTest method setupTuples.
@BeforeEach
public void setupTuples() {
rowKey1 = Bytes.toBytes("rowKey1");
cols1 = new ColumnList();
cols1.addColumn(cf, column, value1);
rowKey2 = Bytes.toBytes("rowKey2");
cols2 = new ColumnList();
cols2.addColumn(cf, column, value2);
}
use of org.apache.metron.hbase.ColumnList in project metron by apache.
the class WidgetMapper method columns.
@Override
public ColumnList columns(Tuple tuple) {
Widget w = (Widget) tuple.getValueByField("widget");
ColumnList cols = new ColumnList();
cols.addColumn(CF, QNAME, Bytes.toBytes(w.getName()));
cols.addColumn(CF, QCOST, Bytes.toBytes(w.getCost()));
return cols;
}
Aggregations