code: public CompletableFuture<Long> update(@NonNull Collection<PageEntry> entries, @NonNull Duration timeout) {
          ensureInitialized();
          TimeoutTimer timer = new TimeoutTimer(timeout);
  
          // Process the Entries in sorted order (by key); this makes the operation more efficient as we can batch-update
          // entries belonging to the same page.
          val toUpdate = entries.stream()
                                .sorted((e1, e2) -> KEY_COMPARATOR.compare(e1.getKey(), e2.getKey()))
                                .iterator();
          return applyUpdates(toUpdate, timer)
                  .thenComposeAsync(pageCollection -> loadSmallestOffsetPage(pageCollection, timer)
                                  .thenRun(() -> processModifiedPages(pageCollection))
                                  .thenComposeAsync(v -> writePages(pageCollection, timer.getRemaining()), this.executor),
                          this.executor);
      }
docs: Inserts, updates or removes the given Page Entries into the index. If {@link PageEntry#value} is null, then
  the page entry is removed, otherwise it is added.
  
  @param entries A Collection of Page Entries to insert. The collection need not be sorted.
  @param timeout Timeout for the operation.
  @return A CompletableFuture that, when completed normally, will indicate that the index updates have been applied
  successfully and will contain the current version of the index (any modifications to the index will result in a
  larger version value). If the operation failed, the Future will be completed with the appropriate exception.