Interface DatabaseUpgradePaginator
-
- All Known Implementing Classes:
DatabaseUpgradePaginatorImpl
@NotThreadSafe public interface DatabaseUpgradePaginatorUtility service for paginating large collections of database entities in upgrade tasks.By definition the paginator is not thread safe. It is expected to be used in a single-threaded environment within an upgrade tasks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceDatabaseUpgradePaginator.PaginatedDataSupplier<T>A supplier of pages over a large collection of elements.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> voidforEach(@NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, int pageSize, @NotNull Consumer<T> consumer)Executes the givenconsumerfor each element of an underlying large collection of elements.<T> voidforEach(@NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, @NotNull Consumer<T> consumer)Executes the givenconsumerfor each element of an underlying large collection of elements.<T> voidforEachPage(@NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, int pageSize, @NotNull Consumer<Collection<T>> consumer)Executes the givenconsumerfor each page of an underlying large collection of elements.<T> voidforEachPage(@NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, @NotNull Consumer<Collection<T>> consumer)Executes the givenconsumeron each page of an underlying large collection of elements.
-
-
-
Method Detail
-
forEachPage
<T> void forEachPage(@NotNull @NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, @NotNull @NotNull Consumer<Collection<T>> consumer)Executes the givenconsumeron each page of an underlying large collection of elements. The elements are fetched using thedataSupplierpage by page, with defaultpageSize.- Type Parameters:
T- type of elements iterated over- Parameters:
dataSupplier- a supplier for fetching paginated data from the actual data sourceconsumer- action to perform for each page; every call will be wrapped in a separate transaction
-
forEachPage
<T> void forEachPage(@NotNull @NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, int pageSize, @NotNull @NotNull Consumer<Collection<T>> consumer)Executes the givenconsumerfor each page of an underlying large collection of elements. The elements are fetched using thedataSupplierpage by page, with specifiedpageSize.- Type Parameters:
T- type of elements iterated over- Parameters:
dataSupplier- a supplier for fetching paginated data from the actual data sourcepageSize- size of each fetched pageconsumer- action to perform for each page; every call will be wrapped in a separate transaction
-
forEach
<T> void forEach(@NotNull @NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, @NotNull @NotNull Consumer<T> consumer)Executes the givenconsumerfor each element of an underlying large collection of elements. The elements are fetched using thedataSupplierpage by page, with defaultpageSize.- Type Parameters:
T- type of elements iterated over- Parameters:
dataSupplier- a supplier for fetching paginated data from the actual data sourceconsumer- action to perform for each element; executed in transactions, one transaction per page
-
forEach
<T> void forEach(@NotNull @NotNull DatabaseUpgradePaginator.PaginatedDataSupplier<T> dataSupplier, int pageSize, @NotNull @NotNull Consumer<T> consumer)Executes the givenconsumerfor each element of an underlying large collection of elements. The elements are fetched using thedataSupplierpage by page, with specifiedpageSize.- Type Parameters:
T- type of elements iterated over- Parameters:
dataSupplier- a supplier for fetching paginated data from the actual data sourcepageSize- size of each fetched pageconsumer- action to perform for each element; executed in transactions, one transaction per page
-
-