本文整理汇总了Java中me.prettyprint.hector.api.query.SliceQuery.execute方法的典型用法代码示例。如果您正苦于以下问题:Java SliceQuery.execute方法的具体用法?Java SliceQuery.execute怎么用?Java SliceQuery.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.prettyprint.hector.api.query.SliceQuery
的用法示例。
在下文中一共展示了SliceQuery.execute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCiStateHistory
import me.prettyprint.hector.api.query.SliceQuery; //导入方法依赖的package包/类
public List<CiChangeStateEvent> getCiStateHistory(long ciId, Long startTime, Long endTime, Integer count) {
if (count == null) count = 1000;
List<CiChangeStateEvent> states = new ArrayList<CiChangeStateEvent>();
SliceQuery<Long, Long, String> sliceQuery = HFactory.createSliceQuery(keyspace, longSerializer, longSerializer, stringSerializer);
sliceQuery.setColumnFamily(SchemaBuilder.CI_STATE_HIST_CF);
sliceQuery.setRange(startTime, endTime, false, count);
sliceQuery.setKey(ciId);
QueryResult<ColumnSlice<Long, String>> result = sliceQuery.execute();
ColumnSlice<Long, String> resultCols = result.get();
for (HColumn<Long, String> col : resultCols.getColumns()) {
CiChangeStateEvent event = gson.fromJson(col.getValue(), CiChangeStateEvent.class);
states.add(event);
}
return states;
}
示例2: getMessage
import me.prettyprint.hector.api.query.SliceQuery; //导入方法依赖的package包/类
@Override
public Message getMessage( UUID messageId ) {
SliceQuery<UUID, String, ByteBuffer> q =
createSliceQuery( cass.getApplicationKeyspace( applicationId ), ue, se, be );
q.setColumnFamily( MESSAGE_PROPERTIES.getColumnFamily() );
q.setKey( messageId );
q.setRange( null, null, false, ALL_COUNT );
QueryResult<ColumnSlice<String, ByteBuffer>> r = q.execute();
ColumnSlice<String, ByteBuffer> slice = r.get();
List<HColumn<String, ByteBuffer>> results = slice.getColumns();
return deserializeMessage( results );
}
示例3: getQueue
import me.prettyprint.hector.api.query.SliceQuery; //导入方法依赖的package包/类
public Queue getQueue( String queuePath, UUID queueId ) {
SliceQuery<UUID, String, ByteBuffer> q =
createSliceQuery( cass.getApplicationKeyspace( applicationId ), ue, se, be );
q.setColumnFamily( QUEUE_PROPERTIES.getColumnFamily() );
q.setKey( queueId );
q.setRange( null, null, false, ALL_COUNT );
QueryResult<ColumnSlice<String, ByteBuffer>> r = q.execute();
ColumnSlice<String, ByteBuffer> slice = r.get();
List<HColumn<String, ByteBuffer>> results = slice.getColumns();
return deserializeQueue( results );
}
示例4: getAllColumns
import me.prettyprint.hector.api.query.SliceQuery; //导入方法依赖的package包/类
/**
* Gets the columns.
*
* @param ko the keyspace
* @param columnFamily the column family
* @param key the key
*
* @return columns
*
* @throws Exception the exception
*/
public <N, V> List<HColumn<N, V>> getAllColumns( Keyspace ko, Object columnFamily, Object key,
Serializer<N> nameSerializer, Serializer<V> valueSerializer )
throws Exception {
if ( db_logger.isTraceEnabled() ) {
db_logger.trace( "getColumns cf={} key={}", columnFamily, key );
}
SliceQuery<ByteBuffer, N, V> q = createSliceQuery( ko, be, nameSerializer, valueSerializer );
q.setColumnFamily( columnFamily.toString() );
q.setKey( bytebuffer( key ) );
q.setRange( null, null, false, ALL_COUNT );
QueryResult<ColumnSlice<N, V>> r = q.execute();
ColumnSlice<N, V> slice = r.get();
List<HColumn<N, V>> results = slice.getColumns();
if ( db_logger.isTraceEnabled() ) {
if ( results == null ) {
db_logger.trace( "getColumns returned null" );
}
else {
db_logger.trace( "getColumns returned {} columns", results.size() );
}
}
return results;
}
示例5: getColumns
import me.prettyprint.hector.api.query.SliceQuery; //导入方法依赖的package包/类
/**
* Gets the columns.
*
* @param ko the keyspace
* @param columnFamily the column family
* @param key the key
* @param columnNames the column names
*
* @return columns
*
* @throws Exception the exception
*/
@SuppressWarnings("unchecked")
public <N, V> List<HColumn<N, V>> getColumns( Keyspace ko, Object columnFamily, Object key, Set<String> columnNames,
Serializer<N> nameSerializer, Serializer<V> valueSerializer )
throws Exception {
if ( db_logger.isTraceEnabled() ) {
db_logger.trace( "getColumns cf={} key={} names={}", columnFamily, key, columnNames );
}
SliceQuery<ByteBuffer, N, V> q = createSliceQuery( ko, be, nameSerializer, valueSerializer );
q.setColumnFamily( columnFamily.toString() );
q.setKey( bytebuffer( key ) );
// q.setColumnNames(columnNames.toArray(new String[0]));
q.setColumnNames( ( N[] ) nameSerializer.fromBytesSet( se.toBytesSet( new ArrayList<String>( columnNames ) ) )
.toArray() );
QueryResult<ColumnSlice<N, V>> r = q.execute();
ColumnSlice<N, V> slice = r.get();
List<HColumn<N, V>> results = slice.getColumns();
if ( db_logger.isTraceEnabled() ) {
if ( results == null ) {
db_logger.trace( "getColumns returned null" );
}
else {
db_logger.trace( "getColumns returned {} columns", results.size());
}
}
return results;
}