Package io.tarantool.driver.api.cursor
Class TarantoolCursorBase<T extends Packable,R extends Collection<T>>
- java.lang.Object
-
- io.tarantool.driver.api.cursor.TarantoolCursorBase<T,R>
-
- All Implemented Interfaces:
TarantoolCursor<T>
- Direct Known Subclasses:
OffsetCursor
,StartAfterCursor
public abstract class TarantoolCursorBase<T extends Packable,R extends Collection<T>> extends Object implements TarantoolCursor<T>
Generic cursor implementation that performs client calls with TarantoolSpaceOperations.
-
-
Constructor Summary
Constructors Constructor Description TarantoolCursorBase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
advanceIterator()
protected static long
calcLimit(long conditionLimit, long batchSize, long spaceOffset)
If batchSize is less than condition limit we need to recalculate limit for each batch.protected abstract void
fetchNextTuples()
T
get()
protected abstract T
getCurrentValue()
boolean
next()
Fetch next element.
-
-
-
Method Detail
-
fetchNextTuples
protected abstract void fetchNextTuples()
-
advanceIterator
protected abstract boolean advanceIterator()
-
getCurrentValue
protected abstract T getCurrentValue()
-
calcLimit
protected static long calcLimit(long conditionLimit, long batchSize, long spaceOffset)
If batchSize is less than condition limit we need to recalculate limit for each batch.- Parameters:
conditionLimit
- initial limit (specified in condition)batchSize
- size of a batchspaceOffset
- current count of fetched elements- Returns:
- effective limit for the current batch
-
next
public boolean next() throws TarantoolClientException
Description copied from interface:TarantoolCursor
Fetch next element.- Specified by:
next
in interfaceTarantoolCursor<T extends Packable>
- Returns:
- true if element was fetched, false if no elements left.
- Throws:
TarantoolClientException
- if the request to server failed.
-
get
public T get() throws TarantoolSpaceOperationException
- Specified by:
get
in interfaceTarantoolCursor<T extends Packable>
- Returns:
- current element or null if cursor is not initialized
- Throws:
TarantoolSpaceOperationException
- when no data is available
-
-