Java Code Examples for org.apache.cassandra.thrift.KeyRange#setCount()

The following examples show how to use org.apache.cassandra.thrift.KeyRange#setCount() . 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: CassandraDefs.java    From Doradus with Apache License 2.0 5 votes vote down vote up
/**
 * Create a KeyRange that begins at the given row key.
 * 
 * @param startRowKey   Starting row key as a byte[].
 * @return              KeyRange that starts at the given row, open-ended.
 */
static KeyRange keyRangeStartRow(byte[] startRowKey) {
    KeyRange keyRange = new KeyRange();
    keyRange.setStart_key(startRowKey);
    keyRange.setEnd_key(EMPTY_BYTE_BUFFER);
    keyRange.setCount(MAX_ROWS_BATCH_SIZE);
    return keyRange;
}
 
Example 2
Source File: CassandraDefs.java    From Doradus with Apache License 2.0 5 votes vote down vote up
static KeyRange keyRangeStartRow(byte[] startRowKey, int count) {
    KeyRange keyRange = new KeyRange();
    keyRange.setStart_key(startRowKey == null ? EMPTY_BYTES : startRowKey);
    keyRange.setEnd_key(EMPTY_BYTES);
    keyRange.setCount(count);
    return keyRange;
}
 
Example 3
Source File: CassandraDefs.java    From Doradus with Apache License 2.0 5 votes vote down vote up
/**
 * Create a KeyRange that selects a single row with the given key.
 * 
 * @param rowKey    Row key as a byte[].
 * @return          KeyRange that starts and ends with the given key.
 */
static KeyRange keyRangeSingleRow(byte[] rowKey) {
    KeyRange keyRange = new KeyRange();
    keyRange.setStart_key(rowKey);
    keyRange.setEnd_key(rowKey);
    keyRange.setCount(1);
    return keyRange;
}