code: private CompletableFuture<PageWrapper> locatePage(Function<BTreePage, PagePointer> getChildPointer, Predicate<PageWrapper> found,
                                                        PageCollection pageCollection, TimeoutTimer timer) {
          AtomicReference<PagePointer> pagePointer = new AtomicReference<>(new PagePointer(null, this.state.get().rootPageOffset, this.state.get().rootPageLength));
          CompletableFuture<PageWrapper> result = new CompletableFuture<>();
          AtomicReference<PageWrapper> parentPage = new AtomicReference<>(null);
          Futures.loop(
                  () -> !result.isDone(),
                  () -> fetchPage(pagePointer.get(), parentPage.get(), pageCollection, timer.getRemaining())
                          .thenAccept(page -> {
                              if (found.test(page)) {
                                  // We are done.
                                  result.complete(page);
                              } else {
                                  PagePointer childPointer = getChildPointer.apply(page.getPage());
                                  pagePointer.set(childPointer);
                                  parentPage.set(page);
                              }
                          }),
                  this.executor)
                 .exceptionally(ex -> {
                     result.completeExceptionally(ex);
                     return null;
                 });
  
          return result;
      }
docs: Locates the BTreePage according to the given criteria.
  
  @param getChildPointer A Function that, when applied to a BTreePage, will return a PagePointer which can be used
  to load up the next page.
  @param found           A Predicate that, when applied to a PageWrapper, will indicate if this is the sought page.
  @param pageCollection  A PageCollection to query for already loaded pages, as well as to store newly loaded ones.
  @param timer           Timer for the operation.
  @return A CompletableFuture with a PageWrapper for the sought page.