Class ScanState


  • public final class ScanState
    extends java.lang.Object
    • Method Detail

      • scan

        @Contract(mutates="this")
        public <Reference> boolean scan​(StoreScanner.ScanCursor<Reference> cursor,
                                        StoreScanner.RecordConsumer<? super Reference> consumer)
        Advances the provided scan to the next batch of records and immediately consumes the batch into the provided StoreScanner.RecordConsumer.
        There are two scenarios that can happen while consuming a batch of records from the kernel. If we read in fixed-size batches, these batches usually align with the buffer size and once we consumed the whole batch, the buffers can be flushed to the importer tasks. In the second scenario, we read from partitioned index scans which have varying sizes for partitions that might also exceed the size of the buffer. In that scenario, we need to flush the buffer before we advance to the next batch. The two scenarios are handled internally, as long as the scan method returns true, the consumer needs to be flushed.
        Parameters:
        cursor - A wrapper around a Cursor that allows us to consume the records in batches.
        consumer - A consumer of records.
        Returns:
        true if there is some data in the batch that needs to be consumed before the next call to scan. false if there is no more data. It is expected that once scan returns false, it will never return true afterward.