@API(value=EXPERIMENTAL) public class SizeStatisticsCollectorCursor extends Object implements RecordCursor<SizeStatisticsCollectorCursor.SizeStatisticsResults>
Note that the cursor emits only a single cursor result containing a value. That value represents full statistics for all keys and values in the specified subspace. Any cursor results emitted prior to that are a manifestation of hitting an execution limit while scanning the subspace. These results provide a continuation that can be used to resume aggregating the remaining keys and values of the subspace.
Modifier and Type | Class and Description |
---|---|
static class |
SizeStatisticsCollectorCursor.SizeStatisticsResults
Encapsulates the distribution statistics returned by a SizeStatisticsCollectorCursor.
|
RecordCursor.NoNextReason
Modifier and Type | Method and Description |
---|---|
boolean |
accept(RecordCursorVisitor visitor)
Accept a visit from hierarchical visitor, which implements
RecordCursorVisitor . |
void |
close() |
byte[] |
getContinuation()
Deprecated.
|
Executor |
getExecutor() |
RecordCursor.NoNextReason |
getNoNextReason()
Deprecated.
|
SizeStatisticsCollectorCursor.SizeStatisticsResults |
next()
Deprecated.
|
static SizeStatisticsCollectorCursor |
ofIndex(FDBRecordStore store,
Index index,
FDBRecordContext context,
ScanProperties scanProperties,
byte[] continuation)
Create a statistics collector cursor of all keys used by index within a given
FDBRecordStore . |
static SizeStatisticsCollectorCursor |
ofIndex(FDBRecordStore store,
String indexName,
FDBRecordContext context,
ScanProperties scanProperties,
byte[] continuation)
Create a statistics collector cursor of all keys used by index within a given
FDBRecordStore . |
static SizeStatisticsCollectorCursor |
ofRecords(FDBRecordStore store,
FDBRecordContext context,
ScanProperties scanProperties,
byte[] continuation)
Create a statistics collector cursor of all records stored within a given
FDBRecordStore . |
static SizeStatisticsCollectorCursor |
ofStore(FDBRecordStore store,
FDBRecordContext context,
ScanProperties scanProperties,
byte[] continuation)
Create a statistics collector cursor of all keys used by a given
FDBRecordStore . |
static SizeStatisticsCollectorCursor |
ofSubspace(Subspace subspace,
FDBRecordContext context,
ScanProperties scanProperties,
byte[] continuation)
Create a statistics collector cursor of all keys used by index within a given
Subspace . |
CompletableFuture<Boolean> |
onHasNext()
Deprecated.
|
CompletableFuture<RecordCursorResult<SizeStatisticsCollectorCursor.SizeStatisticsResults>> |
onNext()
Asynchronously return the next result from this cursor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asIterator, asList, empty, empty, filter, filterAsync, filterAsyncInstrumented, filterAsyncInstrumented, filterInstrumented, filterInstrumented, first, flatMapPipelined, flatMapPipelined, flatMapPipelined, forEach, forEachAsync, forEachResult, forEachResultAsync, fromFuture, fromFuture, fromIterator, fromIterator, fromList, fromList, fromList, fromList, getCount, getNext, hasNext, limitRowsTo, limitTo, map, mapEffect, mapEffect, mapFuture, mapPipelined, orElse, reduce, skip, skipThenLimit
forEachRemaining, remove
@Nonnull public CompletableFuture<RecordCursorResult<SizeStatisticsCollectorCursor.SizeStatisticsResults>> onNext()
RecordCursor
RecordCursorResult
, which represents exactly one of the following:
T
produced by the cursor. In addition to the next record, this result
includes a RecordCursorContinuation
that can be used to continue the cursor after the last record
returned. The returned continuation is guaranteed not to be an "end continuation" representing the end of
the cursor: specifically, RecordCursorContinuation.isEnd()
is always false
on the returned
continuation.
RecordCursor.NoNextReason
that
explains why no record could be produced. The result include a continuation that can be used to continue
the cursor after the last record returned.
If the result's NoNextReason
is anything other than RecordCursor.NoNextReason.SOURCE_EXHAUSTED
, the
returned continuation must not be an end continuation. Conversely, if the result's NoNextReason
is SOURCE_EXHAUSTED
, then the returned continuation must be an an "end continuation".
RecordCursorContinuation
can be serialized to an opaque byte array using
RecordCursorContinuation.toBytes()
. This can be passed back into a new cursor of the same type, with all
other parameters remaining the same.onNext
in interface RecordCursor<SizeStatisticsCollectorCursor.SizeStatisticsResults>
RecordCursorResult
,
RecordCursorContinuation
@Nonnull public Executor getExecutor()
getExecutor
in interface RecordCursor<SizeStatisticsCollectorCursor.SizeStatisticsResults>
@Nonnull public boolean accept(@Nonnull RecordCursorVisitor visitor)
RecordCursor
RecordCursorVisitor
.
By contract, implementations of this method must return the value of visitor.visitLeave(this)
,
which determines whether or not subsequent siblings of this cursor should be visited.accept
in interface RecordCursor<SizeStatisticsCollectorCursor.SizeStatisticsResults>
visitor
- a hierarchical visitortrue
if the subsequent siblings of the cursor
should be visited, and false
otherwise@Nonnull @Deprecated public CompletableFuture<Boolean> onHasNext()
RecordCursor
onHasNext
in interface RecordCursor<SizeStatisticsCollectorCursor.SizeStatisticsResults>
true
if RecordCursor.next()
would return a record.AsyncIterator.onHasNext()
@Nullable @Deprecated public SizeStatisticsCollectorCursor.SizeStatisticsResults next()
RecordCursor
next
in interface RecordCursor<SizeStatisticsCollectorCursor.SizeStatisticsResults>
next
in interface Iterator<SizeStatisticsCollectorCursor.SizeStatisticsResults>
@Nullable @Deprecated public byte[] getContinuation()
RecordCursor
getContinuation
in interface RecordCursor<SizeStatisticsCollectorCursor.SizeStatisticsResults>
null
if the underlying source is completely exhausted, independent of any limit
passed to the cursor creator. Since such creators generally accept null
to mean no continuation,
that is, start from the beginning, one must check for null
from getContinuation
to
keep from starting over.
Result is not always defined if called before onHasNext
or before next
after
onHasNext
has returned true
. That is, a continuation is only guaranteed when called
"between" records from a while (hasNext) next
loop or after its end.@Nonnull @Deprecated public RecordCursor.NoNextReason getNoNextReason()
RecordCursor
false
for RecordCursor.hasNext()
.
If hasNext
was not called or returned true
last time, the result is undefined and
may be an exception.getNoNextReason
in interface RecordCursor<SizeStatisticsCollectorCursor.SizeStatisticsResults>
public void close()
close
in interface RecordCursor<SizeStatisticsCollectorCursor.SizeStatisticsResults>
close
in interface AutoCloseable
@Nonnull public static SizeStatisticsCollectorCursor ofStore(@Nonnull FDBRecordStore store, @Nonnull FDBRecordContext context, @Nonnull ScanProperties scanProperties, @Nullable byte[] continuation)
FDBRecordStore
.
This includes records, indexes, and other meta-data.store
- the store from which to collect statistics on key and value sizescontext
- the transaction context under which stats collection occursscanProperties
- scan direction, limits, etc. under which underlying record store scan is performedcontinuation
- the starting cursor location to start stats collection@Nonnull public static SizeStatisticsCollectorCursor ofRecords(@Nonnull FDBRecordStore store, @Nonnull FDBRecordContext context, @Nonnull ScanProperties scanProperties, @Nullable byte[] continuation)
FDBRecordStore
.
This only looks at the records stored by that store, not any indexes.store
- the store from which to collect statistics on key and value sizescontext
- the transaction context under which stats collection occursscanProperties
- scan direction, limits, etc. under which underlying record store scan is performedcontinuation
- the starting cursor location to start stats collection@Nonnull public static SizeStatisticsCollectorCursor ofIndex(@Nonnull FDBRecordStore store, @Nonnull String indexName, @Nonnull FDBRecordContext context, @Nonnull ScanProperties scanProperties, @Nullable byte[] continuation)
FDBRecordStore
.
This includes only the key-value pairs within the index's primary subspace.store
- a store with the given indexindexName
- the name of the index to collect statistics on key and value sizescontext
- the transaction context under which stats collection occursscanProperties
- scan direction, limits, etc. under which underlying record store scan is performedcontinuation
- the starting cursor location to start stats collection@Nonnull public static SizeStatisticsCollectorCursor ofIndex(@Nonnull FDBRecordStore store, @Nonnull Index index, @Nonnull FDBRecordContext context, @Nonnull ScanProperties scanProperties, @Nullable byte[] continuation)
FDBRecordStore
.
This includes only the key-value pairs within the index's primary subspace.store
- a store with the given indexindex
- the index to collect statistics on key and value sizescontext
- the transaction context under which stats collection occursscanProperties
- scan direction, limits, etc. under which underlying record store scan is performedcontinuation
- the starting cursor location to start stats collection@Nonnull public static SizeStatisticsCollectorCursor ofSubspace(@Nonnull Subspace subspace, @Nonnull FDBRecordContext context, @Nonnull ScanProperties scanProperties, @Nullable byte[] continuation)
Subspace
.subspace
- the subspace to collect statistics on key and value sizescontext
- the transaction context under which stats collection occursscanProperties
- scan direction, limits, etc. under which underlying record store scan is performedcontinuation
- the starting cursor location to start stats collection