Class StreamingUtil


  • public final class StreamingUtil
    extends java.lang.Object
    Helper and utility methods around streaming of NessieApiV1 et al.

    Use the functions that return Streams in the builders that implement PagingBuilder.

    • Method Detail

      • getAllReferencesStream

        @Deprecated
        public static java.util.stream.Stream<org.projectnessie.model.Reference> getAllReferencesStream​(@NotNull @NotNull
                                                                                                        @NotNull @NotNull NessieApiV1 api,
                                                                                                        @NotNull @NotNull
                                                                                                        @NotNull @NotNull java.util.function.Function<GetAllReferencesBuilder,​GetAllReferencesBuilder> builderCustomizer,
                                                                                                        @NotNull @NotNull
                                                                                                        @NotNull @NotNull java.util.OptionalInt pageSizeHint)
                                                                                                 throws org.projectnessie.error.NessieNotFoundException
        Deprecated.
        Default implementation to return a stream of references, functionally equivalent to calling NessieApiV1.getAllReferences() with manual paging.
        Parameters:
        api - The NessieApiV1 to use
        builderCustomizer - a Function that takes and returns GetAllReferencesBuilder that is passed to the caller of this method. It allows the caller to customize the GetAllReferencesBuilder with additional parameters (e.g.: filter).
        pageSizeHint - A hint sent to the Nessie server to return no more than this amount of entries in a single response, the server may decide to ignore this hint or return more or less results. Use OptionalInt.empty() to omit the hint.
        Returns:
        stream of Reference objects
        Throws:
        org.projectnessie.error.NessieNotFoundException
      • getEntriesStream

        @Deprecated
        public static java.util.stream.Stream<org.projectnessie.model.EntriesResponse.Entry> getEntriesStream​(@NotNull @NotNull
                                                                                                              @NotNull @NotNull NessieApiV1 api,
                                                                                                              @NotNull @NotNull
                                                                                                              @NotNull @NotNull java.util.function.Function<GetEntriesBuilder,​GetEntriesBuilder> builderCustomizer,
                                                                                                              @NotNull @NotNull
                                                                                                              @NotNull @NotNull java.util.OptionalInt pageSizeHint)
                                                                                                       throws org.projectnessie.error.NessieNotFoundException
        Deprecated.
        Default implementation to return a stream of objects for a ref, functionally equivalent to calling NessieApiV1.getEntries() with manual paging.

        The Stream returned by getEntriesStream(ref, OptionalInt.empty()), if not limited, returns all commit-log entries.

        Parameters:
        api - The NessieApiV1 to use
        builderCustomizer - a Function that takes and returns GetEntriesBuilder that is passed to the caller of this method. It allows the caller to customize the GetEntriesBuilder with additional parameters (e.g.: hashOnRef, filter).
        pageSizeHint - A hint sent to the Nessie server to return no more than this amount of entries in a single response, the server may decide to ignore this hint or return more or less results. Use OptionalInt.empty() to omit the hint.
        Returns:
        stream of EntriesResponse.Entry objects
        Throws:
        org.projectnessie.error.NessieNotFoundException
      • getCommitLogStream

        @Deprecated
        public static java.util.stream.Stream<org.projectnessie.model.LogResponse.LogEntry> getCommitLogStream​(@NotNull @NotNull
                                                                                                               @NotNull @NotNull NessieApiV1 api,
                                                                                                               @NotNull @NotNull
                                                                                                               @NotNull @NotNull java.util.function.Function<GetCommitLogBuilder,​GetCommitLogBuilder> builderCustomizer,
                                                                                                               @NotNull @NotNull
                                                                                                               @NotNull @NotNull java.util.OptionalInt pageSizeHint)
                                                                                                        throws org.projectnessie.error.NessieNotFoundException
        Deprecated.
        Default implementation to return a stream of commit-log entries, functionally equivalent to calling NessieApiV1.getCommitLog() with manual paging.

        The Stream returned by getCommitLogStream(ref, OptionalInt.empty()), if not limited, returns all commit-log entries.

        Parameters:
        api - The NessieApiV1 to use
        builderCustomizer - a Function that takes and returns GetCommitLogBuilder that is passed to the caller of this method. It allows the caller to customize the GetCommitLogBuilder with additional parameters (e.g.: hashOnRef, untilHash, filter, fetchOption).
        pageSizeHint - A hint sent to the Nessie server to return no more than this amount of entries in a single response, the server may decide to ignore this hint or return more or less results. Use OptionalInt.empty() to omit the hint.
        Returns:
        stream of CommitMeta objects
        Throws:
        org.projectnessie.error.NessieNotFoundException
      • getReflogStream

        @Deprecated
        public static java.util.stream.Stream<org.projectnessie.model.RefLogResponse.RefLogResponseEntry> getReflogStream​(@NotNull @NotNull
                                                                                                                          @NotNull @NotNull NessieApiV1 api,
                                                                                                                          @NotNull @NotNull
                                                                                                                          @NotNull @NotNull java.util.function.Function<GetRefLogBuilder,​GetRefLogBuilder> builderCustomizer,
                                                                                                                          @NotNull @NotNull
                                                                                                                          @NotNull @NotNull java.util.OptionalInt pageSizeHint)
                                                                                                                   throws org.projectnessie.error.NessieNotFoundException
        Deprecated.
        Default implementation to return a stream of reflog entries, functionally equivalent to calling NessieApiV1.getRefLog() with manual paging.

        The Stream returned by getReflogStream(OptionalInt.empty()), if not limited, returns all reflog entries.

        Parameters:
        api - The NessieApiV1 to use
        builderCustomizer - a Function that takes and returns GetRefLogBuilder that is passed to the caller of this method. It allows the caller to customize the GetRefLogBuilder with additional parameters (e.g.: fromHash, untilHash, filter).
        pageSizeHint - A hint sent to the Nessie server to return no more than this amount of entries in a single response, the server may decide to ignore this hint or return more or less results. Use OptionalInt.empty() to omit the hint.
        Returns:
        stream of RefLogResponse.RefLogResponseEntry objects
        Throws:
        org.projectnessie.error.NessieNotFoundException
      • generateStream

        public static <ENTRY,​RESP extends org.projectnessie.model.PaginatedResponse> java.util.stream.Stream<ENTRY> generateStream​(java.util.function.Function<RESP,​java.util.List<ENTRY>> entriesExtractor,
                                                                                                                                         StreamingUtil.NextPage<RESP> pageFetcher)
                                                                                                                                  throws org.projectnessie.error.NessieNotFoundException
        Throws:
        org.projectnessie.error.NessieNotFoundException