Class DisposableAsyncResultCursor

java.lang.Object
org.neo4j.driver.internal.cursor.DisposableAsyncResultCursor
All Implemented Interfaces:
ResultCursor, AsyncResultCursor, org.neo4j.driver.internal.FailableCursor

public class DisposableAsyncResultCursor extends Object implements AsyncResultCursor
  • Constructor Details

    • DisposableAsyncResultCursor

      public DisposableAsyncResultCursor(AsyncResultCursor delegate)
  • Method Details

    • keys

      public List<String> keys()
      Description copied from interface: ResultCursor
      Retrieve the keys of the records this result cursor contains.
      Specified by:
      keys in interface ResultCursor
      Returns:
      list of all keys.
    • consumeAsync

      public CompletionStage<ResultSummary> consumeAsync()
      Description copied from interface: ResultCursor
      Asynchronously 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:
      consumeAsync in interface ResultCursor
      Returns:
      a CompletionStage completed with a summary for the whole query result. Stage can also be completed exceptionally if query execution fails.
    • nextAsync

      public CompletionStage<Record> nextAsync()
      Description copied from interface: ResultCursor
      Asynchronously navigate to and retrieve the next Record in this result. Returned stage can contain null if end of records stream has been reached.
      Specified by:
      nextAsync in interface ResultCursor
      Returns:
      a CompletionStage completed with a record or null. Stage can also be completed exceptionally if query execution fails.
    • peekAsync

      public CompletionStage<Record> peekAsync()
      Description copied from interface: ResultCursor
      Asynchronously investigate the next upcoming Record without moving forward in the result. Returned stage can contain null if end of records stream has been reached.
      Specified by:
      peekAsync in interface ResultCursor
      Returns:
      a CompletionStage completed with a record or null. Stage can also be completed exceptionally if query execution fails.
    • singleAsync

      public CompletionStage<Record> singleAsync()
      Description copied from interface: ResultCursor
      Asynchronously return the first record in the result, failing if there is not exactly one record left in the stream.
      Specified by:
      singleAsync in interface ResultCursor
      Returns:
      a CompletionStage completed with the first and only record in the stream. Stage will be completed exceptionally with NoSuchRecordException if there is not exactly one record left in the stream. It can also be completed exceptionally if query execution fails.
    • forEachAsync

      public CompletionStage<ResultSummary> forEachAsync(Consumer<Record> action)
      Description copied from interface: ResultCursor
      Asynchronously apply the given action to every record in the result, yielding a summary of it.
      Specified by:
      forEachAsync in interface ResultCursor
      Parameters:
      action - the function to be applied to every record in the result. Provided function should not block.
      Returns:
      a CompletionStage completed with a summary for the whole query result. Stage can also be completed exceptionally if query execution or provided function fails.
    • listAsync

      public CompletionStage<List<Record>> listAsync()
      Description copied from interface: ResultCursor
      Asynchronously 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:
      listAsync in interface ResultCursor
      Returns:
      a CompletionStage completed with a list of all remaining immutable records. Stage can also be completed exceptionally if query execution fails.
    • listAsync

      public <T> CompletionStage<List<T>> listAsync(Function<Record,T> mapFunction)
      Description copied from interface: ResultCursor
      Asynchronously 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:
      listAsync in interface ResultCursor
      Type Parameters:
      T - the type of result list elements
      Parameters:
      mapFunction - a function to map from Record to T. See Records for some predefined functions.
      Returns:
      a CompletionStage completed with a list of all remaining immutable records. Stage can also be completed exceptionally if query execution or provided function fails.
    • isOpenAsync

      public CompletionStage<Boolean> isOpenAsync()
      Description copied from interface: ResultCursor
      Determine 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:
      isOpenAsync in interface ResultCursor
      Returns:
      a CompletionStage completed with true if result is open and false otherwise.
    • discardAllFailureAsync

      public CompletionStage<Throwable> discardAllFailureAsync()
      Description copied from interface: org.neo4j.driver.internal.FailableCursor
      Discarding all unconsumed records and returning failure if there is any pull errors.
      Specified by:
      discardAllFailureAsync in interface org.neo4j.driver.internal.FailableCursor
    • pullAllFailureAsync

      public CompletionStage<Throwable> pullAllFailureAsync()
      Description copied from interface: org.neo4j.driver.internal.FailableCursor
      Pulling all unconsumed records into memory and returning failure if there is any pull errors.
      Specified by:
      pullAllFailureAsync in interface org.neo4j.driver.internal.FailableCursor
    • mapSuccessfulRunCompletionAsync

      public CompletableFuture<AsyncResultCursor> mapSuccessfulRunCompletionAsync()
      Specified by:
      mapSuccessfulRunCompletionAsync in interface AsyncResultCursor