Package org.neo4j.gds.core.loading
Class ScanState
- java.lang.Object
-
- org.neo4j.gds.core.loading.ScanState
-
public final class ScanState extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ScanState
of()
<Reference>
booleanscan(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 providedStoreScanner.RecordConsumer
.
-
-
-
Method Detail
-
of
public static ScanState of()
-
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 providedStoreScanner.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 thescan
method returnstrue
, the consumer needs to be flushed.- Parameters:
cursor
- A wrapper around aCursor
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 toscan
.false
if there is no more data. It is expected that oncescan
returnsfalse
, it will never returntrue
afterward.
-
-