org.apache.cassandra.service.pager

## Class PartitionRangeQueryPager

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

- All Implemented Interfaces:
    QueryPager

      public class PartitionRangeQueryPager
      extends java.lang.Object

  Pages a PartitionRangeReadCommand. Note: this only work for CQL3 queries for now (because thrift queries expect a different limit on the rows than on the columns, which complicates it).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ReadCommand` | `command`
    `protected DataLimits` | `limits`
    `protected ProtocolVersion` | `protocolVersion`

    - ### Fields inherited from interface org.apache.cassandra.service.pager.QueryPager

      `EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PartitionRangeQueryPager(PartitionRangeReadCommand command, PagingState state, ProtocolVersion protocolVersion)`
    `PartitionRangeQueryPager(ReadCommand command, ProtocolVersion protocolVersion, DecoratedKey lastReturnedKey, PagingState.RowMark lastReturnedRow, int remaining, int remainingInPartition)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ReadExecutionController` | `executionController()` Starts a new read operation.
    `PartitionIterator` | `fetchPage(int pageSize, ConsistencyLevel consistency, ClientState clientState, long queryStartNanoTime)` Fetches the next page.
    `PartitionIterator` | `fetchPageInternal(int pageSize, ReadExecutionController executionController)` Fetches the next page internally (in other, this does a local query).
    `UnfilteredPartitionIterator` | `fetchPageUnfiltered(CFMetaData cfm, int pageSize, ReadExecutionController executionController)`
    `boolean` | `isExhausted()` Whether or not this pager is exhausted, i.e.
    `protected boolean` | `isPreviouslyReturnedPartition(DecoratedKey key)`
    `int` | `maxRemaining()` The maximum number of cells/CQL3 row that we may still have to return.
    `protected ReadCommand` | `nextPageReadCommand(int pageSize)`
    `protected void` | `recordLast(DecoratedKey key, Row last)`
    `protected int` | `remainingInPartition()`
    `protected void` | `restoreState(DecoratedKey lastKey, int remaining, int remainingInPartition)`
    `PagingState` | `state()` Get the current state of the pager.
    `PartitionRangeQueryPager` | `withUpdatedLimit(DataLimits newLimits)` Creates a new `QueryPager` that use the new limits.

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

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

- - ### Field Detail

    - #### command

          protected final ReadCommand command

    - #### limits

          protected final DataLimits limits

    - #### protocolVersion

          protected final ProtocolVersion protocolVersion

  - ### Constructor Detail

    - #### PartitionRangeQueryPager

          public PartitionRangeQueryPager(PartitionRangeReadCommand command,
                                          PagingState state,
                                          ProtocolVersion protocolVersion)

    - #### PartitionRangeQueryPager

          public PartitionRangeQueryPager(ReadCommand command,
                                          ProtocolVersion protocolVersion,
                                          DecoratedKey lastReturnedKey,
                                          PagingState.RowMark lastReturnedRow,
                                          int remaining,
                                          int remainingInPartition)

  - ### Method Detail

    - #### withUpdatedLimit

          public PartitionRangeQueryPager withUpdatedLimit(DataLimits newLimits)

      Description copied from interface: `QueryPager`
      Creates a new `QueryPager` that use the new limits.
      Parameters:
        `newLimits` - the new limits
      Returns:
        a new `QueryPager` that use the new limits

    - #### 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.
      Returns:
        the current paging state. Will return null if paging is at the beginning. If the pager is exhausted, the result is undefined.

    - #### nextPageReadCommand

          protected ReadCommand nextPageReadCommand(int pageSize)
                                             throws RequestExecutionException

      Throws:
        `RequestExecutionException`

    - #### recordLast

          protected void recordLast(DecoratedKey key,
                                    Row last)

    - #### isPreviouslyReturnedPartition

          protected boolean isPreviouslyReturnedPartition(DecoratedKey key)

    - #### executionController

          public ReadExecutionController executionController()

      Description copied from interface: `QueryPager`
      Starts a new read operation.

      This must be called before `fetchPageInternal` and passed to it to protect the read. The returned object must be closed on all path and it is thus strongly advised to use it in a try-with-ressource construction.

      Specified by:
        `executionController` in interface `QueryPager`
      Returns:
        a newly started order group for this `QueryPager`.

    - #### fetchPage

          public PartitionIterator fetchPage(int pageSize,
                                             ConsistencyLevel consistency,
                                             ClientState clientState,
                                             long queryStartNanoTime)

      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.
        `consistency` - the consistency level to achieve for the query.
        `clientState` - the `ClientState` for the query. In practice, this can be null unless `consistency` is a serial consistency.
      Returns:
        the page of result.

    - #### fetchPageInternal

          public PartitionIterator fetchPageInternal(int pageSize,
                                                     ReadExecutionController executionController)

      Description copied from interface: `QueryPager`
      Fetches the next page internally (in other, this does a local query).
      Specified by:
        `fetchPageInternal` in interface `QueryPager`
      Parameters:
        `pageSize` - the maximum number of elements to return in the next page.
        `executionController` - the `ReadExecutionController` protecting the read.
      Returns:
        the page of result.

    - #### fetchPageUnfiltered

          public UnfilteredPartitionIterator fetchPageUnfiltered(CFMetaData cfm,
                                                                 int pageSize,
                                                                 ReadExecutionController executionController)

    - #### restoreState

          protected void restoreState(DecoratedKey lastKey,
                                      int remaining,
                                      int remainingInPartition)

    - #### 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`

    - #### remainingInPartition

          protected int remainingInPartition()

Copyright © 2018 The Apache Software Foundation