org.apache.cassandra.service.pager

## Class SliceQueryPager

- java.lang.Object
- - org.apache.cassandra.service.pager.SliceQueryPager

All Implemented Interfaces:
  QueryPager, SinglePartitionPager

    public class SliceQueryPager
    extends java.lang.Object
    implements SinglePartitionPager

Pager over a SliceFromReadCommand.

### Field Summary

Fields
`protected CFMetaData` `cfm`
`protected IDiskAtomFilter` `columnFilter`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`ColumnCounter` `columnCounter()`
`protected boolean` `containsPreviousLast(Row first)` Checks to see if the first row of a new page contains the last row from the previous page.
`java.util.List<Row>` `fetchPage(int pageSize)` Fetches the next page.
`protected Cell` `firstNonStaticCell(ColumnFamily cf)` Returns the first non-static cell in the ColumnFamily.
`boolean` `isExhausted()` Whether or not this pager is exhausted, i.e.
`protected boolean` `isReversed()`
`java.nio.ByteBuffer` `key()`
`protected static Cell` `lastCell(ColumnFamily cf)`
`int` `maxRemaining()` The maximum number of cells/CQL3 row that we may still have to return.
`protected java.util.List<Row>` `queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery)`
`protected boolean` `recordLast(Row last)` Saves the paging state by recording the last seen partition key and cell name (where applicable).
`protected void` `restoreState(int remaining, boolean shouldFetchExtraRow)`
`PagingState` `state()` Get the current state of the pager.
`long` `timestamp()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.cassandra.service.pager.SinglePartitionPager

`columnCounter`

### Methods inherited from interface org.apache.cassandra.service.pager.QueryPager

`fetchPage, isExhausted, maxRemaining`

### Field Detail

#### cfm

    protected final CFMetaData cfm

#### columnFilter

    protected final IDiskAtomFilter columnFilter

### Method Detail

#### key

    public java.nio.ByteBuffer key()

Specified by:
  `key` in interface `SinglePartitionPager`

#### state

    public PagingState state()

Description copied from interface: `QueryPager`
Get the current state of the pager. The state can allow to restart the paging on another host from where we are at this point.

Specified by:
  `state` in interface `QueryPager`
Returns:
  the current paging state. Will return null if paging is at the beginning. If the pager is exhausted, the result is undefined.

#### queryNextPage

    protected java.util.List<Row> queryNextPage(int pageSize,
                                                ConsistencyLevel consistencyLevel,
                                                boolean localQuery)
                                         throws RequestValidationException,
                                                RequestExecutionException

Throws:
  `RequestValidationException`
  `RequestExecutionException`

#### containsPreviousLast

    protected boolean containsPreviousLast(Row first)

Checks to see if the first row of a new page contains the last row from the previous page.

Parameters:
  `first` - the first row of the new page
Returns:
  true if `first` contains the last from from the previous page and it is live, false otherwise

#### recordLast

    protected boolean recordLast(Row last)

Saves the paging state by recording the last seen partition key and cell name (where applicable).

Parameters:
  `last` - the last row in the current page
Returns:
  true if an extra row should be fetched in the next page,false otherwise

#### isReversed

    protected boolean isReversed()

#### fetchPage

    public java.util.List<Row> fetchPage(int pageSize)
                                  throws RequestValidationException,
                                         RequestExecutionException

Description copied from interface: `QueryPager`
Fetches the next page.

Specified by:
  `fetchPage` in interface `QueryPager`
Parameters:
  `pageSize` - the maximum number of elements to return in the next page.
Returns:
  the page of result.
Throws:
  `RequestValidationException`
  `RequestExecutionException`

#### restoreState

    protected void restoreState(int remaining,
                                boolean shouldFetchExtraRow)

#### isExhausted

    public boolean isExhausted()

Description copied from interface: `QueryPager`
Whether or not this pager is exhausted, i.e. whether or not a call to fetchPage may return more result.

Specified by:
  `isExhausted` in interface `QueryPager`
Returns:
  whether the pager is exhausted.

#### maxRemaining

    public int maxRemaining()

Description copied from interface: `QueryPager`
The maximum number of cells/CQL3 row that we may still have to return. In other words, that's the initial user limit minus what we've already returned (note that it's not how many we *will* return, just the upper limit on it).

Specified by:
  `maxRemaining` in interface `QueryPager`

#### timestamp

    public long timestamp()

#### columnCounter

    public ColumnCounter columnCounter()

#### firstNonStaticCell

    protected Cell firstNonStaticCell(ColumnFamily cf)

Returns the first non-static cell in the ColumnFamily. This is necessary to avoid recording a static column as the "last" cell seen in a reversed query. Because we will always query static columns alongside the normal data for a page, they are not a good indicator of where paging should resume. When we begin the next page, we need to start from the last non-static cell.

#### lastCell

    protected static Cell lastCell(ColumnFamily cf)