- All Implemented Interfaces:
ResultCursor,DriverResponseHandler,org.neo4j.driver.internal.FailableCursor
-
Nested Class Summary
Nested classes/interfaces inherited from class org.neo4j.driver.internal.cursor.AbstractRecordStateResponseHandler
AbstractRecordStateResponseHandler.RecordState -
Field Summary
FieldsFields inherited from class org.neo4j.driver.internal.cursor.AbstractRecordStateResponseHandler
recordState -
Constructor Summary
ConstructorsConstructorDescriptionResultCursorImpl(DriverBoltConnection boltConnection, Query query, long fetchSize, Consumer<org.neo4j.driver.internal.DatabaseBookmark> bookmarkConsumer, boolean closeOnSummary, CompletableFuture<UnmanagedTransaction> beginFuture, Consumer<String> databaseNameConsumer, ApiTelemetryWork apiTelemetryWork, DriverObservationProvider observationProvider, Class<?> resultType) -
Method Summary
Modifier and TypeMethodDescriptionAsynchronously retrieve the result summary.consumed()discardAllFailureAsync(Observation parentObservation) Discarding all unconsumed records and returning failure if there is any pull errors.forEachAsync(Consumer<Record> action) Asynchronously apply the givenactionto every record in the result, yielding a summary of it.Determine if result is open.keys()Retrieve the keys of the records this result cursor contains.Asynchronously retrieve and store the entire result stream.<T> CompletionStage<List<T>> Asynchronously retrieve and store a projection of the entire result.Asynchronously navigate to and retrieve the nextRecordin this result.voidonBeginSummary(org.neo4j.bolt.connection.summary.BeginSummary summary) voidvoidonDiscardSummary(DiscardSummary summary) voidvoidvoidonPullSummary(PullSummary summary) voidvoidonRunSummary(org.neo4j.bolt.connection.summary.RunSummary summary) voidonTelemetrySummary(org.neo4j.bolt.connection.summary.TelemetrySummary summary) Asynchronously investigate the next upcomingRecordwithout moving forward in the result.pullAllFailureAsync(Observation parentObservation) Pulling all unconsumed records into memory and returning failure if there is any pull errors.Asynchronously return the first record in the result, failing if there is not exactly one record left in the stream.Methods inherited from class org.neo4j.driver.internal.cursor.AbstractRecordStateResponseHandler
generateGqlStatusObject, updateRecordStateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.neo4j.driver.internal.adaptedbolt.DriverResponseHandler
onCommitSummary, onLogoffSummary, onLogonSummary, onResetSummary, onRollbackSummary, onRouteSummary
-
Field Details
-
METADATA_EXTRACTOR
-
-
Constructor Details
-
ResultCursorImpl
public ResultCursorImpl(DriverBoltConnection boltConnection, Query query, long fetchSize, Consumer<org.neo4j.driver.internal.DatabaseBookmark> bookmarkConsumer, boolean closeOnSummary, CompletableFuture<UnmanagedTransaction> beginFuture, Consumer<String> databaseNameConsumer, ApiTelemetryWork apiTelemetryWork, DriverObservationProvider observationProvider, Class<?> resultType)
-
-
Method Details
-
resultCursor
-
keys
Description copied from interface:ResultCursorRetrieve the keys of the records this result cursor contains.- Specified by:
keysin interfaceResultCursor- Returns:
- list of all keys.
-
consumeAsync
Description copied from interface:ResultCursorAsynchronously retrieve the result summary.If the records in the result is not fully consumed, then calling this method will exhausts the result.
If you want to access unconsumed records after summary, you shall use
Result.list()to buffer all records into memory before summary.- Specified by:
consumeAsyncin interfaceResultCursor- Returns:
- a
CompletionStagecompleted with a summary for the whole query result. Stage can also be completed exceptionally if query execution fails.
-
nextAsync
Description copied from interface:ResultCursorAsynchronously navigate to and retrieve the nextRecordin this result. Returned stage can containnullif end of records stream has been reached.- Specified by:
nextAsyncin interfaceResultCursor- Returns:
- a
CompletionStagecompleted with a record ornull. Stage can also be completed exceptionally if query execution fails.
-
peekAsync
Description copied from interface:ResultCursorAsynchronously investigate the next upcomingRecordwithout moving forward in the result. Returned stage can containnullif end of records stream has been reached.- Specified by:
peekAsyncin interfaceResultCursor- Returns:
- a
CompletionStagecompleted with a record ornull. Stage can also be completed exceptionally if query execution fails.
-
singleAsync
Description copied from interface:ResultCursorAsynchronously return the first record in the result, failing if there is not exactly one record left in the stream.- Specified by:
singleAsyncin interfaceResultCursor- Returns:
- a
CompletionStagecompleted with the first and only record in the stream. Stage will be completed exceptionally withNoSuchRecordExceptionif there is not exactly one record left in the stream. It can also be completed exceptionally if query execution fails.
-
forEachAsync
Description copied from interface:ResultCursorAsynchronously apply the givenactionto every record in the result, yielding a summary of it.- Specified by:
forEachAsyncin interfaceResultCursor- Parameters:
action- the function to be applied to every record in the result. Provided function should not block.- Returns:
- a
CompletionStagecompleted with a summary for the whole query result. Stage can also be completed exceptionally if query execution or provided function fails.
-
listAsync
Description copied from interface:ResultCursorAsynchronously retrieve and store the entire result stream. This can be used if you want to iterate over the stream multiple times or to store the whole result for later use.Note that this method can only be used if you know that the query that yielded this result returns a finite stream. Some queries can yield infinite results, in which case calling this method will lead to running out of memory.
Calling this method exhausts the result.
- Specified by:
listAsyncin interfaceResultCursor- Returns:
- a
CompletionStagecompleted with a list of all remaining immutable records. Stage can also be completed exceptionally if query execution fails.
-
listAsync
Description copied from interface:ResultCursorAsynchronously retrieve and store a projection of the entire result. This can be used if you want to iterate over the stream multiple times or to store the whole result for later use.Note that this method can only be used if you know that the query that yielded this result returns a finite stream. Some queries can yield infinite results, in which case calling this method will lead to running out of memory.
Calling this method exhausts the result.
- Specified by:
listAsyncin interfaceResultCursor- Type Parameters:
T- the type of result list elements- Parameters:
mapFunction- a function to map from Record to T. SeeRecordsfor some predefined functions.- Returns:
- a
CompletionStagecompleted with a list of all remaining immutable records. Stage can also be completed exceptionally if query execution or provided function fails.
-
isOpenAsync
Description copied from interface:ResultCursorDetermine if result is open.Result is considered to be open if it has not been consumed (
ResultCursor.consumeAsync()) and its creator object (e.g. session or transaction) has not been closed (including committed or rolled back).Attempts to access data on closed result will produce
ResultConsumedException.- Specified by:
isOpenAsyncin interfaceResultCursor- Returns:
- a
CompletionStagecompleted withtrueif result is open andfalseotherwise.
-
onTelemetrySummary
public void onTelemetrySummary(org.neo4j.bolt.connection.summary.TelemetrySummary summary) - Specified by:
onTelemetrySummaryin interfaceDriverResponseHandler
-
onBeginSummary
public void onBeginSummary(org.neo4j.bolt.connection.summary.BeginSummary summary) - Specified by:
onBeginSummaryin interfaceDriverResponseHandler
-
onRunSummary
public void onRunSummary(org.neo4j.bolt.connection.summary.RunSummary summary) - Specified by:
onRunSummaryin interfaceDriverResponseHandler
-
onRecord
- Specified by:
onRecordin interfaceDriverResponseHandler
-
onError
- Specified by:
onErrorin interfaceDriverResponseHandler
-
onIgnored
public void onIgnored()- Specified by:
onIgnoredin interfaceDriverResponseHandler
-
onDiscardSummary
- Specified by:
onDiscardSummaryin interfaceDriverResponseHandler
-
onPullSummary
- Specified by:
onPullSummaryin interfaceDriverResponseHandler
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceDriverResponseHandler
-
discardAllFailureAsync
Description copied from interface:org.neo4j.driver.internal.FailableCursorDiscarding all unconsumed records and returning failure if there is any pull errors.- Specified by:
discardAllFailureAsyncin interfaceorg.neo4j.driver.internal.FailableCursor
-
pullAllFailureAsync
Description copied from interface:org.neo4j.driver.internal.FailableCursorPulling all unconsumed records into memory and returning failure if there is any pull errors.- Specified by:
pullAllFailureAsyncin interfaceorg.neo4j.driver.internal.FailableCursor
-
consumed
- Specified by:
consumedin interfaceorg.neo4j.driver.internal.FailableCursor
-