Search in sources :

Example 1 with PagingState

use of org.apache.cassandra.service.pager.PagingState in project cassandra by apache.

the class Util method makeSomePagingState.

public static PagingState makeSomePagingState(ProtocolVersion protocolVersion) {
    TableMetadata metadata = TableMetadata.builder("ks", "tbl").addPartitionKeyColumn("k", AsciiType.instance).addClusteringColumn("c1", AsciiType.instance).addClusteringColumn("c2", Int32Type.instance).addRegularColumn("myCol", AsciiType.instance).build();
    ByteBuffer pk = ByteBufferUtil.bytes("someKey");
    ColumnMetadata def = metadata.getColumn(new ColumnIdentifier("myCol", false));
    Clustering c = Clustering.make(ByteBufferUtil.bytes("c1"), ByteBufferUtil.bytes(42));
    Row row = BTreeRow.singleCellRow(c, BufferCell.live(def, 0, ByteBufferUtil.EMPTY_BYTE_BUFFER));
    PagingState.RowMark mark = PagingState.RowMark.create(metadata, row, protocolVersion);
    return new PagingState(pk, mark, 10, 0);
}
Also used : TableMetadata(org.apache.cassandra.schema.TableMetadata) ColumnMetadata(org.apache.cassandra.schema.ColumnMetadata) ColumnIdentifier(org.apache.cassandra.cql3.ColumnIdentifier) ByteBuffer(java.nio.ByteBuffer) PagingState(org.apache.cassandra.service.pager.PagingState)

Aggregations

ByteBuffer (java.nio.ByteBuffer)1 ColumnIdentifier (org.apache.cassandra.cql3.ColumnIdentifier)1 ColumnMetadata (org.apache.cassandra.schema.ColumnMetadata)1 TableMetadata (org.apache.cassandra.schema.TableMetadata)1 PagingState (org.apache.cassandra.service.pager.PagingState)1