Java Code Examples for me.prettyprint.hector.api.factory.HFactory#createColumn()

The following examples show how to use me.prettyprint.hector.api.factory.HFactory#createColumn() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpsEventDao.java    From oneops with Apache License 2.0 6 votes vote down vote up
/**
 * Add OpsEvent for the given ciId
 *
 * @param ciId
 * @param eventName
 * @param eventId
 * @param ciState
 * @return
 */
public boolean addOpenEventForCi(long ciId, String eventName, long eventId, String ciState) {
    boolean isNew = false;
    long lastOpenId = getCiOpenEventId(ciId, eventName);

    if (lastOpenId == 0) {
        List<HColumn<String, byte[]>> subCols = new ArrayList<>();

        HColumn<String, byte[]> eventIdCol = HFactory.createColumn("id", longSerializer.toBytes(eventId), stringSerializer, bytesSerializer);
        HColumn<String, byte[]> eventStateCol = HFactory.createColumn("state", ciState.getBytes(), stringSerializer, bytesSerializer);
        subCols.add(eventIdCol);
        subCols.add(eventStateCol);

        ciMutator.insert(ciId,
                SchemaBuilder.CI_OPEN_EVENTS_CF,
                HFactory.createSuperColumn(eventName, subCols, stringSerializer, stringSerializer, bytesSerializer));
        isNew = true;
    }
    logger.debug("there is already an open event for" + ciId + " " + eventName + " lastOpenId " + lastOpenId);

    return isNew;
}
 
Example 2
Source File: OpsEventDao.java    From oneops with Apache License 2.0 5 votes vote down vote up
public void addOrphanCloseEventForCi(long ciId, String eventName, long manifestId, String openEvent) {
	String event = getOrphanCloseEventForCi(ciId, eventName, manifestId);
	if (event == null) {
		List<HColumn<String, byte[]>> subCols = new ArrayList<>();

		HColumn<String, byte[]> payloadCol = HFactory.createColumn(eventName, openEvent.getBytes(),
				stringSerializer, bytesSerializer);
		subCols.add(payloadCol);

		orphanCloseMutator.insert(ciId, SchemaBuilder.ORPHAN_CLOSE_EVENTS_CF, HFactory.createSuperColumn(manifestId,
				subCols, longSerializer, stringSerializer, bytesSerializer));
	}
}
 
Example 3
Source File: ThresholdsDao.java    From oneops with Apache License 2.0 5 votes vote down vote up
private HColumn<Long, Long> createDataColumn(Long colName, Long value) {
    if (value != null) {
        return HFactory.createColumn(colName, value, longSerializer, longSerializer);
    } else {
        return HFactory.createColumn(colName, Long.MIN_VALUE, longSerializer, longSerializer);
    }
}
 
Example 4
Source File: CassandraUtils.java    From archiva with Apache License 2.0 5 votes vote down vote up
public static <A, B> HColumn<A, B> column( final A name, final B value )
{

    return HFactory.createColumn( name, //
                                  value, //
        SerializerTypeInferer.getSerializer( name ), //
        SerializerTypeInferer.getSerializer( value ) );
}
 
Example 5
Source File: PerfDataAccessor.java    From oneops with Apache License 2.0 4 votes vote down vote up
/**
 * sets the long timestamp, double value of a given metric-instance:rra
 */
private HColumn<Long, Double> createDataColumn(long name, double value) {
    return HFactory.createColumn(name, value, longSerializer,
            doubleSerializer);
}
 
Example 6
Source File: ThresholdsDao.java    From oneops with Apache License 2.0 4 votes vote down vote up
private HColumn<String, Long> createDataColumn(String colName, Long value) {
    return HFactory.createColumn(colName, value, stringSerializer, longSerializer);
}
 
Example 7
Source File: OpsEventDao.java    From oneops with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the long timestamp, string value of a given event
 *
 * @param timestamp
 * @param value
 * @return hector data column
 */
private HColumn<Long, String> createDataColumn(Long timestamp, String value) {
    return HFactory.createColumn(timestamp, value, longSerializer, stringSerializer);
}
 
Example 8
Source File: OpsCiStateDao.java    From oneops with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the long timestamp, string value of a given event
 *
 * @param timestamp
 * @param value
 * @return
 */
private HColumn<Long, String> createDataColumn(Long timestamp, String value) {
    return HFactory.createColumn(timestamp, value, longSerializer, stringSerializer);
}